summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-04-25 10:18:08 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-11-24 11:50:01 +0000
commitcfccd44b9db066e996759515297b42865064c806 (patch)
treea580fd300ce59bb48ecb181943e4e32a92169321
parentb19036ad56896496cad4d679d44032c031c4010b (diff)
Demonstrate the new AA_CompressTabletEvents in the tablet example
Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--examples/widgets/widgets/tablet/mainwindow.cpp10
-rw-r--r--examples/widgets/widgets/tablet/mainwindow.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp
index 0d63ac316b..feae16dd83 100644
--- a/examples/widgets/widgets/tablet/mainwindow.cpp
+++ b/examples/widgets/widgets/tablet/mainwindow.cpp
@@ -60,6 +60,7 @@ MainWindow::MainWindow(TabletCanvas *canvas)
createMenus();
setWindowTitle(tr("Tablet Example"));
setCentralWidget(m_canvas);
+ QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents);
}
//! [0]
@@ -97,6 +98,11 @@ void MainWindow::setSaturationValuator(QAction *action)
}
//! [4]
+void MainWindow::setEventCompression(bool compress)
+{
+ QCoreApplication::setAttribute(Qt::AA_CompressTabletEvents, compress);
+}
+
//! [5]
void MainWindow::save()
{
@@ -220,6 +226,10 @@ void MainWindow::createMenus()
connect(colorSaturationGroup, &QActionGroup::triggered,
this, &MainWindow::setSaturationValuator);
+ QAction *compressAction = tabletMenu->addAction(tr("Co&mpress events"));
+ compressAction->setCheckable(true);
+ connect(compressAction, &QAction::toggled, this, &MainWindow::setEventCompression);
+
QMenu *helpMenu = menuBar()->addMenu("&Help");
helpMenu->addAction(tr("A&bout"), this, &MainWindow::about);
helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt);
diff --git a/examples/widgets/widgets/tablet/mainwindow.h b/examples/widgets/widgets/tablet/mainwindow.h
index 68af1f1687..4b99324f04 100644
--- a/examples/widgets/widgets/tablet/mainwindow.h
+++ b/examples/widgets/widgets/tablet/mainwindow.h
@@ -71,6 +71,7 @@ private slots:
void setAlphaValuator(QAction *action);
void setLineWidthValuator(QAction *action);
void setSaturationValuator(QAction *action);
+ void setEventCompression(bool compress);
void save();
void load();
void about();