From ac94fb4a33df63a610b0235b72d64cad021fa671 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 12 Jan 2023 17:40:20 +0100 Subject: [PATCH] Gui: move to new style connect() --- src/Gui/DlgCustomizeSpaceball.cpp | 16 ++++++++-------- src/Gui/DlgCustomizeSpaceball.h | 4 +--- src/Gui/DlgObjectSelection.cpp | 4 ++-- src/Gui/DlgPropertyLink.cpp | 17 +++++++++-------- src/Gui/ExpressionCompleter.cpp | 6 +++--- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/DlgCustomizeSpaceball.cpp index 6af1abb8f3..fdd7535fa6 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/DlgCustomizeSpaceball.cpp @@ -673,13 +673,13 @@ DlgCustomizeSpaceball::DlgCustomizeSpaceball(QWidget *parent) setupButtonModelView(); setupCommandModelView(); - connect(buttonView, SIGNAL(changeCommandSelection(const QString&)), - commandView, SLOT(goChangeCommandSelection(const QString&))); - connect(commandView, SIGNAL(changedCommand(const QString&)), - buttonView, SLOT(goChangedCommand(const QString&))); + connect(buttonView, &ButtonView::changeCommandSelection, + commandView, &CommandView::goChangeCommandSelection); + connect(commandView, &CommandView::changedCommand, + buttonView, &ButtonView::goChangedCommand); setupLayout(); - connect(clearButton, SIGNAL(clicked()), this, SLOT(goClear())); - connect(printReference, SIGNAL(clicked()), this, SLOT(goPrint())); + connect(clearButton, &QPushButton::clicked, this, &DlgCustomizeSpaceball::goClear); + connect(printReference, &QPushButton::clicked, this, &DlgCustomizeSpaceball::goPrint); } DlgCustomizeSpaceball::~DlgCustomizeSpaceball() @@ -706,8 +706,8 @@ void DlgCustomizeSpaceball::setupButtonModelView() buttonView->setModel(buttonModel); //had to do this here as the views default selection model is not created until after construction. - connect(buttonView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), - buttonView, SLOT(goSelectionChanged(const QItemSelection&, const QItemSelection&))); + connect(buttonView->selectionModel(), &QItemSelectionModel::selectionChanged, + buttonView, &ButtonView::goSelectionChanged); } void DlgCustomizeSpaceball::setupCommandModelView() diff --git a/src/Gui/DlgCustomizeSpaceball.h b/src/Gui/DlgCustomizeSpaceball.h index d3950b6c95..b5850def45 100644 --- a/src/Gui/DlgCustomizeSpaceball.h +++ b/src/Gui/DlgCustomizeSpaceball.h @@ -48,10 +48,8 @@ namespace Gui void selectButton(int number); Q_SIGNALS: void changeCommandSelection(const QString& commandName); - private Q_SLOTS: - void goSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); - public Q_SLOTS: + void goSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void goChangedCommand(const QString& commandName); }; diff --git a/src/Gui/DlgObjectSelection.cpp b/src/Gui/DlgObjectSelection.cpp index c92cb9a1f8..b4f94c3a8d 100644 --- a/src/Gui/DlgObjectSelection.cpp +++ b/src/Gui/DlgObjectSelection.cpp @@ -123,8 +123,8 @@ void DlgObjectSelection::init(const std::vector &objs, ui->treeWidget->headerItem()->setText(0, tr("Selections")); ui->treeWidget->header()->setStretchLastSection(false); - connect(ui->treeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), - this, SLOT(onItemExpanded(QTreeWidgetItem*))); + connect(ui->treeWidget, &QTreeWidget::itemExpanded, + this, &DlgObjectSelection::onItemExpanded); allItem = new QTreeWidgetItem(ui->treeWidget); allItem->setText(0, QStringLiteral("<%1>").arg(tr("All"))); diff --git a/src/Gui/DlgPropertyLink.cpp b/src/Gui/DlgPropertyLink.cpp index d2b2ea867e..927daf7381 100644 --- a/src/Gui/DlgPropertyLink.cpp +++ b/src/Gui/DlgPropertyLink.cpp @@ -78,22 +78,23 @@ DlgPropertyLink::DlgPropertyLink(QWidget* parent) timer = new QTimer(this); timer->setSingleShot(true); - connect(timer, SIGNAL(timeout()), this, SLOT(onTimer())); + + connect(timer, &QTimer::timeout, this, &DlgPropertyLink::onTimer); ui->treeWidget->setEditTriggers(QAbstractItemView::DoubleClicked); ui->treeWidget->setItemDelegate(new ItemDelegate(this)); ui->treeWidget->setMouseTracking(true); - connect(ui->treeWidget, SIGNAL(itemEntered(QTreeWidgetItem*, int)), - this, SLOT(onItemEntered(QTreeWidgetItem*))); + connect(ui->treeWidget, &QTreeWidget::itemEntered, + this, &DlgPropertyLink::onItemEntered); - connect(ui->treeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), - this, SLOT(onItemExpanded(QTreeWidgetItem*))); + connect(ui->treeWidget, &QTreeWidget::itemExpanded, + this, &DlgPropertyLink::onItemExpanded); - connect(ui->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged())); + connect(ui->treeWidget, &QTreeWidget::itemSelectionChanged, this, &DlgPropertyLink::onItemSelectionChanged); - connect(ui->searchBox, SIGNAL(returnPressed()), this, SLOT(onItemSearch())); + connect(ui->searchBox, &QLineEdit::returnPressed, this, &DlgPropertyLink::onItemSearch); - connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(onClicked(QAbstractButton*))); + connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &DlgPropertyLink::onClicked); refreshButton = ui->buttonBox->addButton(tr("Reset"), QDialogButtonBox::ActionRole); resetButton = ui->buttonBox->addButton(tr("Clear"), QDialogButtonBox::ResetRole); diff --git a/src/Gui/ExpressionCompleter.cpp b/src/Gui/ExpressionCompleter.cpp index ec3de48404..bc36cd8b52 100644 --- a/src/Gui/ExpressionCompleter.cpp +++ b/src/Gui/ExpressionCompleter.cpp @@ -707,9 +707,9 @@ void ExpressionTextEdit::setDocumentObject(const App::DocumentObject * currentDo completer->setFilterMode(Qt::MatchContains); completer->setWidget(this); completer->setCaseSensitivity(Qt::CaseInsensitive); - connect(completer, SIGNAL(activated(QString)), this, SLOT(slotCompleteText(QString))); - connect(completer, SIGNAL(highlighted(QString)), this, SLOT(slotCompleteText(QString))); - connect(this, SIGNAL(textChanged2(QString,int)), completer, SLOT(slotUpdate(QString,int))); + connect(completer, qOverload(&QCompleter::activated), this, &ExpressionTextEdit::slotCompleteText); + connect(completer, qOverload(&QCompleter::highlighted), this, &ExpressionTextEdit::slotCompleteText); + connect(this, &ExpressionTextEdit::textChanged2, completer, &ExpressionCompleter::slotUpdate); } }