51 #include "ShortcutButton.hh" 68 modifiers_ = _modifiers;
90 oldModifiers_ = modifiers_;
96 modifiers_ =
event->modifiers();
115 keyString = tr(
"unassigned");
116 }
else if (key_ == Qt::Key_AltGr || key_ == Qt::Key_Alt || key_ == Qt::Key_Control || key_ == Qt::Key_Shift || key_ == Qt::Key_Meta){
117 keyString = QKeySequence( modifiers_ ).toString();
118 keyString = keyString.left(keyString.size()-1);
120 keyString = QKeySequence( key_ + modifiers_ ).toString();
125 void ShortcutButton::focusInEvent(QFocusEvent* event){
128 QPushButton::focusInEvent(event);
131 void ShortcutButton::focusOutEvent(QFocusEvent* event){
135 modifiers_ = oldModifiers_;
138 QPushButton::focusOutEvent(event);
141 void ShortcutButton::mousePressEvent(QMouseEvent* event){
142 checked_ = isChecked();
143 QPushButton::mousePressEvent(event);
146 void ShortcutButton::mouseReleaseEvent(QMouseEvent* event){
147 QPushButton::mouseReleaseEvent(event);
148 setChecked( checked_ );
ShortcutButton(QWidget *_parent=0)
Constructor.
void keyPressEvent(QKeyEvent *event)
key press
void showCurrentShortcut()
show the current shortcut
Qt::KeyboardModifiers modifiers()
get current modifiers
void keyReleaseEvent(QKeyEvent *event)
key release
void setCurrentShortcut(int _key, Qt::KeyboardModifiers _modifiers)
set the current shortcut