Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
luyikei
VLMC
Commits
20c2dcf1
Commit
20c2dcf1
authored
Jan 28, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solved bug when cancelling keyboard shortcut capture
parent
706e4622
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
src/Gui/settings/KeyboardShortcutInput.cpp
src/Gui/settings/KeyboardShortcutInput.cpp
+12
-1
src/Gui/settings/KeyboardShortcutInput.h
src/Gui/settings/KeyboardShortcutInput.h
+2
-0
No files found.
src/Gui/settings/KeyboardShortcutInput.cpp
View file @
20c2dcf1
...
...
@@ -38,12 +38,16 @@ KeyboardShortcutInput::KeyboardShortcutInput( const QString& name,
m_timer
->
setSingleShot
(
true
);
connect
(
m_timer
,
SIGNAL
(
timeout
()
),
this
,
SLOT
(
timeout
()
)
);
setText
(
initialValue
);
QKeySequence
ks
(
initialValue
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
m_shortcuts
[
i
]
=
ks
[
i
];
}
void
KeyboardShortcutInput
::
mousePressEvent
(
QMouseEvent
*
)
{
m_capturing
=
true
;
setDown
(
true
);
memcpy
(
m_initialValue
,
m_shortcuts
,
4
*
sizeof
(
int
)
);
memset
(
m_shortcuts
,
0
,
sizeof
(
m_shortcuts
)
);
m_current
=
0
;
setText
(
""
);
...
...
@@ -59,9 +63,16 @@ void KeyboardShortcutInput::release()
m_capturing
=
false
;
setDown
(
false
);
setText
(
seq
.
toString
()
);
emit
changed
(
m_name
,
seq
.
toString
()
);
}
void
KeyboardShortcutInput
::
cancel
()
{
memcpy
(
m_shortcuts
,
m_initialValue
,
4
*
sizeof
(
int
)
);
release
();
}
void
KeyboardShortcutInput
::
keyPressEvent
(
QKeyEvent
*
e
)
{
if
(
m_capturing
==
false
)
...
...
@@ -71,7 +82,7 @@ void KeyboardShortcutInput::keyPressEvent( QKeyEvent* e )
}
if
(
e
->
modifiers
()
==
Qt
::
NoModifier
&&
e
->
key
()
==
Qt
::
Key_Escape
)
{
release
();
cancel
();
}
else
{
...
...
src/Gui/settings/KeyboardShortcutInput.h
View file @
20c2dcf1
...
...
@@ -38,6 +38,7 @@ class KeyboardShortcutInput : public QPushButton
virtual
void
mousePressEvent
(
QMouseEvent
*
e
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
e
);
void
release
();
void
cancel
();
protected
slots
:
void
timeout
();
...
...
@@ -48,6 +49,7 @@ class KeyboardShortcutInput : public QPushButton
QTimer
*
m_timer
;
unsigned
int
m_current
;
int
m_shortcuts
[
4
];
int
m_initialValue
[
4
];
signals:
void
changed
(
const
QString
&
,
const
QString
&
);
};
...
...
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