From f06e0f62fafcb0eeb725122b2a5321363d417663 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 31 Oct 2018 21:00:46 +0100 Subject: Fix usage of QGuiApplication::set/resetOverrideCursor Replace all occurrences of QApplication::set/resetOverrideCursor with the QGuiApplication::set/resetOverrideCursor since it's a static function of QGuiApplication. Change-Id: Ic898ab50a7ad4ed2bc9c6acb26cf4a979c2f82af Reviewed-by: Shawn Rutledge --- examples/widgets/tools/treemodelcompleter/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/widgets/tools/treemodelcompleter') diff --git a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp index a8b51c7aa0..72b2fad833 100644 --- a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp +++ b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp @@ -180,7 +180,7 @@ QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName) return new QStringListModel(completer); #ifndef QT_NO_CURSOR - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #endif QStringList words; @@ -218,7 +218,7 @@ QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName) } #ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); #endif return model; -- cgit v1.2.3 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 --- .../tools/treemodelcompleter/mainwindow.cpp | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'examples/widgets/tools/treemodelcompleter') 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::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::of(&QComboBox::activated), + this, &MainWindow::changeMode); + connect(caseCombo, QOverload::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); -- cgit v1.2.3