Commit 20cb1f86 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Do not use the stylus id to set the preset

Using the stylus' unique id to set the preset allowed users to
have different presets for e.g. an art pen and a normal stylus.

However, we are seeing random stylus id's for the same actual
stylus being reported, which means that this feature is completely
broken.

BUG:407659
BACKPORT:krita/4.2
parent 60582544
......@@ -66,7 +66,10 @@ public:
QTabletEvent::PointerType pointer() const;
/**
* Return the unique tablet id as registered by QTabletEvents.
* Return the unique tablet id as registered by QTabletEvents. Note that this
* id can change randomly, so it's not dependable.
*
* See https://bugs.kde.org/show_bug.cgi?id=407659
*/
qint64 uniqueTabletId() const;
......
......@@ -516,12 +516,12 @@ KisPaintopBox::~KisPaintopBox()
QMapIterator<TabletToolID, TabletToolData> iter(m_tabletToolMap);
while (iter.hasNext()) {
iter.next();
//qDebug() << "Writing last used preset for" << iter.key().pointer << iter.key().uniqueID << iter.value().preset->name();
qDebug() << "Writing last used preset for" << iter.key().pointer << iter.value().preset->name();
if ((iter.key().pointer) == QTabletEvent::Eraser) {
cfg.writeEntry(QString("LastEraser_%1").arg(iter.key().uniqueID) , iter.value().preset->name());
cfg.writeEntry(QString("LastEraser") , iter.value().preset->name());
}
else {
cfg.writeEntry(QString("LastPreset_%1").arg(iter.key().uniqueID) , iter.value().preset->name());
cfg.writeEntry(QString("LastPreset"), iter.value().preset->name());
}
}
// Do not delete the widget, since it is global to the application, not owned by the view
......
......@@ -222,7 +222,6 @@ private:
struct TabletToolID {
TabletToolID(const KoInputDevice& dev) {
uniqueID = dev.uniqueTabletId();
// Only the eraser is special, and we don't look at Cursor
pointer = QTabletEvent::Pen;
if (dev.pointer() == QTabletEvent::Eraser) {
......@@ -231,17 +230,14 @@ private:
}
bool operator == (const TabletToolID& id) const {
return pointer == id.pointer && uniqueID == id.uniqueID;
return pointer == id.pointer;
}
bool operator < (const TabletToolID& id) const {
if (uniqueID == id.uniqueID)
return pointer < id.pointer;
return uniqueID < id.uniqueID;
return pointer < id.pointer;
}
QTabletEvent::PointerType pointer;
qint64 uniqueID;
};
struct TabletToolData {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment