Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
f5720474
Commit
f5720474
authored
Jul 22, 2010
by
Yannick Verdie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT new functions:
- add CV_RADIOBOX with exclusive mode
parent
2c923c7e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
41 deletions
+86
-41
highgui_c.h
modules/highgui/include/opencv2/highgui/highgui_c.h
+1
-1
window_QT.cpp
modules/highgui/src/window_QT.cpp
+65
-40
window_QT.h
modules/highgui/src/window_QT.h
+20
-0
No files found.
modules/highgui/include/opencv2/highgui/highgui_c.h
View file @
f5720474
...
...
@@ -95,7 +95,7 @@ CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* a
CVAPI
(
void
)
cvStopLoop
();
typedef
void
(
CV_CDECL
*
CvButtonCallback
)(
int
state
,
void
*
userdata
);
enum
{
CV_PUSH_BUTTON
=
0
,
CV_CHECKBOX
=
1
};
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
));
//----------------------
...
...
modules/highgui/src/window_QT.cpp
View file @
f5720474
...
...
@@ -1028,55 +1028,65 @@ CvTrackbar::~CvTrackbar()
//here CvButtonbar class
CvButtonbar
::
CvButtonbar
(
QWidget
*
arg
,
QString
arg2
)
{
type
=
type_CvButtonbar
;
myparent
=
arg
;
name_bar
=
arg2
;
setObjectName
(
name_bar
);
type
=
type_CvButtonbar
;
myparent
=
arg
;
name_bar
=
arg2
;
setObjectName
(
name_bar
);
/*
label = new QLabel;
setLabel();
addWidget(label,Qt::AlignLeft );
*/
group_button
=
new
QButtonGroup
;
/*
label = new QLabel;
setLabel();
addWidget(label,Qt::AlignLeft );
*/
}
CvButtonbar
::~
CvButtonbar
()
{
QLayoutItem
*
child
;
QLayoutItem
*
child
;
while
((
child
=
takeAt
(
0
))
!=
0
)
delete
child
;
while
((
child
=
takeAt
(
0
))
!=
0
)
delete
child
;
delete
group_button
;
}
void
CvButtonbar
::
setLabel
()
{
QString
nameNormalized
=
name_bar
.
leftJustified
(
10
,
' '
,
true
);
label
->
setText
(
nameNormalized
);
QString
nameNormalized
=
name_bar
.
leftJustified
(
10
,
' '
,
true
);
label
->
setText
(
nameNormalized
);
}
void
CvButtonbar
::
addButton
(
QString
name
,
CvButtonCallback
call
,
void
*
userdata
,
int
button_type
,
bool
initial_button_state
)
{
QString
button_name
=
name
;
QString
button_name
=
name
;
if
(
button_name
==
""
)
button_name
=
tr
(
"button %1"
).
arg
(
this
->
count
());
if
(
button_name
==
""
)
button_name
=
tr
(
"button %1"
).
arg
(
this
->
count
());
QPointer
<
QAbstractButton
>
button
;
QPointer
<
QAbstractButton
>
button
;
if
(
button_type
==
CV_PUSH_BUTTON
)
//CvPushButton*
button
=
(
QAbstractButton
*
)
new
CvPushButton
(
this
,
button_name
,
call
,
userdata
);
if
(
button_type
==
CV_PUSH_BUTTON
)
//CvPushButton*
button
=
(
QAbstractButton
*
)
new
CvPushButton
(
this
,
button_name
,
call
,
userdata
);
if
(
button_type
==
CV_CHECKBOX
)
//CvCheckButton*
button
=
(
QAbstractButton
*
)
new
CvCheckBox
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
if
(
button_type
==
CV_CHECKBOX
)
//CvCheckButton*
button
=
(
QAbstractButton
*
)
new
CvCheckBox
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
if
(
button
)
{
QObject
::
connect
(
button
,
SIGNAL
(
clicked
()
),
button
,
SLOT
(
callCallBack
()
));
addWidget
(
button
,
Qt
::
AlignCenter
);
}
if
(
button_type
==
CV_RADIOBOX
)
{
//CvCheckButton*
button
=
(
QAbstractButton
*
)
new
CvRadioButton
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
group_button
->
addButton
(
button
);
}
if
(
button
)
{
QObject
::
connect
(
button
,
SIGNAL
(
clicked
()
),
button
,
SLOT
(
callCallBack
()
));
addWidget
(
button
,
Qt
::
AlignCenter
);
}
}
...
...
@@ -1086,21 +1096,38 @@ void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata
//buttons here
CvPushButton
::
CvPushButton
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
)
{
myparent
=
arg1
;
button_name
=
arg2
;
callback
=
arg3
;
userdata
=
arg4
;
myparent
=
arg1
;
button_name
=
arg2
;
callback
=
arg3
;
userdata
=
arg4
;
setObjectName
(
button_name
);
setText
(
button_name
);
setObjectName
(
button_name
);
setText
(
button_name
);
}
void
CvPushButton
::
callCallBack
()
{
callback
(
-
1
,
userdata
);
callback
(
-
1
,
userdata
);
}
CvCheckBox
::
CvCheckBox
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
,
bool
initial_button_state
)
{
myparent
=
arg1
;
button_name
=
arg2
;
callback
=
arg3
;
userdata
=
arg4
;
setObjectName
(
button_name
);
setCheckState
((
initial_button_state
==
1
?
Qt
::
Checked
:
Qt
::
Unchecked
));
setText
(
button_name
);
}
void
CvCheckBox
::
callCallBack
()
{
callback
(
this
->
isChecked
(),
userdata
);
}
CvRadioButton
::
CvRadioButton
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
,
bool
initial_button_state
)
{
myparent
=
arg1
;
button_name
=
arg2
;
...
...
@@ -1108,11 +1135,11 @@ CvCheckBox::CvCheckBox(CvButtonbar* arg1, QString arg2, CvButtonCallback arg3, v
userdata
=
arg4
;
setObjectName
(
button_name
);
setCheck
State
((
initial_button_state
==
1
?
Qt
::
Checked
:
Qt
::
Unchecked
)
);
setCheck
ed
(
initial_button_state
);
setText
(
button_name
);
}
void
Cv
CheckBox
::
callCallBack
()
void
Cv
RadioButton
::
callCallBack
()
{
callback
(
this
->
isChecked
(),
userdata
);
}
...
...
@@ -1120,8 +1147,6 @@ void CvCheckBox::callCallBack()
//here CvWinProperties class
CvWinProperties
::
CvWinProperties
(
QString
name_paraWindow
,
QWidget
*
parent
)
{
...
...
modules/highgui/src/window_QT.h
View file @
f5720474
...
...
@@ -76,6 +76,8 @@
#include <QAction>
#include <QPushButton>
#include <QCheckBox>
#include <QRadioButton>
#include <QButtonGroup>
#include <QMenu>
//start private enum
...
...
@@ -159,6 +161,7 @@ private:
void
setLabel
();
QPointer
<
QLabel
>
label
;
QPointer
<
QButtonGroup
>
group_button
;
};
...
...
@@ -196,6 +199,23 @@ private slots:
void
callCallBack
();
};
class
CvRadioButton
:
public
QRadioButton
{
Q_OBJECT
public
:
CvRadioButton
(
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment