PR 3841 from OpenToonz: Improve Tablet Response
Co-authored-by: shun-iwasawa shun-iwasawa@users.noreply.github.com
This commit is contained in:
parent
66d04c60f5
commit
2d840ed3b3
2 changed files with 14 additions and 1 deletions
|
@ -412,7 +412,12 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
// Enable to render smooth icons on high dpi monitors
|
||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// Compress tablet events with application attributes instead of implementing
|
||||
// the delay-timer by ourselves
|
||||
a.setAttribute(Qt::AA_CompressHighFrequencyEvents);
|
||||
a.setAttribute(Qt::AA_CompressTabletEvents);
|
||||
#endif
|
||||
// Set the app's locale for numeric stuff to standard C. This is important for
|
||||
// atof() and similar
|
||||
// calls that are locale-dependant.
|
||||
|
|
|
@ -361,6 +361,13 @@ void SceneViewer::tabletEvent(QTabletEvent *e) {
|
|||
}
|
||||
#endif
|
||||
QPointF curPos = e->posF() * getDevPixRatio();
|
||||
#if defined(_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// Use the application attribute Qt::AA_CompressTabletEvents instead of the
|
||||
// delay timer
|
||||
if (curPos != m_lastMousePos) {
|
||||
TMouseEvent mouseEvent;
|
||||
initToonzEvent(mouseEvent, e, height(), m_pressure, getDevPixRatio());
|
||||
#else
|
||||
// It seems that the tabletEvent is called more often than mouseMoveEvent.
|
||||
// So I fire the interval timer in order to limit the following process
|
||||
// to be called in 50fps in maximum.
|
||||
|
@ -371,6 +378,7 @@ void SceneViewer::tabletEvent(QTabletEvent *e) {
|
|||
TMouseEvent mouseEvent;
|
||||
initToonzEvent(mouseEvent, e, height(), m_pressure, getDevPixRatio());
|
||||
QTimer::singleShot(20, this, SLOT(releaseBusyOnTabletMove()));
|
||||
#endif
|
||||
// cancel stroke to prevent drawing while floating
|
||||
// 23/1/2018 There is a case that the pressure becomes zero at the start
|
||||
// and the end of stroke. For such case, stroke should not be cancelled.
|
||||
|
|
Loading…
Reference in a new issue