diff --git a/resources/forms/preferences.ui b/resources/forms/preferences.ui index 45a2fc180..c873ecf78 100644 --- a/resources/forms/preferences.ui +++ b/resources/forms/preferences.ui @@ -948,6 +948,13 @@ + + + + Ignore broken eraser detection for tablets + + + diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 74b41215c..9c611b1b6 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -350,13 +350,16 @@ void UBBoardView::tabletEvent (QTabletEvent * event) UBStylusTool::Enum currentTool = (UBStylusTool::Enum)dc->stylusTool (); if (event->type () == QEvent::TabletPress || event->type () == QEvent::TabletEnterProximity) { + const bool ignoreBrokenEraser = UBSettings::settings()->boardIgnoreBrokenEraserDetection->get().toBool(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) if (event->pointerType () == QPointingDevice::PointerType::Eraser) { #else if (event->pointerType () == QTabletEvent::Eraser) { #endif - dc->setStylusTool (UBStylusTool::Eraser); - mUsingTabletEraser = true; + if (!ignoreBrokenEraser) { + dc->setStylusTool (UBStylusTool::Eraser); + mUsingTabletEraser = true; + } } else { if (mUsingTabletEraser && currentTool == UBStylusTool::Eraser) diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp index ed0e393d8..b068f6f97 100644 --- a/src/core/UBPreferencesController.cpp +++ b/src/core/UBPreferencesController.cpp @@ -271,6 +271,8 @@ void UBPreferencesController::wire() connect(mPenProperties->circleCheckBox, SIGNAL(clicked(bool)), settings, SLOT(setPenPreviewCircle(bool))); connect(mPenProperties->circleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(penPreviewFromSizeChanged(int))); + connect(mPreferencesUI->autoSwitchToEraserCheckBox, SIGNAL(clicked(bool)), settings->boardIgnoreBrokenEraserDetection, SLOT(setBool(bool))); + // marker QList markerLightBackgroundColors = settings->boardMarkerLightBackgroundColors->colors(); QList markerDarkBackgroundColors = settings->boardMarkerDarkBackgroundColors->colors(); @@ -342,6 +344,7 @@ void UBPreferencesController::init() mPenProperties->pressureSensitiveCheckBox->setChecked(settings->boardPenPressureSensitive->get().toBool()); mPenProperties->circleCheckBox->setChecked(settings->showPenPreviewCircle->get().toBool()); mPenProperties->circleSpinBox->setValue(settings->penPreviewFromSize->get().toInt()); + mPreferencesUI->autoSwitchToEraserCheckBox->setChecked(settings->boardIgnoreBrokenEraserDetection->get().toBool()); // marker tab mMarkerProperties->fineSlider->setValue(settings->boardMarkerFineWidth->get().toDouble() * sSliderRatio); diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 22ec9c940..b9af2ffbd 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -285,6 +285,7 @@ void UBSettings::init() boardMarkerPressureSensitive = new UBSetting(this, "Board", "MarkerPressureSensitive", false); boardUseHighResTabletEvent = new UBSetting(this, "Board", "UseHighResTabletEvent", true); + boardIgnoreBrokenEraserDetection = new UBSetting(this, "Board", "IgnoreBrokenEraserDetection", false); boardInterpolatePenStrokes = new UBSetting(this, "Board", "InterpolatePenStrokes", true); boardSimplifyPenStrokes = new UBSetting(this, "Board", "SimplifyPenStrokes", true); diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index fa16a0270..0357256c8 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -287,6 +287,7 @@ class UBSettings : public QObject UBSetting* boardMarkerPressureSensitive; UBSetting* boardUseHighResTabletEvent; + UBSetting* boardIgnoreBrokenEraserDetection; UBSetting* boardInterpolatePenStrokes; UBSetting* boardSimplifyPenStrokes;