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
46bd49ef
Commit
46bd49ef
authored
Aug 18, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7126 from paroj:buttonlayout
parents
241df6c6
e4cf3297
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
highgui.hpp
modules/highgui/include/opencv2/highgui.hpp
+7
-4
window_QT.cpp
modules/highgui/src/window_QT.cpp
+6
-1
No files found.
modules/highgui/include/opencv2/highgui.hpp
View file @
46bd49ef
...
...
@@ -239,9 +239,10 @@ enum QtFontStyles {
//! Qt "button" type
enum
QtButtonTypes
{
QT_PUSH_BUTTON
=
0
,
//!< Push button.
QT_CHECKBOX
=
1
,
//!< Checkbox button.
QT_RADIOBOX
=
2
//!< Radiobox button.
QT_PUSH_BUTTON
=
0
,
//!< Push button.
QT_CHECKBOX
=
1
,
//!< Checkbox button.
QT_RADIOBOX
=
2
,
//!< Radiobox button.
QT_NEW_BUTTONBAR
=
1024
//!< Button should create a new buttonbar
};
/** @brief Callback function for mouse events. see cv::setMouseCallback
...
...
@@ -719,7 +720,8 @@ CV_EXPORTS void stopLoop();
The function createButton attaches a button to the control panel. Each button is added to a
buttonbar to the right of the last button. A new buttonbar is created if nothing was attached to the
control panel before, or if the last element attached to the control panel was a trackbar.
control panel before, or if the last element attached to the control panel was a trackbar or if the
QT_NEW_BUTTONBAR flag is added to the type.
See below various examples of the cv::createButton function call: :
@code
...
...
@@ -728,6 +730,7 @@ See below various examples of the cv::createButton function call: :
createButton("button3",callbackButton,&value);
createButton("button5",callbackButton1,NULL,QT_RADIOBOX);
createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON,1);
createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON|QT_NEW_BUTTONBAR);// create a push button in a new row
@endcode
@param bar_name Name of the button.
...
...
modules/highgui/src/window_QT.cpp
View file @
46bd49ef
...
...
@@ -1139,13 +1139,18 @@ void GuiReceiver::addButton(QString button_name, int button_type, int initial_bu
{
CvBar
*
lastbar
=
(
CvBar
*
)
global_control_panel
->
myLayout
->
itemAt
(
global_control_panel
->
myLayout
->
count
()
-
1
);
if
(
lastbar
->
type
==
type_CvTrackbar
)
//if last bar is a trackbar, create a new buttonbar, else, attach to the current bar
// if last bar is a trackbar or the user requests a new buttonbar, create a new buttonbar
// else, attach to the current bar
if
(
lastbar
->
type
==
type_CvTrackbar
||
cv
::
QT_NEW_BUTTONBAR
&
button_type
)
b
=
CvWindow
::
createButtonBar
(
button_name
);
//the bar has the name of the first button attached to it
else
b
=
(
CvButtonbar
*
)
lastbar
;
}
// unset buttonbar flag
button_type
=
button_type
&
~
cv
::
QT_NEW_BUTTONBAR
;
b
->
addButton
(
button_name
,
(
CvButtonCallback
)
on_change
,
userdata
,
button_type
,
initial_button_state
);
}
...
...
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