Gui: replace slots with member function pointers

This commit is contained in:
wmayer
2023-02-01 16:16:05 +01:00
committed by Uwe
parent ec0182b915
commit 9b29c3a683
16 changed files with 79 additions and 70 deletions

View File

@@ -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"));
}