Gui: Enable compression of tablet motion events
By default (on platforms that support it, X11 and Windows currently) QT applies compression for high frequency events (mouse move, touch, window resizes) to keep things smooth even when handling the event takes a while (e.g. to calculate snapping). However, tablet pen move events (and mouse move events synthesised from those, which is what FreeCAD uses) are not compressed by default (to allow maximum precision when e.g. hand-drawing curves), leading to unacceptable slowdowns using a tablet pen. This commit enable compression for tablet events here to solve that and make use of a tablet just as smooth as a mouse with FreeCAD. This can (and likely will) lead to some movement events being dropped, but since there is no freeform curve drawing tool, that should not be problematic (and if it is ever added, it could still work without compression if the mouse movement event handler is written to be fast enough).
This commit is contained in:
committed by
wwmayer
parent
856f16211c
commit
fdc6890f4e
@@ -1833,6 +1833,20 @@ void Application::runApplication(void)
|
||||
QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
// By default (on platforms that support it, see docs for
|
||||
// Qt::AA_CompressHighFrequencyEvents) QT applies compression
|
||||
// for high frequency events (mouse move, touch, window resizes)
|
||||
// to keep things smooth even when handling the event takes a
|
||||
// while (e.g. to calculate snapping).
|
||||
// However, tablet pen move events (and mouse move events
|
||||
// synthesised from those) are not compressed by default (to
|
||||
// allow maximum precision when e.g. hand-drawing curves),
|
||||
// leading to unacceptable slowdowns using a tablet pen. Enable
|
||||
// compression for tablet events here to solve that.
|
||||
QCoreApplication::setAttribute(Qt::AA_CompressTabletEvents);
|
||||
#endif
|
||||
|
||||
// A new QApplication
|
||||
Base::Console().Log("Init: Creating Gui::Application and QApplication\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user