Adapt to tablet event pointer type changes in Qt6

This commit is contained in:
Volker Krause 2022-03-18 15:37:37 +01:00 committed by Vlad Zahorodnii
parent 3c945358fc
commit 31d9aa6914

View file

@ -334,6 +334,7 @@ bool MouseClickEffect::tabletToolEvent(QTabletEvent *event)
auto &tabletEvent = m_tabletTools[event->uniqueId()];
if (!tabletEvent.m_color.isValid()) {
switch (event->pointerType()) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
case QTabletEvent::UnknownPointer:
case QTabletEvent::Pen:
tabletEvent.m_color = MouseClickConfig::color1();
@ -344,6 +345,20 @@ bool MouseClickEffect::tabletToolEvent(QTabletEvent *event)
case QTabletEvent::Cursor:
tabletEvent.m_color = MouseClickConfig::color3();
break;
#else
case QPointingDevice::PointerType::Unknown:
case QPointingDevice::PointerType::Generic:
case QPointingDevice::PointerType::Finger:
case QPointingDevice::PointerType::Pen:
tabletEvent.m_color = MouseClickConfig::color1();
break;
case QPointingDevice::PointerType::Eraser:
tabletEvent.m_color = MouseClickConfig::color2();
break;
case QPointingDevice::PointerType::Cursor:
tabletEvent.m_color = MouseClickConfig::color3();
break;
#endif
}
}
switch (event->type()) {