diff --git a/src/Gui/Assistant.cpp b/src/Gui/Assistant.cpp index 18fea10203..83a2c90c24 100644 --- a/src/Gui/Assistant.cpp +++ b/src/Gui/Assistant.cpp @@ -69,10 +69,10 @@ bool Assistant::startAssistant() { if (!proc) { proc = new QProcess(); - connect(proc, SIGNAL(readyReadStandardOutput()), - this, SLOT(readyReadStandardOutput())); - connect(proc, SIGNAL(readyReadStandardError()), - this, SLOT(readyReadStandardError())); + connect(proc, &QProcess::readyReadStandardOutput, + this, &Assistant::readyReadStandardOutput); + connect(proc, &QProcess::readyReadStandardError, + this, &Assistant::readyReadStandardError); } if (proc->state() != QProcess::Running) { diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 403e3832bf..2e6e03e704 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1586,8 +1586,8 @@ void StdCmdAlignment::activated(int iMsg) std::vector sel = Gui::Selection().getObjectsOfType (App::GeoFeature::getClassTypeId()); ManualAlignment* align = ManualAlignment::instance(); - QObject::connect(align, SIGNAL(emitCanceled()), align, SLOT(deleteLater())); - QObject::connect(align, SIGNAL(emitFinished()), align, SLOT(deleteLater())); + QObject::connect(align, &ManualAlignment::emitCanceled, align, &QObject::deleteLater); + QObject::connect(align, &ManualAlignment::emitFinished, align, &QObject::deleteLater); // Get the fixed and moving meshes FixedGroup fixedGroup; diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index b42e3a7c0a..959bda5bfb 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -603,7 +603,7 @@ void CmdTestProgress5::activated(int iMsg) QEventLoop loop; auto thr1 = new BarThread(2000); - QObject::connect(thr1, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(thr1, &QThread::finished, &loop, &QEventLoop::quit); thr1->start(); loop.exec(); @@ -611,7 +611,7 @@ void CmdTestProgress5::activated(int iMsg) QTimer timer; timer.setSingleShot(true); - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); thr2->start(); timer.start(2000); // 2s timeout loop.exec(); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 164257d937..89ef0a83c5 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1863,8 +1863,8 @@ void StdViewScreenShot::activated(int iMsg) fd.setOptionsWidget(FileOptionsDialog::ExtensionRight, opt); fd.setOption(QFileDialog::DontConfirmOverwrite, false); opt->onSelectedFilter(fd.selectedNameFilter()); - QObject::connect(&fd, SIGNAL(filterSelected(const QString&)), - opt, SLOT(onSelectedFilter(const QString&))); + QObject::connect(&fd, &FileOptionsDialog::filterSelected, + opt, &DlgSettingsImageImp::onSelectedFilter); if (fd.exec() == QDialog::Accepted) { selFilter = fd.selectedNameFilter(); diff --git a/src/Gui/DemoMode.cpp b/src/Gui/DemoMode.cpp index 87a8c51a24..7774d29857 100644 --- a/src/Gui/DemoMode.cpp +++ b/src/Gui/DemoMode.cpp @@ -51,7 +51,7 @@ DemoMode::DemoMode(QWidget* /*parent*/, Qt::WindowFlags fl) timer = new QTimer(this); timer->setInterval(1000 * ui->timeout->value()); - connect(timer, SIGNAL(timeout()), this, SLOT(onAutoPlay())); + connect(timer, &QTimer::timeout, this, &DemoMode::onAutoPlay); oldvalue = ui->angleSlider->value(); wasHidden = false; diff --git a/src/Gui/DlgCustomizeImp.cpp b/src/Gui/DlgCustomizeImp.cpp index 2189ff3f05..858267a30b 100644 --- a/src/Gui/DlgCustomizeImp.cpp +++ b/src/Gui/DlgCustomizeImp.cpp @@ -97,8 +97,8 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl) // connections // - connect(buttonHelp, SIGNAL (clicked()), getMainWindow(), SLOT (whatsThis())); - connect(buttonClose, SIGNAL (clicked()), this, SLOT (close())); + connect(buttonHelp, &QPushButton::clicked, getMainWindow(), &MainWindow::whatsThis); + connect(buttonClose, &QPushButton::clicked, this, &QDialog::close); } /** diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 9db1fe01c2..cfc334fb7b 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -660,8 +660,8 @@ ParameterValue::ParameterValue( QWidget * parent ) newUlgAct = menuNew->addAction(tr("New unsigned item"), this, SLOT(onCreateUIntItem())); newBlnAct = menuNew->addAction(tr("New Boolean item"), this, SLOT(onCreateBoolItem())); - connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), - this, SLOT(onChangeSelectedItem(QTreeWidgetItem*, int))); + connect(this, &ParameterValue::itemDoubleClicked, + this, qOverload(&ParameterValue::onChangeSelectedItem)); } ParameterValue::~ParameterValue() diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp index 5062e388e4..8b26bd8b5d 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -57,7 +57,8 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) ui->comboBoxScheme->addItem(item, i); } - connect(ui->ValueInput, SIGNAL(valueChanged(Base::Quantity)), this, SLOT(valueChanged(Base::Quantity))); + connect(ui->ValueInput, qOverload(&InputField::valueChanged), + this, &DlgUnitsCalculator::valueChanged); connect(ui->ValueInput, &InputField::returnPressed, this, &DlgUnitsCalculator::returnPressed); connect(ui->ValueInput, &InputField::parseError, this, &DlgUnitsCalculator::parseError); diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 7a5b080c3d..cb62a615de 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -145,10 +145,10 @@ QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget, default: break; } - connect(dw, SIGNAL(destroyed(QObject*)), - this, SLOT(onDockWidgetDestroyed(QObject*))); - connect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(onWidgetDestroyed(QObject*))); + connect(dw, &QObject::destroyed, + this, &DockWindowManager::onDockWidgetDestroyed); + connect(widget, &QObject::destroyed, + this, &DockWindowManager::onWidgetDestroyed); // add the widget to the dock widget widget->setParent(dw); @@ -205,10 +205,10 @@ QWidget* DockWindowManager::removeDockWindow(const char* name) widget = dw->widget(); widget->setParent(nullptr); dw->setWidget(nullptr); - disconnect(dw, SIGNAL(destroyed(QObject*)), - this, SLOT(onDockWidgetDestroyed(QObject*))); - disconnect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(onWidgetDestroyed(QObject*))); + disconnect(dw, &QObject::destroyed, + this, &DockWindowManager::onDockWidgetDestroyed); + disconnect(widget, &QObject::destroyed, + this, &DockWindowManager::onWidgetDestroyed); delete dw; // destruct the QDockWidget, i.e. the parent of the widget break; } @@ -231,10 +231,10 @@ void DockWindowManager::removeDockWindow(QWidget* widget) // avoid to destruct the embedded widget widget->setParent(nullptr); dw->setWidget(nullptr); - disconnect(dw, SIGNAL(destroyed(QObject*)), - this, SLOT(onDockWidgetDestroyed(QObject*))); - disconnect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(onWidgetDestroyed(QObject*))); + disconnect(dw, &QObject::destroyed, + this, &DockWindowManager::onDockWidgetDestroyed); + disconnect(widget, &QObject::destroyed, + this, &DockWindowManager::onWidgetDestroyed); delete dw; // destruct the QDockWidget, i.e. the parent of the widget break; } @@ -427,8 +427,8 @@ void DockWindowManager::onWidgetDestroyed(QObject* widget) for (QList::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) { // make sure that the dock widget is not about to being deleted if ((*it)->metaObject() != &QDockWidget::staticMetaObject) { - disconnect(*it, SIGNAL(destroyed(QObject*)), - this, SLOT(onDockWidgetDestroyed(QObject*))); + disconnect(*it, &QObject::destroyed, + this, &DockWindowManager::onDockWidgetDestroyed); d->_dockedWindows.erase(it); break; } diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index db886c086c..984278edea 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -160,10 +160,10 @@ void AutoSaver::saveIfNecessary() NetworkAccessManager::NetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) { - connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), - SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); - connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), - SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); + connect(this, &QNetworkAccessManager::authenticationRequired, + this, &NetworkAccessManager::authenticationRequired); + connect(this, &QNetworkAccessManager::proxyAuthenticationRequired, + this, &NetworkAccessManager::proxyAuthenticationRequired); auto diskCache = new QNetworkDiskCache(this); QString location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); @@ -229,9 +229,9 @@ DownloadItem::DownloadItem(QNetworkReply *reply, bool requestFileName, QWidget * downloadInfoLabel->setPalette(p); progressBar->setMaximum(0); tryAgainButton->hide(); - connect(stopButton, SIGNAL(clicked()), this, SLOT(stop())); - connect(openButton, SIGNAL(clicked()), this, SLOT(open())); - connect(tryAgainButton, SIGNAL(clicked()), this, SLOT(tryAgain())); + connect(stopButton, &QPushButton::clicked, this, &DownloadItem::stop); + connect(openButton, &QPushButton::clicked, this, &DownloadItem::open); + connect(tryAgainButton, &QPushButton::clicked, this, &DownloadItem::tryAgain); init(); } @@ -244,15 +244,15 @@ void DownloadItem::init() // attach to the m_reply m_url = m_reply->url(); m_reply->setParent(this); - connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(downloadProgress(qint64, qint64))); - connect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - connect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); + connect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead); +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + connect(m_reply, qOverload(&QNetworkReply::error), this, &DownloadItem::error); +#else + connect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error); +#endif + connect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress); + connect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged); + connect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished); // reset info downloadInfoLabel->clear(); @@ -496,15 +496,15 @@ void DownloadItem::metaDataChanged() if (url != redirectUrl) { url = redirectUrl; - disconnect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); - disconnect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(error(QNetworkReply::NetworkError))); - disconnect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(downloadProgress(qint64, qint64))); - disconnect(m_reply, SIGNAL(metaDataChanged()), - this, SLOT(metaDataChanged())); - disconnect(m_reply, SIGNAL(finished()), - this, SLOT(finished())); + disconnect(m_reply, &QNetworkReply::readyRead, this, &DownloadItem::downloadReadyRead); +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + disconnect(m_reply, qOverload(&QNetworkReply::error), this, &DownloadItem::error); +#else + disconnect(m_reply, &QNetworkReply::errorOccurred, this, &DownloadItem::error); +#endif + disconnect(m_reply, &QNetworkReply::downloadProgress, this, &DownloadItem::downloadProgress); + disconnect(m_reply, &QNetworkReply::metaDataChanged, this, &DownloadItem::metaDataChanged); + disconnect(m_reply, &QNetworkReply::finished, this, &DownloadItem::finished); m_reply->close(); m_reply->deleteLater(); diff --git a/src/Gui/DownloadManager.cpp b/src/Gui/DownloadManager.cpp index 98a76aa0b8..786eca7632 100644 --- a/src/Gui/DownloadManager.cpp +++ b/src/Gui/DownloadManager.cpp @@ -70,7 +70,7 @@ DownloadManager::DownloadManager(QWidget *parent) ui->downloadsView->horizontalHeader()->setStretchLastSection(true); m_model = new DownloadModel(this); ui->downloadsView->setModel(m_model); - connect(ui->cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup())); + connect(ui->cleanupButton, &QPushButton::clicked, this, &DownloadManager::cleanup); load(); Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); @@ -167,7 +167,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool reques void DownloadManager::addItem(DownloadItem *item) { - connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow())); + connect(item, &DownloadItem::statusChanged, this, &DownloadManager::updateRow); int row = m_downloads.count(); m_model->beginInsertRows(QModelIndex(), row, row); m_downloads.append(item); diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index de3a4a654f..708acbf93d 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -60,7 +60,7 @@ using namespace Gui; namespace Gui { class EditorViewP { public: - QPlainTextEdit* textEdit; + TextEdit* textEdit; SearchBar* searchBar; QString fileName; EditorView::DisplayName displayName; @@ -83,8 +83,9 @@ TYPESYSTEM_SOURCE_ABSTRACT(Gui::EditorView, Gui::MDIView) * Constructs a EditorView which is a child of 'parent', with the * name 'name'. */ -EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent) - : MDIView(nullptr,parent,Qt::WindowFlags()), WindowParameter( "Editor" ) +EditorView::EditorView(TextEdit* editor, QWidget* parent) + : MDIView(nullptr, parent, Qt::WindowFlags()) + , WindowParameter( "Editor" ) { d = new EditorViewP; d->lock = false; @@ -100,13 +101,13 @@ EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent) // update editor actions on request Gui::MainWindow* mw = Gui::getMainWindow(); - connect(editor, SIGNAL(undoAvailable(bool)), mw, SLOT(updateEditorActions())); - connect(editor, SIGNAL(redoAvailable(bool)), mw, SLOT(updateEditorActions())); - connect(editor, SIGNAL(copyAvailable(bool)), mw, SLOT(updateEditorActions())); + connect(editor, &QPlainTextEdit::undoAvailable, mw, &MainWindow::updateEditorActions); + connect(editor, &QPlainTextEdit::redoAvailable, mw, &MainWindow::updateEditorActions); + connect(editor, &QPlainTextEdit::copyAvailable, mw, &MainWindow::updateEditorActions); - connect(editor, SIGNAL(showSearchBar()), d->searchBar, SLOT(activate())); - connect(editor, SIGNAL(findNext()), d->searchBar, SLOT(findNext())); - connect(editor, SIGNAL(findPrevious()), d->searchBar, SLOT(findPrevious())); + connect(editor, &TextEdit::showSearchBar, d->searchBar, &SearchBar::activate); + connect(editor, &TextEdit::findNext, d->searchBar, &SearchBar::findNext); + connect(editor, &TextEdit::findPrevious, d->searchBar, &SearchBar::findPrevious); // Create the layout containing the workspace and a tab bar auto hbox = new QFrame(this); @@ -131,16 +132,16 @@ EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent) hPrefGrp->NotifyAll(); d->activityTimer = new QTimer(this); - connect(d->activityTimer, SIGNAL(timeout()), - this, SLOT(checkTimestamp()) ); - connect(d->textEdit->document(), SIGNAL(modificationChanged(bool)), - this, SLOT(setWindowModified(bool))); - connect(d->textEdit->document(), SIGNAL(undoAvailable(bool)), - this, SLOT(undoAvailable(bool))); - connect(d->textEdit->document(), SIGNAL(redoAvailable(bool)), - this, SLOT(redoAvailable(bool))); - connect(d->textEdit->document(), SIGNAL(contentsChange(int, int, int)), - this, SLOT(contentsChange(int, int, int))); + connect(d->activityTimer, &QTimer::timeout, + this, &EditorView::checkTimestamp); + connect(d->textEdit->document(), &QTextDocument::modificationChanged, + this, &EditorView::setWindowModified); + connect(d->textEdit->document(), &QTextDocument::undoAvailable, + this, &EditorView::undoAvailable); + connect(d->textEdit->document(), &QTextDocument::redoAvailable, + this, &EditorView::redoAvailable); + connect(d->textEdit->document(), &QTextDocument::contentsChange, + this, &EditorView::contentsChange); } /** Destroys the object and frees any allocated resources */ @@ -451,8 +452,8 @@ void EditorView::printPreview() { QPrinter printer(QPrinter::ScreenResolution); QPrintPreviewDialog dlg(&printer, this); - connect(&dlg, SIGNAL(paintRequested (QPrinter *)), - this, SLOT(print(QPrinter *))); + connect(&dlg, &QPrintPreviewDialog::paintRequested, + this, qOverload(&EditorView::print)); dlg.exec(); } @@ -591,8 +592,8 @@ TYPESYSTEM_SOURCE_ABSTRACT(Gui::PythonEditorView, Gui::EditorView) PythonEditorView::PythonEditorView(PythonEditor* editor, QWidget* parent) : EditorView(editor, parent), _pye(editor) { - connect(this, SIGNAL(changeFileName(const QString&)), - editor, SLOT(setFileName(const QString&))); + connect(this, &PythonEditorView::changeFileName, + editor, &PythonEditor::setFileName); } PythonEditorView::~PythonEditorView() diff --git a/src/Gui/EditorView.h b/src/Gui/EditorView.h index 19a700246b..3a09321fb0 100644 --- a/src/Gui/EditorView.h +++ b/src/Gui/EditorView.h @@ -40,6 +40,7 @@ QT_END_NAMESPACE namespace Gui { class EditorViewP; +class TextEdit; /** * A special view class which sends the messages from the application to @@ -59,7 +60,7 @@ public: BaseName }; - EditorView(QPlainTextEdit* editor, QWidget* parent); + EditorView(TextEdit* editor, QWidget* parent); ~EditorView() override; QPlainTextEdit* getEditor() const; diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 8cd81e1c5b..a6320fb7c8 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -451,7 +451,7 @@ FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl ) auto grid = this->findChild(); grid->addWidget(extensionButton, 4, 2, Qt::AlignLeft); - connect(extensionButton, SIGNAL(clicked()), this, SLOT(toggleExtension())); + connect(extensionButton, &QPushButton::clicked, this, &FileOptionsDialog::toggleExtension); } FileOptionsDialog::~FileOptionsDialog() @@ -685,7 +685,7 @@ FileChooser::FileChooser ( QWidget * parent ) layout->addWidget(button); - connect( button, SIGNAL(clicked()), this, SLOT(chooseFile())); + connect(button, &QPushButton::clicked, this, &FileChooser::chooseFile); setFocusProxy(lineEdit); } @@ -907,8 +907,12 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types gridLayout->addLayout(hboxLayout, 2, 0, 1, 1); // connections - connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); - connect(group, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked())); + connect(okButton, &QPushButton::clicked, this, &SelectModule::accept); +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + connect(group, qOverload(&QButtonGroup::buttonClicked), this, &SelectModule::onButtonClicked); +#else + connect(group, &QButtonGroup::idClicked, this, &SelectModule::onButtonClicked); +#endif } SelectModule::~SelectModule() diff --git a/src/Gui/GraphvizView.cpp b/src/Gui/GraphvizView.cpp index 510f2cb65f..871f8f779d 100644 --- a/src/Gui/GraphvizView.cpp +++ b/src/Gui/GraphvizView.cpp @@ -248,10 +248,10 @@ GraphvizView::GraphvizView(App::Document & _doc, QWidget* parent) // Create worker thread thread = new GraphvizWorker(this); - connect(thread, SIGNAL(emitFinished()), this, SLOT(done())); - connect(thread, SIGNAL(finished()), this, SLOT(done())); - connect(thread, SIGNAL(error()), this, SLOT(error())); - connect(thread, SIGNAL(svgFileRead(const QByteArray &)), this, SLOT(svgFileRead(const QByteArray &))); + connect(thread, &GraphvizWorker::emitFinished, this, &GraphvizView::done); + connect(thread, &GraphvizWorker::finished, this, &GraphvizView::done); + connect(thread, &GraphvizWorker::error, this, &GraphvizView::error); + connect(thread, &GraphvizWorker::svgFileRead, this, &GraphvizView::svgFileRead); // Connect signal from document recomputeConnection = _doc.signalRecomputed.connect(boost::bind(&GraphvizView::updateSvgItem, this, bp::_1)); @@ -556,8 +556,8 @@ void GraphvizView::printPreview() printer.setPageOrientation(QPageLayout::Landscape); QPrintPreviewDialog dlg(&printer, this); - connect(&dlg, SIGNAL(paintRequested (QPrinter *)), - this, SLOT(print(QPrinter *))); + connect(&dlg, &QPrintPreviewDialog::paintRequested, + this, qOverload(&GraphvizView::print)); dlg.exec(); } diff --git a/src/Gui/GuiApplication.cpp b/src/Gui/GuiApplication.cpp index 2ffac946d0..a0f27370a8 100644 --- a/src/Gui/GuiApplication.cpp +++ b/src/Gui/GuiApplication.cpp @@ -59,8 +59,8 @@ using namespace Gui; GUIApplication::GUIApplication(int & argc, char ** argv) : GUIApplicationNativeEventAware(argc, argv) { - connect(this, SIGNAL(commitDataRequest(QSessionManager&)), - SLOT(commitData(QSessionManager&)), Qt::DirectConnection); + connect(this, &GUIApplication::commitDataRequest, + this, &GUIApplication::commitData, Qt::DirectConnection); #if QT_VERSION < QT_VERSION_CHECK(6,0,0) setFallbackSessionManagementEnabled(false); #endif @@ -200,8 +200,8 @@ public: { // Start a QLocalServer to listen for connections server = new QLocalServer(); - QObject::connect(server, SIGNAL(newConnection()), - q_ptr, SLOT(receiveConnection())); + QObject::connect(server, &QLocalServer::newConnection, + q_ptr, &GUISingleApplication::receiveConnection); // first attempt if (!server->listen(serverName)) { if (server->serverError() == QAbstractSocket::AddressInUseError) { @@ -231,7 +231,7 @@ GUISingleApplication::GUISingleApplication(int & argc, char ** argv) d_ptr(new Private(this)) { d_ptr->setupConnection(); - connect(d_ptr->timer, SIGNAL(timeout()), this, SLOT(processMessages())); + connect(d_ptr->timer, &QTimer::timeout, this, &GUISingleApplication::processMessages); } GUISingleApplication::~GUISingleApplication() @@ -274,8 +274,8 @@ void GUISingleApplication::receiveConnection() if (!socket) return; - connect(socket, SIGNAL(disconnected()), - socket, SLOT(deleteLater())); + connect(socket, &QLocalSocket::disconnected, + socket, &QLocalSocket::deleteLater); if (socket->waitForReadyRead()) { QDataStream in(socket); if (!in.atEnd()) { diff --git a/src/Gui/InputVector.cpp b/src/Gui/InputVector.cpp index b7a4024d8f..e8c22df47b 100644 --- a/src/Gui/InputVector.cpp +++ b/src/Gui/InputVector.cpp @@ -74,8 +74,8 @@ LocationWidget::LocationWidget (QWidget * parent) auto gridLayout = new QGridLayout(this); gridLayout->addLayout(box, 0, 0, 1, 2); - connect(dValue, SIGNAL(activated(int)), - this, SLOT(on_direction_activated(int))); + connect(dValue, qOverload(&QComboBox::activated), + this, &LocationWidget::on_direction_activated); retranslateUi(); } diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index bfb317e94b..3a7bd1fee3 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -264,8 +264,8 @@ void MDIView::printPreview() { QPrinter printer(QPrinter::ScreenResolution); QPrintPreviewDialog dlg(&printer, this); - connect(&dlg, SIGNAL(paintRequested (QPrinter *)), - this, SLOT(print(QPrinter *))); + connect(&dlg, &QPrintPreviewDialog::paintRequested, + this, qOverload(&MDIView::print)); dlg.exec(); } diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index f12db04696..2e924daad0 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -820,7 +820,7 @@ void ManualAlignment::startAlignment(Base::Type mousemodel) : tr("Please, select at least %1 points in the left and the right view").arg(n); myViewer->myLabel->setText(msg); - connect(myViewer, SIGNAL(destroyed()), this, SLOT(reset())); + connect(myViewer, &QObject::destroyed, this, &ManualAlignment::reset); // show all aligned views in the 2nd view myFixedGroup.addToViewer(myViewer->getViewer(1)); diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index 2affba60d6..15f25344a1 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -91,11 +91,11 @@ NetworkRetriever::NetworkRetriever( QObject * parent ) wget = new QProcess(this); // if wgets exits emit signal - connect(wget, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(wgetFinished(int, QProcess::ExitStatus))); + connect(wget, qOverload(&QProcess::finished), + this, &NetworkRetriever::wgetFinished); // if application quits kill wget immediately to avoid dangling processes - connect( qApp, SIGNAL(lastWindowClosed()), wget, SLOT(kill()) ); + connect(qApp, &QApplication::lastWindowClosed, wget, &QProcess::kill); } NetworkRetriever::~NetworkRetriever() @@ -406,7 +406,7 @@ StdCmdDownloadOnlineHelp::StdCmdDownloadOnlineHelp( QObject * parent) wget->setFollowRelative( false ); wget->setNoParent( true ); - connect( wget, SIGNAL( wgetExited() ), this, SLOT( wgetFinished() ) ); + connect(wget, &NetworkRetriever::wgetExited, this, &StdCmdDownloadOnlineHelp::wgetFinished); } StdCmdDownloadOnlineHelp::~StdCmdDownloadOnlineHelp() diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index 0343a7a815..9a1a9b8bb7 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -288,8 +288,8 @@ void HttpServer::incomingConnection(qintptr socket) // works asynchronously, this means that all the communication is done // in the two slots readClient() and discardClient(). auto s = new QTcpSocket(this); - connect(s, SIGNAL(readyRead()), this, SLOT(readClient())); - connect(s, SIGNAL(disconnected()), this, SLOT(discardClient())); + connect(s, &QTcpSocket::readyRead, this, &HttpServer::readClient); + connect(s, &QTcpSocket::disconnected, this, &HttpServer::discardClient); s->setSocketDescriptor(socket); } diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index 7e9a482c89..82109e18f2 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -398,7 +398,7 @@ ProgressBar::ProgressBar (SequencerBar* s, QWidget * parent) d->minimumDuration = 2000; // 2 seconds d->delayShowTimer = new QTimer(this); d->delayShowTimer->setSingleShot(true); - connect(d->delayShowTimer, SIGNAL(timeout()), this, SLOT(delayedShow())); + connect(d->delayShowTimer, &QTimer::timeout, this, &ProgressBar::delayedShow); d->observeEventFilter = 0; setFixedWidth(120); @@ -410,7 +410,7 @@ ProgressBar::ProgressBar (SequencerBar* s, QWidget * parent) ProgressBar::~ProgressBar () { - disconnect(d->delayShowTimer, SIGNAL(timeout()), this, SLOT(delayedShow())); + disconnect(d->delayShowTimer, &QTimer::timeout, this, &ProgressBar::delayedShow); delete d->delayShowTimer; delete d; } diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 4930344205..d01b969860 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -76,7 +76,7 @@ PropertyView::PropertyView(QWidget *parent) timer = new QTimer(this); timer->setSingleShot(true); - connect(timer, SIGNAL(timeout()), this, SLOT(onTimer())); + connect(timer, &QTimer::timeout, this, &PropertyView::onTimer); tabs = new QTabWidget (this); tabs->setObjectName(QString::fromUtf8("propertyTab")); @@ -99,7 +99,7 @@ PropertyView::PropertyView(QWidget *parent) tabs->setCurrentIndex(preferredTab); // connect after adding all tabs, so adding doesn't thrash the parameter - connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); + connect(tabs, &QTabWidget::currentChanged, this, &PropertyView::tabChanged); this->connectPropData = App::GetApplication().signalChangedObject.connect(boost::bind diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index e152d5cdd7..11def4e544 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1429,7 +1429,7 @@ QString PythonConsole::readline( ) printPrompt(PythonConsole::Special); this->_sourceDrain = &inputBuffer; //< enable source drain ... // ... and wait until we get notified about pendingSource - QObject::connect( this, SIGNAL(pendingSource()), &loop, SLOT(quit()) ); + QObject::connect( this, &PythonConsole::pendingSource, &loop, &QEventLoop::quit); // application is about to quit if (loop.exec() != 0) { PyErr_SetInterrupt(); diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index 81c472b379..b45f071fb5 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -616,7 +616,7 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha if (bp.checkLine(line)) { dbg->showDebugMarker(file, line); QEventLoop loop; - QObject::connect(dbg, SIGNAL(signalNextStep()), &loop, SLOT(quit())); + QObject::connect(dbg, &PythonDebugger::signalNextStep, &loop, &QEventLoop::quit); loop.exec(); dbg->hideDebugMarker(file); } diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index cabf9b0ae8..b4c5a81d7a 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -58,7 +58,7 @@ void ActionGroup::init(bool header) vbl->addWidget(myDummy); myDummy->hide(); - connect(myHeader, SIGNAL(activated()), this, SLOT(showHide())); + connect(myHeader, &TaskHeader::activated, this, &ActionGroup::showHide); } void ActionGroup::setScheme(ActionPanelScheme *pointer) diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp index 871043cf3a..aa4701f4c2 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.cpp +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -37,7 +37,7 @@ TaskHeader::TaskHeader(const QIcon &icon, const QString &title, bool expandable, myTitle->setIcon(icon); myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - connect(myTitle, SIGNAL(clicked()), this, SLOT(fold())); + connect(myTitle, &ActionLabel::clicked, this, &TaskHeader::fold); QHBoxLayout *hbl = new QHBoxLayout(); hbl->setContentsMargins(2, 2, 2, 2); diff --git a/src/Gui/Quarter/ContextMenu.cpp b/src/Gui/Quarter/ContextMenu.cpp index 3b9c54cda0..9cd4e1becd 100644 --- a/src/Gui/Quarter/ContextMenu.cpp +++ b/src/Gui/Quarter/ContextMenu.cpp @@ -105,25 +105,25 @@ ContextMenu::ContextMenu(QuarterWidget * quarterwidget) functionsmenu->addAction(viewall); functionsmenu->addAction(seek); - QObject::connect(seek, SIGNAL(triggered()), - this->quarterwidget, SLOT(seek())); + QObject::connect(seek, &QAction::triggered, + this->quarterwidget, &QuarterWidget::seek); - QObject::connect(viewall, SIGNAL(triggered()), - this->quarterwidget, SLOT(viewAll())); + QObject::connect(viewall, &QAction::triggered, + this->quarterwidget, &QuarterWidget::viewAll); // FIXME: It would be ideal to expose these actiongroups to Qt // Designer and be able to connect them to the appropriate slots on // QuarterWidget, but this is not possible in Qt. Exposing every // single action is supposed to work, but it doesn't at the // moment. (20081215 frodo) - QObject::connect(rendermodegroup, SIGNAL(triggered(QAction *)), - this, SLOT(changeRenderMode(QAction *))); + QObject::connect(rendermodegroup, &QActionGroup::triggered, + this, &ContextMenu::changeRenderMode); - QObject::connect(stereomodegroup, SIGNAL(triggered(QAction *)), - this, SLOT(changeStereoMode(QAction *))); + QObject::connect(stereomodegroup, &QActionGroup::triggered, + this, &ContextMenu::changeStereoMode); - QObject::connect(transparencytypegroup, SIGNAL(triggered(QAction *)), - this, SLOT(changeTransparencyType(QAction *))); + QObject::connect(transparencytypegroup, &QActionGroup::triggered, + this, &ContextMenu::changeTransparencyType); } ContextMenu::~ContextMenu() diff --git a/src/Gui/Quarter/SensorManager.cpp b/src/Gui/Quarter/SensorManager.cpp index b453a03e32..f0fd0c2418 100644 --- a/src/Gui/Quarter/SensorManager.cpp +++ b/src/Gui/Quarter/SensorManager.cpp @@ -50,8 +50,8 @@ SensorManager::SensorManager() this->mainthreadid = cc_thread_id(); this->signalthread = new SignalThread(); - QObject::connect(this->signalthread, SIGNAL(triggerSignal()), - this, SLOT(sensorQueueChanged())); + QObject::connect(this->signalthread, &SignalThread::triggerSignal, + this, &SensorManager::sensorQueueChanged); this->idletimer = new QTimer; this->delaytimer = new QTimer; @@ -61,9 +61,9 @@ SensorManager::SensorManager() this->delaytimer->setSingleShot(true); this->timerqueuetimer->setSingleShot(true); - this->connect(this->idletimer, SIGNAL(timeout(void)), this, SLOT(idleTimeout())); - this->connect(this->delaytimer, SIGNAL(timeout(void)), this, SLOT(delayTimeout())); - this->connect(this->timerqueuetimer, SIGNAL(timeout(void)), this, SLOT(timerQueueTimeout())); + this->connect(this->idletimer, &QTimer::timeout, this, &SensorManager::idleTimeout); + this->connect(this->delaytimer, &QTimer::timeout, this, &SensorManager::delayTimeout); + this->connect(this->timerqueuetimer, &QTimer::timeout, this, &SensorManager::timerQueueTimeout); SoDB::getSensorManager()->setChangedCallback(SensorManager::sensorQueueChangedCB, this); this->timerEpsilon = 1.0 / 5000.0; diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index 9597824d89..6ae6bf6991 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -100,16 +100,15 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent) resize(200, 200); - connect(clearButton, SIGNAL(clicked()), searchBox, SLOT(clear())); - connect(searchBox, SIGNAL(textChanged(QString)), this, SLOT(search(QString))); - connect(searchBox, SIGNAL(editingFinished()), this, SLOT(validateSearch())); - connect(selectionView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleSelect(QListWidgetItem*))); - connect(selectionView, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(preselect(QListWidgetItem*))); - connect(pickList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(toggleSelect(QListWidgetItem*))); - connect(pickList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(preselect(QListWidgetItem*))); - connect(selectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onItemContextMenu(QPoint))); - connect(enablePickList, SIGNAL(stateChanged(int)), this, SLOT(onEnablePickList())); - + connect(clearButton, &QToolButton::clicked, searchBox, &QLineEdit::clear); + connect(searchBox, &QLineEdit::textChanged, this, &SelectionView::search); + connect(searchBox, &QLineEdit::editingFinished, this, &SelectionView::validateSearch); + connect(selectionView, &QListWidget::itemDoubleClicked, this, &SelectionView::toggleSelect); + connect(selectionView, &QListWidget::itemEntered, this, &SelectionView::preselect); + connect(pickList, &QListWidget::itemDoubleClicked, this, &SelectionView::toggleSelect); + connect(pickList, &QListWidget::itemEntered, this, &SelectionView::preselect); + connect(selectionView, &QListWidget::customContextMenuRequested, this, &SelectionView::onItemContextMenu); + connect(enablePickList, &QCheckBox::stateChanged, this, &SelectionView::onEnablePickList); } SelectionView::~SelectionView() diff --git a/src/Gui/TaskCSysDragger.cpp b/src/Gui/TaskCSysDragger.cpp index c99dffffd3..2b2a952555 100644 --- a/src/Gui/TaskCSysDragger.cpp +++ b/src/Gui/TaskCSysDragger.cpp @@ -101,8 +101,8 @@ void TaskCSysDragger::setupGui() incrementsBox->groupLayout()->addLayout(gridLayout); Content.push_back(incrementsBox); - connect(tSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onTIncrementSlot(double))); - connect(rSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onRIncrementSlot(double))); + connect(tSpinBox, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCSysDragger::onTIncrementSlot); + connect(rSpinBox, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCSysDragger::onRIncrementSlot); } void TaskCSysDragger::onTIncrementSlot(double freshValue) diff --git a/src/Gui/TaskDlgRelocation.cpp b/src/Gui/TaskDlgRelocation.cpp index 195c49ba4d..6a2b6d6845 100644 --- a/src/Gui/TaskDlgRelocation.cpp +++ b/src/Gui/TaskDlgRelocation.cpp @@ -48,8 +48,6 @@ TaskBoxPosition::TaskBoxPosition(QWidget *parent) QMetaObject::connectSlotsByName(this); this->groupLayout()->addWidget(proxy); - - //QObject::connect(ui->horizontalSlider_Axis1,SIGNAL(sliderMoved(int)),this,SLOT(changeSliderA1(int))); } TaskBoxPosition::~TaskBoxPosition() @@ -75,8 +73,6 @@ TaskBoxAngle::TaskBoxAngle(QWidget *parent) QMetaObject::connectSlotsByName(this); this->groupLayout()->addWidget(proxy); - - //QObject::connect(ui->horizontalSlider_Axis1,SIGNAL(sliderMoved(int)),this,SLOT(changeSliderA1(int))); } TaskBoxAngle::~TaskBoxAngle() @@ -95,20 +91,6 @@ TaskBoxAngle::~TaskBoxAngle() TaskDlgRelocation::TaskDlgRelocation() : TaskDialog() { - /* rob = new TaskRobot6Axis(pcRobotObject); - ctr = new TaskRobotControl(pcRobotObject); - - trac = new TaskTrajectory(pcRobotObject,pcTrajectoryObject); - msg = new TaskRobotMessages(pcRobotObject); - - - QObject::connect(trac ,SIGNAL(axisChanged(float,float,float,float,float,float,const Base::Placement &)), - rob ,SLOT (setAxis(float,float,float,float,float,float,const Base::Placement &))); - - Content.push_back(rob); - Content.push_back(ctr); - Content.push_back(trac); - Content.push_back(msg);*/ } TaskDlgRelocation::~TaskDlgRelocation() @@ -121,8 +103,6 @@ TaskDlgRelocation::~TaskDlgRelocation() void TaskDlgRelocation::open() { - //msg->hideGroupBox(); - //ctr->hideGroupBox(); } void TaskDlgRelocation::clicked(int) diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 5d20f9107d..4d225c1dc7 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -482,14 +482,14 @@ void TaskView::showDialog(TaskDialog *dlg) TaskDialogAttorney::setButtonBox(dlg, ActiveCtrl->buttonBox); // make connection to the needed signals - connect(ActiveCtrl->buttonBox,SIGNAL(accepted()), - this,SLOT(accept())); - connect(ActiveCtrl->buttonBox,SIGNAL(rejected()), - this,SLOT(reject())); - connect(ActiveCtrl->buttonBox,SIGNAL(helpRequested()), - this,SLOT(helpRequested())); - connect(ActiveCtrl->buttonBox,SIGNAL(clicked(QAbstractButton *)), - this,SLOT(clicked(QAbstractButton *))); + connect(ActiveCtrl->buttonBox, &QDialogButtonBox::accepted, + this, &TaskView::accept); + connect(ActiveCtrl->buttonBox, &QDialogButtonBox::rejected, + this, &TaskView::reject); + connect(ActiveCtrl->buttonBox, &QDialogButtonBox::helpRequested, + this, &TaskView::helpRequested); + connect(ActiveCtrl->buttonBox, &QDialogButtonBox::clicked, + this, &TaskView::clicked); const std::vector& cont = dlg->getDialogContent(); diff --git a/src/Gui/TextDocumentEditorView.cpp b/src/Gui/TextDocumentEditorView.cpp index d60ee70930..ed8ccd9e80 100644 --- a/src/Gui/TextDocumentEditorView.cpp +++ b/src/Gui/TextDocumentEditorView.cpp @@ -53,9 +53,9 @@ TextDocumentEditorView::TextDocumentEditorView( // update editor actions on request Gui::MainWindow* mw = Gui::getMainWindow(); - connect(editor, SIGNAL(undoAvailable(bool)), mw, SLOT(updateEditorActions())); - connect(editor, SIGNAL(redoAvailable(bool)), mw, SLOT(updateEditorActions())); - connect(editor, SIGNAL(copyAvailable(bool)), mw, SLOT(updateEditorActions())); + connect(editor, &QPlainTextEdit::undoAvailable, mw, &MainWindow::updateEditorActions); + connect(editor, &QPlainTextEdit::redoAvailable, mw, &MainWindow::updateEditorActions); + connect(editor, &QPlainTextEdit::copyAvailable, mw, &MainWindow::updateEditorActions); } TextDocumentEditorView::~TextDocumentEditorView() @@ -97,8 +97,8 @@ bool TextDocumentEditorView::event(QEvent *event) void TextDocumentEditorView::setupEditor() { - connect(getEditor()->document(), SIGNAL(modificationChanged(bool)), - this, SLOT(setWindowModified(bool))); + connect(getEditor()->document(), &QTextDocument::modificationChanged, + this, &TextDocumentEditorView::setWindowModified); setWindowTitle(QString::fromUtf8(textDocument->Label.getValue()) + QString::fromLatin1("[*]")); getEditor()->setPlainText( diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index 4503621f8a..d57b820def 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -535,8 +535,8 @@ CompletionList::CompletionList(QPlainTextEdit* parent) pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText)); parent->setPalette( pal ); - connect(this, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(completionItem(QListWidgetItem *))); + connect(this, &CompletionList::itemActivated, + this, &CompletionList::completionItem); } CompletionList::~CompletionList() diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp index c6379bbd1a..f79bdf71b4 100644 --- a/src/Gui/Transform.cpp +++ b/src/Gui/Transform.cpp @@ -298,12 +298,17 @@ Transform::Transform(QWidget* parent, Qt::WindowFlags fl) int id = 1; QList sb = this->findChildren(); for (const auto & it : sb) { - connect(it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map())); + connect(it, qOverload(&QuantitySpinBox::valueChanged), signalMapper, qOverload<>(&QSignalMapper::map)); signalMapper->setMapping(it, id++); } - connect(signalMapper, SIGNAL(mapped(int)), - this, SLOT(onTransformChanged(int))); +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + connect(signalMapper, qOverload(&QSignalMapper::mapped), + this, &Transform::onTransformChanged); +#else + connect(signalMapper, &QSignalMapper::mappedInt, + this, &Transform::onTransformChanged); +#endif setTransformStrategy(new DefaultTransformStrategy(this)); } diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 16c9eff9ce..85d50ca154 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -404,63 +404,63 @@ TreeWidget::TreeWidget(const char* name, QWidget* parent) this->showHiddenAction = new QAction(this); this->showHiddenAction->setCheckable(true); - connect(this->showHiddenAction, SIGNAL(triggered()), - this, SLOT(onShowHidden())); + connect(this->showHiddenAction, &QAction::triggered, + this, &TreeWidget::onShowHidden); this->hideInTreeAction = new QAction(this); this->hideInTreeAction->setCheckable(true); - connect(this->hideInTreeAction, SIGNAL(triggered()), - this, SLOT(onHideInTree())); + connect(this->hideInTreeAction, &QAction::triggered, + this, &TreeWidget::onHideInTree); this->createGroupAction = new QAction(this); - connect(this->createGroupAction, SIGNAL(triggered()), - this, SLOT(onCreateGroup())); + connect(this->createGroupAction, &QAction::triggered, + this, &TreeWidget::onCreateGroup); this->relabelObjectAction = new QAction(this); #ifndef Q_OS_MAC this->relabelObjectAction->setShortcut(Qt::Key_F2); #endif - connect(this->relabelObjectAction, SIGNAL(triggered()), - this, SLOT(onRelabelObject())); + connect(this->relabelObjectAction, &QAction::triggered, + this, &TreeWidget::onRelabelObject); this->finishEditingAction = new QAction(this); - connect(this->finishEditingAction, SIGNAL(triggered()), - this, SLOT(onFinishEditing())); + connect(this->finishEditingAction, &QAction::triggered, + this, &TreeWidget::onFinishEditing); this->selectDependentsAction = new QAction(this); - connect(this->selectDependentsAction, SIGNAL(triggered()), - this, SLOT(onSelectDependents())); + connect(this->selectDependentsAction, &QAction::triggered, + this, &TreeWidget::onSelectDependents); this->closeDocAction = new QAction(this); - connect(this->closeDocAction, SIGNAL(triggered()), - this, SLOT(onCloseDoc())); + connect(this->closeDocAction, &QAction::triggered, + this, &TreeWidget::onCloseDoc); this->reloadDocAction = new QAction(this); - connect(this->reloadDocAction, SIGNAL(triggered()), - this, SLOT(onReloadDoc())); + connect(this->reloadDocAction, &QAction::triggered, + this, &TreeWidget::onReloadDoc); this->skipRecomputeAction = new QAction(this); this->skipRecomputeAction->setCheckable(true); - connect(this->skipRecomputeAction, SIGNAL(toggled(bool)), - this, SLOT(onSkipRecompute(bool))); + connect(this->skipRecomputeAction, &QAction::toggled, + this, &TreeWidget::onSkipRecompute); this->allowPartialRecomputeAction = new QAction(this); this->allowPartialRecomputeAction->setCheckable(true); - connect(this->allowPartialRecomputeAction, SIGNAL(toggled(bool)), - this, SLOT(onAllowPartialRecompute(bool))); + connect(this->allowPartialRecomputeAction, &QAction::toggled, + this, &TreeWidget::onAllowPartialRecompute); this->markRecomputeAction = new QAction(this); - connect(this->markRecomputeAction, SIGNAL(triggered()), - this, SLOT(onMarkRecompute())); + connect(this->markRecomputeAction, &QAction::triggered, + this, &TreeWidget::onMarkRecompute); this->recomputeObjectAction = new QAction(this); - connect(this->recomputeObjectAction, SIGNAL(triggered()), - this, SLOT(onRecomputeObject())); + connect(this->recomputeObjectAction, &QAction::triggered, + this, &TreeWidget::onRecomputeObject); this->searchObjectsAction = new QAction(this); this->searchObjectsAction->setText(tr("Search...")); this->searchObjectsAction->setStatusTip(tr("Search for objects")); - connect(this->searchObjectsAction, SIGNAL(triggered()), - this, SLOT(onSearchObjects())); + connect(this->searchObjectsAction, &QAction::triggered, + this, &TreeWidget::onSearchObjects); // Setup connections connectNewDocument = Application::Instance->signalNewDocument.connect(boost::bind(&TreeWidget::slotNewDocument, this, bp::_1, bp::_2)); @@ -782,8 +782,8 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) QMenu editMenu; QActionGroup subMenuGroup(&subMenu); subMenuGroup.setExclusive(true); - connect(&subMenuGroup, SIGNAL(triggered(QAction*)), - this, SLOT(onActivateDocument(QAction*))); + connect(&subMenuGroup, &QActionGroup::triggered, + this, &TreeWidget::onActivateDocument); MenuManager::getInstance()->setupContextMenu(&view, contextMenu); // get the current item @@ -3027,8 +3027,8 @@ TreePanel::TreePanel(const char* name, QWidget* parent) pLayout->setSpacing(0); pLayout->setContentsMargins(0, 0, 0, 0); pLayout->addWidget(this->treeWidget); - connect(this->treeWidget, SIGNAL(emitSearchObjects()), - this, SLOT(showEditor())); + connect(this->treeWidget, &TreeWidget::emitSearchObjects, + this, &TreePanel::showEditor); this->searchBox = new Gui::ExpressionLineEdit(this, true); static_cast(this->searchBox)->setExactMatch(Gui::ExpressionParameter::instance()->isExactMatch()); @@ -3036,10 +3036,10 @@ TreePanel::TreePanel(const char* name, QWidget* parent) this->searchBox->hide(); this->searchBox->installEventFilter(this); this->searchBox->setPlaceholderText(tr("Search")); - connect(this->searchBox, SIGNAL(returnPressed()), - this, SLOT(accept())); - connect(this->searchBox, SIGNAL(textChanged(QString)), - this, SLOT(itemSearch(QString))); + connect(this->searchBox, &QLineEdit::returnPressed, + this, &TreePanel::accept); + connect(this->searchBox, &QLineEdit::textChanged, + this, &TreePanel::itemSearch); } TreePanel::~TreePanel() diff --git a/src/Gui/VectorListEditor.cpp b/src/Gui/VectorListEditor.cpp index d9d7db87f4..fd7de57afd 100644 --- a/src/Gui/VectorListEditor.cpp +++ b/src/Gui/VectorListEditor.cpp @@ -230,14 +230,14 @@ VectorListEditor::VectorListEditor(int decimals, QWidget* parent) ui->toolButtonMouse->setDisabled(true); - connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &VectorListEditor::accept); + connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &VectorListEditor::reject); - connect(ui->spinBox, SIGNAL(valueChanged(int)), this, SLOT(setCurrentRow(int))); - connect(ui->toolButtonAdd, SIGNAL(clicked(bool)), this, SLOT(addRow())); - connect(ui->toolButtonRemove, SIGNAL(clicked(bool)), this, SLOT(removeRow())); - connect(ui->toolButtonAccept, SIGNAL(clicked(bool)), this, SLOT(acceptCurrent())); - connect(ui->tableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedRow(QModelIndex))); + connect(ui->spinBox, qOverload(&QSpinBox::valueChanged), this, &VectorListEditor::setCurrentRow); + connect(ui->toolButtonAdd, &QToolButton::clicked, this, &VectorListEditor::addRow); + connect(ui->toolButtonRemove, &QToolButton::clicked, this, &VectorListEditor::removeRow); + connect(ui->toolButtonAccept, &QToolButton::clicked, this, &VectorListEditor::acceptCurrent); + connect(ui->tableWidget, &QTableView::clicked, this, &VectorListEditor::clickedRow); } VectorListEditor::~VectorListEditor() diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 5aeb8954e4..a6ca82d864 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -172,7 +172,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, OnChange(*hGrp,"TransparentObjectRenderType"); stopSpinTimer = new QTimer(this); - connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating())); + connect(stopSpinTimer, &QTimer::timeout, this, &View3DInventor::stopAnimating); } View3DInventor::~View3DInventor() @@ -501,8 +501,8 @@ void View3DInventor::printPreview() restorePrinterSettings(&printer); QPrintPreviewDialog dlg(&printer, this); - connect(&dlg, SIGNAL(paintRequested (QPrinter *)), - this, SLOT(print(QPrinter *))); + connect(&dlg, &QPrintPreviewDialog::paintRequested, + this, qOverload(&View3DInventor::print)); dlg.exec(); savePrinterSettings(&printer); } diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 4880fd155d..1a18403144 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -2635,7 +2635,7 @@ void View3DInventorViewer::moveCameraTo(const SbRotation& rot, const SbVec3f& po anim.setEndValue(steps); QEventLoop loop; - QObject::connect(&anim, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(&anim, &CameraAnimation::finished, &loop, &QEventLoop::quit); anim.start(); loop.exec(QEventLoop::ExcludeUserInputEvents); @@ -2693,7 +2693,7 @@ void View3DInventorViewer::animatedViewAll(int steps, int ms) QEventLoop loop; QTimer timer; timer.setSingleShot(true); - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); for (int i=0; icol = palette().color(QPalette::Active,QPalette::Midlight); - connect(this, SIGNAL(clicked()), SLOT(onChooseColor())); + connect(this, &ColorButton::clicked, this, &ColorButton::onChooseColor); int e = style()->pixelMetric(QStyle::PM_ButtonIconSize); setIconSize(QSize(2*e, e)); @@ -1254,7 +1254,7 @@ void StatusWidget::showText(int ms) show(); QTimer timer; QEventLoop loop; - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); timer.start(ms); loop.exec(QEventLoop::ExcludeUserInputEvents); hide(); @@ -1451,8 +1451,8 @@ LabelEditor::LabelEditor (QWidget * parent) lineEdit = new QLineEdit(this); layout->addWidget(lineEdit); - connect(lineEdit, SIGNAL(textChanged(const QString &)), - this, SLOT(validateText(const QString &))); + connect(lineEdit, &QLineEdit::textChanged, + this, &LabelEditor::validateText); button = new QPushButton(QLatin1String("..."), this); #if defined (Q_OS_MAC) @@ -1460,7 +1460,7 @@ LabelEditor::LabelEditor (QWidget * parent) #endif layout->addWidget(button); - connect(button, SIGNAL(clicked()), this, SLOT(changeText())); + connect(button, &QPushButton::clicked, this, &LabelEditor::changeText); setFocusProxy(lineEdit); } @@ -1556,7 +1556,7 @@ ExpLineEdit::ExpLineEdit(QWidget* parent, bool expressionOnly) { makeLabel(this); - QObject::connect(iconLabel, SIGNAL(clicked()), this, SLOT(openFormulaDialog())); + QObject::connect(iconLabel, &ExpressionLabel::clicked, this, &ExpLineEdit::openFormulaDialog); if (expressionOnly) QMetaObject::invokeMethod(this, "openFormulaDialog", Qt::QueuedConnection, QGenericReturnArgument()); } @@ -1673,7 +1673,7 @@ void ExpLineEdit::openFormulaDialog() auto box = new Gui::Dialog::DlgExpressionInput( getPath(), getExpression(),Unit(), this); - connect(box, SIGNAL(finished(int)), this, SLOT(finishFormulaDialog())); + connect(box, &Dialog::DlgExpressionInput::finished, this, &ExpLineEdit::finishFormulaDialog); box->show(); QPoint pos = mapToGlobal(QPoint(0,0)); diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 9a2ec5b90d..b38bf556a8 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -1567,7 +1567,7 @@ VectorListWidget::VectorListWidget(int decimals, QWidget *parent) : PropertyEditorWidget(parent) , decimals(decimals) { - connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked())); + connect(button, &QPushButton::clicked, this, &VectorListWidget::buttonClicked); } void VectorListWidget::buttonClicked() @@ -2483,8 +2483,8 @@ void PlacementEditor::browse() } if (!_task) { _task = task; - connect(task, SIGNAL(placementChanged(const QVariant &, bool, bool)), - this, SLOT(updateValue(const QVariant&, bool, bool))); + connect(task, &TaskPlacement::placementChanged, + this, &PlacementEditor::updateValue); } task->setPlacement(value().value()); task->setPropertyName(propertyname); @@ -4319,10 +4319,10 @@ LinkLabel::LinkLabel (QWidget * parent, const App::Property *prop) // setLayout(layout); - connect(label, SIGNAL(linkActivated(const QString&)), - this, SLOT(onLinkActivated(const QString&))); - connect(editButton, SIGNAL(clicked()), - this, SLOT(onEditClicked())); + connect(label, &QLabel::linkActivated, + this, &LinkLabel::onLinkActivated); + connect(editButton, &QPushButton::clicked, + this, &LinkLabel::onEditClicked); } LinkLabel::~LinkLabel()