45 #include "ShortcutButton.hh" 62 modifiers_ = _modifiers;
84 oldModifiers_ = modifiers_;
90 modifiers_ =
event->modifiers();
109 keyString = tr(
"unassigned");
110 }
else if (key_ == Qt::Key_AltGr || key_ == Qt::Key_Alt || key_ == Qt::Key_Control || key_ == Qt::Key_Shift || key_ == Qt::Key_Meta){
111 keyString = QKeySequence( modifiers_ ).toString();
112 keyString = keyString.left(keyString.size()-1);
114 keyString = QKeySequence( key_ + modifiers_ ).toString();
119 void ShortcutButton::focusInEvent(QFocusEvent* event){
122 QPushButton::focusInEvent(event);
125 void ShortcutButton::focusOutEvent(QFocusEvent* event){
129 modifiers_ = oldModifiers_;
132 QPushButton::focusOutEvent(event);
135 void ShortcutButton::mousePressEvent(QMouseEvent* event){
136 checked_ = isChecked();
137 QPushButton::mousePressEvent(event);
140 void ShortcutButton::mouseReleaseEvent(QMouseEvent* event){
141 QPushButton::mouseReleaseEvent(event);
142 setChecked( checked_ );
void showCurrentShortcut()
show the current shortcut
void keyReleaseEvent(QKeyEvent *event)
key release
void setCurrentShortcut(int _key, Qt::KeyboardModifiers _modifiers)
set the current shortcut
ShortcutButton(QWidget *_parent=0)
Constructor.
Qt::KeyboardModifiers modifiers()
get current modifiers
void keyPressEvent(QKeyEvent *event)
key press