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
edcc762f
Commit
edcc762f
authored
Feb 27, 2020
by
Yuriy Obukh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add "Copy to clipboard functional" to imshow wnd with Qt
parent
85c97f77
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
window_QT.cpp
modules/highgui/src/window_QT.cpp
+27
-8
window_QT.h
modules/highgui/src/window_QT.h
+3
-0
window_QT.qrc
modules/highgui/src/window_QT.qrc
+1
-0
No files found.
modules/highgui/src/window_QT.cpp
View file @
edcc762f
...
...
@@ -1856,7 +1856,7 @@ void CvWindow::displayStatusBar(QString text, int delayms)
void
CvWindow
::
enablePropertiesButton
()
{
if
(
!
vect_QActions
.
empty
())
vect_QActions
[
9
]
->
setDisabled
(
false
);
vect_QActions
[
10
]
->
setDisabled
(
false
);
}
...
...
@@ -1991,7 +1991,7 @@ void CvWindow::createView()
void
CvWindow
::
createActions
()
{
vect_QActions
.
resize
(
1
0
);
vect_QActions
.
resize
(
1
1
);
QWidget
*
view
=
myView
->
getWidget
();
...
...
@@ -2032,18 +2032,22 @@ void CvWindow::createActions()
vect_QActions
[
8
]
->
setIconVisibleInMenu
(
true
);
QObject
::
connect
(
vect_QActions
[
8
],
SIGNAL
(
triggered
()),
view
,
SLOT
(
saveView
()));
vect_QActions
[
9
]
=
new
QAction
(
QIcon
(
":/
properties-icon"
),
"Display properties window (CTRL+P
)"
,
this
);
vect_QActions
[
9
]
=
new
QAction
(
QIcon
(
":/
copy_clipbrd-icon"
),
"Copy image to clipboard (CTRL+C
)"
,
this
);
vect_QActions
[
9
]
->
setIconVisibleInMenu
(
true
);
QObject
::
connect
(
vect_QActions
[
9
],
SIGNAL
(
triggered
()),
this
,
SLOT
(
displayPropertiesWin
()));
QObject
::
connect
(
vect_QActions
[
9
],
SIGNAL
(
triggered
()),
view
,
SLOT
(
copy2Clipbrd
()));
vect_QActions
[
10
]
=
new
QAction
(
QIcon
(
":/properties-icon"
),
"Display properties window (CTRL+P)"
,
this
);
vect_QActions
[
10
]
->
setIconVisibleInMenu
(
true
);
QObject
::
connect
(
vect_QActions
[
10
],
SIGNAL
(
triggered
()),
this
,
SLOT
(
displayPropertiesWin
()));
if
(
global_control_panel
->
myLayout
->
count
()
==
0
)
vect_QActions
[
9
]
->
setDisabled
(
true
);
vect_QActions
[
10
]
->
setDisabled
(
true
);
}
void
CvWindow
::
createShortcuts
()
{
vect_QShortcuts
.
resize
(
1
0
);
vect_QShortcuts
.
resize
(
1
1
);
QWidget
*
view
=
myView
->
getWidget
();
...
...
@@ -2074,8 +2078,11 @@ void CvWindow::createShortcuts()
vect_QShortcuts
[
8
]
=
new
QShortcut
(
shortcut_save_img
,
this
);
QObject
::
connect
(
vect_QShortcuts
[
8
],
SIGNAL
(
activated
()),
view
,
SLOT
(
saveView
()));
vect_QShortcuts
[
9
]
=
new
QShortcut
(
shortcut_properties_win
,
this
);
QObject
::
connect
(
vect_QShortcuts
[
9
],
SIGNAL
(
activated
()),
this
,
SLOT
(
displayPropertiesWin
()));
vect_QShortcuts
[
9
]
=
new
QShortcut
(
shortcut_copy_clipbrd
,
this
);
QObject
::
connect
(
vect_QShortcuts
[
9
],
SIGNAL
(
activated
()),
view
,
SLOT
(
copy2Clipbrd
()));
vect_QShortcuts
[
10
]
=
new
QShortcut
(
shortcut_properties_win
,
this
);
QObject
::
connect
(
vect_QShortcuts
[
10
],
SIGNAL
(
activated
()),
this
,
SLOT
(
displayPropertiesWin
()));
}
...
...
@@ -2698,6 +2705,18 @@ void DefaultViewPort::saveView()
}
//copy image to clipboard
void
DefaultViewPort
::
copy2Clipbrd
()
{
// Create a new pixmap to render the viewport into
QPixmap
viewportPixmap
(
viewport
()
->
size
());
viewport
()
->
render
(
&
viewportPixmap
);
QClipboard
*
pClipboard
=
QApplication
::
clipboard
();
pClipboard
->
setPixmap
(
viewportPixmap
);
}
void
DefaultViewPort
::
contextMenuEvent
(
QContextMenuEvent
*
evnt
)
{
if
(
centralWidget
->
vect_QActions
.
size
()
>
0
)
...
...
modules/highgui/src/window_QT.h
View file @
edcc762f
...
...
@@ -76,6 +76,7 @@
#include <QDate>
#include <QFileDialog>
#include <QToolBar>
#include <QClipboard>
#include <QAction>
#include <QCheckBox>
...
...
@@ -91,6 +92,7 @@ enum { CV_MODE_NORMAL = 0, CV_MODE_OPENGL = 1 };
enum
{
shortcut_zoom_normal
=
Qt
::
CTRL
+
Qt
::
Key_Z
,
shortcut_zoom_imgRegion
=
Qt
::
CTRL
+
Qt
::
Key_X
,
shortcut_save_img
=
Qt
::
CTRL
+
Qt
::
Key_S
,
shortcut_copy_clipbrd
=
Qt
::
CTRL
+
Qt
::
Key_C
,
shortcut_properties_win
=
Qt
::
CTRL
+
Qt
::
Key_P
,
shortcut_zoom_in
=
Qt
::
CTRL
+
Qt
::
Key_Plus
,
//QKeySequence(QKeySequence::ZoomIn),
shortcut_zoom_out
=
Qt
::
CTRL
+
Qt
::
Key_Minus
,
//QKeySequence(QKeySequence::ZoomOut),
...
...
@@ -518,6 +520,7 @@ public slots:
void
ZoomOut
();
void
saveView
();
void
copy2Clipbrd
();
protected
:
void
contextMenuEvent
(
QContextMenuEvent
*
event
)
CV_OVERRIDE
;
...
...
modules/highgui/src/window_QT.qrc
View file @
edcc762f
...
...
@@ -9,6 +9,7 @@
<file alias="zoom_in-icon">files_Qt/Milky/48/106.png</file>
<file alias="zoom_out-icon">files_Qt/Milky/48/107.png</file>
<file alias="save-icon">files_Qt/Milky/48/7.png</file>
<file alias="copy_clipbrd-icon">files_Qt/Milky/48/43.png</file>
<file alias="properties-icon">files_Qt/Milky/48/38.png</file>
<file alias="stylesheet-trackbar">files_Qt/stylesheet_trackbar.qss</file>
</qresource>
...
...
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