void KisInputManager::Private::addStrokeShortcut(KisAbstractInputAction* action, int index, const QList<Qt::Key> &modifiers, Qt::MouseButtons buttons) { KisStrokeShortcut *strokeShortcut = new KisStrokeShortcut(action, index); QList<Qt::MouseButton> buttonList; if(buttons & Qt::LeftButton) { buttonList << Qt::LeftButton; } if(buttons & Qt::RightButton) { buttonList << Qt::RightButton; } if(buttons & Qt::MidButton) { buttonList << Qt::MidButton; } if(buttons & Qt::XButton1) { buttonList << Qt::XButton1; } if(buttons & Qt::XButton2) { buttonList << Qt::XButton2; } if (buttonList.size() > 0) { strokeShortcut->setButtons(QSet<Qt::Key>::fromList(modifiers), QSet<Qt::MouseButton>::fromList(buttonList)); matcher.addShortcut(strokeShortcut); } }
KisStrokeShortcut* createStrokeShortcut(KisAbstractInputAction *action, int shortcutIndex, const QList<Qt::Key> &modifiers, Qt::MouseButton button) { KisStrokeShortcut *s = new KisStrokeShortcut(action, shortcutIndex); s->setButtons(modifiers, QList<Qt::MouseButton>() << button); return s; }