From 9b29c3a6839981f6f4b33234fab4e857d26bfcff Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 1 Feb 2023 16:16:05 +0100 Subject: [PATCH] Gui: replace slots with member function pointers --- src/Gui/CoinRiftWidget.cpp | 4 +-- src/Gui/DAGView/DAGModel.cpp | 2 +- src/Gui/DlgParameterImp.cpp | 28 ++++++++++---------- src/Gui/DlgUndoRedo.cpp | 10 +++++--- src/Gui/DocumentRecovery.cpp | 2 +- src/Gui/DownloadItem.cpp | 2 +- src/Gui/EditorView.cpp | 2 +- src/Gui/ManualAlignment.cpp | 10 ++++---- src/Gui/NetworkRetriever.cpp | 2 +- src/Gui/PythonConsole.cpp | 16 ++++++------ src/Gui/PythonEditor.cpp | 4 +-- src/Gui/QSint/actionpanel/actiongroup.cpp | 8 +++--- src/Gui/QSint/actionpanel/taskheader_p.cpp | 6 ++--- src/Gui/ReportView.cpp | 30 +++++++++++----------- src/Gui/SelectionView.cpp | 21 ++++++++++----- src/Gui/propertyeditor/PropertyItem.cpp | 2 +- 16 files changed, 79 insertions(+), 70 deletions(-) diff --git a/src/Gui/CoinRiftWidget.cpp b/src/Gui/CoinRiftWidget.cpp index 53d97343f1..5f3a9cd86d 100644 --- a/src/Gui/CoinRiftWidget.cpp +++ b/src/Gui/CoinRiftWidget.cpp @@ -317,7 +317,7 @@ void CoinRiftWidget::initializeGL() void CoinRiftWidget::paintGL() { const int ms(1000 / 75 /*fps*/); - QTimer::singleShot(ms, this, SLOT(updateGL())); + QTimer::singleShot(ms, this, &CoinRiftWidget::updateGL); // handling the safety warning handlingSafetyWarning(); @@ -504,4 +504,4 @@ int main(int argc, char *argv[]) #endif //BUILD_RIFT_TEST_MAIN -#endif //BUILD_VR \ No newline at end of file +#endif //BUILD_VR diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index c4ec81da6a..970f4fc10e 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -1109,7 +1109,7 @@ void Model::onRenameSlot() proxy->setGeometry(text->sceneBoundingRect()); lineEdit->selectAll(); - QTimer::singleShot(0, lineEdit, SLOT(setFocus())); + QTimer::singleShot(0, lineEdit, qOverload<>(&QLineEdit::setFocus)); } void Model::renameAcceptedSlot() diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index cfc334fb7b..408ef36dba 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -452,14 +452,14 @@ ParameterGroup::ParameterGroup( QWidget * parent ) : QTreeWidget(parent) { menuEdit = new QMenu(this); - expandAct = menuEdit->addAction(tr("Expand"), this, SLOT(onToggleSelectedItem())); + expandAct = menuEdit->addAction(tr("Expand"), this, &ParameterGroup::onToggleSelectedItem); menuEdit->addSeparator(); - subGrpAct = menuEdit->addAction(tr("Add sub-group"), this, SLOT(onCreateSubgroup())); - removeAct = menuEdit->addAction(tr("Remove group"), this, SLOT(onDeleteSelectedItem())); - renameAct = menuEdit->addAction(tr("Rename group"), this, SLOT(onRenameSelectedItem())); + subGrpAct = menuEdit->addAction(tr("Add sub-group"), this, &ParameterGroup::onCreateSubgroup); + removeAct = menuEdit->addAction(tr("Remove group"), this, &ParameterGroup::onDeleteSelectedItem); + renameAct = menuEdit->addAction(tr("Rename group"), this, &ParameterGroup::onRenameSelectedItem); menuEdit->addSeparator(); - exportAct = menuEdit->addAction(tr("Export parameter"), this, SLOT(onExportToFile())); - importAct = menuEdit->addAction(tr("Import parameter"), this, SLOT(onImportFromFile())); + exportAct = menuEdit->addAction(tr("Export parameter"), this, &ParameterGroup::onExportToFile); + importAct = menuEdit->addAction(tr("Import parameter"), this, &ParameterGroup::onImportFromFile); menuEdit->setDefaultAction(expandAct); } @@ -646,19 +646,19 @@ ParameterValue::ParameterValue( QWidget * parent ) : QTreeWidget(parent) { menuEdit = new QMenu(this); - changeAct = menuEdit->addAction(tr("Change value"), this, SLOT(onChangeSelectedItem())); + changeAct = menuEdit->addAction(tr("Change value"), this, qOverload<>(&ParameterValue::onChangeSelectedItem)); menuEdit->addSeparator(); - removeAct = menuEdit->addAction(tr("Remove key"), this, SLOT(onDeleteSelectedItem())); - renameAct = menuEdit->addAction(tr("Rename key"), this, SLOT(onRenameSelectedItem())); + removeAct = menuEdit->addAction(tr("Remove key"), this, &ParameterValue::onDeleteSelectedItem); + renameAct = menuEdit->addAction(tr("Rename key"), this, &ParameterValue::onRenameSelectedItem); menuEdit->setDefaultAction(changeAct); menuEdit->addSeparator(); menuNew = menuEdit->addMenu(tr("New")); - newStrAct = menuNew->addAction(tr("New string item"), this, SLOT(onCreateTextItem())); - newFltAct = menuNew->addAction(tr("New float item"), this, SLOT(onCreateFloatItem())); - newIntAct = menuNew->addAction(tr("New integer item"), this, SLOT(onCreateIntItem())); - newUlgAct = menuNew->addAction(tr("New unsigned item"), this, SLOT(onCreateUIntItem())); - newBlnAct = menuNew->addAction(tr("New Boolean item"), this, SLOT(onCreateBoolItem())); + newStrAct = menuNew->addAction(tr("New string item"), this, &ParameterValue::onCreateTextItem); + newFltAct = menuNew->addAction(tr("New float item"), this, &ParameterValue::onCreateFloatItem); + newIntAct = menuNew->addAction(tr("New integer item"), this, &ParameterValue::onCreateIntItem); + newUlgAct = menuNew->addAction(tr("New unsigned item"), this, &ParameterValue::onCreateUIntItem); + newBlnAct = menuNew->addAction(tr("New Boolean item"), this, &ParameterValue::onCreateBoolItem); connect(this, &ParameterValue::itemDoubleClicked, this, qOverload(&ParameterValue::onChangeSelectedItem)); diff --git a/src/Gui/DlgUndoRedo.cpp b/src/Gui/DlgUndoRedo.cpp index 3aa156fc2f..fd77f2b00b 100644 --- a/src/Gui/DlgUndoRedo.cpp +++ b/src/Gui/DlgUndoRedo.cpp @@ -66,8 +66,9 @@ void UndoDialog::onFetchInfo() MDIView* mdi = getMainWindow()->activeWindow(); if (mdi) { QStringList vecUndos = mdi->undoActions(); - for (QStringList::Iterator i = vecUndos.begin(); i != vecUndos.end(); ++i) - addAction(*i, this, SLOT(onSelected())); + for (QStringList::Iterator i = vecUndos.begin(); i != vecUndos.end(); ++i) { + addAction(*i, this, &UndoDialog::onSelected); + } } } @@ -114,8 +115,9 @@ void RedoDialog::onFetchInfo() MDIView* mdi = getMainWindow()->activeWindow(); if (mdi) { QStringList vecRedos = mdi->redoActions(); - for (QStringList::Iterator i = vecRedos.begin(); i != vecRedos.end(); ++i) - addAction(*i, this, SLOT(onSelected())); + for (QStringList::Iterator i = vecRedos.begin(); i != vecRedos.end(); ++i) { + addAction(*i, this, &RedoDialog::onSelected); + } } } diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index c2e40ba6bf..aa7eafc435 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -498,7 +498,7 @@ void DocumentRecovery::contextMenuEvent(QContextMenuEvent* ev) QList items = d_ptr->ui.treeWidget->selectedItems(); if (!items.isEmpty()) { QMenu menu; - menu.addAction(tr("Delete"), this, SLOT(onDeleteSection())); + menu.addAction(tr("Delete"), this, &DocumentRecovery::onDeleteSection); menu.exec(ev->globalPos()); } } diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 984278edea..a9a96ea351 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -412,7 +412,7 @@ void DownloadItem::tryAgain() void DownloadItem::contextMenuEvent (QContextMenuEvent * e) { QMenu menu; - QAction* a = menu.addAction(tr("Open containing folder"), this, SLOT(openFolder())); + QAction* a = menu.addAction(tr("Open containing folder"), this, &DownloadItem::openFolder); a->setEnabled(m_output.exists()); menu.exec(e->globalPos()); } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 708acbf93d..f56570ffc3 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -610,7 +610,7 @@ bool PythonEditorView::onMsg(const char* pMsg,const char** ppReturn) return true; } else if (strcmp(pMsg,"StartDebug")==0) { - QTimer::singleShot(300, this, SLOT(startDebug())); + QTimer::singleShot(300, this, &PythonEditorView::startDebug); return true; } else if (strcmp(pMsg,"ToggleBreakpoint")==0) { diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 2e924daad0..892ff43e1b 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -1273,21 +1273,21 @@ void ManualAlignment::probePickedCallback(void * ud, SoEventCallback * n) QAction* id = menu.exec(QCursor::pos()); if (id == fi) { // call align->align(); - QTimer::singleShot(300, self, SLOT(onAlign())); + QTimer::singleShot(300, self, &ManualAlignment::onAlign); } else if ((id == rem) && (view == self->myViewer->getViewer(0))) { - QTimer::singleShot(300, self, SLOT(onRemoveLastPointMoveable())); + QTimer::singleShot(300, self, &ManualAlignment::onRemoveLastPointMoveable); } else if ((id == rem) && (view == self->myViewer->getViewer(1))) { - QTimer::singleShot(300, self, SLOT(onRemoveLastPointFixed())); + QTimer::singleShot(300, self, &ManualAlignment::onRemoveLastPointFixed); } //else if (id == cl) { // // call align->clear(); - // QTimer::singleShot(300, self, SLOT(onClear())); + // QTimer::singleShot(300, self, &ManualAlignment::onClear); //} else if (id == ca) { // call align->cancel(); - QTimer::singleShot(300, self, SLOT(onCancel())); + QTimer::singleShot(300, self, &ManualAlignment::onCancel); } else if (id == sync) { // setup sensor connection diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index 15f25344a1..192d9bdebb 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -351,7 +351,7 @@ void NetworkRetriever::abort() { if ( wget->state() == QProcess::Running) { - QTimer::singleShot( 2000, wget, SLOT( kill() ) ); + QTimer::singleShot( 2000, wget, &QProcess::kill); } } diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 11def4e544..a5007f60b6 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1311,16 +1311,16 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e ) QAction *a; bool mayPasteHere = cursorBeyond( this->textCursor(), this->inputBegin() ); - a = menu.addAction(tr("&Copy"), this, SLOT(copy()), QKeySequence(QString::fromLatin1("CTRL+C"))); + a = menu.addAction(tr("&Copy"), this, &PythonConsole::copy, QKeySequence(QString::fromLatin1("CTRL+C"))); a->setEnabled(textCursor().hasSelection()); - a = menu.addAction(tr("&Copy command"), this, SLOT(onCopyCommand())); + a = menu.addAction(tr("&Copy command"), this, &PythonConsole::onCopyCommand); a->setEnabled(textCursor().hasSelection()); - a = menu.addAction(tr("&Copy history"), this, SLOT(onCopyHistory())); + a = menu.addAction(tr("&Copy history"), this, &PythonConsole::onCopyHistory); a->setEnabled(!d->history.isEmpty()); - a = menu.addAction( tr("Save history as..."), this, SLOT(onSaveHistoryAs())); + a = menu.addAction( tr("Save history as..."), this, &PythonConsole::onSaveHistoryAs); a->setEnabled(!d->history.isEmpty()); QAction* saveh = menu.addAction(tr("Save history")); @@ -1330,18 +1330,18 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e ) menu.addSeparator(); - a = menu.addAction(tr("&Paste"), this, SLOT(paste()), QKeySequence(QString::fromLatin1("CTRL+V"))); + a = menu.addAction(tr("&Paste"), this, &PythonConsole::paste, QKeySequence(QString::fromLatin1("CTRL+V"))); const QMimeData *md = QApplication::clipboard()->mimeData(); a->setEnabled( mayPasteHere && md && canInsertFromMimeData(md)); - a = menu.addAction(tr("Select All"), this, SLOT(selectAll()), QKeySequence(QString::fromLatin1("CTRL+A"))); + a = menu.addAction(tr("Select All"), this, &PythonConsole::selectAll, QKeySequence(QString::fromLatin1("CTRL+A"))); a->setEnabled(!document()->isEmpty()); - a = menu.addAction(tr("Clear console"), this, SLOT(onClearConsole())); + a = menu.addAction(tr("Clear console"), this, &PythonConsole::onClearConsole); a->setEnabled(!document()->isEmpty()); menu.addSeparator(); - menu.addAction( tr("Insert file name..."), this, SLOT(onInsertFileName())); + menu.addAction( tr("Insert file name..."), this, &PythonConsole::onInsertFileName); menu.addSeparator(); QAction* wrap = menu.addAction(tr("Word wrap")); diff --git a/src/Gui/PythonEditor.cpp b/src/Gui/PythonEditor.cpp index 61a58f4f9c..b589fbdb04 100644 --- a/src/Gui/PythonEditor.cpp +++ b/src/Gui/PythonEditor.cpp @@ -150,8 +150,8 @@ void PythonEditor::contextMenuEvent ( QContextMenuEvent * e ) QMenu* menu = createStandardContextMenu(); if (!isReadOnly()) { menu->addSeparator(); - menu->addAction( tr("Comment"), this, SLOT( onComment() ), QKeySequence(QString::fromLatin1("ALT+C"))); - menu->addAction( tr("Uncomment"), this, SLOT( onUncomment() ), QKeySequence(QString::fromLatin1("ALT+U"))); + menu->addAction( tr("Comment"), this, &PythonEditor::onComment, QKeySequence(QString::fromLatin1("ALT+C"))); + menu->addAction( tr("Uncomment"), this, &PythonEditor::onUncomment, QKeySequence(QString::fromLatin1("ALT+U"))); } menu->exec(e->globalPos()); diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index b4c5a81d7a..403c570590 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -122,7 +122,7 @@ void ActionGroup::showHide() myDummy->setFixedSize(myGroup->size()); myDummy->show(); - QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processHide())); + QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processHide); } else { @@ -130,7 +130,7 @@ void ActionGroup::showHide() m_foldDirection = 1; m_tempHeight = 0; - QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processShow())); + QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processShow); } myDummy->show(); @@ -153,7 +153,7 @@ void ActionGroup::processHide() myDummy->setFixedHeight(m_tempHeight); setFixedHeight(myDummy->height()+myHeader->height()); - QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processHide())); + QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processHide); setUpdatesEnabled(true); } @@ -178,7 +178,7 @@ void ActionGroup::processShow() myDummy->setFixedHeight(m_tempHeight); setFixedHeight(myDummy->height()+myHeader->height()); - QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processShow())); + QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processShow); setUpdatesEnabled(true); } diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp index aa4701f4c2..387b796d3f 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.cpp +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -164,7 +164,7 @@ void TaskHeader::animate() m_opacity = qMax(0.1, m_opacity-0.05); } - QTimer::singleShot(100, this, SLOT(animate())); + QTimer::singleShot(100, this, &TaskHeader::animate); update(); } @@ -177,7 +177,7 @@ void TaskHeader::enterEvent ( QEnterEvent * /*event*/ ) m_over = true; if (isEnabled()) - QTimer::singleShot(100, this, SLOT(animate())); + QTimer::singleShot(100, this, &TaskHeader::animate); update(); } @@ -187,7 +187,7 @@ void TaskHeader::leaveEvent ( QEvent * /*event*/ ) m_over = false; if (isEnabled()) - QTimer::singleShot(100, this, SLOT(animate())); + QTimer::singleShot(100, this, &TaskHeader::animate); update(); } diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index 023edd907b..e518cad362 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -554,19 +554,19 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e ) displayMenu->setTitle(tr("Display message types")); optionMenu->addMenu(displayMenu); - QAction* logMsg = displayMenu->addAction(tr("Normal messages"), this, SLOT(onToggleNormalMessage())); + QAction* logMsg = displayMenu->addAction(tr("Normal messages"), this, &ReportOutput::onToggleNormalMessage); logMsg->setCheckable(true); logMsg->setChecked(bMsg); - QAction* logAct = displayMenu->addAction(tr("Log messages"), this, SLOT(onToggleLogMessage())); + QAction* logAct = displayMenu->addAction(tr("Log messages"), this, &ReportOutput::onToggleLogMessage); logAct->setCheckable(true); logAct->setChecked(bLog); - QAction* wrnAct = displayMenu->addAction(tr("Warnings"), this, SLOT(onToggleWarning())); + QAction* wrnAct = displayMenu->addAction(tr("Warnings"), this, &ReportOutput::onToggleWarning); wrnAct->setCheckable(true); wrnAct->setChecked(bWrn); - QAction* errAct = displayMenu->addAction(tr("Errors"), this, SLOT(onToggleError())); + QAction* errAct = displayMenu->addAction(tr("Errors"), this, &ReportOutput::onToggleError); errAct->setCheckable(true); errAct->setChecked(bErr); @@ -574,41 +574,41 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e ) showOnMenu->setTitle(tr("Show Report view on")); optionMenu->addMenu(showOnMenu); - QAction* showNormAct = showOnMenu->addAction(tr("Normal messages"), this, SLOT(onToggleShowReportViewOnNormalMessage())); + QAction* showNormAct = showOnMenu->addAction(tr("Normal messages"), this, &ReportOutput::onToggleShowReportViewOnNormalMessage); showNormAct->setCheckable(true); showNormAct->setChecked(bShowOnNormal); - QAction* showLogAct = showOnMenu->addAction(tr("Log messages"), this, SLOT(onToggleShowReportViewOnLogMessage())); + QAction* showLogAct = showOnMenu->addAction(tr("Log messages"), this, &ReportOutput::onToggleShowReportViewOnLogMessage); showLogAct->setCheckable(true); showLogAct->setChecked(bShowOnLog); - QAction* showWrnAct = showOnMenu->addAction(tr("Warnings"), this, SLOT(onToggleShowReportViewOnWarning())); + QAction* showWrnAct = showOnMenu->addAction(tr("Warnings"), this, &ReportOutput::onToggleShowReportViewOnWarning); showWrnAct->setCheckable(true); showWrnAct->setChecked(bShowOnWarn); - QAction* showErrAct = showOnMenu->addAction(tr("Errors"), this, SLOT(onToggleShowReportViewOnError())); + QAction* showErrAct = showOnMenu->addAction(tr("Errors"), this, &ReportOutput::onToggleShowReportViewOnError); showErrAct->setCheckable(true); showErrAct->setChecked(bShowOnError); optionMenu->addSeparator(); - QAction* stdoutAct = optionMenu->addAction(tr("Redirect Python output"), this, SLOT(onToggleRedirectPythonStdout())); + QAction* stdoutAct = optionMenu->addAction(tr("Redirect Python output"), this, &ReportOutput::onToggleRedirectPythonStdout); stdoutAct->setCheckable(true); stdoutAct->setChecked(d->redirected_stdout); - QAction* stderrAct = optionMenu->addAction(tr("Redirect Python errors"), this, SLOT(onToggleRedirectPythonStderr())); + QAction* stderrAct = optionMenu->addAction(tr("Redirect Python errors"), this, &ReportOutput::onToggleRedirectPythonStderr); stderrAct->setCheckable(true); stderrAct->setChecked(d->redirected_stderr); optionMenu->addSeparator(); - QAction* botAct = optionMenu->addAction(tr("Go to end"), this, SLOT(onToggleGoToEnd())); + QAction* botAct = optionMenu->addAction(tr("Go to end"), this, &ReportOutput::onToggleGoToEnd); botAct->setCheckable(true); botAct->setChecked(gotoEnd); // Use Qt's internal translation of the Copy & Select All commands const char* context = "QWidgetTextControl"; QString copyStr = QCoreApplication::translate(context, "&Copy"); - QAction* copy = menu->addAction(copyStr, this, SLOT(copy()), QKeySequence(QKeySequence::Copy)); + QAction* copy = menu->addAction(copyStr, this, &ReportOutput::copy, QKeySequence(QKeySequence::Copy)); copy->setEnabled(textCursor().hasSelection()); QIcon icon = QIcon::fromTheme(QString::fromLatin1("edit-copy")); if (!icon.isNull()) @@ -616,11 +616,11 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e ) menu->addSeparator(); QString selectStr = QCoreApplication::translate(context, "Select All"); - menu->addAction(selectStr, this, SLOT(selectAll()), QKeySequence(QKeySequence::SelectAll)); + menu->addAction(selectStr, this, &ReportOutput::selectAll, QKeySequence(QKeySequence::SelectAll)); - menu->addAction(tr("Clear"), this, SLOT(clear())); + menu->addAction(tr("Clear"), this, &ReportOutput::clear); menu->addSeparator(); - menu->addAction(tr("Save As..."), this, SLOT(onSaveAs())); + menu->addAction(tr("Save As..."), this, &ReportOutput::onSaveAs); menu->exec(e->globalPos()); delete menu; diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index 6ae6bf6991..35eaddbd01 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -586,28 +586,35 @@ void SelectionView::onItemContextMenu(const QPoint& point) if (!item) return; QMenu menu; - QAction *selectAction = menu.addAction(tr("Select only"),this,SLOT(select())); + QAction *selectAction = menu.addAction(tr("Select only"), this, [&]{ + this->select(nullptr); + }); selectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-select"))); selectAction->setToolTip(tr("Selects only this object")); - QAction *deselectAction = menu.addAction(tr("Deselect"),this,SLOT(deselect())); + + QAction *deselectAction = menu.addAction(tr("Deselect"), this, &SelectionView::deselect); deselectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-unselectable"))); deselectAction->setToolTip(tr("Deselects this object")); - QAction *zoomAction = menu.addAction(tr("Zoom fit"),this,SLOT(zoom())); + + QAction *zoomAction = menu.addAction(tr("Zoom fit"), this, &SelectionView::zoom); zoomAction->setIcon(QIcon::fromTheme(QString::fromLatin1("zoom-fit-best"))); zoomAction->setToolTip(tr("Selects and fits this object in the 3D window")); - QAction *gotoAction = menu.addAction(tr("Go to selection"),this,SLOT(treeSelect())); + + QAction *gotoAction = menu.addAction(tr("Go to selection"), this, &SelectionView::treeSelect); gotoAction->setToolTip(tr("Selects and locates this object in the tree view")); - QAction *touchAction = menu.addAction(tr("Mark to recompute"),this,SLOT(touch())); + + QAction *touchAction = menu.addAction(tr("Mark to recompute"), this, &SelectionView::touch); touchAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-refresh"))); touchAction->setToolTip(tr("Mark this object to be recomputed")); - QAction *toPythonAction = menu.addAction(tr("To python console"),this,SLOT(toPython())); + + QAction *toPythonAction = menu.addAction(tr("To python console"), this, &SelectionView::toPython); toPythonAction->setIcon(QIcon::fromTheme(QString::fromLatin1("applications-python"))); toPythonAction->setToolTip(tr("Reveals this object and its subelements in the python console.")); QStringList elements = item->data(Qt::UserRole).toStringList(); if (elements.length() > 2) { // subshape-specific entries - QAction *showPart = menu.addAction(tr("Duplicate subshape"),this,SLOT(showPart())); + QAction *showPart = menu.addAction(tr("Duplicate subshape"), this, &SelectionView::showPart); showPart->setIcon(QIcon(QString::fromLatin1(":/icons/ClassBrowser/member.svg"))); showPart->setToolTip(tr("Creates a standalone copy of this subshape in the document")); } diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index b38bf556a8..a320830084 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -4373,7 +4373,7 @@ void LinkLabel::onLinkActivated (const QString& s) { Q_UNUSED(s); auto select = new LinkSelection(qvariant_cast(link)); - QTimer::singleShot(50, select, SLOT(select())); + QTimer::singleShot(50, select, &LinkSelection::select); } void LinkLabel::onEditClicked ()