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
d46f44b4
Commit
d46f44b4
authored
Mar 28, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1695 fixed arrow key events with the Qt backend
parent
dd01861d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
window_QT.cpp
modules/highgui/src/window_QT.cpp
+5
-7
No files found.
modules/highgui/src/window_QT.cpp
View file @
d46f44b4
...
@@ -1555,6 +1555,8 @@ CvWindow::CvWindow(QString name, int arg2)
...
@@ -1555,6 +1555,8 @@ CvWindow::CvWindow(QString name, int arg2)
setWindowTitle
(
name
);
setWindowTitle
(
name
);
setObjectName
(
name
);
setObjectName
(
name
);
setFocus
(
Qt
::
PopupFocusReason
);
//#1695 arrow keys are not recieved without the explicit focus
resize
(
400
,
300
);
resize
(
400
,
300
);
setMinimumSize
(
1
,
1
);
setMinimumSize
(
1
,
1
);
...
@@ -2060,22 +2062,18 @@ void CvWindow::keyPressEvent(QKeyEvent *event)
...
@@ -2060,22 +2062,18 @@ void CvWindow::keyPressEvent(QKeyEvent *event)
//see http://doc.trolltech.com/4.6/qt.html#Key-enum
//see http://doc.trolltech.com/4.6/qt.html#Key-enum
int
key
=
event
->
key
();
int
key
=
event
->
key
();
//bool goodKey = false;
bool
goodKey
=
true
;
Qt
::
Key
qtkey
=
static_cast
<
Qt
::
Key
>
(
key
);
Qt
::
Key
qtkey
=
static_cast
<
Qt
::
Key
>
(
key
);
char
asciiCode
=
QTest
::
keyToAscii
(
qtkey
);
char
asciiCode
=
QTest
::
keyToAscii
(
qtkey
);
if
(
asciiCode
!=
0
)
if
(
asciiCode
!=
0
)
{
key
=
static_cast
<
int
>
(
asciiCode
);
key
=
static_cast
<
int
>
(
asciiCode
);
}
else
key
=
event
->
nativeVirtualKey
();
//same codes as returned by GTK-based backend
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
if
(
event
->
modifiers
()
!=
Qt
::
ControlModifier
&&
goodKey
)
if
(
event
->
modifiers
()
!=
Qt
::
ControlModifier
)
{
{
mutexKey
.
lock
();
mutexKey
.
lock
();
last_key
=
key
;
last_key
=
key
;
//last_key = event->nativeVirtualKey ();
mutexKey
.
unlock
();
mutexKey
.
unlock
();
key_pressed
.
wakeAll
();
key_pressed
.
wakeAll
();
//event->accept();
//event->accept();
...
...
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