summaryrefslogtreecommitdiffstats
path: root/examples/widgets/touch
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-04-16 16:32:08 +0200
commit6630937e63ae5797487b86743a7733c8ae5cc42c (patch)
tree3d53dacf6430f9099e1fb20835881205de674961 /examples/widgets/touch
parent37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff)
parentc7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff)
Merge commit 'dev' into 'wip/cmake-merge'
Diffstat (limited to 'examples/widgets/touch')
-rw-r--r--examples/widgets/touch/dials/main.cpp4
-rw-r--r--examples/widgets/touch/fingerpaint/mainwindow.cpp22
-rw-r--r--examples/widgets/touch/fingerpaint/scribblearea.cpp6
-rw-r--r--examples/widgets/touch/pinchzoom/mouse.cpp2
4 files changed, 17 insertions, 17 deletions
diff --git a/examples/widgets/touch/dials/main.cpp b/examples/widgets/touch/dials/main.cpp
index 071f485de3..059dfdc716 100644
--- a/examples/widgets/touch/dials/main.cpp
+++ b/examples/widgets/touch/dials/main.cpp
@@ -60,8 +60,8 @@ int main(int argc, char **argv)
QWidget window;
Ui::Dials dialsUi;
dialsUi.setupUi(&window);
- QList<QAbstractSlider *> sliders = window.findChildren<QAbstractSlider *>();
- foreach (QAbstractSlider *slider, sliders)
+ const QList<QAbstractSlider *> sliders = window.findChildren<QAbstractSlider *>();
+ for (QAbstractSlider *slider : sliders)
slider->setAttribute(Qt::WA_AcceptTouchEvents);
window.showMaximized();
return app.exec();
diff --git a/examples/widgets/touch/fingerpaint/mainwindow.cpp b/examples/widgets/touch/fingerpaint/mainwindow.cpp
index 0e45eea240..2f7ec38d1a 100644
--- a/examples/widgets/touch/fingerpaint/mainwindow.cpp
+++ b/examples/widgets/touch/fingerpaint/mainwindow.cpp
@@ -127,34 +127,35 @@ void MainWindow::createActions()
{
openAct = new QAction(tr("&Open..."), this);
openAct->setShortcut(tr("Ctrl+O"));
- connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
+ connect(openAct, &QAction::triggered, this, &MainWindow::open);
- foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
+ const QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
+ for (const QByteArray &format : imageFormats) {
QString text = tr("%1...").arg(QString(format).toUpper());
QAction *action = new QAction(text, this);
action->setData(format);
- connect(action, SIGNAL(triggered()), this, SLOT(save()));
+ connect(action, &QAction::triggered, this, &MainWindow::save);
saveAsActs.append(action);
}
printAct = new QAction(tr("&Print..."), this);
- connect(printAct, SIGNAL(triggered()), scribbleArea, SLOT(print()));
+ connect(printAct, &QAction::triggered, scribbleArea, &ScribbleArea::print);
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcut(tr("Ctrl+Q"));
- connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
+ connect(exitAct, &QAction::triggered, this, &QWidget::close);
clearScreenAct = new QAction(tr("&Clear Screen"), this);
clearScreenAct->setShortcut(tr("Ctrl+L"));
- connect(clearScreenAct, SIGNAL(triggered()),
- scribbleArea, SLOT(clearImage()));
+ connect(clearScreenAct, &QAction::triggered,
+ scribbleArea, &ScribbleArea::clearImage);
aboutAct = new QAction(tr("&About"), this);
- connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+ connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
aboutQtAct = new QAction(tr("About &Qt"), this);
- connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
}
//! [14]
@@ -163,8 +164,7 @@ void MainWindow::createMenus()
//! [15] //! [16]
{
saveAsMenu = new QMenu(tr("&Save As"), this);
- foreach (QAction *action, saveAsActs)
- saveAsMenu->addAction(action);
+ saveAsMenu->addActions(saveAsActs);
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
diff --git a/examples/widgets/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp
index aa4e60c934..0b0c4476d9 100644
--- a/examples/widgets/touch/fingerpaint/scribblearea.cpp
+++ b/examples/widgets/touch/fingerpaint/scribblearea.cpp
@@ -195,9 +195,9 @@ bool ScribbleArea::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
- QTouchEvent *touch = static_cast<QTouchEvent *>(event);
- QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
- foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
+ const QTouchEvent *touch = static_cast<QTouchEvent *>(event);
+ const QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ for (const QTouchEvent::TouchPoint &touchPoint : touchPoints) {
switch (touchPoint.state()) {
case Qt::TouchPointStationary:
case Qt::TouchPointReleased:
diff --git a/examples/widgets/touch/pinchzoom/mouse.cpp b/examples/widgets/touch/pinchzoom/mouse.cpp
index 1e6814be13..1dfd7d749c 100644
--- a/examples/widgets/touch/pinchzoom/mouse.cpp
+++ b/examples/widgets/touch/pinchzoom/mouse.cpp
@@ -163,7 +163,7 @@ void Mouse::timerEvent(QTimerEvent *)
<< mapToScene(0, 0)
<< mapToScene(-30, -50)
<< mapToScene(30, -50));
- foreach (QGraphicsItem *item, dangerMice) {
+ for (QGraphicsItem *item : dangerMice) {
if (item == this)
continue;