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
e8aad754
Commit
e8aad754
authored
Jul 31, 2010
by
Yannick Verdie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs on Qt
parent
49f1a9c3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
451 additions
and
304 deletions
+451
-304
highgui.hpp
modules/highgui/include/opencv2/highgui/highgui.hpp
+1
-0
highgui_c.h
modules/highgui/include/opencv2/highgui/highgui_c.h
+1
-1
window.cpp
modules/highgui/src/window.cpp
+6
-1
window_QT.cpp
modules/highgui/src/window_QT.cpp
+439
-302
window_QT.h
modules/highgui/src/window_QT.h
+4
-0
No files found.
modules/highgui/include/opencv2/highgui/highgui.hpp
View file @
e8aad754
...
@@ -66,6 +66,7 @@ CV_EXPORTS double getWindowProperty(const string& winname, int prop_id);//YV
...
@@ -66,6 +66,7 @@ CV_EXPORTS double getWindowProperty(const string& winname, int prop_id);//YV
//Only for Qt
//Only for Qt
//------------------------
//------------------------
CV_EXPORTS
CvFont
fontQt
(
const
string
&
nameFont
,
int
pointSize
CV_DEFAULT
(
-
1
),
Scalar
color
CV_DEFAULT
(
Scalar
::
all
(
0
)),
int
weight
CV_DEFAULT
(
CV_FONT_NORMAL
),
int
style
CV_DEFAULT
(
CV_STYLE_NORMAL
),
int
spacing
CV_DEFAULT
(
0
));
CV_EXPORTS
void
addText
(
const
Mat
&
img
,
const
char
*
text
,
Point
org
,
CvFont
font
);
CV_EXPORTS
void
addText
(
const
Mat
&
img
,
const
char
*
text
,
Point
org
,
CvFont
font
);
CV_EXPORTS
void
displayOverlay
(
const
string
&
winname
,
const
string
&
text
,
int
delayms
);
CV_EXPORTS
void
displayOverlay
(
const
string
&
winname
,
const
string
&
text
,
int
delayms
);
...
...
modules/highgui/include/opencv2/highgui/highgui_c.h
View file @
e8aad754
...
@@ -74,7 +74,7 @@ enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal,
...
@@ -74,7 +74,7 @@ enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal,
//for color cvScalar(blue_component, green_component, red\_component[, alpha_component])
//for color cvScalar(blue_component, green_component, red\_component[, alpha_component])
//and alpha= 0 <-> 0xFF (not transparent <-> transparent)
//and alpha= 0 <-> 0xFF (not transparent <-> transparent)
CVAPI
(
CvFont
)
cvFont
_
Qt
(
const
char
*
nameFont
,
int
pointSize
CV_DEFAULT
(
-
1
),
CvScalar
color
CV_DEFAULT
(
cvScalarAll
(
0
)),
int
weight
CV_DEFAULT
(
CV_FONT_NORMAL
),
int
style
CV_DEFAULT
(
CV_STYLE_NORMAL
),
int
spacing
CV_DEFAULT
(
0
));
CVAPI
(
CvFont
)
cvFontQt
(
const
char
*
nameFont
,
int
pointSize
CV_DEFAULT
(
-
1
),
CvScalar
color
CV_DEFAULT
(
cvScalarAll
(
0
)),
int
weight
CV_DEFAULT
(
CV_FONT_NORMAL
),
int
style
CV_DEFAULT
(
CV_STYLE_NORMAL
),
int
spacing
CV_DEFAULT
(
0
));
CVAPI
(
void
)
cvAddText
(
const
CvArr
*
img
,
const
char
*
text
,
CvPoint
org
,
CvFont
*
arg2
);
CVAPI
(
void
)
cvAddText
(
const
CvArr
*
img
,
const
char
*
text
,
CvPoint
org
,
CvFont
*
arg2
);
...
...
modules/highgui/src/window.cpp
View file @
e8aad754
...
@@ -190,10 +190,15 @@ int startWindowThread()
...
@@ -190,10 +190,15 @@ int startWindowThread()
#if defined (HAVE_QT)
#if defined (HAVE_QT)
CvFont
fontQt
(
const
string
&
nameFont
,
int
pointSize
,
Scalar
color
,
int
weight
,
int
style
,
int
spacing
)
{
return
cvFontQt
(
nameFont
.
c_str
(),
pointSize
,
color
,
weight
,
style
);
}
void
addText
(
const
Mat
&
img
,
const
string
&
text
,
Point
org
,
CvFont
font
)
void
addText
(
const
Mat
&
img
,
const
string
&
text
,
Point
org
,
CvFont
font
)
{
{
CvMat
_img
=
img
;
CvMat
_img
=
img
;
cvAddText
(
&
_img
,
text
.
c_str
(),
CvPoint
(
org
)
,
&
font
);
cvAddText
(
&
_img
,
text
.
c_str
(),
org
,
&
font
);
}
}
void
displayStatusBar
(
const
string
&
name
,
const
string
&
text
,
int
delayms
)
void
displayStatusBar
(
const
string
&
name
,
const
string
&
text
,
int
delayms
)
...
...
modules/highgui/src/window_QT.cpp
View file @
e8aad754
...
@@ -60,7 +60,7 @@ static CvWinProperties* global_control_panel = NULL;
...
@@ -60,7 +60,7 @@ static CvWinProperties* global_control_panel = NULL;
CV_IMPL
CvFont
cvFont
_
Qt
(
const
char
*
nameFont
,
int
pointSize
,
CvScalar
color
,
int
weight
,
int
style
,
int
spacing
)
CV_IMPL
CvFont
cvFontQt
(
const
char
*
nameFont
,
int
pointSize
,
CvScalar
color
,
int
weight
,
int
style
,
int
spacing
)
{
{
/*
/*
...
@@ -75,7 +75,7 @@ CV_IMPL CvFont cvFont_Qt(const char* nameFont, int pointSize,CvScalar color,int
...
@@ -75,7 +75,7 @@ CV_IMPL CvFont cvFont_Qt(const char* nameFont, int pointSize,CvScalar color,int
int thickness;//<- weight in Qt
int thickness;//<- weight in Qt
float dx;//spacing letter in Qt (0 default) in pixel
float dx;//spacing letter in Qt (0 default) in pixel
int line_type;//<- pointSize in Qt
int line_type;//<- pointSize in Qt
*/
*/
CvFont
f
=
{
nameFont
,
color
,
style
,
NULL
,
NULL
,
NULL
,
0
,
0
,
0
,
weight
,
spacing
,
pointSize
};
CvFont
f
=
{
nameFont
,
color
,
style
,
NULL
,
NULL
,
NULL
,
0
,
0
,
0
,
weight
,
spacing
,
pointSize
};
return
f
;
return
f
;
}
}
...
@@ -89,12 +89,12 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont*
...
@@ -89,12 +89,12 @@ CV_IMPL void cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont*
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"putText"
,
"putText"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
void
*
,
(
void
*
)
img
),
Q_ARG
(
void
*
,
(
void
*
)
img
),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
QPoint
,
QPoint
(
org
.
x
,
org
.
y
)),
Q_ARG
(
QPoint
,
QPoint
(
org
.
x
,
org
.
y
)),
Q_ARG
(
void
*
,(
void
*
)
font
));
Q_ARG
(
void
*
,(
void
*
)
font
));
}
}
double
cvGetRatioWindow_QT
(
const
char
*
name
)
double
cvGetRatioWindow_QT
(
const
char
*
name
)
...
@@ -105,11 +105,11 @@ double cvGetRatioWindow_QT(const char* name)
...
@@ -105,11 +105,11 @@ double cvGetRatioWindow_QT(const char* name)
double
result
=
-
1
;
double
result
=
-
1
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"getRatioWindow"
,
"getRatioWindow"
,
//Qt::DirectConnection,
//Qt::DirectConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_RETURN_ARG
(
double
,
result
),
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
Q_ARG
(
QString
,
QString
(
name
)));
return
result
;
return
result
;
}
}
...
@@ -120,10 +120,10 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
...
@@ -120,10 +120,10 @@ void cvSetRatioWindow_QT(const char* name,double prop_value)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setRatioWindow"
,
"setRatioWindow"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
Q_ARG
(
double
,
prop_value
));
}
}
double
cvGetPropWindow_QT
(
const
char
*
name
)
double
cvGetPropWindow_QT
(
const
char
*
name
)
...
@@ -134,11 +134,11 @@ double cvGetPropWindow_QT(const char* name)
...
@@ -134,11 +134,11 @@ double cvGetPropWindow_QT(const char* name)
double
result
=
-
1
;
double
result
=
-
1
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"getPropWindow"
,
"getPropWindow"
,
//Qt::DirectConnection,
//Qt::DirectConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_RETURN_ARG
(
double
,
result
),
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
Q_ARG
(
QString
,
QString
(
name
)));
return
result
;
return
result
;
}
}
...
@@ -149,10 +149,10 @@ void cvSetPropWindow_QT(const char* name,double prop_value)
...
@@ -149,10 +149,10 @@ void cvSetPropWindow_QT(const char* name,double prop_value)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setPropWindow"
,
"setPropWindow"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
Q_ARG
(
double
,
prop_value
));
}
}
void
cvSetModeWindow_QT
(
const
char
*
name
,
double
prop_value
)
void
cvSetModeWindow_QT
(
const
char
*
name
,
double
prop_value
)
...
@@ -162,10 +162,10 @@ void cvSetModeWindow_QT(const char* name, double prop_value)
...
@@ -162,10 +162,10 @@ void cvSetModeWindow_QT(const char* name, double prop_value)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"toggleFullScreen"
,
"toggleFullScreen"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
double
,
prop_value
));
Q_ARG
(
double
,
prop_value
));
}
}
double
cvGetModeWindow_QT
(
const
char
*
name
)
double
cvGetModeWindow_QT
(
const
char
*
name
)
...
@@ -176,10 +176,10 @@ double cvGetModeWindow_QT(const char* name)
...
@@ -176,10 +176,10 @@ double cvGetModeWindow_QT(const char* name)
double
result
=
-
1
;
double
result
=
-
1
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"isFullScreen"
,
"isFullScreen"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_RETURN_ARG
(
double
,
result
),
Q_RETURN_ARG
(
double
,
result
),
Q_ARG
(
QString
,
QString
(
name
)));
Q_ARG
(
QString
,
QString
(
name
)));
return
result
;
return
result
;
}
}
...
@@ -189,12 +189,12 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
...
@@ -189,12 +189,12 @@ CV_IMPL void cvDisplayOverlay(const char* name, const char* text, int delayms)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"displayInfo"
,
"displayInfo"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
//Qt::DirectConnection,
//Qt::DirectConnection,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
int
,
delayms
));
Q_ARG
(
int
,
delayms
));
}
}
...
@@ -204,9 +204,9 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
...
@@ -204,9 +204,9 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"saveWindowParameters"
,
"saveWindowParameters"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)));
Q_ARG
(
QString
,
QString
(
name
)));
}
}
CV_IMPL
void
cvLoadWindowParameters
(
const
char
*
name
)
CV_IMPL
void
cvLoadWindowParameters
(
const
char
*
name
)
...
@@ -215,9 +215,9 @@ CV_IMPL void cvLoadWindowParameters(const char* name)
...
@@ -215,9 +215,9 @@ CV_IMPL void cvLoadWindowParameters(const char* name)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"loadWindowParameters"
,
"loadWindowParameters"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)));
Q_ARG
(
QString
,
QString
(
name
)));
}
}
CV_IMPL
void
cvDisplayStatusBar
(
const
char
*
name
,
const
char
*
text
,
int
delayms
)
CV_IMPL
void
cvDisplayStatusBar
(
const
char
*
name
,
const
char
*
text
,
int
delayms
)
...
@@ -226,12 +226,12 @@ CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
...
@@ -226,12 +226,12 @@ CV_IMPL void cvDisplayStatusBar(const char* name, const char* text, int delayms)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"displayStatusBar"
,
"displayStatusBar"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
//Qt::DirectConnection,
//Qt::DirectConnection,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
QString
,
QString
(
text
)),
Q_ARG
(
int
,
delayms
));
Q_ARG
(
int
,
delayms
));
}
}
...
@@ -300,11 +300,11 @@ CV_IMPL int cvWaitKey( int arg )
...
@@ -300,11 +300,11 @@ CV_IMPL int cvWaitKey( int arg )
else
else
{
{
/*
/*
* //will not work, I broke the event loop !!!!
* //will not work, I broke the event loop !!!!
dummy.lock();
dummy.lock();
QWaitCondition waitCondition;
QWaitCondition waitCondition;
waitCondition.wait(&dummy, 2);
waitCondition.wait(&dummy, 2);
*/
*/
//to decrease CPU usage
//to decrease CPU usage
//sleep 1 millisecond
//sleep 1 millisecond
...
@@ -317,7 +317,7 @@ CV_IMPL int cvWaitKey( int arg )
...
@@ -317,7 +317,7 @@ CV_IMPL int cvWaitKey( int arg )
}
}
}
}
guiMainThread
->
_bTimeOut
=
false
;
guiMainThread
->
_bTimeOut
=
false
;
}
}
return
result
;
return
result
;
...
@@ -441,10 +441,10 @@ int icvInitSystem()
...
@@ -441,10 +441,10 @@ int icvInitSystem()
new
QApplication
(
parameterSystemC
,
parameterSystemV
);
new
QApplication
(
parameterSystemC
,
parameterSystemV
);
wasInitialized
=
1
;
wasInitialized
=
1
;
qDebug
()
<<
"init done"
;
//
qDebug()<<"init done";
#if defined( HAVE_QT_OPENGL )//OK tested !
#if defined( HAVE_QT_OPENGL )//OK tested !
qDebug
()
<<
"opengl support available"
;
//
qDebug()<<"opengl support available";
#endif
#endif
}
}
...
@@ -459,13 +459,13 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
...
@@ -459,13 +459,13 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
if
(
multiThreads
)
if
(
multiThreads
)
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"createWindow"
,
"createWindow"
,
//Qt::AutoConnection,
//Qt::AutoConnection,
Qt
::
BlockingQueuedConnection
,
Qt
::
BlockingQueuedConnection
,
//TypeConnection,
//TypeConnection,
//Qt::AutoConnection,
//Qt::AutoConnection,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
flags
));
Q_ARG
(
int
,
flags
));
else
else
guiMainThread
->
createWindow
(
QString
(
name
),
flags
);
guiMainThread
->
createWindow
(
QString
(
name
),
flags
);
...
@@ -478,11 +478,11 @@ CV_IMPL void cvDestroyWindow( const char* name )
...
@@ -478,11 +478,11 @@ CV_IMPL void cvDestroyWindow( const char* name )
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"destroyWindow"
,
"destroyWindow"
,
//Qt::BlockingQueuedConnection,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
))
Q_ARG
(
QString
,
QString
(
name
))
);
);
}
}
...
@@ -493,10 +493,10 @@ CV_IMPL void cvDestroyAllWindows(void)
...
@@ -493,10 +493,10 @@ CV_IMPL void cvDestroyAllWindows(void)
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"destroyAllWindow"
,
"destroyAllWindow"
,
//Qt::BlockingQueuedConnection,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
Qt
::
AutoConnection
);
);
}
}
CV_IMPL
void
*
cvGetWindowHandle
(
const
char
*
name
)
CV_IMPL
void
*
cvGetWindowHandle
(
const
char
*
name
)
...
@@ -523,13 +523,13 @@ CV_IMPL void cvMoveWindow( const char* name, int x, int y )
...
@@ -523,13 +523,13 @@ CV_IMPL void cvMoveWindow( const char* name, int x, int y )
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"moveWindow"
,
"moveWindow"
,
//Qt::BlockingQueuedConnection,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
x
),
Q_ARG
(
int
,
x
),
Q_ARG
(
int
,
y
)
Q_ARG
(
int
,
y
)
);
);
}
}
...
@@ -540,13 +540,13 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height )
...
@@ -540,13 +540,13 @@ CV_IMPL void cvResizeWindow(const char* name, int width, int height )
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"resizeWindow"
,
"resizeWindow"
,
//Qt::BlockingQueuedConnection,
//Qt::BlockingQueuedConnection,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
int
,
width
),
Q_ARG
(
int
,
width
),
Q_ARG
(
int
,
height
)
Q_ARG
(
int
,
height
)
);
);
}
}
...
@@ -567,14 +567,14 @@ CV_IMPL int cvCreateTrackbar( const char* name_bar, const char* window_name, int
...
@@ -567,14 +567,14 @@ CV_IMPL int cvCreateTrackbar( const char* name_bar, const char* window_name, int
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"addSlider"
,
"addSlider"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
name_bar
)),
Q_ARG
(
QString
,
QString
(
name_bar
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
value
),
Q_ARG
(
void
*
,
(
void
*
)
value
),
Q_ARG
(
int
,
count
),
Q_ARG
(
int
,
count
),
Q_ARG
(
void
*
,
(
void
*
)
on_change
)
Q_ARG
(
void
*
,
(
void
*
)
on_change
)
);
);
return
1
;
//dummy value
return
1
;
//dummy value
}
}
...
@@ -588,16 +588,16 @@ CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, v
...
@@ -588,16 +588,16 @@ CV_IMPL int cvCreateButton(const char* button_name,CvButtonCallback on_change, v
if
(
initial_button_state
<
0
||
initial_button_state
>
1
)
if
(
initial_button_state
<
0
||
initial_button_state
>
1
)
return
0
;
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
(
int
,
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
)
);
);
return
1
;
//dummy value
return
1
;
//dummy value
}
}
...
@@ -608,15 +608,15 @@ CV_IMPL void cvCreateOpenGLCallback( const char* window_name, CvOpenGLCallback c
...
@@ -608,15 +608,15 @@ CV_IMPL void cvCreateOpenGLCallback( const char* window_name, CvOpenGLCallback c
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
CV_Error
(
CV_StsNullPtr
,
"NULL guiReceiver (please create a window)"
);
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"setOpenGLCallback"
,
"setOpenGLCallback"
,
Qt
::
AutoConnection
,
Qt
::
AutoConnection
,
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
QString
,
QString
(
window_name
)),
Q_ARG
(
void
*
,
(
void
*
)
callbackOpenGL
),
Q_ARG
(
void
*
,
(
void
*
)
callbackOpenGL
),
Q_ARG
(
void
*
,
userdata
),
Q_ARG
(
void
*
,
userdata
),
Q_ARG
(
double
,
angle
),
Q_ARG
(
double
,
angle
),
Q_ARG
(
double
,
zmin
),
Q_ARG
(
double
,
zmin
),
Q_ARG
(
double
,
zmax
)
Q_ARG
(
double
,
zmax
)
);
);
}
}
CV_IMPL
int
cvGetTrackbarPos
(
const
char
*
name_bar
,
const
char
*
window_name
)
CV_IMPL
int
cvGetTrackbarPos
(
const
char
*
name_bar
,
const
char
*
window_name
)
...
@@ -660,12 +660,12 @@ CV_IMPL void cvShowImage( const char* name, const CvArr* arr )
...
@@ -660,12 +660,12 @@ CV_IMPL void cvShowImage( const char* name, const CvArr* arr )
guiMainThread
=
new
GuiReceiver
;
guiMainThread
=
new
GuiReceiver
;
QMetaObject
::
invokeMethod
(
guiMainThread
,
QMetaObject
::
invokeMethod
(
guiMainThread
,
"showImage"
,
"showImage"
,
//Qt::BlockingQueuedConnection,
//Qt::BlockingQueuedConnection,
Qt
::
DirectConnection
,
Qt
::
DirectConnection
,
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
QString
,
QString
(
name
)),
Q_ARG
(
void
*
,
(
void
*
)
arr
)
Q_ARG
(
void
*
,
(
void
*
)
arr
)
);
);
}
}
...
@@ -801,15 +801,15 @@ void GuiReceiver::setPropWindow(QString name, double arg2 )
...
@@ -801,15 +801,15 @@ void GuiReceiver::setPropWindow(QString name, double arg2 )
switch
(
flags
)
switch
(
flags
)
{
{
case
CV_WINDOW_NORMAL
:
case
CV_WINDOW_NORMAL
:
w
->
myGlobalLayout
->
setSizeConstraint
(
QLayout
::
SetMinAndMaxSize
);
w
->
myGlobalLayout
->
setSizeConstraint
(
QLayout
::
SetMinAndMaxSize
);
w
->
param_flags
=
flags
;
w
->
param_flags
=
flags
;
break
;
break
;
case
CV_WINDOW_AUTOSIZE
:
case
CV_WINDOW_AUTOSIZE
:
w
->
myGlobalLayout
->
setSizeConstraint
(
QLayout
::
SetFixedSize
);
w
->
myGlobalLayout
->
setSizeConstraint
(
QLayout
::
SetFixedSize
);
w
->
param_flags
=
flags
;
w
->
param_flags
=
flags
;
break
;
break
;
default
:
;
default
:
;
}
}
}
}
...
@@ -905,7 +905,7 @@ void GuiReceiver::showImage(QString name, void* arr)
...
@@ -905,7 +905,7 @@ void GuiReceiver::showImage(QString name, void* arr)
}
}
else
else
{
{
qDebug
()
<<
"Do nothing (Window or Image NULL)"
<<
endl
;
CV_Error
(
CV_StsNullPtr
,
"Do nothing (Window or Image NULL)"
)
;
}
}
}
}
...
@@ -941,7 +941,7 @@ void GuiReceiver::destroyAllWindow()
...
@@ -941,7 +941,7 @@ void GuiReceiver::destroyAllWindow()
delete
obj
;
delete
obj
;
}
}
}
}
}
}
}
}
...
@@ -982,12 +982,19 @@ void GuiReceiver::addButton(QString button_name, int button_type, int initial_bu
...
@@ -982,12 +982,19 @@ void GuiReceiver::addButton(QString button_name, int button_type, int initial_bu
//if (b)//button with this name already exist
//if (b)//button with this name already exist
// return;
// return;
CvBar
*
lastbar
=
(
CvBar
*
)
global_control_panel
->
myLayout
->
itemAt
(
global_control_panel
->
myLayout
->
count
()
-
1
);
if
(
global_control_panel
->
myLayout
->
count
()
==
0
)
//if that is the first button attach to the control panel, create a new button bar
{
if
(
lastbar
->
type
==
type_CvTrackbar
)
//if last bar is a trackbar, create a new buttonbar, else, attach to the current bar
b
=
CvWindow
::
createButtonbar
(
button_name
);
//the bar has the name of the first button attached to it
b
=
CvWindow
::
createButtonbar
(
button_name
);
//the bar has the name of the first button attached to it
else
b
=
(
CvButtonbar
*
)
lastbar
;
}
else
{
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
b
=
CvWindow
::
createButtonbar
(
button_name
);
//the bar has the name of the first button attached to it
else
b
=
(
CvButtonbar
*
)
lastbar
;
}
b
->
addButton
(
button_name
,(
CvButtonCallback
)
on_change
,
userdata
,
button_type
,
initial_button_state
);
b
->
addButton
(
button_name
,(
CvButtonCallback
)
on_change
,
userdata
,
button_type
,
initial_button_state
);
}
}
...
@@ -1092,13 +1099,13 @@ void CvTrackbar::createDialog()
...
@@ -1092,13 +1099,13 @@ void CvTrackbar::createDialog()
QInputDialog
::
getInteger
QInputDialog
::
getInteger
#endif
#endif
(
this
->
parentWidget
(),
(
this
->
parentWidget
(),
tr
(
"Slider %1"
).
arg
(
name_bar
),
tr
(
"Slider %1"
).
arg
(
name_bar
),
tr
(
"New value:"
),
tr
(
"New value:"
),
value
,
value
,
min
,
min
,
max
,
max
,
step
,
step
,
&
ok
);
&
ok
);
if
(
ok
)
if
(
ok
)
slider
->
setValue
(
i
);
slider
->
setValue
(
i
);
...
@@ -1134,62 +1141,62 @@ CvTrackbar::~CvTrackbar()
...
@@ -1134,62 +1141,62 @@ CvTrackbar::~CvTrackbar()
//here CvButtonbar class
//here CvButtonbar class
CvButtonbar
::
CvButtonbar
(
QWidget
*
arg
,
QString
arg2
)
CvButtonbar
::
CvButtonbar
(
QWidget
*
arg
,
QString
arg2
)
{
{
type
=
type_CvButtonbar
;
type
=
type_CvButtonbar
;
myparent
=
arg
;
myparent
=
arg
;
name_bar
=
arg2
;
name_bar
=
arg2
;
setObjectName
(
name_bar
);
setObjectName
(
name_bar
);
group_button
=
new
QButtonGroup
;
group_button
=
new
QButtonGroup
;
/*
/*
label = new QLabel;
label = new QLabel;
setLabel();
setLabel();
addWidget(label,Qt::AlignLeft );
addWidget(label,Qt::AlignLeft );
*/
*/
}
}
CvButtonbar
::~
CvButtonbar
()
CvButtonbar
::~
CvButtonbar
()
{
{
QLayoutItem
*
child
;
QLayoutItem
*
child
;
while
((
child
=
takeAt
(
0
))
!=
0
)
while
((
child
=
takeAt
(
0
))
!=
0
)
delete
child
;
delete
child
;
delete
group_button
;
delete
group_button
;
}
}
void
CvButtonbar
::
setLabel
()
void
CvButtonbar
::
setLabel
()
{
{
QString
nameNormalized
=
name_bar
.
leftJustified
(
10
,
' '
,
true
);
QString
nameNormalized
=
name_bar
.
leftJustified
(
10
,
' '
,
true
);
label
->
setText
(
nameNormalized
);
label
->
setText
(
nameNormalized
);
}
}
void
CvButtonbar
::
addButton
(
QString
name
,
CvButtonCallback
call
,
void
*
userdata
,
int
button_type
,
int
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
;
if
(
button_name
==
""
)
if
(
button_name
==
""
)
button_name
=
tr
(
"button %1"
).
arg
(
this
->
count
());
button_name
=
tr
(
"button %1"
).
arg
(
this
->
count
());
QPointer
<
QAbstractButton
>
button
;
QPointer
<
QAbstractButton
>
button
;
if
(
button_type
==
CV_PUSH_BUTTON
)
if
(
button_type
==
CV_PUSH_BUTTON
)
button
=
(
QAbstractButton
*
)
new
CvPushButton
(
this
,
button_name
,
call
,
userdata
);
button
=
(
QAbstractButton
*
)
new
CvPushButton
(
this
,
button_name
,
call
,
userdata
);
if
(
button_type
==
CV_CHECKBOX
)
if
(
button_type
==
CV_CHECKBOX
)
button
=
(
QAbstractButton
*
)
new
CvCheckBox
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
button
=
(
QAbstractButton
*
)
new
CvCheckBox
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
if
(
button_type
==
CV_RADIOBOX
)
if
(
button_type
==
CV_RADIOBOX
)
{
{
button
=
(
QAbstractButton
*
)
new
CvRadioButton
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
button
=
(
QAbstractButton
*
)
new
CvRadioButton
(
this
,
button_name
,
call
,
userdata
,
initial_button_state
);
group_button
->
addButton
(
button
);
group_button
->
addButton
(
button
);
}
}
if
(
button
)
if
(
button
)
{
{
QObject
::
connect
(
button
,
SIGNAL
(
toggled
(
bool
)
),
button
,
SLOT
(
callCallBack
(
bool
)
));
QObject
::
connect
(
button
,
SIGNAL
(
toggled
(
bool
)
),
button
,
SLOT
(
callCallBack
(
bool
)
));
addWidget
(
button
,
Qt
::
AlignCenter
);
addWidget
(
button
,
Qt
::
AlignCenter
);
}
}
}
}
...
@@ -1199,13 +1206,13 @@ void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata
...
@@ -1199,13 +1206,13 @@ void CvButtonbar::addButton( QString name, CvButtonCallback call, void* userdata
//buttons here
//buttons here
CvPushButton
::
CvPushButton
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
)
CvPushButton
::
CvPushButton
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
)
{
{
myparent
=
arg1
;
myparent
=
arg1
;
button_name
=
arg2
;
button_name
=
arg2
;
callback
=
arg3
;
callback
=
arg3
;
userdata
=
arg4
;
userdata
=
arg4
;
setObjectName
(
button_name
);
setObjectName
(
button_name
);
setText
(
button_name
);
setText
(
button_name
);
if
(
isChecked
())
if
(
isChecked
())
callCallBack
(
true
);
callCallBack
(
true
);
...
@@ -1219,14 +1226,14 @@ void CvPushButton::callCallBack(bool checked)
...
@@ -1219,14 +1226,14 @@ void CvPushButton::callCallBack(bool checked)
CvCheckBox
::
CvCheckBox
(
CvButtonbar
*
arg1
,
QString
arg2
,
CvButtonCallback
arg3
,
void
*
arg4
,
int
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
;
callback
=
arg3
;
callback
=
arg3
;
userdata
=
arg4
;
userdata
=
arg4
;
setObjectName
(
button_name
);
setObjectName
(
button_name
);
setCheckState
((
initial_button_state
==
1
?
Qt
::
Checked
:
Qt
::
Unchecked
));
setCheckState
((
initial_button_state
==
1
?
Qt
::
Checked
:
Qt
::
Unchecked
));
setText
(
button_name
);
setText
(
button_name
);
if
(
isChecked
())
if
(
isChecked
())
callCallBack
(
true
);
callCallBack
(
true
);
...
@@ -1524,8 +1531,8 @@ void CvWindow::createActions()
...
@@ -1524,8 +1531,8 @@ void CvWindow::createActions()
QObject
::
connect
(
vect_QActions
[
4
],
SIGNAL
(
triggered
()),
myview
,
SLOT
(
resetZoom
()
));
QObject
::
connect
(
vect_QActions
[
4
],
SIGNAL
(
triggered
()),
myview
,
SLOT
(
resetZoom
()
));
vect_QActions
[
5
]
=
new
QAction
(
QIcon
(
":/imgRegion-icon"
),
tr
(
"Zoom x%1 (see label) (CTRL+X)"
)
vect_QActions
[
5
]
=
new
QAction
(
QIcon
(
":/imgRegion-icon"
),
tr
(
"Zoom x%1 (see label) (CTRL+X)"
)
.
arg
(
threshold_zoom_img_region
)
.
arg
(
threshold_zoom_img_region
)
,
this
);
,
this
);
vect_QActions
[
5
]
->
setIconVisibleInMenu
(
true
);
vect_QActions
[
5
]
->
setIconVisibleInMenu
(
true
);
QObject
::
connect
(
vect_QActions
[
5
],
SIGNAL
(
triggered
()),
myview
,
SLOT
(
imgRegion
()
));
QObject
::
connect
(
vect_QActions
[
5
],
SIGNAL
(
triggered
()),
myview
,
SLOT
(
imgRegion
()
));
...
@@ -1713,6 +1720,8 @@ void CvWindow::readSettings()
...
@@ -1713,6 +1720,8 @@ void CvWindow::readSettings()
//param_name = settings.value("name_window",param_name).toString();
//param_name = settings.value("name_window",param_name).toString();
param_flags
=
settings
.
value
(
"mode_resize"
,
param_flags
).
toInt
();
param_flags
=
settings
.
value
(
"mode_resize"
,
param_flags
).
toInt
();
param_gui_mode
=
settings
.
value
(
"mode_gui"
,
param_gui_mode
).
toInt
();
param_gui_mode
=
settings
.
value
(
"mode_gui"
,
param_gui_mode
).
toInt
();
param_ratio_mode
=
settings
.
value
(
"mode_ratio"
,
param_ratio_mode
).
toInt
();
myview
->
param_keepRatio
=
settings
.
value
(
"view_aspectRatio"
,
myview
->
param_keepRatio
).
toInt
();
myview
->
param_keepRatio
=
settings
.
value
(
"view_aspectRatio"
,
myview
->
param_keepRatio
).
toInt
();
param_flags
=
settings
.
value
(
"mode_resize"
,
param_flags
).
toInt
();
param_flags
=
settings
.
value
(
"mode_resize"
,
param_flags
).
toInt
();
...
@@ -1732,6 +1741,12 @@ void CvWindow::readSettings()
...
@@ -1732,6 +1741,12 @@ void CvWindow::readSettings()
resize
(
size
);
resize
(
size
);
move
(
pos
);
move
(
pos
);
if
(
global_control_panel
)
{
icvLoadControlPanel
();
global_control_panel
->
move
(
settings
.
value
(
"posPanel"
,
global_control_panel
->
pos
()).
toPoint
());
}
}
}
void
CvWindow
::
writeSettings
()
void
CvWindow
::
writeSettings
()
...
@@ -1743,6 +1758,8 @@ void CvWindow::writeSettings()
...
@@ -1743,6 +1758,8 @@ void CvWindow::writeSettings()
settings
.
setValue
(
"size"
,
size
());
settings
.
setValue
(
"size"
,
size
());
settings
.
setValue
(
"mode_resize"
,
param_flags
);
settings
.
setValue
(
"mode_resize"
,
param_flags
);
settings
.
setValue
(
"mode_gui"
,
param_gui_mode
);
settings
.
setValue
(
"mode_gui"
,
param_gui_mode
);
settings
.
setValue
(
"param_ratio_mode"
,
param_ratio_mode
);
settings
.
setValue
(
"view_aspectRatio"
,
myview
->
param_keepRatio
);
settings
.
setValue
(
"view_aspectRatio"
,
myview
->
param_keepRatio
);
settings
.
setValue
(
"matrix_view.m11"
,
myview
->
param_matrixWorld
.
m11
());
settings
.
setValue
(
"matrix_view.m11"
,
myview
->
param_matrixWorld
.
m11
());
...
@@ -1756,8 +1773,134 @@ void CvWindow::writeSettings()
...
@@ -1756,8 +1773,134 @@ void CvWindow::writeSettings()
settings
.
setValue
(
"matrix_view.m33"
,
myview
->
param_matrixWorld
.
m33
());
settings
.
setValue
(
"matrix_view.m33"
,
myview
->
param_matrixWorld
.
m33
());
icvSaveTrackbars
(
&
settings
);
icvSaveTrackbars
(
&
settings
);
if
(
global_control_panel
)
{
icvSaveControlPanel
();
settings
.
setValue
(
"posPanel"
,
global_control_panel
->
pos
());
}
}
void
CvWindow
::
icvLoadControlPanel
()
{
QSettings
settings
(
"OpenCV2"
,
QFileInfo
(
QApplication
::
applicationFilePath
()).
fileName
()
+
" control panel"
);
int
size
=
settings
.
beginReadArray
(
"bars"
);
int
subsize
;
CvBar
*
t
;
if
(
size
==
global_control_panel
->
myLayout
->
layout
()
->
count
())
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
t
=
(
CvBar
*
)
global_control_panel
->
myLayout
->
layout
()
->
itemAt
(
i
);
settings
.
setArrayIndex
(
i
);
if
(
t
->
type
==
type_CvTrackbar
)
{
if
(
t
->
name_bar
==
settings
.
value
(
"namebar"
).
toString
())
{
((
CvTrackbar
*
)
t
)
->
slider
->
setValue
(
settings
.
value
(
"valuebar"
).
toInt
());
}
}
if
(
t
->
type
==
type_CvButtonbar
)
{
subsize
=
settings
.
beginReadArray
(
QString
(
"buttonbar"
)
+
i
);
if
(
subsize
==
((
CvButtonbar
*
)
t
)
->
layout
()
->
count
()
)
icvLoadButtonbar
((
CvButtonbar
*
)
t
,
&
settings
);
settings
.
endArray
();
}
}
settings
.
endArray
();
}
}
void
CvWindow
::
icvSaveControlPanel
()
{
QSettings
settings
(
"OpenCV2"
,
QFileInfo
(
QApplication
::
applicationFilePath
()).
fileName
()
+
" control panel"
);
settings
.
beginWriteArray
(
"bars"
);
CvBar
*
t
;
for
(
int
i
=
0
;
i
<
global_control_panel
->
myLayout
->
layout
()
->
count
();
++
i
)
{
t
=
(
CvBar
*
)
global_control_panel
->
myLayout
->
layout
()
->
itemAt
(
i
);
settings
.
setArrayIndex
(
i
);
if
(
t
->
type
==
type_CvTrackbar
)
{
settings
.
setValue
(
"namebar"
,
QString
(
t
->
name_bar
));
settings
.
setValue
(
"valuebar"
,((
CvTrackbar
*
)
t
)
->
slider
->
value
());
}
if
(
t
->
type
==
type_CvButtonbar
)
{
settings
.
beginWriteArray
(
QString
(
"buttonbar"
)
+
i
);
icvSaveButtonbar
((
CvButtonbar
*
)
t
,
&
settings
);
settings
.
endArray
();
}
}
settings
.
endArray
();
}
void
CvWindow
::
icvSaveButtonbar
(
CvButtonbar
*
b
,
QSettings
*
settings
)
{
QWidget
*
temp
;
QString
myclass
;
for
(
int
i
=
0
;
i
<
b
->
layout
()
->
count
();
++
i
)
{
settings
->
setArrayIndex
(
i
);
temp
=
(
QWidget
*
)
b
->
layout
()
->
itemAt
(
i
)
->
widget
();
myclass
=
QString
(
temp
->
metaObject
()
->
className
());
if
(
myclass
==
"CvPushButton"
)
{
CvPushButton
*
button
=
(
CvPushButton
*
)
temp
;
settings
->
setValue
(
"namebutton"
,
QString
(
button
->
text
())
);
settings
->
setValue
(
"valuebutton"
,
int
(
button
->
isChecked
()));
}
if
(
myclass
==
"CvCheckBox"
)
{
CvCheckBox
*
button
=
(
CvCheckBox
*
)
temp
;
settings
->
setValue
(
"namebutton"
,
QString
(
button
->
text
())
);
settings
->
setValue
(
"valuebutton"
,
int
(
button
->
isChecked
()));
}
if
(
myclass
==
"CvRadioButton"
)
{
CvRadioButton
*
button
=
(
CvRadioButton
*
)
temp
;
settings
->
setValue
(
"namebutton"
,
QString
(
button
->
text
())
);
settings
->
setValue
(
"valuebutton"
,
int
(
button
->
isChecked
()));
}
}
}
void
CvWindow
::
icvLoadButtonbar
(
CvButtonbar
*
b
,
QSettings
*
settings
)
{
QWidget
*
temp
;
QString
myclass
;
for
(
int
i
=
0
;
i
<
b
->
layout
()
->
count
();
++
i
)
{
settings
->
setArrayIndex
(
i
);
temp
=
(
QWidget
*
)
b
->
layout
()
->
itemAt
(
i
)
->
widget
();
myclass
=
QString
(
temp
->
metaObject
()
->
className
());
if
(
myclass
==
"CvPushButton"
)
{
CvPushButton
*
button
=
(
CvPushButton
*
)
temp
;
if
(
button
->
text
()
==
settings
->
value
(
"namebutton"
).
toString
())
button
->
setChecked
(
settings
->
value
(
"valuebutton"
).
toInt
());
}
if
(
myclass
==
"CvCheckBox"
)
{
CvCheckBox
*
button
=
(
CvCheckBox
*
)
temp
;
if
(
button
->
text
()
==
settings
->
value
(
"namebutton"
).
toString
())
button
->
setChecked
(
settings
->
value
(
"valuebutton"
).
toInt
());
}
if
(
myclass
==
"CvRadioButton"
)
{
CvRadioButton
*
button
=
(
CvRadioButton
*
)
temp
;
if
(
button
->
text
()
==
settings
->
value
(
"namebutton"
).
toString
())
button
->
setChecked
(
settings
->
value
(
"valuebutton"
).
toInt
());
}
}
}
void
CvWindow
::
icvLoadTrackbars
(
QSettings
*
settings
)
void
CvWindow
::
icvLoadTrackbars
(
QSettings
*
settings
)
{
{
int
size
=
settings
->
beginReadArray
(
"trackbars"
);
int
size
=
settings
->
beginReadArray
(
"trackbars"
);
...
@@ -1765,20 +1908,17 @@ void CvWindow::icvLoadTrackbars(QSettings *settings)
...
@@ -1765,20 +1908,17 @@ void CvWindow::icvLoadTrackbars(QSettings *settings)
//trackbar are saved in the same order, so no need to use icvFindTrackbarByName
//trackbar are saved in the same order, so no need to use icvFindTrackbarByName
int
start_index
=
0
;
if
(
myBarLayout
->
layout
()
->
count
()
==
size
)
//if not the same number, the window saved and loaded is not the same (nb trackbar not equal)
int
stop_index
=
myBarLayout
->
layout
()
->
count
()
;
for
(
int
i
=
0
;
i
<
size
;
++
i
)
if
(
stop_index
-
start_index
==
size
)
//if not the same number, the window saved and loaded is not the same (nb trackbar not equal)
for
(
int
i
=
start_index
;
i
<
size
+
start_index
;
++
i
)
{
{
settings
->
setArrayIndex
(
i
-
start_index
);
settings
->
setArrayIndex
(
i
);
t
=
(
CvTrackbar
*
)
myBarLayout
->
layout
()
->
itemAt
(
i
);
t
=
(
CvTrackbar
*
)
myBarLayout
->
layout
()
->
itemAt
(
i
);
if
(
t
->
name_bar
==
settings
->
value
(
"name"
).
toString
())
if
(
t
->
name_bar
==
settings
->
value
(
"name"
).
toString
())
t
->
slider
->
setValue
(
settings
->
value
(
"value"
).
toInt
());
t
->
slider
->
setValue
(
settings
->
value
(
"value"
).
toInt
());
}
}
settings
->
endArray
();
settings
->
endArray
();
}
}
...
@@ -1788,13 +1928,10 @@ void CvWindow::icvSaveTrackbars(QSettings *settings)
...
@@ -1788,13 +1928,10 @@ void CvWindow::icvSaveTrackbars(QSettings *settings)
settings
->
beginWriteArray
(
"trackbars"
);
settings
->
beginWriteArray
(
"trackbars"
);
int
start_index
=
0
;
for
(
int
i
=
0
;
i
<
myBarLayout
->
layout
()
->
count
();
++
i
)
{
for
(
int
i
=
start_index
;
i
<
myBarLayout
->
layout
()
->
count
()
-
1
;
++
i
)
{
t
=
(
CvTrackbar
*
)
myBarLayout
->
layout
()
->
itemAt
(
i
);
t
=
(
CvTrackbar
*
)
myBarLayout
->
layout
()
->
itemAt
(
i
);
settings
->
setArrayIndex
(
i
-
start_index
);
settings
->
setArrayIndex
(
i
);
settings
->
setValue
(
"name"
,
t
->
name_bar
);
settings
->
setValue
(
"name"
,
t
->
name_bar
);
//settings->setValue("name", t->getName());
settings
->
setValue
(
"value"
,
t
->
slider
->
value
());
settings
->
setValue
(
"value"
,
t
->
slider
->
value
());
}
}
settings
->
endArray
();
settings
->
endArray
();
...
@@ -1810,7 +1947,7 @@ void CvWindow::icvSaveTrackbars(QSettings *settings)
...
@@ -1810,7 +1947,7 @@ void CvWindow::icvSaveTrackbars(QSettings *settings)
ViewPort
::
ViewPort
(
CvWindow
*
arg
,
int
arg2
,
int
arg3
)
ViewPort
::
ViewPort
(
CvWindow
*
arg
,
int
arg2
,
int
arg3
)
{
{
centralWidget
=
arg
,
centralWidget
=
arg
,
setParent
(
centralWidget
);
setParent
(
centralWidget
);
mode_display
=
arg2
;
mode_display
=
arg2
;
param_keepRatio
=
arg3
;
param_keepRatio
=
arg3
;
...
@@ -1881,18 +2018,18 @@ void ViewPort::saveView()
...
@@ -1881,18 +2018,18 @@ void ViewPort::saveView()
QString
name_s
=
centralWidget
->
param_name
+
"_screenshot_"
+
date_s
;
QString
name_s
=
centralWidget
->
param_name
+
"_screenshot_"
+
date_s
;
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save File %1"
).
arg
(
name_s
),
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save File %1"
).
arg
(
name_s
),
name_s
+
".png"
,
name_s
+
".png"
,
tr
(
"Images (*.png *.jpg *.bmp *.jpeg)"
));
tr
(
"Images (*.png *.jpg *.bmp *.jpeg)"
));
if
(
!
fileName
.
isEmpty
())
//save the picture
if
(
!
fileName
.
isEmpty
())
//save the picture
{
{
QString
extension
=
fileName
.
right
(
3
);
QString
extension
=
fileName
.
right
(
3
);
#if defined( HAVE_QT_OPENGL )
#if defined( HAVE_QT_OPENGL )
image2Draw_qt_resized
=
((
QGLWidget
*
)
viewport
())
->
grabFrameBuffer
();
image2Draw_qt_resized
=
((
QGLWidget
*
)
viewport
())
->
grabFrameBuffer
();
#else
#else
QPainter
saveimage
(
&
image2Draw_qt_resized
);
QPainter
saveimage
(
&
image2Draw_qt_resized
);
this
->
render
(
&
saveimage
);
this
->
render
(
&
saveimage
);
#endif
#endif
// Save it..
// Save it..
...
@@ -1920,7 +2057,7 @@ void ViewPort::saveView()
...
@@ -1920,7 +2057,7 @@ void ViewPort::saveView()
return
;
return
;
}
}
qDebug
()
<<
"file extension not recognized, please choose between JPG, JPEG, BMP or PNG"
;
CV_Error
(
CV_StsNullPtr
,
"file extension not recognized, please choose between JPG, JPEG, BMP or PNG"
)
;
}
}
}
}
...
@@ -2046,19 +2183,19 @@ void ViewPort::setOpenGLCallback(CvOpenGLCallback func,void* userdata, double an
...
@@ -2046,19 +2183,19 @@ void ViewPort::setOpenGLCallback(CvOpenGLCallback func,void* userdata, double an
#if defined( HAVE_QT_OPENGL )
#if defined( HAVE_QT_OPENGL )
on_openGL_draw3D
=
func
;
on_openGL_draw3D
=
func
;
on_openGL_param
=
userdata
;
on_openGL_param
=
userdata
;
if
(
angle_arg
>
0
)
if
(
angle_arg
>
0
)
angle
=
angle_arg
;
angle
=
angle_arg
;
else
else
angle
=
DEFAULT_ANGLE
;
angle
=
DEFAULT_ANGLE
;
if
(
zmin_arg
>=
0
)
if
(
zmin_arg
>=
0
)
zmin
=
zmin_arg
;
zmin
=
zmin_arg
;
else
else
zmin
=
DEFAULT_ZMIN
;
zmin
=
DEFAULT_ZMIN
;
if
(
zmax_arg
>
0
)
if
(
zmax_arg
>
0
)
zmax
=
zmax_arg
;
zmax
=
zmax_arg
;
else
else
...
@@ -2232,39 +2369,39 @@ void ViewPort::icvmouseHandler(QMouseEvent *event, type_mouse_event category, in
...
@@ -2232,39 +2369,39 @@ void ViewPort::icvmouseHandler(QMouseEvent *event, type_mouse_event category, in
switch
(
event
->
modifiers
())
switch
(
event
->
modifiers
())
{
{
case
Qt
:
:
ShiftModifier
:
case
Qt
:
:
ShiftModifier
:
flags
=
CV_EVENT_FLAG_SHIFTKEY
;
flags
=
CV_EVENT_FLAG_SHIFTKEY
;
break
;
break
;
case
Qt
:
:
ControlModifier
:
case
Qt
:
:
ControlModifier
:
flags
=
CV_EVENT_FLAG_CTRLKEY
;
flags
=
CV_EVENT_FLAG_CTRLKEY
;
break
;
break
;
case
Qt
:
:
AltModifier
:
case
Qt
:
:
AltModifier
:
flags
=
CV_EVENT_FLAG_ALTKEY
;
flags
=
CV_EVENT_FLAG_ALTKEY
;
break
;
break
;
case
Qt
:
:
NoModifier
:
case
Qt
:
:
NoModifier
:
break
;
break
;
case
Qt
:
:
MetaModifier
:
case
Qt
:
:
MetaModifier
:
break
;
break
;
case
Qt
:
:
KeypadModifier
:
case
Qt
:
:
KeypadModifier
:
break
;
break
;
default
:
;
default
:
;
}
}
switch
(
event
->
button
())
switch
(
event
->
button
())
{
{
case
Qt
:
:
LeftButton
:
case
Qt
:
:
LeftButton
:
cv_event
=
tableMouseButtons
[
category
][
0
];
cv_event
=
tableMouseButtons
[
category
][
0
];
flags
|=
CV_EVENT_FLAG_LBUTTON
;
flags
|=
CV_EVENT_FLAG_LBUTTON
;
break
;
break
;
case
Qt
:
:
RightButton
:
case
Qt
:
:
RightButton
:
cv_event
=
tableMouseButtons
[
category
][
1
];
cv_event
=
tableMouseButtons
[
category
][
1
];
flags
|=
CV_EVENT_FLAG_RBUTTON
;
flags
|=
CV_EVENT_FLAG_RBUTTON
;
break
;
break
;
case
Qt
:
:
MidButton
:
case
Qt
:
:
MidButton
:
cv_event
=
tableMouseButtons
[
category
][
2
];
cv_event
=
tableMouseButtons
[
category
][
2
];
flags
|=
CV_EVENT_FLAG_MBUTTON
;
flags
|=
CV_EVENT_FLAG_MBUTTON
;
break
;
break
;
default
:
;
default
:
;
}
}
}
}
...
@@ -2330,47 +2467,47 @@ void ViewPort::resizeEvent ( QResizeEvent *event)
...
@@ -2330,47 +2467,47 @@ void ViewPort::resizeEvent ( QResizeEvent *event)
void
ViewPort
::
paintEvent
(
QPaintEvent
*
event
)
void
ViewPort
::
paintEvent
(
QPaintEvent
*
event
)
{
{
QPainter
myPainter
(
viewport
());
QPainter
myPainter
(
viewport
());
myPainter
.
setWorldTransform
(
param_matrixWorld
);
myPainter
.
setWorldTransform
(
param_matrixWorld
);
draw2D
(
&
myPainter
);
draw2D
(
&
myPainter
);
#if defined( HAVE_QT_OPENGL )
#if defined( HAVE_QT_OPENGL )
if
(
mode_display
==
CV_MODE_OPENGL
&&
on_openGL_draw3D
)
if
(
mode_display
==
CV_MODE_OPENGL
&&
on_openGL_draw3D
)
{
{
myPainter
.
save
();
// Needed when using the GL1 engine
myPainter
.
save
();
// Needed when using the GL1 engine
myPainter
.
beginNativePainting
();
// Needed when using the GL2 engine
myPainter
.
beginNativePainting
();
// Needed when using the GL2 engine
setGL
(
width
(),
height
());
setGL
(
width
(),
height
());
on_openGL_draw3D
(
on_openGL_param
);
on_openGL_draw3D
(
on_openGL_param
);
unsetGL
();
unsetGL
();
myPainter
.
endNativePainting
();
// Needed when using the GL2 engine
myPainter
.
endNativePainting
();
// Needed when using the GL2 engine
myPainter
.
restore
();
// Needed when using the GL1 engine
myPainter
.
restore
();
// Needed when using the GL1 engine
}
}
#endif
#endif
//Now disable matrixWorld for overlay display
//Now disable matrixWorld for overlay display
myPainter
.
setWorldMatrixEnabled
(
false
);
myPainter
.
setWorldMatrixEnabled
(
false
);
//in mode zoom/panning
//in mode zoom/panning
if
(
param_matrixWorld
.
m11
()
>
1
)
if
(
param_matrixWorld
.
m11
()
>
1
)
{
{
if
(
param_matrixWorld
.
m11
()
>=
threshold_zoom_img_region
)
if
(
param_matrixWorld
.
m11
()
>=
threshold_zoom_img_region
)
drawImgRegion
(
&
myPainter
);
drawImgRegion
(
&
myPainter
);
drawViewOverview
(
&
myPainter
);
drawViewOverview
(
&
myPainter
);
}
}
//for information overlay
//for information overlay
if
(
drawInfo
)
if
(
drawInfo
)
drawInstructions
(
&
myPainter
);
drawInstructions
(
&
myPainter
);
//for statusbar
//for statusbar
if
(
centralWidget
->
myStatusBar
)
if
(
centralWidget
->
myStatusBar
)
drawStatusBar
();
drawStatusBar
();
QGraphicsView
::
paintEvent
(
event
);
QGraphicsView
::
paintEvent
(
event
);
}
}
void
ViewPort
::
draw2D
(
QPainter
*
painter
)
void
ViewPort
::
draw2D
(
QPainter
*
painter
)
...
@@ -2381,28 +2518,28 @@ void ViewPort::draw2D(QPainter *painter)
...
@@ -2381,28 +2518,28 @@ void ViewPort::draw2D(QPainter *painter)
void
ViewPort
::
drawStatusBar
()
void
ViewPort
::
drawStatusBar
()
{
{
if
(
mouseCoordinate
.
x
()
>=
0
&&
if
(
mouseCoordinate
.
x
()
>=
0
&&
mouseCoordinate
.
y
()
>=
0
&&
mouseCoordinate
.
y
()
>=
0
&&
mouseCoordinate
.
x
()
<
image2Draw_ipl
->
width
&&
mouseCoordinate
.
x
()
<
image2Draw_ipl
->
width
&&
mouseCoordinate
.
y
()
<
image2Draw_ipl
->
height
)
mouseCoordinate
.
y
()
<
image2Draw_ipl
->
height
)
{
{
QRgb
rgbValue
=
image2Draw_qt
.
pixel
(
mouseCoordinate
);
QRgb
rgbValue
=
image2Draw_qt
.
pixel
(
mouseCoordinate
);
if
(
nbChannelOriginImage
==
3
)
if
(
nbChannelOriginImage
==
3
)
{
{
centralWidget
->
myStatusBar_msg
->
setText
(
tr
(
"<font color='black'>Coordinate: %1x%2 ~ </font>"
)
centralWidget
->
myStatusBar_msg
->
setText
(
tr
(
"<font color='black'>Coordinate: %1x%2 ~ </font>"
)
.
arg
(
mouseCoordinate
.
x
())
.
arg
(
mouseCoordinate
.
x
())
.
arg
(
mouseCoordinate
.
y
())
+
.
arg
(
mouseCoordinate
.
y
())
+
tr
(
"<font color='red'>R:%3 </font>"
).
arg
(
qRed
(
rgbValue
))
+
//.arg(value.val[0])+
tr
(
"<font color='red'>R:%3 </font>"
).
arg
(
qRed
(
rgbValue
))
+
//.arg(value.val[0])+
tr
(
"<font color='green'>G:%4 </font>"
).
arg
(
qGreen
(
rgbValue
))
+
//.arg(value.val[1])+
tr
(
"<font color='green'>G:%4 </font>"
).
arg
(
qGreen
(
rgbValue
))
+
//.arg(value.val[1])+
tr
(
"<font color='blue'>B:%5</font>"
).
arg
(
qBlue
(
rgbValue
))
//.arg(value.val[2])
tr
(
"<font color='blue'>B:%5</font>"
).
arg
(
qBlue
(
rgbValue
))
//.arg(value.val[2])
);
);
}
else
{
}
else
{
//all the channel have the same value (because of cvconvertimage), so only the r channel is dsplayed
//all the channel have the same value (because of cvconvertimage), so only the r channel is dsplayed
centralWidget
->
myStatusBar_msg
->
setText
(
tr
(
"<font color='black'>Coordinate: %1x%2 ~ </font>"
)
centralWidget
->
myStatusBar_msg
->
setText
(
tr
(
"<font color='black'>Coordinate: %1x%2 ~ </font>"
)
.
arg
(
mouseCoordinate
.
x
())
.
arg
(
mouseCoordinate
.
x
())
.
arg
(
mouseCoordinate
.
y
())
+
.
arg
(
mouseCoordinate
.
y
())
+
tr
(
"<font color='grey'>grey:%3 </font>"
).
arg
(
qRed
(
rgbValue
))
tr
(
"<font color='grey'>grey:%3 </font>"
).
arg
(
qRed
(
rgbValue
))
);
);
}
}
}
}
}
}
...
@@ -2455,17 +2592,17 @@ void ViewPort::drawImgRegion(QPainter *painter)
...
@@ -2455,17 +2592,17 @@ void ViewPort::drawImgRegion(QPainter *painter)
val
=
tr
(
"%1"
).
arg
(
qRed
(
rgbValue
));
val
=
tr
(
"%1"
).
arg
(
qRed
(
rgbValue
));
painter
->
setPen
(
QPen
(
Qt
::
red
,
1
));
painter
->
setPen
(
QPen
(
Qt
::
red
,
1
));
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
(),
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
(),
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
Qt
::
AlignCenter
,
val
);
Qt
::
AlignCenter
,
val
);
val
=
tr
(
"%1"
).
arg
(
qGreen
(
rgbValue
));
val
=
tr
(
"%1"
).
arg
(
qGreen
(
rgbValue
));
painter
->
setPen
(
QPen
(
Qt
::
green
,
1
));
painter
->
setPen
(
QPen
(
Qt
::
green
,
1
));
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
()
+
param_matrixWorld
.
m11
()
/
3
,
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
()
+
param_matrixWorld
.
m11
()
/
3
,
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
Qt
::
AlignCenter
,
val
);
Qt
::
AlignCenter
,
val
);
val
=
tr
(
"%1"
).
arg
(
qBlue
(
rgbValue
));
val
=
tr
(
"%1"
).
arg
(
qBlue
(
rgbValue
));
painter
->
setPen
(
QPen
(
Qt
::
blue
,
1
));
painter
->
setPen
(
QPen
(
Qt
::
blue
,
1
));
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
()
+
2
*
param_matrixWorld
.
m11
()
/
3
,
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
()
+
2
*
param_matrixWorld
.
m11
()
/
3
,
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()
/
3
),
Qt
::
AlignCenter
,
val
);
Qt
::
AlignCenter
,
val
);
}
}
else
else
...
@@ -2473,17 +2610,17 @@ void ViewPort::drawImgRegion(QPainter *painter)
...
@@ -2473,17 +2610,17 @@ void ViewPort::drawImgRegion(QPainter *painter)
val
=
tr
(
"%1"
).
arg
(
qRed
(
rgbValue
));
val
=
tr
(
"%1"
).
arg
(
qRed
(
rgbValue
));
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
(),
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()),
painter
->
drawText
(
QRect
(
point1
.
x
(),
point1
.
y
(),
param_matrixWorld
.
m11
(),
param_matrixWorld
.
m11
()),
Qt
::
AlignCenter
,
val
);
Qt
::
AlignCenter
,
val
);
}
}
}
}
painter
->
setPen
(
QPen
(
Qt
::
black
,
1
));
painter
->
setPen
(
QPen
(
Qt
::
black
,
1
));
painter
->
drawLines
(
linesX
.
data
(),
linesX
.
size
());
painter
->
drawLines
(
linesX
.
data
(),
linesX
.
size
());
painter
->
drawLines
(
linesY
.
data
(),
linesY
.
size
());
painter
->
drawLines
(
linesY
.
data
(),
linesY
.
size
());
//restore font size
//restore font size
f
.
setPointSize
(
original_font_size
);
f
.
setPointSize
(
original_font_size
);
painter
->
setFont
(
f
);
painter
->
setFont
(
f
);
}
}
...
@@ -2504,10 +2641,10 @@ void ViewPort::drawViewOverview(QPainter *painter)
...
@@ -2504,10 +2641,10 @@ void ViewPort::drawViewOverview(QPainter *painter)
qreal
ratioWindow
=
(
qreal
)(
viewSize
.
height
())
/
(
qreal
)(
size
().
height
());
qreal
ratioWindow
=
(
qreal
)(
viewSize
.
height
())
/
(
qreal
)(
size
().
height
());
painter
->
setPen
(
Qt
::
darkBlue
);
painter
->
setPen
(
Qt
::
darkBlue
);
painter
->
drawRect
(
QRectF
(
width
()
-
viewSize
.
width
()
-
positionCorners
.
left
()
*
ratioSize
*
ratioWindow
-
margin
,
painter
->
drawRect
(
QRectF
(
width
()
-
viewSize
.
width
()
-
positionCorners
.
left
()
*
ratioSize
*
ratioWindow
-
margin
,
-
positionCorners
.
top
()
*
ratioSize
*
ratioWindow
,
-
positionCorners
.
top
()
*
ratioSize
*
ratioWindow
,
(
viewSize
.
width
()
-
1
)
*
ratioSize
,
(
viewSize
.
width
()
-
1
)
*
ratioSize
,
(
viewSize
.
height
()
-
1
)
*
ratioSize
)
(
viewSize
.
height
()
-
1
)
*
ratioSize
)
);
);
}
}
void
ViewPort
::
drawInstructions
(
QPainter
*
painter
)
void
ViewPort
::
drawInstructions
(
QPainter
*
painter
)
...
@@ -2516,17 +2653,17 @@ void ViewPort::drawInstructions(QPainter *painter)
...
@@ -2516,17 +2653,17 @@ void ViewPort::drawInstructions(QPainter *painter)
int
border
=
qMax
(
4
,
metrics
.
leading
());
int
border
=
qMax
(
4
,
metrics
.
leading
());
QRect
rect
=
metrics
.
boundingRect
(
0
,
0
,
width
()
-
2
*
border
,
int
(
height
()
*
0.125
),
QRect
rect
=
metrics
.
boundingRect
(
0
,
0
,
width
()
-
2
*
border
,
int
(
height
()
*
0.125
),
Qt
::
AlignCenter
|
Qt
::
TextWordWrap
,
infoText
);
Qt
::
AlignCenter
|
Qt
::
TextWordWrap
,
infoText
);
painter
->
setRenderHint
(
QPainter
::
TextAntialiasing
);
painter
->
setRenderHint
(
QPainter
::
TextAntialiasing
);
painter
->
fillRect
(
QRect
(
0
,
0
,
width
(),
rect
.
height
()
+
2
*
border
),
painter
->
fillRect
(
QRect
(
0
,
0
,
width
(),
rect
.
height
()
+
2
*
border
),
QColor
(
0
,
0
,
0
,
127
));
QColor
(
0
,
0
,
0
,
127
));
painter
->
setPen
(
Qt
::
white
);
painter
->
setPen
(
Qt
::
white
);
painter
->
fillRect
(
QRect
(
0
,
0
,
width
(),
rect
.
height
()
+
2
*
border
),
painter
->
fillRect
(
QRect
(
0
,
0
,
width
(),
rect
.
height
()
+
2
*
border
),
QColor
(
0
,
0
,
0
,
127
));
QColor
(
0
,
0
,
0
,
127
));
painter
->
drawText
((
width
()
-
rect
.
width
())
/
2
,
border
,
painter
->
drawText
((
width
()
-
rect
.
width
())
/
2
,
border
,
rect
.
width
(),
rect
.
height
(),
rect
.
width
(),
rect
.
height
(),
Qt
::
AlignCenter
|
Qt
::
TextWordWrap
,
infoText
);
Qt
::
AlignCenter
|
Qt
::
TextWordWrap
,
infoText
);
}
}
...
...
modules/highgui/src/window_QT.h
View file @
e8aad754
...
@@ -304,6 +304,10 @@ private:
...
@@ -304,6 +304,10 @@ private:
void
icvLoadTrackbars
(
QSettings
*
settings
);
void
icvLoadTrackbars
(
QSettings
*
settings
);
void
icvSaveTrackbars
(
QSettings
*
settings
);
void
icvSaveTrackbars
(
QSettings
*
settings
);
void
icvLoadControlPanel
();
void
icvSaveControlPanel
();
void
icvLoadButtonbar
(
CvButtonbar
*
t
,
QSettings
*
settings
);
void
icvSaveButtonbar
(
CvButtonbar
*
t
,
QSettings
*
settings
);
void
createShortcuts
();
void
createShortcuts
();
void
createActions
();
void
createActions
();
...
...
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