Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix SAP not working on touchscreens

Luna Lovecraft2257ac2c7e64
diff --git a/libs/ui/kis_selection_actions_panel_button.cpp b/libs/ui/kis_selection_actions_panel_button.cpp
index aa2dd1ec23..eca0c0dfd5 100644
--- a/libs/ui/kis_selection_actions_panel_button.cpp
+++ b/libs/ui/kis_selection_actions_panel_button.cpp
@@ -22,6 +22,7 @@ KisSelectionActionsPanelButton::KisSelectionActionsPanelButton(const QString& ic
setToolTip(tooltip);
setCursor(Qt::PointingHandCursor);
setIconSize(QSize(size - ICON_SIZE_OFFSET, size - ICON_SIZE_OFFSET));
+ setAttribute(Qt::WA_AcceptTouchEvents);
}
KisSelectionActionsPanelButton::~KisSelectionActionsPanelButton()
@@ -72,3 +73,16 @@ void KisSelectionActionsPanelButton::tabletEvent(QTabletEvent *e)
e->accept();
}
}
+
+bool KisSelectionActionsPanelButton::event(QEvent *e)
+{
+ //Manually handle the button being pressed on touch
+ if (e->type() == QEvent::TouchBegin) {
+ e->accept();
+ if (((QTouchEvent *)e)->points().count() == 1) {
+ this->animateClick();
+ }
+ return true;
+ }
+ return QAbstractButton::event(e);
+}
diff --git a/libs/ui/kis_selection_actions_panel_button.h b/libs/ui/kis_selection_actions_panel_button.h
index 5fb6816442..513709fdb7 100644
--- a/libs/ui/kis_selection_actions_panel_button.h
+++ b/libs/ui/kis_selection_actions_panel_button.h
@@ -18,6 +18,7 @@ class KisSelectionActionsPanelButton : public QAbstractButton {
protected:
void paintEvent(QPaintEvent *e) override;
void tabletEvent(QTabletEvent* e) override;
+ bool event(QEvent* event) override;
};
diff --git a/libs/ui/kis_selection_actions_panel_handle.cpp b/libs/ui/kis_selection_actions_panel_handle.cpp
index 33b013459d..546892001b 100644
--- a/libs/ui/kis_selection_actions_panel_handle.cpp
+++ b/libs/ui/kis_selection_actions_panel_handle.cpp
@@ -25,6 +25,7 @@ KisSelectionActionsPanelHandle::KisSelectionActionsPanelHandle(int size, QWidget
d->handle_icon = KisIconUtils::loadIcon("drag-handle");
this->setCursor(d->default_cursor);
setFixedSize(size, size);
+ setAttribute(Qt::WA_AcceptTouchEvents);
}
KisSelectionActionsPanelHandle::~KisSelectionActionsPanelHandle()