summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tools/treemodelcompleter
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-12-07 14:17:38 +0100
committerLuca Beldi <v.ronin@yahoo.it>2019-01-03 08:29:56 +0000
commit8c04aab8966611e96c64f469b7a1c6afe67e3fca (patch)
tree40fe2bc3f4d945a65828d49586292ea6c72440a1 /examples/widgets/tools/treemodelcompleter
parent451ebdff824cad329b40aad9a10cec5e5cb464cc (diff)
Cleanup Widgets examples - new signal/slot syntax
Cleanup the Widget examples - use the new signal/slot syntax where possible - layout, statemachine, tools and touch subdirectory Change-Id: I466b309b643ef7ffc27be7591fa10f4c75cfd3f8 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/tools/treemodelcompleter')
-rw-r--r--examples/widgets/tools/treemodelcompleter/mainwindow.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp
index 72b2fad833..dec3cb0496 100644
--- a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp
+++ b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp
@@ -61,8 +61,8 @@ MainWindow::MainWindow(QWidget *parent)
completer = new TreeModelCompleter(this);
completer->setModel(modelFromFile(":/resources/treemodel.txt"));
completer->setSeparator(QLatin1String("."));
- QObject::connect(completer, SIGNAL(highlighted(QModelIndex)),
- this, SLOT(highlight(QModelIndex)));
+ QObject::connect(completer, QOverload<const QModelIndex &>::of(&TreeModelCompleter::highlighted),
+ this, &MainWindow::highlight);
QWidget *centralWidget = new QWidget;
@@ -91,18 +91,18 @@ MainWindow::MainWindow(QWidget *parent)
QLineEdit *separatorLineEdit = new QLineEdit;
separatorLineEdit->setText(completer->separator());
- connect(separatorLineEdit, SIGNAL(textChanged(QString)),
- completer, SLOT(setSeparator(QString)));
+ connect(separatorLineEdit, &QLineEdit::textChanged,
+ completer, &TreeModelCompleter::setSeparator);
QCheckBox *wrapCheckBox = new QCheckBox;
wrapCheckBox->setText(tr("Wrap around completions"));
wrapCheckBox->setChecked(completer->wrapAround());
- connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool)));
+ connect(wrapCheckBox, &QAbstractButton::clicked, completer, &QCompleter::setWrapAround);
contentsLabel = new QLabel;
contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- connect(separatorLineEdit, SIGNAL(textChanged(QString)),
- this, SLOT(updateContentsLabel(QString)));
+ connect(separatorLineEdit, &QLineEdit::textChanged,
+ this, &MainWindow::updateContentsLabel);
treeView = new QTreeView;
treeView->setModel(completer->model());
@@ -111,8 +111,10 @@ MainWindow::MainWindow(QWidget *parent)
//! [1]
//! [2]
- connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
- connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));
+ connect(modeCombo, QOverload<int>::of(&QComboBox::activated),
+ this, &MainWindow::changeMode);
+ connect(caseCombo, QOverload<int>::of(&QComboBox::activated),
+ this, &MainWindow::changeMode);
lineEdit = new QLineEdit;
lineEdit->setCompleter(completer);
@@ -145,9 +147,9 @@ void MainWindow::createMenu()
QAction *aboutAct = new QAction(tr("About"), this);
QAction *aboutQtAct = new QAction(tr("About Qt"), this);
- connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
- connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(exitAction, &QAction::triggered, qApp, &QApplication::quit);
+ connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
+ connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
QMenu* fileMenu = menuBar()->addMenu(tr("File"));
fileMenu->addAction(exitAction);