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>bb10
parent
b19036ad56
commit
cfccd44b9d
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue