[Gui] modernize some UI connections

This commit is contained in:
Uwe
2023-01-31 05:25:13 +01:00
committed by wwmayer
parent 25c4792690
commit 900ad81b49
8 changed files with 22 additions and 25 deletions

View File

@@ -132,7 +132,8 @@ void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
if (ActiveDialog == dlg)
return; // dialog is already defined
ActiveDialog = dlg;
connect(dlg, SIGNAL(aboutToBeDestroyed()), this, SLOT(closedDialog()));
connect(dlg, &TaskView::TaskDialog::aboutToBeDestroyed,
this, &ControlSingleton::closedDialog);
}
// not all workbenches have the combo view enabled
else if (!_taskPanel) {
@@ -143,7 +144,7 @@ void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
dw->setWidget(_taskPanel);
_taskPanel->showDialog(dlg);
getMainWindow()->addDockWidget(Qt::LeftDockWidgetArea, dw);
connect(dlg, SIGNAL(destroyed()), dw, SLOT(deleteLater()));
connect(dlg, &TaskView::TaskDialog::destroyed, dw, &ControlSingleton::deleteLater);
// if we have the normal tree view available then just tabify with it
QWidget* treeView = Gui::DockWindowManager::instance()->getDockWindow("Tree view");

View File

@@ -134,8 +134,8 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen
editingFinishedAction = new QAction(this);
editingFinishedAction->setText(tr("Finish editing"));
editingFinishedAction->setStatusTip(tr("Finish editing object"));
connect(this->editingFinishedAction, SIGNAL(triggered()),
this, SLOT(editingFinishedSlot()));
connect(this->editingFinishedAction, &QAction::triggered,
this, &Model::editingFinishedSlot);
connectNewObject = documentIn.signalNewObject.connect(boost::bind(&Model::slotNewObject, this, bp::_1));
connectDelObject = documentIn.signalDeletedObject.connect(boost::bind(&Model::slotDeleteObject, this, bp::_1));

View File

@@ -104,10 +104,9 @@ DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WindowFlags fl )
if (ui->parameterSet->count() < 2)
ui->parameterSet->hide();
connect(ui->parameterSet, SIGNAL(activated(int)),
this, SLOT(onChangeParameterSet(int)));
connect(paramGroup, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(onGroupSelected(QTreeWidgetItem*)));
connect(ui->parameterSet, qOverload<int>(&QComboBox::activated),
this, &DlgParameterImp::onChangeParameterSet);
connect(paramGroup, &QTreeWidget::currentItemChanged, this, &DlgParameterImp::onGroupSelected);
onGroupSelected(paramGroup->currentItem());
// setup for function on_findGroup_changed:

View File

@@ -119,8 +119,8 @@ void DlgSettings3DViewImp::loadSettings()
index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
ui->comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box
connect(ui->comboAliasing, SIGNAL(currentIndexChanged(int)),
this, SLOT(onAliasingChanged(int)));
connect(ui->comboAliasing, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettings3DViewImp::onAliasingChanged);
index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index);

View File

@@ -54,7 +54,8 @@ DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent )
ui->prefCountBackupFiles->setMaximum(INT_MAX);
ui->prefCompression->setMinimum(Z_NO_COMPRESSION);
ui->prefCompression->setMaximum(Z_BEST_COMPRESSION);
connect( ui->prefLicenseType, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseTypeChanged(int)) );
connect(ui->prefLicenseType, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettingsDocumentImp::onLicenseTypeChanged);
}
/**

View File

@@ -58,14 +58,13 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
}
connect(ui->ValueInput, SIGNAL(valueChanged(Base::Quantity)), this, SLOT(valueChanged(Base::Quantity)));
connect(ui->ValueInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(ui->UnitInput, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
connect(ui->UnitInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(ui->pushButton_Close, SIGNAL(clicked()), this, SLOT(accept()));
connect(ui->pushButton_Copy, SIGNAL(clicked()), this, SLOT(copy()));
connect(ui->ValueInput, SIGNAL(parseError(QString)), this, SLOT(parseError(QString)));
connect(ui->ValueInput, &InputField::returnPressed,
this, &DlgUnitsCalculator::returnPressed);
connect(ui->ValueInput, &InputField::parseError, this, &DlgUnitsCalculator::parseError);
connect(ui->UnitInput, &QLineEdit::textChanged, this, &DlgUnitsCalculator::textChanged);
connect(ui->UnitInput, &QLineEdit::returnPressed, this, &DlgUnitsCalculator::returnPressed);
connect(ui->pushButton_Close, &QPushButton::clicked, this, &DlgUnitsCalculator::accept);
connect(ui->pushButton_Copy, &QPushButton::clicked, this, &DlgUnitsCalculator::copy);
ui->ValueInput->setParamGrpPath(QByteArray("User parameter:BaseApp/History/UnitsCalculator"));
// set a default that also illustrates how the dialog works

View File

@@ -954,8 +954,7 @@ void PythonConsole::changeEvent(QEvent *e)
if (e->type() == QEvent::ParentChange) {
auto dw = qobject_cast<QDockWidget*>(this->parentWidget());
if (dw) {
connect(dw, SIGNAL(visibilityChanged(bool)),
this, SLOT(visibilityChanged(bool)));
connect(dw, &QDockWidget::visibilityChanged, this, &PythonConsole::visibilityChanged);
}
}
else if (e->type() == QEvent::StyleChange) {

View File

@@ -78,10 +78,8 @@ PythonEditor::PythonEditor(QWidget* parent)
auto uncomment = new QShortcut(this);
uncomment->setKey(QKeySequence(QString::fromLatin1("ALT+U")));
connect(comment, SIGNAL(activated()),
this, SLOT(onComment()));
connect(uncomment, SIGNAL(activated()),
this, SLOT(onUncomment()));
connect(comment, &QShortcut::activated, this, &PythonEditor::onComment);
connect(uncomment, &QShortcut::activated, this, &PythonEditor::onUncomment);
}
/** Destroys the object and frees any allocated resources */