From 8c04aab8966611e96c64f469b7a1c6afe67e3fca Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 7 Dec 2018 14:17:38 +0100 Subject: 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 Reviewed-by: Sze Howe Koh Reviewed-by: Paul Wicking --- examples/widgets/tools/completer/mainwindow.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'examples/widgets/tools/completer/mainwindow.cpp') diff --git a/examples/widgets/tools/completer/mainwindow.cpp b/examples/widgets/tools/completer/mainwindow.cpp index 8eb2e60030..114ff0fd7c 100644 --- a/examples/widgets/tools/completer/mainwindow.cpp +++ b/examples/widgets/tools/completer/mainwindow.cpp @@ -102,10 +102,14 @@ MainWindow::MainWindow(QWidget *parent) contentsLabel = new QLabel; contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(modelCombo, SIGNAL(activated(int)), this, SLOT(changeModel())); - connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int))); - connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int))); - connect(maxVisibleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeMaxVisible(int))); + connect(modelCombo, QOverload::of(&QComboBox::activated), + this, &MainWindow::changeModel); + connect(modeCombo, QOverload::of(&QComboBox::activated), + this, &MainWindow::changeMode); + connect(caseCombo, QOverload::of(&QComboBox::activated), + this, &MainWindow::changeCase); + connect(maxVisibleSpinBox, QOverload::of(&QSpinBox::valueChanged), + this, &MainWindow::changeMaxVisible); //! [2] //! [3] @@ -136,9 +140,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); @@ -271,7 +275,7 @@ void MainWindow::changeModel() changeCase(caseCombo->currentIndex()); completer->setWrapAround(wrapCheckBox->isChecked()); lineEdit->setCompleter(completer); - connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool))); + connect(wrapCheckBox, &QAbstractButton::clicked, completer, &QCompleter::setWrapAround); } //! [14] -- cgit v1.2.3