Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/input/kis_input_manager_p.cpp
Context not available. | |||||
23 | #include <QScopedPointer> | 23 | #include <QScopedPointer> | ||
---|---|---|---|---|---|
24 | #include <QtGlobal> | 24 | #include <QtGlobal> | ||
25 | 25 | | |||
26 | #include <boost/preprocessor/repeat_from_to.hpp> | ||||
27 | | ||||
26 | #include "kis_input_manager.h" | 28 | #include "kis_input_manager.h" | ||
27 | #include "kis_config.h" | 29 | #include "kis_config.h" | ||
28 | #include "kis_abstract_input_action.h" | 30 | #include "kis_abstract_input_action.h" | ||
Context not available. | |||||
363 | return QObject::eventFilter(object, event); | 365 | return QObject::eventFilter(object, event); | ||
364 | } | 366 | } | ||
365 | 367 | | |||
368 | #define EXTRA_BUTTON(z, n, _) \ | ||||
369 | if(buttons & Qt::ExtraButton##n) { \ | ||||
370 | buttonSet << Qt::ExtraButton##n; \ | ||||
371 | } | ||||
372 | | ||||
366 | void KisInputManager::Private::addStrokeShortcut(KisAbstractInputAction* action, int index, | 373 | void KisInputManager::Private::addStrokeShortcut(KisAbstractInputAction* action, int index, | ||
367 | const QList<Qt::Key> &modifiers, | 374 | const QList<Qt::Key> &modifiers, | ||
368 | Qt::MouseButtons buttons) | 375 | Qt::MouseButtons buttons) | ||
Context not available. | |||||
370 | KisStrokeShortcut *strokeShortcut = | 377 | KisStrokeShortcut *strokeShortcut = | ||
371 | new KisStrokeShortcut(action, index); | 378 | new KisStrokeShortcut(action, index); | ||
372 | 379 | | |||
373 | QList<Qt::MouseButton> buttonList; | 380 | QSet<Qt::MouseButton> buttonSet; | ||
374 | if(buttons & Qt::LeftButton) { | 381 | if(buttons & Qt::LeftButton) { | ||
375 | buttonList << Qt::LeftButton; | 382 | buttonSet << Qt::LeftButton; | ||
376 | } | 383 | } | ||
377 | if(buttons & Qt::RightButton) { | 384 | if(buttons & Qt::RightButton) { | ||
378 | buttonList << Qt::RightButton; | 385 | buttonSet << Qt::RightButton; | ||
379 | } | 386 | } | ||
380 | if(buttons & Qt::MidButton) { | 387 | if(buttons & Qt::MidButton) { | ||
381 | buttonList << Qt::MidButton; | 388 | buttonSet << Qt::MidButton; | ||
382 | } | | |||
383 | if(buttons & Qt::XButton1) { | | |||
384 | buttonList << Qt::XButton1; | | |||
385 | } | | |||
386 | if(buttons & Qt::XButton2) { | | |||
387 | buttonList << Qt::XButton2; | | |||
388 | } | 389 | } | ||
389 | 390 | | |||
390 | if (buttonList.size() > 0) { | 391 | BOOST_PP_REPEAT_FROM_TO(1, 25, EXTRA_BUTTON, _) | ||
391 | strokeShortcut->setButtons(QSet<Qt::Key>::fromList(modifiers), QSet<Qt::MouseButton>::fromList(buttonList)); | 392 | | ||
393 | if (!buttonSet.empty()) { | ||||
394 | strokeShortcut->setButtons(QSet<Qt::Key>::fromList(modifiers), buttonSet); | ||||
392 | matcher.addShortcut(strokeShortcut); | 395 | matcher.addShortcut(strokeShortcut); | ||
393 | } | 396 | } | ||
394 | else { | 397 | else { | ||
Context not available. |