Merge pull request #620 from turtletooth/shortcutwindow

Fixed remove shortcut not updating, added focus when item selected
This commit is contained in:
shun-iwasawa 2016-07-11 20:43:17 +09:00 committed by GitHub
commit b2a562cb68

View file

@ -49,8 +49,7 @@ public:
text.remove("&"); text.remove("&");
setText(0, text); setText(0, text);
QString shortcut = m_action->shortcut().toString(); QString shortcut = m_action->shortcut().toString();
if (shortcut != "") setText(1, shortcut);
setText(1, shortcut);
} }
QAction *getAction() const { return m_action; } QAction *getAction() const { return m_action; }
}; };
@ -90,6 +89,7 @@ void ShortcutViewer::paintEvent(QPaintEvent *) {
void ShortcutViewer::setAction(QAction *action) { void ShortcutViewer::setAction(QAction *action) {
m_action = action; m_action = action;
update(); update();
setFocus();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -171,7 +171,6 @@ void ShortcutViewer::enterEvent(QEvent *event) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ShortcutViewer::leaveEvent(QEvent *event) { void ShortcutViewer::leaveEvent(QEvent *event) {
clearFocus();
update(); update();
} }