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 int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
|
||||||
CV_EXPORTS void stopLoop();
|
CV_EXPORTS void stopLoop();
|
||||||
|
|
||||||
typedef void (CV_CDECL *ButtonCallback)(void* userdata);
|
typedef void (CV_CDECL *ButtonCallback)(int state, 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));
|
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 );
|
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(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
|
||||||
CVAPI(void) cvStopLoop();
|
CVAPI(void) cvStopLoop();
|
||||||
|
|
||||||
typedef void (CV_CDECL *CvButtonCallback)(void* userdata);
|
typedef void (CV_CDECL *CvButtonCallback)(int state, 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));
|
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());
|
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
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -74,6 +74,9 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
//start private enum
|
//start private enum
|
||||||
enum {CV_MODE_NORMAL= 0, CV_MODE_OPENGL = 1};
|
enum {CV_MODE_NORMAL= 0, CV_MODE_OPENGL = 1};
|
||||||
@ -130,7 +133,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 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:
|
public:
|
||||||
typeBar type;
|
typeBar type;
|
||||||
QString name_bar;
|
QString name_bar;
|
||||||
QPointer<CvWindow> myparent;
|
QPointer<QWidget> myparent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -148,9 +151,9 @@ class CvButtonbar : public CvBar
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CvButtonbar(CvWindow* arg, QString bar_name);
|
CvButtonbar(QWidget* arg, QString bar_name);
|
||||||
~CvButtonbar();
|
~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:
|
private:
|
||||||
void setLabel();
|
void setLabel();
|
||||||
@ -158,11 +161,12 @@ private:
|
|||||||
QPointer<QLabel> label;
|
QPointer<QLabel> label;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CvButton : public QPushButton
|
|
||||||
|
class CvPushButton : public QPushButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CvButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata);
|
CvPushButton(CvButtonbar* par, QString button_name, CvButtonCallback call, void* userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CvButtonbar* myparent;
|
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
|
class CvTrackbar : public CvBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -219,7 +240,7 @@ class CvWindow : public QWidget
|
|||||||
public:
|
public:
|
||||||
CvWindow(QString arg2, int flag = CV_WINDOW_NORMAL);
|
CvWindow(QString arg2, int flag = CV_WINDOW_NORMAL);
|
||||||
~CvWindow();
|
~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 setMouseCallBack(CvMouseCallback m, void* param);
|
||||||
void updateImage(void* arr);
|
void updateImage(void* arr);
|
||||||
void displayInfo(QString text, int delayms );
|
void displayInfo(QString text, int delayms );
|
||||||
@ -229,42 +250,44 @@ public:
|
|||||||
void setOpenGLCallback(CvOpenGLCallback arg1,void* userdata);
|
void setOpenGLCallback(CvOpenGLCallback arg1,void* userdata);
|
||||||
void hideTools();
|
void hideTools();
|
||||||
void showTools();
|
void showTools();
|
||||||
CvButtonbar* createButtonbar(QString bar_name);
|
static CvButtonbar* createButtonbar(QString bar_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ViewPort* getView();
|
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<QStatusBar> myStatusBar;
|
||||||
QPointer<QToolBar> myToolBar;
|
QPointer<QToolBar> myToolBar;
|
||||||
QPointer<QLabel> myStatusBar_msg;
|
QPointer<QLabel> myStatusBar_msg;
|
||||||
|
|
||||||
//parameters (will be save/load)
|
//parameters (will be save/load)
|
||||||
QString param_name;
|
QString param_name;
|
||||||
|
QPointer<CvWinProperties> parameters_window ;
|
||||||
int param_flags;
|
int param_flags;
|
||||||
int param_gui_mode;
|
int param_gui_mode;
|
||||||
|
QVector<QAction*> vect_QActions;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent(QKeyEvent *event);
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<CvWinProperties> parameters_window ;
|
|
||||||
QPointer<ViewPort> myview;
|
QPointer<ViewPort> myview;
|
||||||
QVector<QAction*> vect_QActions;
|
|
||||||
QVector<QShortcut*> vect_QShortcuts;
|
QVector<QShortcut*> vect_QShortcuts;
|
||||||
|
|
||||||
void icvLoadTrackbars(QSettings *settings);
|
void icvLoadTrackbars(QSettings *settings);
|
||||||
void icvSaveTrackbars(QSettings *settings);
|
void icvSaveTrackbars(QSettings *settings);
|
||||||
|
|
||||||
void createShortcuts();
|
void createShortcuts();
|
||||||
|
void createActions();
|
||||||
void createToolBar();
|
void createToolBar();
|
||||||
void createView(int mode);
|
void createView(int mode);
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createLayout();
|
void createGlobalLayout();
|
||||||
void createParameterWindow();
|
void createBarLayout();
|
||||||
|
CvWinProperties* createParameterWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void displayPropertiesWin();
|
void displayPropertiesWin();
|
||||||
@ -323,6 +346,7 @@ public slots:
|
|||||||
void siftWindowOnDown();
|
void siftWindowOnDown();
|
||||||
void resizeEvent ( QResizeEvent * );
|
void resizeEvent ( QResizeEvent * );
|
||||||
void saveView();
|
void saveView();
|
||||||
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user