From cfccd44b9db066e996759515297b42865064c806 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 25 Apr 2017 10:18:08 +0200 Subject: Demonstrate the new AA_CompressTabletEvents in the tablet example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe Reviewed-by: Gabriel de Dietrich Reviewed-by: Jan Arve Sæther --- examples/widgets/widgets/tablet/mainwindow.cpp | 10 ++++++++++ examples/widgets/widgets/tablet/mainwindow.h | 1 + 2 files changed, 11 insertions(+) (limited to 'examples/widgets/widgets') 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(); -- cgit v1.2.3