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
48090fd3
Commit
48090fd3
authored
Aug 18, 2010
by
Yannick Verdie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt bug fixed #534
parent
97d17d8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
28 deletions
+43
-28
window_QT.cpp
modules/highgui/src/window_QT.cpp
+28
-25
window_QT.h
modules/highgui/src/window_QT.h
+15
-3
No files found.
modules/highgui/src/window_QT.cpp
View file @
48090fd3
...
...
@@ -343,21 +343,27 @@ CvWindow* icvFindWindowByName( const char* arg )
QString
name
(
arg
);
CvWindow
*
w
;
CvWinModel
*
temp
;
foreach
(
QWidget
*
widget
,
QApplication
::
topLevelWidgets
())
{
if
(
widget
->
isWindow
()
&&
!
widget
->
parentWidget
())
//is a window without parent
{
w
=
(
CvWindow
*
)
widget
;
temp
=
(
CvWinModel
*
)
widget
;
if
(
temp
->
type
==
type_CvWindow
)
{
w
=
(
CvWindow
*
)
temp
;
if
(
w
->
param_name
==
name
)
{
window
=
w
;
break
;
}
}
}
}
return
window
;
}
...
...
@@ -695,7 +701,7 @@ void GuiReceiver::isLastWindow()
{
if
(
--
nb_windows
<=
0
)
{
delete
guiMainThread
;
delete
guiMainThread
;
//delete global_control_panel too
guiMainThread
=
NULL
;
qApp
->
quit
();
}
...
...
@@ -703,8 +709,12 @@ void GuiReceiver::isLastWindow()
GuiReceiver
::~
GuiReceiver
()
{
if
(
global_control_panel
)
{
delete
global_control_panel
;
global_control_panel
=
NULL
;
}
delete
timer
;
}
...
...
@@ -913,6 +923,9 @@ void GuiReceiver::showImage(QString name, void* arr)
if
(
w
&&
arr
)
{
w
->
updateImage
(
arr
);
if
(
w
->
isHidden
())
w
->
show
();
}
else
{
...
...
@@ -1353,9 +1366,10 @@ void CvRadioButton::callCallBack(bool checked)
//here CvWinProperties class
CvWinProperties
::
CvWinProperties
(
QString
name_paraWindow
,
Q
Widge
t
*
parent
)
CvWinProperties
::
CvWinProperties
(
QString
name_paraWindow
,
Q
Objec
t
*
parent
)
{
setParent
(
parent
);
//setParent(parent);
type
=
type_CvWinProperties
;
setWindowFlags
(
Qt
::
Tool
);
setContentsMargins
(
0
,
0
,
0
,
0
);
setWindowTitle
(
name_paraWindow
);
...
...
@@ -1411,7 +1425,6 @@ CvWinProperties::~CvWinProperties()
QSettings
settings
(
"OpenCV2"
,
this
->
windowTitle
());
settings
.
remove
(
"pos"
);
QLayoutItem
*
child
;
if
(
myLayout
)
{
...
...
@@ -1430,6 +1443,7 @@ CvWinProperties::~CvWinProperties()
//Here CvWindow class
CvWindow
::
CvWindow
(
QString
arg
,
int
arg2
)
{
type
=
type_CvWindow
;
moveToThread
(
qApp
->
instance
()
->
thread
());
param_name
=
arg
;
...
...
@@ -1437,7 +1451,7 @@ CvWindow::CvWindow(QString arg, int arg2)
param_gui_mode
=
arg2
&
0x000000F0
;
param_ratio_mode
=
arg2
&
0x00000F00
;
setAttribute
(
Qt
::
WA_DeleteOnClose
);
//in other case, does not release memory
//
setAttribute(Qt::WA_DeleteOnClose);//in other case, does not release memory
setContentsMargins
(
0
,
0
,
0
,
0
);
setWindowTitle
(
param_name
);
setObjectName
(
param_name
);
...
...
@@ -1490,6 +1504,7 @@ CvWindow::CvWindow(QString arg, int arg2)
CvWindow
::~
CvWindow
()
{
QLayoutItem
*
child
;
if
(
myGlobalLayout
)
...
...
@@ -1508,7 +1523,6 @@ CvWindow::~CvWindow()
delete
myBarLayout
;
}
if
(
myStatusBar
)
{
delete
myStatusBar
;
...
...
@@ -1571,7 +1585,7 @@ CvWinProperties* CvWindow::createParameterWindow()
{
QString
name_paraWindow
=
QFileInfo
(
QApplication
::
applicationFilePath
()).
fileName
()
+
" settings"
;
CvWinProperties
*
result
=
new
CvWinProperties
(
name_paraWindow
,
this
);
CvWinProperties
*
result
=
new
CvWinProperties
(
name_paraWindow
,
guiMainThread
);
return
result
;
}
...
...
@@ -1632,7 +1646,6 @@ void CvWindow::createActions()
if
(
global_control_panel
->
myLayout
->
count
()
==
0
)
vect_QActions
[
9
]
->
setDisabled
(
true
);
}
...
...
@@ -2138,12 +2151,10 @@ ViewPort::~ViewPort()
cvReleaseImage
(
&
image2Draw_ipl
);
#if defined( HAVE_QT_OPENGL )
if
(
myGL
)
delete
myGL
;
#endif;
qDebug
()
<<
"kill vieport"
;
//#if defined( HAVE_QT_OPENGL )
// if (myGL)
// delete myGL;
//#endif;
delete
timerDisplay
;
}
...
...
@@ -2573,8 +2584,6 @@ void ViewPort::icvmouseProcessing(QPointF pt, int cv_event, int flags)
{
//to convert mouse coordinate
qreal
pfx
,
pfy
;
//qreal ratioX = float(image2Draw_qt.width())/image2Draw_qt_resized.width();
//qreal ratioY = float(image2Draw_qt.height())/image2Draw_qt_resized.height();
matrixWorld_inv
.
map
(
pt
.
x
(),
pt
.
y
(),
&
pfx
,
&
pfy
);
mouseCoordinate
.
rx
()
=
floor
(
pfx
/
ratioX
);
...
...
@@ -2588,12 +2597,9 @@ void ViewPort::icvmouseProcessing(QPointF pt, int cv_event, int flags)
QSize
ViewPort
::
sizeHint
()
const
{
if
(
image2Draw_ipl
)
{
//qDebug()<<centralWidget->param_name<<" "<<image2Draw_ipl->width<<" "<<image2Draw_ipl->height;
return
QSize
(
image2Draw_ipl
->
width
,
image2Draw_ipl
->
height
);
}
else
{
else
return
QGraphicsView
::
sizeHint
();
}
}
void
ViewPort
::
resizeEvent
(
QResizeEvent
*
event
)
...
...
@@ -2751,9 +2757,6 @@ void ViewPort::drawImgRegion(QPainter *painter)
QPointF
point1
;
//sorry, I do not know how to name it
QPointF
point2
;
//idem
//qreal ratioX = float(image2Draw_qt.width())/image2Draw_qt_resized.width();
//qreal ratioY = float(image2Draw_qt.height())/image2Draw_qt_resized.height();
for
(
int
j
=-
1
;
j
<
height
()
/
param_matrixWorld
.
m11
();
j
++
)
//-1 because display the pixels top rows left colums
for
(
int
i
=-
1
;
i
<
width
()
/
param_matrixWorld
.
m11
();
i
++
)
//-1
{
...
...
modules/highgui/src/window_QT.h
View file @
48090fd3
...
...
@@ -253,11 +253,23 @@ private:
};
class
CvWinProperties
:
public
QWidget
//Both are top level window, so that a way to differenciate them.
//if (obj->metaObject ()->className () == "CvWindow") does not give me robust result
enum
typeWindow
{
type_CvWindow
=
0
,
type_CvWinProperties
=
1
};
class
CvWinModel
:
public
QWidget
{
public
:
typeWindow
type
;
};
class
CvWinProperties
:
public
CvWinModel
{
Q_OBJECT
public
:
CvWinProperties
(
QString
name
,
Q
Widge
t
*
parent
);
CvWinProperties
(
QString
name
,
Q
Objec
t
*
parent
);
~
CvWinProperties
();
QPointer
<
QBoxLayout
>
myLayout
;
...
...
@@ -279,7 +291,7 @@ public:
};
class
CvWindow
:
public
QWidget
class
CvWindow
:
public
CvWinModel
{
Q_OBJECT
public
:
...
...
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