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
f668a230
Commit
f668a230
authored
Jun 28, 2010
by
Yannick Verdie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New functions with QT GUI:
- imgregion shortcut implemented (CTRL+O)
parent
f8c83340
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
33 deletions
+46
-33
window_QT.cpp
modules/highgui/src/window_QT.cpp
+36
-25
window_QT.h
modules/highgui/src/window_QT.h
+10
-8
No files found.
modules/highgui/src/window_QT.cpp
View file @
f668a230
...
...
@@ -810,20 +810,22 @@ CvWindow::CvWindow(QString arg, int arg2)
myview
->
setAlignment
(
Qt
::
AlignHCenter
);
shortcutZ
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_P
,
this
);
QObject
::
connect
(
shortcutZ
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
resetZoom
(
)
));
shortcutPlus
=
new
QShortcut
(
QKeySequence
(
QKeySequence
::
ZoomIn
),
this
);
QObject
::
connect
(
shortcutPlus
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
ZoomIn
()
));
shortcutMinus
=
new
QShortcut
(
QKeySequence
(
QKeySequence
::
ZoomOut
),
this
);
QObject
::
connect
(
shortcutMinus
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
ZoomOut
()
));
shortcutLeft
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Left
,
this
);
QObject
::
connect
(
shortcutLeft
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnLeft
()
));
shortcutRight
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Right
,
this
);
QObject
::
connect
(
shortcutRight
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnRight
()
));
shortcutUp
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Up
,
this
);
QObject
::
connect
(
shortcutUp
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnUp
()
));
shortcutDown
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Down
,
this
);
QObject
::
connect
(
shortcutDown
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnDown
()
));
shortcut_r_Zoom
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_P
,
this
);
QObject
::
connect
(
shortcut_r_Zoom
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
resetZoom
(
)
));
shortcut_imgRegion
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_O
,
this
);
QObject
::
connect
(
shortcut_imgRegion
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
imgRegion
(
)
));
shortcut_Plus
=
new
QShortcut
(
QKeySequence
(
QKeySequence
::
ZoomIn
),
this
);
QObject
::
connect
(
shortcut_Plus
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
ZoomIn
()
));
shortcut_Minus
=
new
QShortcut
(
QKeySequence
(
QKeySequence
::
ZoomOut
),
this
);
QObject
::
connect
(
shortcut_Minus
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
ZoomOut
()
));
shortcut_Left
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Left
,
this
);
QObject
::
connect
(
shortcut_Left
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnLeft
()
));
shortcut_Right
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Right
,
this
);
QObject
::
connect
(
shortcut_Right
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnRight
()
));
shortcut_Up
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Up
,
this
);
QObject
::
connect
(
shortcut_Up
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnUp
()
));
shortcut_Down
=
new
QShortcut
(
Qt
::
CTRL
+
Qt
::
Key_Down
,
this
);
QObject
::
connect
(
shortcut_Down
,
SIGNAL
(
activated
()),
myview
,
SLOT
(
siftWindowOnDown
()
));
layout
=
new
QBoxLayout
(
QBoxLayout
::
TopToBottom
);
//layout = new CustomLayout;
...
...
@@ -871,13 +873,14 @@ CvWindow::~CvWindow()
delete
myBar_msg
;
delete
shortcutZ
;
delete
shortcutPlus
;
delete
shortcutMinus
;
delete
shortcutLeft
;
delete
shortcutRight
;
delete
shortcutUp
;
delete
shortcutDown
;
delete
shortcut_r_Zoom
;
delete
shortcut_imgRegion
;
delete
shortcut_Plus
;
delete
shortcut_Minus
;
delete
shortcut_Left
;
delete
shortcut_Right
;
delete
shortcut_Up
;
delete
shortcut_Down
;
}
ViewPort
*
CvWindow
::
getView
()
...
...
@@ -1025,14 +1028,19 @@ void ViewPort::resetZoom()
controlImagePosition
();
}
void
ViewPort
::
imgRegion
(
)
{
scaleView
(
threshold_zoom_img_region
/
matrixWorld
.
m11
(),
QPointF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
),
false
);
//false = do not process the 1st param
}
void
ViewPort
::
ZoomIn
()
{
scaleView
(
0.5
,
QPointF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
));
scaleView
(
0.5
,
QPointF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
)
,
true
);
}
void
ViewPort
::
ZoomOut
()
{
scaleView
(
-
0.5
,
QPointF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
));
scaleView
(
-
0.5
,
QPointF
(
size
().
width
()
/
2
,
size
().
height
()
/
2
)
,
true
);
}
//Note: move 2 percent of the window
...
...
@@ -1159,10 +1167,13 @@ void ViewPort::moveView(QPointF delta)
}
//factor is -0.5 (zoom out) or 0.5 (zoom in)
void
ViewPort
::
scaleView
(
qreal
factor
,
QPointF
center
)
void
ViewPort
::
scaleView
(
qreal
factor
,
QPointF
center
,
bool
process_factor
)
{
if
(
process_factor
)
{
factor
/=
5
;
//-0.1 <-> 0.1
factor
+=
1
;
//0.9 <-> 1.1
}
//limit zoom out ---
if
(
matrixWorld
.
m11
()
==
1
&&
factor
<
1
)
...
...
@@ -1196,7 +1207,7 @@ void ViewPort::scaleView(qreal factor,QPointF center)
void
ViewPort
::
wheelEvent
(
QWheelEvent
*
event
)
{
scaleView
(
-
event
->
delta
()
/
240.0
,
event
->
pos
()
);
scaleView
(
-
event
->
delta
()
/
240.0
,
event
->
pos
()
,
true
);
//true means process the 1st parameter
}
void
ViewPort
::
mousePressEvent
(
QMouseEvent
*
event
)
...
...
modules/highgui/src/window_QT.h
View file @
f668a230
...
...
@@ -165,13 +165,14 @@ private:
QPointer
<
ViewPort
>
myview
;
int
status
;
//0 normal, 1 fullscreen (YV)
QPointer
<
QShortcut
>
shortcutZ
;
QPointer
<
QShortcut
>
shortcutPlus
;
QPointer
<
QShortcut
>
shortcutMinus
;
QPointer
<
QShortcut
>
shortcutLeft
;
QPointer
<
QShortcut
>
shortcutRight
;
QPointer
<
QShortcut
>
shortcutUp
;
QPointer
<
QShortcut
>
shortcutDown
;
QPointer
<
QShortcut
>
shortcut_r_Zoom
;
QPointer
<
QShortcut
>
shortcut_imgRegion
;
QPointer
<
QShortcut
>
shortcut_Plus
;
QPointer
<
QShortcut
>
shortcut_Minus
;
QPointer
<
QShortcut
>
shortcut_Left
;
QPointer
<
QShortcut
>
shortcut_Right
;
QPointer
<
QShortcut
>
shortcut_Up
;
QPointer
<
QShortcut
>
shortcut_Down
;
};
...
...
@@ -206,7 +207,8 @@ public slots:
//reference:
//http://www.qtcentre.org/wiki/index.php?title=QGraphicsView:_Smooth_Panning_and_Zooming
//http://doc.qt.nokia.com/4.6/gestures-imagegestures-imagewidget-cpp.html
void
scaleView
(
qreal
scaleFactor
,
QPointF
center
);
void
scaleView
(
qreal
scaleFactor
,
QPointF
center
,
bool
process1stParam
);
void
imgRegion
(
);
void
moveView
(
QPointF
delta
);
void
resetZoom
();
void
ZoomIn
();
...
...
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