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++

Qt6: adapt to new QInputDevice and QPointingDevice API

Halla Rempt6cb7e3cf95c8
diff --git a/libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp b/libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
index ff0727a875..70620a8219 100644
--- a/libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
+++ b/libs/ui/input/wintab/drawpile_tablettester/tablettest.cpp
@@ -90,8 +90,12 @@ void TabletTester::tabletEvent(QTabletEvent *e)
QString msg;
switch(e->deviceType()) {
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
case QTabletEvent::Stylus: msg = "Stylus"; break;
- default: msg = QString("Device(%1)").arg(e->deviceType()); break;
+#else
+ case QInputDevice::DeviceType::Stylus: msg = "Stylus"; break;
+#endif
+ default: msg = QString("Device(%1)").arg((int)e->deviceType()); break;
}
switch(e->type()) {
diff --git a/libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp b/libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
index 386b3e9dc1..c059567bf4 100644
--- a/libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
+++ b/libs/ui/input/wintab/drawpile_tablettester/tablettester.cpp
@@ -10,6 +10,8 @@
#include "tablettest.h"
#include "ui_tablettest.h"
+#include <QTabletEvent>
+
TabletTestDialog::TabletTestDialog(QWidget *parent)
: KoDialog(parent, Qt::Dialog)
{
@@ -43,7 +45,12 @@ bool TabletTestDialog::eventFilter(QObject *watched, QEvent *e) {
Q_UNUSED(watched);
if(e->type() == QEvent::TabletEnterProximity || e->type() == QEvent::TabletLeaveProximity) {
QTabletEvent *te = static_cast<QTabletEvent*>(e);
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
bool isEraser = te->pointerType() == QTabletEvent::Eraser;
+#else
+ bool isEraser = te->pointingDevice()->pointerType() == QPointingDevice::PointerType::Eraser;
+#endif
+
bool isNear = e->type() == QEvent::TabletEnterProximity;
QString msg;
if(isEraser) {