QT new functions:
- cvAddButton changed to match requirement - CV_GUI_NORMAL and CV_GUI_EXPANDED done - context menu with right click
This commit is contained in:
parent
912607a387
commit
2c923c7eba
@ -79,8 +79,8 @@ CV_EXPORTS void loadWindowParameters(const string& windowName);
|
||||
CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
|
||||
CV_EXPORTS void stopLoop();
|
||||
|
||||
typedef void (CV_CDECL *ButtonCallback)(void* userdata);
|
||||
CV_EXPORTS int createButton( const char* bar_name, const char* window_name, ButtonCallback on_change, const char* button_name CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL));
|
||||
typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
|
||||
CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change , void* userdata CV_DEFAULT(NULL), int type CV_DEFAULT(CV_PUSH_BUTTON), bool initial_button_state CV_DEFAULT(0));
|
||||
//-------------------------
|
||||
|
||||
CV_EXPORTS void imshow( const string& winname, const Mat& mat );
|
||||
|
@ -94,8 +94,9 @@ CVAPI(void) cvLoadWindowParameters(const char* name);
|
||||
CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
|
||||
CVAPI(void) cvStopLoop();
|
||||
|
||||
typedef void (CV_CDECL *CvButtonCallback)(void* userdata);
|
||||
CVAPI(int) cvCreateButton( const char* bar_name, const char* window_name, CvButtonCallback on_change, const char* button_name CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL));
|
||||
typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
|
||||
enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1};
|
||||
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));
|
||||
//----------------------
|
||||
|
||||
|
||||
|
@ -231,9 +231,9 @@ void loadWindowParameters(const string& windowName)
|
||||
cvLoadWindowParameters(windowName.c_str());
|
||||
}
|
||||
|
||||
int createButton( const string& bar_name, const string& window_name, ButtonCallback on_change, const string& button_name, void* userdata)
|
||||
int createButton(const string& button_name, ButtonCallback on_change, void* userdata, int button_type , bool initial_button_state )
|
||||
{
|
||||
return cvCreateButton( bar_name.c_str(), window_name.c_str(), on_change, button_name.c_str(), userdata);
|
||||
return cvCreateButton(button_name.c_str(), on_change, userdata, button_type , initial_button_state );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -74,6 +74,9 @@
|
||||
#include <QFileDialog>
|
||||
#include <QToolBar>
|
||||
#include <QAction>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QMenu>
|
||||
|
||||
//start private enum
|
||||
enum {CV_MODE_NORMAL= 0, CV_MODE_OPENGL = 1};
|
||||
@ -130,7 +133,7 @@ public slots:
|
||||
void loadWindowParameters(QString name);
|
||||
void setOpenGLCallback(QString window_name, void* callbackOpenGL, void* userdata);
|
||||
void putText(void* arg1, QString text, QPoint org, void* font);
|
||||
void addButton(QString window_name, QString bar_name, QString button_name, void* on_change, void* userdata);
|
||||
void addButton(QString button_name, int button_type, bool initial_button_state , void* on_change, void* userdata);
|
||||
|
||||
};
|
||||
|
||||
@ -140,7 +143,7 @@ class CvBar : public QHBoxLayout
|
||||
public:
|
||||
typeBar type;
|
||||
QString name_bar;
|
||||
QPointer<CvWindow> myparent;
|
||||
QPointer<QWidget> myparent;
|
||||
};
|
||||
|
||||
|
||||
@ -148,9 +151,9 @@ class CvButtonbar : public CvBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CvButtonbar(CvWindow* arg, QString bar_name);
|
||||
CvButtonbar(QWidget* arg, QString bar_name);
|
||||
~CvButtonbar();
|
||||
void addButton( QString button_name, CvButtonCallback call, void* userdata);
|
||||
void addButton( QString button_name, CvButtonCallback call, void* userdata, int button_type, bool initial_button_state);
|
||||
|
||||
private:
|
||||
void setLabel();
|
||||
@ -158,11 +161,12 @@ private:
|
||||
QPointer<QLabel> label;
|
||||
};
|
||||
|
||||
class CvButton : public QPushButton
|
||||
|
||||
class CvPushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CvButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata);
|
||||
CvPushButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata);
|
||||
|
||||
private:
|
||||
CvButtonbar* myparent;
|
||||
@ -176,6 +180,23 @@ private slots:
|
||||
|
||||
|
||||
|
||||
class CvCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CvCheckBox(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata, bool initial_button_state);
|
||||
|
||||
private:
|
||||
CvButtonbar* myparent;
|
||||
QString button_name ;
|
||||
CvButtonCallback callback;
|
||||
void* userdata;
|
||||
|
||||
private slots:
|
||||
void callCallBack();
|
||||
};
|
||||
|
||||
|
||||
class CvTrackbar : public CvBar
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -219,7 +240,7 @@ class CvWindow : public QWidget
|
||||
public:
|
||||
CvWindow(QString arg2, int flag = CV_WINDOW_NORMAL);
|
||||
~CvWindow();
|
||||
void addSlider(QString name, int* value, int count, CvTrackbarCallback on_change = NULL);
|
||||
static void addSlider(CvWindow* w,QString name, int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
|
||||
void setMouseCallBack(CvMouseCallback m, void* param);
|
||||
void updateImage(void* arr);
|
||||
void displayInfo(QString text, int delayms );
|
||||
@ -229,42 +250,44 @@ public:
|
||||
void setOpenGLCallback(CvOpenGLCallback arg1,void* userdata);
|
||||
void hideTools();
|
||||
void showTools();
|
||||
CvButtonbar* createButtonbar(QString bar_name);
|
||||
static CvButtonbar* createButtonbar(QString bar_name);
|
||||
|
||||
|
||||
|
||||
ViewPort* getView();
|
||||
CvWinProperties* getWinProp();
|
||||
|
||||
QPointer<QBoxLayout> myLayout;
|
||||
QPointer<QBoxLayout> myGlobalLayout;//All the widget (toolbar, view, LayoutBar, ...) are attached to it
|
||||
QPointer<QBoxLayout> myBarLayout;
|
||||
QPointer<QStatusBar> myStatusBar;
|
||||
QPointer<QToolBar> myToolBar;
|
||||
QPointer<QLabel> myStatusBar_msg;
|
||||
|
||||
//parameters (will be save/load)
|
||||
QString param_name;
|
||||
QPointer<CvWinProperties> parameters_window ;
|
||||
int param_flags;
|
||||
int param_gui_mode;
|
||||
QVector<QAction*> vect_QActions;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
private:
|
||||
QPointer<CvWinProperties> parameters_window ;
|
||||
QPointer<ViewPort> myview;
|
||||
QVector<QAction*> vect_QActions;
|
||||
QVector<QShortcut*> vect_QShortcuts;
|
||||
|
||||
void icvLoadTrackbars(QSettings *settings);
|
||||
void icvSaveTrackbars(QSettings *settings);
|
||||
|
||||
void createShortcuts();
|
||||
void createActions();
|
||||
void createToolBar();
|
||||
void createView(int mode);
|
||||
void createStatusBar();
|
||||
void createLayout();
|
||||
void createParameterWindow();
|
||||
void createGlobalLayout();
|
||||
void createBarLayout();
|
||||
CvWinProperties* createParameterWindow();
|
||||
|
||||
private slots:
|
||||
void displayPropertiesWin();
|
||||
@ -323,6 +346,7 @@ public slots:
|
||||
void siftWindowOnDown();
|
||||
void resizeEvent ( QResizeEvent * );
|
||||
void saveView();
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user