diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-07-27 12:02:06 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2015-07-31 04:33:20 +0000 |
commit | 6a991f9cce9da6057c4a053e52e5956284805eea (patch) | |
tree | dd6b2fb68016c8723728ea9114f05b603196bfe9 /examples/widgets/widgets/tablet/mainwindow.cpp | |
parent | ad4d25589fcd5efd4faa3074c19928d195f615bb (diff) |
Tablet example: smoother, rotation stylus, better airbrush
The drawing is antialiased and with rounded caps and joins.
Rotation stylus acts like a felt marker.
Airbrush sprays a radial gradient of color, and its alpha can
depend on the tangential pressure if so chosen.
Task-number: QTBUG-46694
Change-Id: I4fb16eb621707e3c56a75aa302dd0d3bf418a745
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Diffstat (limited to 'examples/widgets/widgets/tablet/mainwindow.cpp')
-rw-r--r-- | examples/widgets/widgets/tablet/mainwindow.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp index aed84c50df..5e84f5b6a2 100644 --- a/examples/widgets/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/widgets/tablet/mainwindow.cpp @@ -52,7 +52,7 @@ MainWindow::MainWindow(TabletCanvas *canvas) myCanvas->setColor(Qt::red); myCanvas->setLineWidthType(TabletCanvas::LineWidthPressure); - myCanvas->setAlphaChannelType(TabletCanvas::NoAlpha); + myCanvas->setAlphaChannelType(TabletCanvas::AlphaTangentialPressure); myCanvas->setColorSaturationType(TabletCanvas::NoSaturation); setWindowTitle(tr("Tablet Example")); @@ -75,6 +75,8 @@ void MainWindow::alphaActionTriggered(QAction *action) { if (action == alphaChannelPressureAction) { myCanvas->setAlphaChannelType(TabletCanvas::AlphaPressure); + } else if (action == alphaChannelTangentialPressureAction) { + myCanvas->setAlphaChannelType(TabletCanvas::AlphaTangentialPressure); } else if (action == alphaChannelTiltAction) { myCanvas->setAlphaChannelType(TabletCanvas::AlphaTilt); } else { @@ -157,15 +159,19 @@ void MainWindow::createActions() alphaChannelPressureAction = new QAction(tr("&Pressure"), this); alphaChannelPressureAction->setCheckable(true); + alphaChannelTangentialPressureAction = new QAction(tr("T&angential Pressure"), this); + alphaChannelTangentialPressureAction->setCheckable(true); + alphaChannelTangentialPressureAction->setChecked(true); + alphaChannelTiltAction = new QAction(tr("&Tilt"), this); alphaChannelTiltAction->setCheckable(true); noAlphaChannelAction = new QAction(tr("No Alpha Channel"), this); noAlphaChannelAction->setCheckable(true); - noAlphaChannelAction->setChecked(true); alphaChannelGroup = new QActionGroup(this); alphaChannelGroup->addAction(alphaChannelPressureAction); + alphaChannelGroup->addAction(alphaChannelTangentialPressureAction); alphaChannelGroup->addAction(alphaChannelTiltAction); alphaChannelGroup->addAction(noAlphaChannelAction); connect(alphaChannelGroup, SIGNAL(triggered(QAction*)), @@ -259,6 +265,7 @@ void MainWindow::createMenus() alphaChannelMenu = tabletMenu->addMenu(tr("&Alpha Channel")); alphaChannelMenu->addAction(alphaChannelPressureAction); + alphaChannelMenu->addAction(alphaChannelTangentialPressureAction); alphaChannelMenu->addAction(alphaChannelTiltAction); alphaChannelMenu->addAction(noAlphaChannelAction); |