[Gui] modernize some UI connections

This commit is contained in:
Uwe
2023-01-27 02:11:37 +01:00
committed by Chris Hennes
parent d5e1b3f441
commit 8801836321
12 changed files with 46 additions and 46 deletions

View File

@@ -58,7 +58,8 @@ ComboView::ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent)
tabs->setTabPosition(QTabWidget::North);
pLayout->addWidget( tabs, 0, 0 );
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int)));
connect(tabs, qOverload<int>(&QTabWidget::currentChanged),
this, &ComboView::onCurrentTabChanged);
if (showModel) {
// splitter between tree and property view
auto splitter = new QSplitter();

View File

@@ -129,7 +129,7 @@ Model::Model(QObject *parentIn, const Gui::Document &documentIn) : QGraphicsScen
#ifndef Q_OS_MAC
renameAction->setShortcut(Qt::Key_F2);
#endif
connect(renameAction, SIGNAL(triggered()), this, SLOT(onRenameSlot()));
connect(renameAction, &QAction::triggered, this, &Model::renameAcceptedSlot);
editingFinishedAction = new QAction(this);
editingFinishedAction->setText(tr("Finish editing"));
@@ -1102,8 +1102,8 @@ void Model::onRenameSlot()
auto lineEdit = new LineEdit();
auto text = (*theGraph)[selections.front()].text.get();
lineEdit->setText(text->toPlainText());
connect(lineEdit, SIGNAL(acceptedSignal()), this, SLOT(renameAcceptedSlot()));
connect(lineEdit, SIGNAL(rejectedSignal()), this, SLOT(renameRejectedSlot()));
connect(lineEdit, &LineEdit::acceptedSignal, this, &Model::renameAcceptedSlot);
connect(lineEdit, &LineEdit::rejectedSignal, this, &Model::renameRejectedSlot);
proxy = this->addWidget(lineEdit);
proxy->setGeometry(text->sceneBoundingRect());

View File

@@ -54,7 +54,8 @@ View::View(QWidget* parentIn): QGraphicsView(parentIn)
conDelete = Application::Instance->signalDeleteDocument.connect(boost::bind(&View::slotDeleteDocument, this, bp::_1));
//just update the dagview when the gui process is idle.
connect(QAbstractEventDispatcher::instance(), SIGNAL(awake()), this, SLOT(awakeSlot()));
connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::awake,
this, &View::awakeSlot);
}
View::~View()

View File

@@ -57,7 +57,7 @@ DemoMode::DemoMode(QWidget* /*parent*/, Qt::WindowFlags fl)
wasHidden = false;
showHideTimer = new QTimer(this);
showHideTimer->setInterval(5000);
connect(showHideTimer, SIGNAL(timeout()), this, SLOT(hide()));
connect(showHideTimer, &QTimer::timeout, this, &DemoMode::hide);
}
/** Destroys the object and frees any allocated resources */

View File

@@ -386,10 +386,8 @@ IconDialog::IconDialog(QWidget* parent)
ui->setupUi(this);
ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// signals and slots connections
connect(ui->listWidget, SIGNAL(itemClicked (QListWidgetItem *)),
this, SLOT(accept()));
connect(ui->addButton, SIGNAL(clicked()),
this, SLOT(onAddIconPath()));
connect(ui->listWidget, &QListWidget::itemClicked, this, &IconDialog::accept);
connect(ui->addButton, &QPushButton::clicked, this, &IconDialog::onAddIconPath);
QListWidgetItem* item;
QStringList names = BitmapFactory().findIconFiles();
@@ -503,10 +501,8 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
resize(600,400);
auto buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()),
this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::accepted, this, &IconFolders::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &IconFolders::reject);
gridLayout = new QGridLayout();
auto mainLayout = new QGridLayout(this);
@@ -536,7 +532,7 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
}
buttonMap.append(qMakePair(edit, removeButton));
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeFolder()));
connect(removeButton, &QPushButton::clicked, this, &IconFolders::removeFolder);
}
textLabel = new QLabel(this);
@@ -547,7 +543,7 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
gridLayout->addWidget(textLabel, maxRow, 0, 1, 1);
gridLayout->addWidget(addButton, maxRow, 1, 1, 1);
connect(addButton, SIGNAL(clicked()), this, SLOT(addFolder()));
connect(addButton, &QPushButton::clicked, this, &IconFolders::addFolder);
if (numPaths >= this->maxLines)
addButton->setDisabled(true);
}

View File

@@ -120,9 +120,10 @@ DlgCheckableMessageBox::DlgCheckableMessageBox(QWidget *parent) :
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_d->ui.setupUi(this);
m_d->ui.pixmapLabel->setVisible(false);
connect(m_d->ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_d->ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_d->ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotClicked(QAbstractButton*)));
connect(m_d->ui.buttonBox, &QDialogButtonBox::accepted, this, &DlgCheckableMessageBox::accept);
connect(m_d->ui.buttonBox, &QDialogButtonBox::rejected, this, &DlgCheckableMessageBox::reject);
connect(m_d->ui.buttonBox, &QDialogButtonBox::clicked,
this, &DlgCheckableMessageBox::slotClicked);
}
DlgCheckableMessageBox::~DlgCheckableMessageBox()

View File

@@ -73,10 +73,10 @@ DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
ui->categoryTreeWidget->setPalette( pal );
connect(ui->commandTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(onDescription(QTreeWidgetItem*)));
connect(ui->categoryTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(onGroupActivated(QTreeWidgetItem*)));
connect(ui->commandTreeWidget, &QTreeWidget::currentItemChanged,
this, &DlgCustomCommandsImp::onDescription);
connect(ui->commandTreeWidget, &QTreeWidget::currentItemChanged,
this, &DlgCustomCommandsImp::onGroupActivated);
CommandManager & cCmdMgr = Application::Instance->commandManager();
std::map<std::string,Command*> sCommands = cCmdMgr.getCommands();

View File

@@ -57,8 +57,10 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path,
ui->setupUi(this);
// Connect signal(s)
connect(ui->expression, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
connect(ui->discardBtn, SIGNAL(clicked()), this, SLOT(setDiscarded()));
connect(ui->expression, &ExpressionLineEdit::textChanged,
this, &DlgExpressionInput::textChanged);
connect(ui->discardBtn, &QPushButton::clicked,
this, &DlgExpressionInput::setDiscarded);
if (expression) {
ui->expression->setText(Base::Tools::fromStdString(expression->toString()));

View File

@@ -54,8 +54,8 @@ DlgInputDialogImp::DlgInputDialogImp( const QString& labelTxt, QWidget* parent,
setType(type);
resize(qMax(sh.width(), 400), 1);
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(tryAccept()));
connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
connect(ui->lineEdit, &QLineEdit::returnPressed, this, &DlgInputDialogImp::tryAccept);
connect(ui->lineEdit, &QLineEdit::textChanged, this, &DlgInputDialogImp::textChanged);
}
/**

View File

@@ -158,22 +158,19 @@ void DlgObjectSelection::init(const std::vector<App::DocumentObject*> &objs,
useOriginalsBtn->setToolTip(tr("Ignore dependencies and proceed with objects\noriginally selected prior to opening this dialog"));
ui->buttonBox->addButton(useOriginalsBtn, QDialogButtonBox::ResetRole);
connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(onObjItemChanged(QTreeWidgetItem*,int)));
connect(ui->depList, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(onDepItemChanged(QTreeWidgetItem*,int)));
connect(ui->inList, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(onDepItemChanged(QTreeWidgetItem*,int)));
connect(ui->treeWidget, SIGNAL(itemSelectionChanged()),
this, SLOT(onItemSelectionChanged()));
connect(useOriginalsBtn, SIGNAL(clicked()),
this, SLOT(onUseOriginalsBtnClicked()));
connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &DlgObjectSelection::onObjItemChanged);
connect(ui->depList, &QTreeWidget::itemChanged, this, &DlgObjectSelection::onDepItemChanged);
connect(ui->inList, &QTreeWidget::itemChanged, this, &DlgObjectSelection::onDepItemChanged);
connect(ui->treeWidget, &QTreeWidget::itemSelectionChanged,
this, &DlgObjectSelection::onItemSelectionChanged);
connect(useOriginalsBtn, &QPushButton::clicked,
this, &DlgObjectSelection::onUseOriginalsBtnClicked);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DlgObjectSelection::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &DlgObjectSelection::reject);
timer.setSingleShot(true);
connect(&timer, SIGNAL(timeout()), this, SLOT(checkItemChanged()));
connect(&timer, &QTimer::timeout, this, &DlgObjectSelection::checkItemChanged);
}
/**

View File

@@ -98,8 +98,10 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, QWidget*
#endif
QString text = lines.join(QLatin1String("\n"));
ui->textEditComment->setPlainText( text );
connect(ui->pushButtonOpenURL, SIGNAL(clicked()),this, SLOT(open_url()));
connect(ui->comboLicense, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseTypeChanged(int)));
connect(ui->pushButtonOpenURL, &QPushButton::clicked,
this, &DlgProjectInformationImp::open_url);
connect(ui->comboLicense, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgProjectInformationImp::onLicenseTypeChanged);
}
/**

View File

@@ -173,8 +173,8 @@ void DlgSettingsNavigation::loadSettings()
q3 = hCustom->GetFloat("Q3", q3);
}
connect(ui->comboNewDocView, SIGNAL(currentIndexChanged(int)),
this, SLOT(onNewDocViewChanged(int)));
connect(ui->comboNewDocView, qOverload<int>(&QComboBox::currentIndexChanged),
this, &DlgSettingsNavigation::onNewDocViewChanged);
// fill up font styles
hGrp = App::GetApplication().GetParameterGroupByPath(
@@ -338,8 +338,8 @@ CameraDialog::CameraDialog(QWidget* parent)
currentViewButton->setObjectName(QString::fromLatin1("currentView"));
layout->addWidget(currentViewButton, 4, 1, 2, 1);
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
QMetaObject::connectSlotsByName(this);
}