ticket 490:

bool not defined ? -> changed everything in int
This commit is contained in:
Yannick Verdie 2010-07-23 12:09:13 +00:00
parent 60a4e81a12
commit ffe7bdf69c
3 changed files with 23 additions and 17 deletions

View File

@ -96,7 +96,7 @@ CVAPI(void) cvStopLoop();
typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata); typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2}; enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), bool initial_button_state CV_DEFAULT(0)); CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0));
//---------------------- //----------------------
@ -154,7 +154,7 @@ typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
/* create trackbar and display it on top of given window, set callback */ /* create trackbar and display it on top of given window, set callback */
CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name, CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
int* value, int count, CvTrackbarCallback on_change); int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata); typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);

View File

@ -515,14 +515,17 @@ CV_IMPL int cvCreateTrackbar( const char* name_bar, const char* window_name, int
CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, void* userdata , int button_type, bool initial_button_state ) CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, void* userdata , int button_type, int initial_button_state )
{ {
if (initial_button_state < 0 || initial_button_state > 1)
return 0;
QMetaObject::invokeMethod(&guiMainThread, QMetaObject::invokeMethod(&guiMainThread,
"addButton", "addButton",
Qt::AutoConnection, Qt::AutoConnection,
Q_ARG(QString, QString(button_name)), Q_ARG(QString, QString(button_name)),
Q_ARG(int, button_type), Q_ARG(int, button_type),
Q_ARG(bool, initial_button_state), Q_ARG(int, initial_button_state),
Q_ARG(void*, (void*)on_change), Q_ARG(void*, (void*)on_change),
Q_ARG(void*, userdata) Q_ARG(void*, userdata)
); );
@ -865,7 +868,7 @@ void GuiReceiver::resizeWindow(QString name, int width, int height)
w->resize(width, height); w->resize(width, height);
} }
void GuiReceiver::addButton(QString button_name, int button_type, bool initial_button_state , void* on_change, void* userdata) void GuiReceiver::addButton(QString button_name, int button_type, int initial_button_state , void* on_change, void* userdata)
{ {
if (!global_control_panel) if (!global_control_panel)
@ -1058,7 +1061,7 @@ void CvButtonbar::setLabel()
label->setText(nameNormalized); label->setText(nameNormalized);
} }
void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata, int button_type, bool initial_button_state) void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata, int button_type, int initial_button_state)
{ {
QString button_name = name; QString button_name = name;
@ -1107,10 +1110,11 @@ CvPushButton::CvPushButton(CvButtonbar* arg1, QString arg2, CvButtonCallback arg
void CvPushButton::callCallBack() void CvPushButton::callCallBack()
{ {
callback(-1,userdata); if (callback)
callback(-1,userdata);
} }
CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, bool initial_button_state) CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, int initial_button_state)
{ {
myparent = arg1; myparent = arg1;
button_name = arg2; button_name = arg2;
@ -1124,10 +1128,11 @@ CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, v
void CvCheckBox::callCallBack() void CvCheckBox::callCallBack()
{ {
callback(this->isChecked(),userdata); if (callback)
callback(this->isChecked(),userdata);
} }
CvRadioButton::CvRadioButton(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, bool initial_button_state) CvRadioButton::CvRadioButton(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, void* arg4, int initial_button_state)
{ {
myparent = arg1; myparent = arg1;
button_name = arg2; button_name = arg2;
@ -1141,7 +1146,8 @@ CvRadioButton::CvRadioButton(CvButtonbar* arg1, QString arg2, CvButtonCallback a
void CvRadioButton::callCallBack() void CvRadioButton::callCallBack()
{ {
callback(this->isChecked(),userdata); if (callback)
callback(this->isChecked(),userdata);
} }
@ -1363,7 +1369,7 @@ void CvWindow::showTools()
CvWinProperties* CvWindow::createParameterWindow() CvWinProperties* CvWindow::createParameterWindow()
{ {
QString name_paraWindow ="Global control panel"; QString name_paraWindow =QFileInfo(QApplication::applicationFilePath()).fileName()+" settings";
CvWinProperties *result = new CvWinProperties(name_paraWindow,this); CvWinProperties *result = new CvWinProperties(name_paraWindow,this);
return result; return result;

View File

@ -135,7 +135,7 @@ public slots:
void loadWindowParameters(QString name); void loadWindowParameters(QString name);
void setOpenGLCallback(QString window_name, void* callbackOpenGL, void* userdata); void setOpenGLCallback(QString window_name, void* callbackOpenGL, void* userdata);
void putText(void* arg1, QString text, QPoint org, void* font); void putText(void* arg1, QString text, QPoint org, void* font);
void addButton(QString button_name, int button_type, bool initial_button_state , void* on_change, void* userdata); void addButton(QString button_name, int button_type, int initial_button_state , void* on_change, void* userdata);
}; };
@ -155,7 +155,7 @@ class CvButtonbar : public CvBar
public: public:
CvButtonbar(QWidget* arg, QString bar_name); CvButtonbar(QWidget* arg, QString bar_name);
~CvButtonbar(); ~CvButtonbar();
void addButton( QString button_name, CvButtonCallback call, void* userdata, int button_type, bool initial_button_state); void addButton( QString button_name, CvButtonCallback call, void* userdata, int button_type, int initial_button_state);
private: private:
void setLabel(); void setLabel();
@ -187,7 +187,7 @@ class CvCheckBox : public QCheckBox
{ {
Q_OBJECT Q_OBJECT
public: public:
CvCheckBox(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, bool initial_button_state); CvCheckBox(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, int initial_button_state);
private: private:
CvButtonbar* myparent; CvButtonbar* myparent;
@ -203,7 +203,7 @@ class CvRadioButton : public QRadioButton
{ {
Q_OBJECT Q_OBJECT
public: public:
CvRadioButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, bool initial_button_state); CvRadioButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, int initial_button_state);
private: private:
CvButtonbar* myparent; CvButtonbar* myparent;
@ -284,7 +284,7 @@ public:
//parameters (will be save/load) //parameters (will be save/load)
QString param_name; QString param_name;
QPointer<CvWinProperties> parameters_window ; CvWinProperties* parameters_window ;
int param_flags; int param_flags;
int param_gui_mode; int param_gui_mode;
QVector<QAction*> vect_QActions; QVector<QAction*> vect_QActions;