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
fd1da009
Commit
fd1da009
authored
Aug 18, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7129 from paroj:mousecallback-dry-code
parents
2f069c10
46bfdbaf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
19 deletions
+22
-19
window_QT.cpp
modules/highgui/src/window_QT.cpp
+0
-0
window_QT.h
modules/highgui/src/window_QT.h
+22
-19
No files found.
modules/highgui/src/window_QT.cpp
View file @
fd1da009
This diff is collapsed.
Click to expand it.
modules/highgui/src/window_QT.h
View file @
fd1da009
...
...
@@ -403,10 +403,26 @@ public:
};
class
OCVViewPort
:
public
ViewPort
{
public
:
explicit
OCVViewPort
();
~
OCVViewPort
()
{};
void
setMouseCallBack
(
CvMouseCallback
callback
,
void
*
param
);
protected
:
void
icvmouseEvent
(
QMouseEvent
*
event
,
type_mouse_event
category
);
void
icvmouseHandler
(
QMouseEvent
*
event
,
type_mouse_event
category
,
int
&
cv_event
,
int
&
flags
);
void
icvmouseProcessing
(
QPointF
pt
,
int
cv_event
,
int
flags
);
CvMouseCallback
mouseCallback
;
void
*
mouseData
;
};
#ifdef HAVE_QT_OPENGL
class
OpenGlViewPort
:
public
QGLWidget
,
public
ViewPort
class
OpenGlViewPort
:
public
QGLWidget
,
public
OCV
ViewPort
{
public
:
explicit
OpenGlViewPort
(
QWidget
*
parent
);
...
...
@@ -414,8 +430,6 @@ public:
QWidget
*
getWidget
();
void
setMouseCallBack
(
CvMouseCallback
callback
,
void
*
param
);
void
writeSettings
(
QSettings
&
settings
);
void
readSettings
(
QSettings
&
settings
);
...
...
@@ -448,20 +462,14 @@ protected:
private
:
QSize
size
;
CvMouseCallback
mouseCallback
;
void
*
mouseData
;
CvOpenGlDrawCallback
glDrawCallback
;
void
*
glDrawData
;
void
icvmouseHandler
(
QMouseEvent
*
event
,
type_mouse_event
category
,
int
&
cv_event
,
int
&
flags
);
void
icvmouseProcessing
(
QPointF
pt
,
int
cv_event
,
int
flags
);
};
#endif // HAVE_QT_OPENGL
class
DefaultViewPort
:
public
QGraphicsView
,
public
ViewPort
class
DefaultViewPort
:
public
QGraphicsView
,
public
OCV
ViewPort
{
Q_OBJECT
...
...
@@ -471,8 +479,6 @@ public:
QWidget
*
getWidget
();
void
setMouseCallBack
(
CvMouseCallback
callback
,
void
*
param
);
void
writeSettings
(
QSettings
&
settings
);
void
readSettings
(
QSettings
&
settings
);
...
...
@@ -510,6 +516,7 @@ protected:
void
contextMenuEvent
(
QContextMenuEvent
*
event
);
void
resizeEvent
(
QResizeEvent
*
event
);
void
paintEvent
(
QPaintEvent
*
paintEventInfo
);
void
wheelEvent
(
QWheelEvent
*
event
);
void
mouseMoveEvent
(
QMouseEvent
*
event
);
void
mousePressEvent
(
QMouseEvent
*
event
);
...
...
@@ -526,17 +533,13 @@ private:
QImage
image2Draw_qt
;
int
nbChannelOriginImage
;
//for mouse callback
CvMouseCallback
on_mouse
;
void
*
on_mouse_param
;
void
scaleView
(
qreal
scaleFactor
,
QPointF
center
);
void
moveView
(
QPointF
delta
);
QPoint
mouseCoordinate
;
QPoint
mouseCoordinate
;
QPointF
positionGrabbing
;
QRect
positionCorners
;
QRect
positionCorners
;
QTransform
matrixWorld_inv
;
float
ratioX
,
ratioY
;
...
...
@@ -555,7 +558,7 @@ private:
void
draw2D
(
QPainter
*
painter
);
void
drawStatusBar
();
void
controlImagePosition
();
void
icvmouseHandler
(
QMouseEvent
*
event
,
type_mouse_event
category
,
int
&
cv_event
,
int
&
flags
);
void
icvmouseProcessing
(
QPointF
pt
,
int
cv_event
,
int
flags
);
private
slots
:
...
...
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