diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/widgets/doc/snippets/reading-selections/window.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/widgets/doc/snippets/reading-selections/window.cpp')
-rw-r--r-- | src/widgets/doc/snippets/reading-selections/window.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/widgets/doc/snippets/reading-selections/window.cpp b/src/widgets/doc/snippets/reading-selections/window.cpp index 08805fe4b3..045d66a199 100644 --- a/src/widgets/doc/snippets/reading-selections/window.cpp +++ b/src/widgets/doc/snippets/reading-selections/window.cpp @@ -81,9 +81,9 @@ MainWindow::MainWindow(QWidget *parent) QAction *selectAllAction = actionMenu->addAction(tr("&Select All")); menuBar()->addMenu(actionMenu); - connect(fillAction, SIGNAL(triggered()), this, SLOT(fillSelection())); - connect(clearAction, SIGNAL(triggered()), this, SLOT(clearSelection())); - connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll())); + connect(fillAction, &QAction::triggered, this, &MainWindow::fillSelection); + connect(clearAction, &QAction::triggered, this, &MainWindow::clearSelection); + connect(selectAllAction, &QAction::triggered, this, &MainWindow::selectAll); selectionModel = table->selectionModel(); @@ -94,10 +94,9 @@ MainWindow::MainWindow(QWidget *parent) void MainWindow::fillSelection() { //! [0] - QModelIndexList indexes = selectionModel->selectedIndexes(); - QModelIndex index; + const QModelIndexList indexes = selectionModel->selectedIndexes(); - foreach(index, indexes) { + for (const QModelIndex &index : indexes) { QString text = QString("(%1,%2)").arg(index.row()).arg(index.column()); model->setData(index, text); } @@ -106,11 +105,10 @@ void MainWindow::fillSelection() void MainWindow::clearSelection() { - QModelIndexList indexes = selectionModel->selectedIndexes(); - QModelIndex index; + const QModelIndexList indexes = selectionModel->selectedIndexes(); - foreach(index, indexes) - model->setData(index, ""); + for (const QModelIndex &index : indexes) + model->setData(index, QString()); } void MainWindow::selectAll() |