From d310876099eef7ab5d40bd636c7391f4b70229e2 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 17 Sep 2024 17:17:15 -0400 Subject: [PATCH 1/2] [TD]add preferences for Balloon drag modifiers --- src/Mod/TechDraw/App/Preferences.cpp | 29 ++++ src/Mod/TechDraw/App/Preferences.h | 6 + .../TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui | 151 +++++++++++++++++- .../Gui/DlgPrefsTechDrawAdvancedImp.cpp | 140 +++++++++++++++- .../Gui/DlgPrefsTechDrawAdvancedImp.h | 14 +- 5 files changed, 332 insertions(+), 8 deletions(-) diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 99e31ed1f5..d06fcc469e 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -612,3 +612,32 @@ double Preferences::SnapLimitFactor() } +//! returns the key combination that simulates multiple selection. Traditionally Ctrl+pick, as that +//! is how QGraphicsScene implements multiple selection. This method is likely to only be used by +//! developers. +Qt::KeyboardModifiers Preferences::multiselectModifiers() +{ + uint iModifiers = getPreferenceGroup("General")->GetUnsigned("MultiselectModifiers", (uint)Qt::ControlModifier); + return (Qt::KeyboardModifiers)iModifiers; +// Qt::KeyboardModifiers testMods = Qt::ControlModifier; +// return testMods; +} + + +//! returns the key combination that modifies Balloon drag behaviour so that the bubble and leader +//! are moved together. Traditionally Ctrl+drag, but that can be in conflict with multi selection. +Qt::KeyboardModifiers Preferences::balloonDragModifiers() +{ + uint iModifiers = getPreferenceGroup("General")->GetUnsigned("BalloonDragModifier", (uint)Qt::ControlModifier); + return (Qt::KeyboardModifiers)iModifiers; +// Qt::KeyboardModifiers testMods = Qt::ShiftModifier | Qt::ControlModifier; +// return testMods; +} + + +void Preferences::setBalloonDragModifiers(Qt::KeyboardModifiers newModifiers) +{ + getPreferenceGroup("General")->SetUnsigned("BalloonDragModifier", (uint)newModifiers); +} + + diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index b4c46e945f..ab8b7d2f75 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -23,6 +23,7 @@ #ifndef Preferences_h_ #define Preferences_h_ +#include #include #include @@ -141,6 +142,11 @@ public: static bool SnapViews(); static double SnapLimitFactor(); + + static Qt::KeyboardModifiers multiselectModifiers(); + + static Qt::KeyboardModifiers balloonDragModifiers(); + static void setBalloonDragModifiers(Qt::KeyboardModifiers newModifiers); }; diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui index 2897f27b27..ffa49c628e 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui @@ -6,8 +6,8 @@ 0 0 - 474 - 424 + 700 + 810 @@ -443,6 +443,149 @@ can be a performance penalty in complex models. + + + + <html><head/><body><p>Some combinations of OS and Navigation style key bindings may conflict with the default modifier keys for Ballon dragging and View snapping override. You can make adjustments here to find a non-conflicting key binding.</p></body></html> + + + Behaviour Overrides + + + + + + + + Check this box to use the default modifier keys. Uncheck this box to set a different key combination. + + + Use Default + + + true + + + + + + + Check this box to include the Shift key in the modifiers. + + + Shift + + + + + + + Check this box to use the default modifier keys. Uncheck this box to set a different key combination. + + + Use Default + + + true + + + + + + + Check this box to include the Shift key in the modifiers. + + + Shift + + + + + + + Check this box to include the Alt key in the modifiers. + + + Alt + + + + + + + Check this box to include the Meta/Start/Super key in the modifiers. + + + Meta + + + + + + + Balloon Drag + + + + + + + Snap Override + + + + + + + Check this box to include the Control key in the modifiers. + + + Control + + + + + + + Check this box to include the Control key in the modifiers. + + + Control + + + + + + + Check this box to include the Meta/Start/Super key in the modifiers. + + + Meta + + + + + + + Check this box to include the Alt key in the modifiers. + + + Alt + + + + + + + + + + + + + + + @@ -469,8 +612,8 @@ can be a performance penalty in complex models. - 17 - 1 + 20 + 40 diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp index c3d3ea062e..b686b14aca 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp @@ -24,17 +24,21 @@ #include "PreCompiled.h" +#include #include "DlgPrefsTechDrawAdvancedImp.h" #include "ui_DlgPrefsTechDrawAdvanced.h" using namespace TechDrawGui; +using namespace TechDraw; DlgPrefsTechDrawAdvancedImp::DlgPrefsTechDrawAdvancedImp( QWidget* parent ) : PreferencePage( parent ) , ui(new Ui_DlgPrefsTechDrawAdvancedImp) { ui->setupUi(this); + + makeBalloonBoxConnections(); } DlgPrefsTechDrawAdvancedImp::~DlgPrefsTechDrawAdvancedImp() @@ -58,8 +62,40 @@ void DlgPrefsTechDrawAdvancedImp::saveSettings() ui->cbAutoCorrectRefs->onSave(); ui->cbNewFaceFinder->onSave(); ui->sbScrubCount->onSave(); + + saveBalloonOverride(); } + +void DlgPrefsTechDrawAdvancedImp::saveBalloonOverride() +{ + if (ui->cbBalloonDefault->isChecked()) { + Preferences::setBalloonDragModifiers(Qt::ControlModifier); + return; + } + + Qt::KeyboardModifiers result{Qt::NoModifier}; + + if (ui->cbBalloonShift->isChecked()) { + result |= Qt::ShiftModifier; + } + + if (ui->cbBalloonControl->isChecked()) { + result |= Qt::ControlModifier; + } + + if (ui->cbBalloonAlt->isChecked()) { + result |= Qt::AltModifier; + } + + if (ui->cbBalloonMeta->isChecked()) { + result |= Qt::MetaModifier; + } + + Preferences::setBalloonDragModifiers(result); +} + + void DlgPrefsTechDrawAdvancedImp::loadSettings() { ui->cbDetectFaces->onRestore(); @@ -76,18 +112,116 @@ void DlgPrefsTechDrawAdvancedImp::loadSettings() ui->cbAutoCorrectRefs->onRestore(); ui->cbNewFaceFinder->onRestore(); ui->sbScrubCount->onRestore(); + + loadBalloonOverride(); } +void DlgPrefsTechDrawAdvancedImp::loadBalloonOverride() +{ + uint prefOverride = Preferences::balloonDragModifiers(); + if (prefOverride == Qt::ControlModifier) { + // default case + ui->cbBalloonDefault->setChecked(true); + clearBalloonOptions(); + enableBalloonOptions(false); + return; + } + + ui->cbBalloonDefault->setChecked(false); + enableBalloonOptions(true); + + if (flagsContainValue(prefOverride, Qt::ShiftModifier)) { + ui->cbBalloonShift->setChecked(true); + } + if (flagsContainValue(prefOverride, Qt::ControlModifier)) { + ui->cbBalloonControl->setChecked(true); + } + + if (flagsContainValue(prefOverride, Qt::AltModifier)) { + ui->cbBalloonAlt->setChecked(true); + } + + if (flagsContainValue(prefOverride, Qt::MetaModifier)) { + ui->cbBalloonMeta->setChecked(true); + } +} + +//! true if bit pattern of value is found in flags. +bool DlgPrefsTechDrawAdvancedImp::flagsContainValue(uint flags, uint value) +{ + uint matchResult = flags & value; + if (matchResult == value) { + return true; + } + return false; +} + + +void DlgPrefsTechDrawAdvancedImp::clearBalloonOptions() +{ + ui->cbBalloonShift->setChecked(false); + ui->cbBalloonControl->setChecked(false); + ui->cbBalloonAlt->setChecked(false); + ui->cbBalloonMeta->setChecked(false); +} + + +void DlgPrefsTechDrawAdvancedImp::enableBalloonOptions(bool newState) +{ + ui->cbBalloonShift->setEnabled(newState); + ui->cbBalloonControl->setEnabled(newState); + ui->cbBalloonAlt->setEnabled(newState); + ui->cbBalloonMeta->setEnabled(newState); +} + + +void DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked() +{ + if (ui->cbBalloonDefault->isChecked()) { + clearBalloonOptions(); + enableBalloonOptions(false); + } else { + enableBalloonOptions(true); + } + +} + + +void DlgPrefsTechDrawAdvancedImp::makeBalloonBoxConnections() +{ + connect(ui->cbBalloonDefault, + qOverload(&QCheckBox::stateChanged), + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonShift, + qOverload(&QCheckBox::stateChanged), + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonControl, + qOverload(&QCheckBox::stateChanged), + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonAlt, + qOverload(&QCheckBox::stateChanged), + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); + connect(ui->cbBalloonMeta, + qOverload(&QCheckBox::stateChanged), + this, + &DlgPrefsTechDrawAdvancedImp::slotBalloonBoxChecked); +} + + /** * Sets the strings of the subwidgets using the current language. */ -void DlgPrefsTechDrawAdvancedImp::changeEvent(QEvent *e) +void DlgPrefsTechDrawAdvancedImp::changeEvent(QEvent *event) { - if (e->type() == QEvent::LanguageChange) { + if (event->type() == QEvent::LanguageChange) { ui->retranslateUi(this); } else { - QWidget::changeEvent(e); + QWidget::changeEvent(event); } } diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h index cbdb05b32b..2970e45dd4 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h @@ -44,7 +44,19 @@ public: protected: void saveSettings() override; void loadSettings() override; - void changeEvent(QEvent *e) override; + void changeEvent(QEvent *event) override; + + void loadBalloonOverride(); + void saveBalloonOverride(); + + void clearBalloonOptions(); + + static bool flagsContainValue(uint flags, uint value); + + void makeBalloonBoxConnections(); + void slotBalloonBoxChecked(); + void enableBalloonOptions(bool newState); + private: std::unique_ptr ui; From ca2b9dc8d814f021badc1e5b6e2a2c12390bf911 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 17 Sep 2024 17:23:20 -0400 Subject: [PATCH 2/2] [TD]allow override of Balloon drag modifier (fix #15388) --- .../TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui | 118 +++++------------- src/Mod/TechDraw/Gui/QGIView.cpp | 3 + src/Mod/TechDraw/Gui/QGIViewBalloon.cpp | 50 +++++--- src/Mod/TechDraw/Gui/QGIViewBalloon.h | 7 +- src/Mod/TechDraw/Gui/QGSPage.cpp | 64 +++++++--- src/Mod/TechDraw/Gui/QGSPage.h | 2 + 6 files changed, 113 insertions(+), 131 deletions(-) diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui index ffa49c628e..c5b74fc300 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvanced.ui @@ -467,56 +467,10 @@ can be a performance penalty in complex models. - - - - Check this box to include the Shift key in the modifiers. - + + - Shift - - - - - - - Check this box to use the default modifier keys. Uncheck this box to set a different key combination. - - - Use Default - - - true - - - - - - - Check this box to include the Shift key in the modifiers. - - - Shift - - - - - - - Check this box to include the Alt key in the modifiers. - - - Alt - - - - - - - Check this box to include the Meta/Start/Super key in the modifiers. - - - Meta + @@ -527,43 +481,6 @@ can be a performance penalty in complex models. - - - - Snap Override - - - - - - - Check this box to include the Control key in the modifiers. - - - Control - - - - - - - Check this box to include the Control key in the modifiers. - - - Control - - - - - - - Check this box to include the Meta/Start/Super key in the modifiers. - - - Meta - - - @@ -574,10 +491,33 @@ can be a performance penalty in complex models. - - + + + + Check this box to include the Shift key in the modifiers. + - + Shift + + + + + + + Check this box to include the Meta/Start/Super key in the modifiers. + + + Meta + + + + + + + Check this box to include the Control key in the modifiers. + + + Control diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp index 0f311d4ead..f636104eed 100644 --- a/src/Mod/TechDraw/Gui/QGIView.cpp +++ b/src/Mod/TechDraw/Gui/QGIView.cpp @@ -401,6 +401,9 @@ Base::Vector3d QGIView::projItemPagePos(DrawViewPart* item) void QGIView::mousePressEvent(QGraphicsSceneMouseEvent * event) { + // this is never called for balloons (and dimensions?) because the label objects do not + // inherit from QGIView, but directly from QGraphicsItem. - wf + Qt::KeyboardModifiers originalModifiers = event->modifiers(); if (event->button()&Qt::LeftButton) { m_multiselectActivated = false; diff --git a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp index f4e2ebec89..acdda7b4c1 100644 --- a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp @@ -26,6 +26,7 @@ # include # include +# include # include # include # include @@ -55,6 +56,7 @@ #include "ViewProviderViewPart.h" #include "ZVALUE.h" #include "DrawGuiUtil.h" +#include "QGSPage.h" //TODO: hide the Qt coord system (+y down). @@ -66,8 +68,8 @@ using DGU = DrawGuiUtil; QGIBalloonLabel::QGIBalloonLabel() { - m_ctrl = false; - m_drag = false; + m_originDrag = false; + m_dragging = false; setCacheMode(QGraphicsItem::NoCache); setFlag(ItemSendsGeometryChanges, true); @@ -98,8 +100,8 @@ QVariant QGIBalloonLabel::itemChange(GraphicsItemChange change, const QVariant& update(); } else if (change == ItemPositionHasChanged && scene()) { - if (m_drag) { - Q_EMIT dragging(m_ctrl); + if (m_dragging) { + Q_EMIT dragging(m_originDrag); } } @@ -108,11 +110,22 @@ QVariant QGIBalloonLabel::itemChange(GraphicsItemChange change, const QVariant& void QGIBalloonLabel::mousePressEvent(QGraphicsSceneMouseEvent* event) { - m_ctrl = false; - m_drag = true; - if (event->modifiers() & Qt::ControlModifier) { - m_ctrl = true; + m_originDrag = false; + m_dragging = true; + + if (event->button() != Qt::LeftButton) { + QGraphicsItem::mousePressEvent(event); + return; } + + if (QGSPage::cleanModifierList(event->modifiers()) == Preferences::balloonDragModifiers()) { + if (!PreferencesGui::multiSelection() || + Preferences::multiselectModifiers() != Preferences::balloonDragModifiers()) { + // multiselect does not apply or does not conflict, so treat this is an origin drag + m_originDrag = true; + } + } + QGraphicsItem::mousePressEvent(event); } @@ -123,8 +136,8 @@ void QGIBalloonLabel::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) Q_EMIT dragFinished(); } } - m_ctrl = false; - m_drag = false; + m_originDrag = false; + m_dragging = false; QGraphicsItem::mouseReleaseEvent(event); } @@ -234,8 +247,6 @@ QGIViewBalloon::QGIViewBalloon() : dvBalloon(nullptr), hasHover(false), m_lineWidth(0.0), m_obtuse(false), parent(nullptr), m_dragInProgress(false) { - m_ctrl = false; - setHandlesChildEvents(false); setFlag(QGraphicsItem::ItemIsMovable, false); setCacheMode(QGraphicsItem::NoCache); @@ -443,9 +454,8 @@ void QGIViewBalloon::updateBalloon(bool obtuse) balloonLabel->setPosFromCenter(x, -y); } -void QGIViewBalloon::balloonLabelDragged(bool ctrl) +void QGIViewBalloon::balloonLabelDragged(bool originDrag) { - m_ctrl = ctrl; auto dvb(dynamic_cast(getViewObject())); if (!dvb) { return; @@ -453,7 +463,7 @@ void QGIViewBalloon::balloonLabelDragged(bool ctrl) if (!m_dragInProgress) {//first drag movement m_dragInProgress = true; - if (ctrl) {//moving whole thing, remember Origin offset from Bubble + if (originDrag) {//moving whole thing, remember Origin offset from Bubble m_saveOriginOffset = dvb->getOriginOffset(); m_saveOrigin = DU::toVector3d(arrow->pos()); m_savePosition = DU::toVector3d(balloonLabel->pos()); @@ -461,7 +471,7 @@ void QGIViewBalloon::balloonLabelDragged(bool ctrl) } // store if origin is also moving to be able to later calc new origin and update feature - if (ctrl) { + if (originDrag) { m_originDragged = true; } @@ -595,10 +605,10 @@ void QGIViewBalloon::draw() drawBalloon(false); } -void QGIViewBalloon::drawBalloon(bool dragged) +void QGIViewBalloon::drawBalloon(bool originDrag) { - if ((!dragged) && m_dragInProgress) { - // TODO there are 2 drag status variables. m_dragInProgress appears to be the one to use? + if ((!originDrag) && m_dragInProgress) { + // TODO there are 2 drag status variables. m_draggingInProgress appears to be the one to use? // dragged shows false while drag is still in progress. return; } @@ -630,7 +640,7 @@ void QGIViewBalloon::drawBalloon(bool dragged) float arrowTipX; Base::Vector3d arrowTipPosInParent; - bool isDragging = dragged || m_dragInProgress; + bool isDragging = originDrag || m_dragInProgress; Base::Vector3d labelPos; getBalloonPoints(balloon, refObj, isDragging, labelPos, arrowTipPosInParent); arrowTipX = arrowTipPosInParent.x; diff --git a/src/Mod/TechDraw/Gui/QGIViewBalloon.h b/src/Mod/TechDraw/Gui/QGIViewBalloon.h index 671b6e7df4..990dccf3b8 100644 --- a/src/Mod/TechDraw/Gui/QGIViewBalloon.h +++ b/src/Mod/TechDraw/Gui/QGIViewBalloon.h @@ -158,8 +158,8 @@ private: QColor m_colNormal; - bool m_ctrl; - bool m_drag; + bool m_originDrag; + bool m_dragging; }; //******************************************************************* @@ -220,7 +220,7 @@ public Q_SLOTS: protected: void draw() override; - void drawBalloon(bool dragged = false); + void drawBalloon(bool originDrag = false); QVariant itemChange(GraphicsItemChange change, const QVariant& value) override; virtual void setSvgPens(); virtual void setPens(); @@ -248,7 +248,6 @@ private: bool m_dragInProgress; bool m_originDragged = false; - bool m_ctrl; Base::Vector3d m_saveOriginOffset; Base::Vector3d m_saveOrigin; Base::Vector3d m_savePosition; diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index b91c144d9a..461acb5d2a 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -22,6 +22,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +#include #include #include #include @@ -110,30 +111,20 @@ QGSPage::QGSPage(ViewProviderPage* vpPage, QWidget* parent) void QGSPage::mousePressEvent(QGraphicsSceneMouseEvent * event) { - constexpr int QGITemplateType{QGraphicsItem::UserType + 150}; - constexpr int QGIDrawingTemplateType{QGraphicsItem::UserType + 151}; - constexpr int QGISVGTemplateType{QGraphicsItem::UserType + 153}; - // type 13 is the itemUnderMouse on a page outside of any views. It is not - // the template or background or foreground. QGraphicsItem type = 13 is not - // documented and not found in QGraphicsItem.h. - constexpr int MysteryType{13}; - Qt::KeyboardModifiers originalModifiers = event->modifiers(); auto itemUnderMouse = itemAt(event->scenePos().x(), event->scenePos().y(), QTransform()); if (!itemUnderMouse || - itemUnderMouse->type() == QGITemplateType || - itemUnderMouse->type() == QGIDrawingTemplateType || - itemUnderMouse->type() == QGISVGTemplateType || - itemUnderMouse->type() == MysteryType) { - // click without item clears selection + itemClearsSelection(itemUnderMouse->type()) ) { Gui::Selection().clearSelection(); QGraphicsScene::mousePressEvent(event); return; } - if (event->button() == Qt::LeftButton && PreferencesGui::multiSelection()) { - event->setModifiers(originalModifiers | Qt::ControlModifier); + if (event->button() == Qt::LeftButton && + PreferencesGui::multiSelection() && + (cleanModifierList(QApplication::keyboardModifiers()) == Preferences::multiselectModifiers()) ) { + event->setModifiers(originalModifiers | Preferences::multiselectModifiers()); } QGraphicsScene::mousePressEvent(event); @@ -147,10 +138,47 @@ void QGSPage::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) } QGraphicsScene::mouseReleaseEvent(event); +} - // what does this do? the event has already been propagated so this will have - // no effect? - event->setModifiers(originalModifiers); +//! returns true if clicking on the item should clear the selection +bool QGSPage::itemClearsSelection(int itemTypeIn) +{ + // type 13 is the itemUnderMouse on a page outside of any views. It is not + // the template or background or foreground. QGraphicsItem type = 13 is not + // documented and not found in QGraphicsItem.h. + const std::vector ClearingTypes { 13, // MysteryType + QGraphicsItem::UserType + 150, // QGITemplateType + QGraphicsItem::UserType + 151, // QGIDrawingTemplateType + QGraphicsItem::UserType + 153 }; // QGISVGTemplateType + + for (auto& type : ClearingTypes) { + if (itemTypeIn == type) { + return true; + } + } + return false; +} + + +//! return only the modifiers that are relevant to snapping/balloon drag. +//! this is a substitute for !modifiers (ie no modifiers in use) since keypad or group modifiers +//! (which don't apply to snapping/dragging) would give a misleading result. +Qt::KeyboardModifiers QGSPage::cleanModifierList(Qt::KeyboardModifiers mods) +{ + if (!mods) { + return mods; + } + + // remove misleading modifiers if present + auto newMods = mods; + if (newMods & Qt::KeypadModifier) { + newMods = newMods & ~Qt::KeypadModifier; + } + if (newMods & Qt::GroupSwitchModifier) { + newMods = newMods & ~Qt::GroupSwitchModifier; + } + + return newMods; } diff --git a/src/Mod/TechDraw/Gui/QGSPage.h b/src/Mod/TechDraw/Gui/QGSPage.h index 4eef5a34b2..7a2d54c02d 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.h +++ b/src/Mod/TechDraw/Gui/QGSPage.h @@ -147,6 +147,8 @@ public: void setBalloonGroups(); void setLeaderParentage(); + static bool itemClearsSelection(int itemTypeIn); + static Qt::KeyboardModifiers cleanModifierList(Qt::KeyboardModifiers mods); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) override;