diff --git a/sources/autoNum/ui/autonumberingdockwidget.cpp b/sources/autoNum/ui/autonumberingdockwidget.cpp index a01cc538f..1681cb57a 100644 --- a/sources/autoNum/ui/autonumberingdockwidget.cpp +++ b/sources/autoNum/ui/autonumberingdockwidget.cpp @@ -86,29 +86,21 @@ void AutoNumberingDockWidget::setProject(QETProject *project, //Disconnect previous project if (m_project && m_project_view) { - //Conductor Signals - disconnect(m_project, SIGNAL(conductorAutoNumChanged()), - this,SLOT(conductorAutoNumChanged())); - disconnect (m_project,SIGNAL(conductorAutoNumRemoved()), - this,SLOT(conductorAutoNumChanged())); - disconnect (m_project,SIGNAL(conductorAutoNumAdded()), - this,SLOT(conductorAutoNumChanged())); - disconnect(m_project_view,SIGNAL(diagramActivated(DiagramView*)), - this,SLOT(setConductorActive(DiagramView*))); - - //Element Signals - disconnect (m_project,SIGNAL(elementAutoNumRemoved(QString)), - this,SLOT(elementAutoNumChanged())); - disconnect (m_project,SIGNAL(elementAutoNumAdded(QString)), - this,SLOT(elementAutoNumChanged())); + disconnect(m_project, &QETProject::conductorAutoNumChanged, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + disconnect(m_project, &QETProject::conductorAutoNumRemoved, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + disconnect(m_project, &QETProject::conductorAutoNumAdded, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + disconnect(m_project_view, &ProjectView::diagramActivated, this, &AutoNumberingDockWidget::setConductorActive); + + //Element Signals + disconnect(m_project, &QETProject::elementAutoNumRemoved, this, &AutoNumberingDockWidget::elementAutoNumChanged); + disconnect(m_project, &QETProject::elementAutoNumAdded, this, &AutoNumberingDockWidget::elementAutoNumChanged); //Folio Signals disconnect (m_project,SIGNAL(folioAutoNumRemoved()), this,SLOT(folioAutoNumChanged())); disconnect (m_project,SIGNAL(folioAutoNumAdded()), this,SLOT(folioAutoNumChanged())); - disconnect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()), - this,SLOT(setActive())); + disconnect(m_project, &QETProject::defaultTitleBlockPropertiesChanged, this, &AutoNumberingDockWidget::setActive); //Conductor, Element and Folio Signals disconnect(m_project, &QETProject::autoNumContextUpdated, @@ -121,29 +113,21 @@ void AutoNumberingDockWidget::setProject(QETProject *project, m_project_view = projectview; this->setEnabled(true); - //Conductor Signals - connect(m_project, SIGNAL(conductorAutoNumChanged()), - this,SLOT(conductorAutoNumChanged())); - connect(m_project,SIGNAL(conductorAutoNumRemoved()), - this,SLOT(conductorAutoNumChanged())); - connect(m_project,SIGNAL(conductorAutoNumAdded()), - this,SLOT(conductorAutoNumChanged())); - connect(m_project_view,SIGNAL(diagramActivated(DiagramView*)), - this,SLOT(setConductorActive(DiagramView*))); + connect(m_project, &QETProject::conductorAutoNumChanged, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + connect(m_project, &QETProject::conductorAutoNumRemoved, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + connect(m_project, &QETProject::conductorAutoNumAdded, this, &AutoNumberingDockWidget::conductorAutoNumChanged); + connect(m_project_view, &ProjectView::diagramActivated, this, &AutoNumberingDockWidget::setConductorActive); - //Element Signals - connect (m_project,SIGNAL(elementAutoNumRemoved(QString)), - this,SLOT(elementAutoNumChanged())); - connect (m_project,SIGNAL(elementAutoNumAdded(QString)), - this,SLOT(elementAutoNumChanged())); + //Element Signals + connect(m_project, &QETProject::elementAutoNumRemoved, this, &AutoNumberingDockWidget::elementAutoNumChanged); + connect(m_project, &QETProject::elementAutoNumAdded, this, &AutoNumberingDockWidget::elementAutoNumChanged); //Folio Signals connect (m_project,SIGNAL(folioAutoNumRemoved()), this,SLOT(folioAutoNumChanged())); connect (m_project,SIGNAL(folioAutoNumAdded()), this,SLOT(folioAutoNumChanged())); - connect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()), - this,SLOT(setActive())); + connect(m_project, &QETProject::defaultTitleBlockPropertiesChanged, this, &AutoNumberingDockWidget::setActive); //Conductor, Element and Folio Signals connect(m_project, &QETProject::autoNumContextUpdated, diff --git a/sources/configdialog.cpp b/sources/configdialog.cpp index b737ca7c2..10a0d0e0e 100644 --- a/sources/configdialog.cpp +++ b/sources/configdialog.cpp @@ -74,10 +74,9 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { setLayout(dialog_layout); // connexion signaux / slots - connect(buttons, SIGNAL(accepted()), this, SLOT(applyConf())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); - connect(pages_list, SIGNAL(currentRowChanged(int)), - pages_widget, SLOT(setCurrentIndex(int))); + connect(buttons, &QDialogButtonBox::accepted, this, &ConfigDialog::applyConf); + connect(buttons, &QDialogButtonBox::rejected, this, &ConfigDialog::reject); + connect(pages_list, &QListWidget::currentRowChanged, pages_widget, &QStackedWidget::setCurrentIndex); // set maximum a bit smaller than available size = (screen-size - Task-Bar): setMaximumSize((int)(0.94 * MachineInfo::instance()->i_max_available_width()), diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 427ad0634..1eea4f80e 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -99,7 +99,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : } connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*))); - connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect())); + connect(m_diagram, &QGraphicsScene::sceneRectChanged, this, &DiagramView::adjustSceneRect); connect(&(m_diagram -> border_and_titleblock), &BorderTitleBlock::informationChanged, this, &DiagramView::updateWindowTitle); connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation))); diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index a2c8146d3..1692e2dbb 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -69,10 +69,8 @@ ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) : initPasteArea(); m_undo_stack.setClean(); m_decorator_lock = new QMutex(); - connect(&m_undo_stack, SIGNAL(indexChanged(int)), - this, SLOT(managePrimitivesGroups())); - connect(this, SIGNAL(selectionChanged()), - this, SLOT(managePrimitivesGroups())); + connect(&m_undo_stack, &QUndoStack::indexChanged, this, &ElementScene::managePrimitivesGroups); + connect(this, &ElementScene::selectionChanged, this, &ElementScene::managePrimitivesGroups); } /** @@ -102,8 +100,7 @@ void ElementScene::setElementData(ElementData data) ElementScene::~ElementScene() { //Disconnect to avoid crash, see bug report N° 122. - disconnect(&m_undo_stack, SIGNAL(indexChanged(int)), - this, SLOT(managePrimitivesGroups())); + disconnect(&m_undo_stack, &QUndoStack::indexChanged, this, &ElementScene::managePrimitivesGroups); delete m_decorator_lock; if (m_event_interface) @@ -907,8 +904,8 @@ void ElementScene::slot_editAuthorInformations() QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog_layout -> addWidget(dialog_buttons); - connect(dialog_buttons, SIGNAL(accepted()),&dialog_author, SLOT(accept())); - connect(dialog_buttons, SIGNAL(rejected()),&dialog_author, SLOT(reject())); + connect(dialog_buttons, &QDialogButtonBox::accepted, &dialog_author, &QDialog::accept); + connect(dialog_buttons, &QDialogButtonBox::rejected, &dialog_author, &QDialog::reject); // start the dialogue // lance le dialogue @@ -1399,9 +1396,7 @@ void ElementScene::managePrimitivesGroups() if (!m_decorator) { m_decorator = new ElementPrimitiveDecorator(); - connect(m_decorator, - SIGNAL(actionFinished(ElementEditionCommand*)), - this, SLOT(stackAction(ElementEditionCommand *))); + connect(m_decorator, &ElementPrimitiveDecorator::actionFinished, this, &ElementScene::stackAction); addItem(m_decorator); m_decorator -> hide(); } diff --git a/sources/editor/elementview.cpp b/sources/editor/elementview.cpp index a2cc8af58..fe7d515b0 100644 --- a/sources/editor/elementview.cpp +++ b/sources/editor/elementview.cpp @@ -37,8 +37,8 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) : setResizeAnchor(QGraphicsView::AnchorUnderMouse); setTransformationAnchor(QGraphicsView::AnchorUnderMouse); zoomReset(); - connect(m_scene, SIGNAL(pasteAreaDefined(const QRectF &)), this, SLOT(pasteAreaDefined(const QRectF &))); - connect(m_scene, SIGNAL(needZoomFit()), this, SLOT(zoomFit())); + connect(m_scene, &ElementScene::pasteAreaDefined, this, &ElementView::pasteAreaDefined); + connect(m_scene, &ElementScene::needZoomFit, this, &ElementView::zoomFit); } /// Destructeur diff --git a/sources/editor/graphicspart/parttext.cpp b/sources/editor/graphicspart/parttext.cpp index 7f4112d86..2154603f4 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -50,10 +50,10 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) : adjustItemPosition(1); // adjust textfield position after line additions/deletions - connect(document(), - SIGNAL(blockCountChanged(int)), - this, - SLOT(adjustItemPosition(int))); + connect(document(), + &QTextDocument::blockCountChanged, + this, + &PartText::adjustItemPosition); connect(document(), SIGNAL(contentsChanged()), this, diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 4500a1734..b5fbdc2bc 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -222,7 +222,7 @@ void ElementPropertiesEditorWidget::setUpInterface() ui->m_tree->setItemDelegate(new EditorDelegate(this)); // NEU: Checkbox mit der Zahlenbox verbinden (Aktivieren/Deaktivieren) - connect(ui->max_slaves_checkbox, SIGNAL(toggled(bool)), ui->max_slaves_spinbox, SLOT(setEnabled(bool))); + connect(ui->max_slaves_checkbox, &QCheckBox::toggled, ui->max_slaves_spinbox, &QWidget::setEnabled); connect(ui->max_slaves_spinbox, QOverload::of(&QSpinBox::valueChanged), [this](int) { if (ui->m_slave_groups_checkbox->isChecked()) { populateSlaveGroupsTable(); diff --git a/sources/elementscategoryeditor.cpp b/sources/elementscategoryeditor.cpp index 1a3f223a5..600b7e28e 100644 --- a/sources/elementscategoryeditor.cpp +++ b/sources/elementscategoryeditor.cpp @@ -58,14 +58,14 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &location, if (m_edit_mode) { setWindowTitle(tr("Éditer une catégorie", "window title")); - connect(m_buttons, SIGNAL(accepted()), this, SLOT(acceptUpdate())); + connect(m_buttons, &QDialogButtonBox::accepted, this, &ElementsCategoryEditor::acceptUpdate); m_names_list -> setNames(m_location.nameList()); m_file_line_edit -> setText(m_location.fileSystemPath()); m_file_line_edit -> setReadOnly(true); } else { setWindowTitle(tr("Créer une nouvelle catégorie", "window title")); - connect(m_buttons, SIGNAL(accepted()), this, SLOT(acceptCreation())); + connect(m_buttons, &QDialogButtonBox::accepted, this, &ElementsCategoryEditor::acceptCreation); NamesList cat_names; cat_names.addName(QLocale::system().name().left(2), tr("Nom de la nouvelle catégorie", "default name when creating a new category")); @@ -114,7 +114,7 @@ void ElementsCategoryEditor::setUpWidget() m_file_line_edit = new QFileNameEdit(); m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject())); + connect(m_buttons, &QDialogButtonBox::rejected, this, &ElementsCategoryEditor::reject); QHBoxLayout *internal_name_layout = new QHBoxLayout(); internal_name_layout -> addWidget(m_file_name); diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 7baf0afbe..10d07d45e 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -117,7 +117,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { connect(filter_textfield, SIGNAL(textChanged(const QString &)), this, SLOT(filterEdited(const QString &))); connect(elements_panel, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(updateButtons())); - connect(elements_panel, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(handleContextMenu(const QPoint &))); + connect(elements_panel, &ElementsPanel::customContextMenuRequested, this, &ElementsPanelWidget::handleContextMenu); connect( elements_panel, SIGNAL(requestForTitleBlockTemplate(const TitleBlockTemplateLocation &)), diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index b736aa240..860b6ce6d 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -99,9 +99,9 @@ ExportDialog::ExportDialog( // connexions signaux/slots connect(epw, SIGNAL(formatChanged()), this, SLOT(slot_changeFilesExtension())); - connect(epw, SIGNAL(exportedAreaChanged()), this, SLOT(slot_changeUseBorder())); - connect(buttons, SIGNAL(accepted()), this, SLOT(slot_export())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); + connect(epw, &ExportPropertiesWidget::exportedAreaChanged, this, &ExportDialog::slot_changeUseBorder); + connect(buttons, &QDialogButtonBox::accepted, this, &ExportDialog::slot_export); + connect(buttons, &QDialogButtonBox::rejected, this, &ExportDialog::reject); // ajustement des extensions des fichiers slot_changeFilesExtension(true); @@ -140,21 +140,21 @@ QWidget *ExportDialog::initDiagramsListPart() reset_mapper_ = new QSignalMapper(this); clipboard_mapper_ = new QSignalMapper(this); - #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - connect(preview_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_previewDiagram); - connect(width_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctHeight); - connect(height_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctWidth); - connect(ratio_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_keepRatioChanged); - connect(reset_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_resetSize); - connect(clipboard_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_exportToClipBoard); - #else // TODO Qt6 only: remove, mappedInt() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available connect(preview_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_previewDiagram(int))); connect(width_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctHeight(int))); connect(height_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctWidth(int))); connect(ratio_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_keepRatioChanged(int))); connect(reset_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_resetSize(int))); connect(clipboard_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_exportToClipBoard(int))); - #endif +#else + connect(preview_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_previewDiagram); + connect(width_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctHeight); + connect(height_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctWidth); + connect(ratio_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_keepRatioChanged); + connect(reset_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_resetSize); + connect(clipboard_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_exportToClipBoard); +#endif diagrams_list_layout_ = new QGridLayout(); @@ -174,7 +174,7 @@ QWidget *ExportDialog::initDiagramsListPart() diagrams_list_layout_ -> addLayout(diagram_line -> sizeLayout(), line_count, 3); // si on decoche tous les schemas, on desactive le bouton "Exporter" - connect(diagram_line -> must_export, SIGNAL(toggled(bool)), this, SLOT(slot_checkDiagramsCount())); + connect(diagram_line -> must_export, &QCheckBox::toggled, this, &ExportDialog::slot_checkDiagramsCount); // mappings et signaux pour la gestion des dimensions du schema width_mapper_ -> setMapping(diagram_line -> width, line_count); @@ -939,7 +939,7 @@ void ExportDialog::slot_previewDiagram(int diagram_id) { QGraphicsView *preview_view = new QGraphicsView(preview_scene); preview_view -> setDragMode(QGraphicsView::ScrollHandDrag); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok); - connect(buttons, SIGNAL(accepted()), &preview_dialog, SLOT(accept())); + connect(buttons, &QDialogButtonBox::accepted, &preview_dialog, &QDialog::accept); QVBoxLayout *vboxlayout1 = new QVBoxLayout(); vboxlayout1 -> addWidget(preview_view); diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp index aaa0966d0..b31dd3813 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -230,7 +230,7 @@ void ExportPropertiesWidget::build() setTabOrder(draw_colored_conductors, draw_bg_transparent); // connexion du bouton permettant le choix du repertoire - connect(button_browse, SIGNAL(released()), this, SLOT(slot_chooseADirectory())); + connect(button_browse, &QPushButton::released, this, &ExportPropertiesWidget::slot_chooseADirectory); // emission de signaux lors du changement de format et lors du changement de zone exportee connect(format, SIGNAL(currentIndexChanged(int)), this, SIGNAL(formatChanged())); diff --git a/sources/projectview.cpp b/sources/projectview.cpp index 2978d9745..4fee66bb6 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -763,8 +763,8 @@ int ProjectView::cleanProject() clean_dialog_layout -> addWidget(buttons); clean_dialog.setLayout(clean_dialog_layout); - connect(buttons, SIGNAL(accepted()), &clean_dialog, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), &clean_dialog, SLOT(reject())); + connect(buttons, &QDialogButtonBox::accepted, &clean_dialog, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, &clean_dialog, &QDialog::reject); int clean_count = 0; if (clean_dialog.exec() == QDialog::Accepted) @@ -888,9 +888,9 @@ void ProjectView::initWidgets() m_tab -> setCornerWidget(tabwidgetLeft, Qt::TopLeftCorner); // manage signals - connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); - connect(m_tab, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(tabDoubleClicked(int))); - connect(m_tab->tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)), Qt::QueuedConnection); + connect(m_tab, &QTabWidget::currentChanged, this, &ProjectView::tabChanged); + connect(m_tab, &QTabWidget::tabBarDoubleClicked, this, &ProjectView::tabDoubleClicked); + connect(m_tab->tabBar(), &QTabBar::tabMoved, this, &ProjectView::tabMoved, Qt::QueuedConnection); fallback_widget_ -> setVisible(false); m_tab -> setVisible(false); @@ -1119,9 +1119,9 @@ void ProjectView::setDiagramPosition(Diagram *diagram, int new_position) if (current_position < 0) return; - disconnect(m_tab->tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int))); + disconnect(m_tab->tabBar(), &QTabBar::tabMoved, this, &ProjectView::tabMoved); m_tab->tabBar()->moveTab(current_position, new_position); - connect(m_tab->tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)), Qt::QueuedConnection); + connect(m_tab->tabBar(), &QTabBar::tabMoved, this, &ProjectView::tabMoved, Qt::QueuedConnection); rebuildDiagramsMap(); diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 26d0b4cd6..7a7912fa7 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -122,11 +122,11 @@ QETApp::QETApp() : initSplashScreen(); initSystemTray(); - #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - connect(&signal_map, &QSignalMapper::mappedObject, this, [this](QObject *object) { invertMainWindowVisibility(qobject_cast(object)); }); - #else // TODO Qt6 only: remove, mappedObject() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedObject() always available connect(&signal_map, SIGNAL(mapped(QWidget *)), this, SLOT(invertMainWindowVisibility(QWidget *))); - #endif +#else + connect(&signal_map, &QSignalMapper::mappedObject, this, [this](QObject *object) { invertMainWindowVisibility(qobject_cast(object)); }); +#endif qApp->setQuitOnLastWindowClosed(false); connect(qApp, &QApplication::lastWindowClosed, this, &QETApp::checkRemainingWindows); diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 208d36817..68d5bdd3b 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -107,11 +107,11 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : m_workspace.setTabsClosable(true); //Set the signal mapper - #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - connect(&windowMapper, &QSignalMapper::mappedObject, this, [this](QObject *object) { activateWidget(qobject_cast(object)); }); - #else // TODO Qt6 only: remove, mappedObject() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedObject() always available connect(&windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *))); - #endif +#else + connect(&windowMapper, &QSignalMapper::mappedObject, this, [this](QObject *object) { activateWidget(qobject_cast(object)); }); +#endif setWindowTitle(tr("QElectroTech", "window title")); setWindowIcon(QET::Icons::QETLogo); @@ -133,14 +133,8 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : setMinimumSize(QSize(500, 350)); setWindowState(Qt::WindowMaximized); - connect (&m_workspace, - SIGNAL(subWindowActivated(QMdiSubWindow *)), - this, - SLOT(subWindowActivated(QMdiSubWindow*))); - connect (QApplication::clipboard(), - SIGNAL(dataChanged()), - this, - SLOT(slot_updatePasteAction())); + connect(&m_workspace, &QMdiArea::subWindowActivated, this, &QETDiagramEditor::subWindowActivated); + connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &QETDiagramEditor::slot_updatePasteAction); readSettings(); show(); @@ -188,16 +182,16 @@ void QETDiagramEditor::setUpElementsPanel() connect(pa, SIGNAL(requestForProject (QETProject *)), this, SLOT(activateProject(QETProject *))); connect(pa, SIGNAL(requestForProjectClosing (QETProject *)), this, SLOT(closeProject(QETProject *))); connect(pa, SIGNAL(requestForProjectPropertiesEdition (QETProject *)), this, SLOT(editProjectProperties(QETProject *))); - connect(pa, SIGNAL(requestForNewDiagram (QETProject *)), this, SLOT(addDiagramToProject(QETProject *))); + connect(pa, &ElementsPanelWidget::requestForNewDiagram, this, &QETDiagramEditor::addDiagramToProject); connect(pa, SIGNAL(requestForDiagramPropertiesEdition (Diagram *)), this, SLOT(editDiagramProperties(Diagram *))); - connect(pa, SIGNAL(requestForDiagramsDeletion (const QList &)), this, SLOT(removeDiagrams(const QList &))); - connect(pa, SIGNAL(requestForDiagramMoveUp (const QList &)), this, SLOT(moveDiagramUp(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveDown (const QList &)), this, SLOT(moveDiagramDown(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveUpTop (const QList &)), this, SLOT(moveDiagramUpTop(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveUpx10 (const QList &)), this, SLOT(moveDiagramUpx10(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveDownx10 (const QList &)), this, SLOT(moveDiagramDownx10(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveUpx100 (const QList &)), this, SLOT(moveDiagramUpx100(const QList&))); - connect(pa, SIGNAL(requestForDiagramMoveDownx100 (const QList &)), this, SLOT(moveDiagramDownx100(const QList&))); + connect(pa, &ElementsPanelWidget::requestForDiagramsDeletion, this, &QETDiagramEditor::removeDiagrams); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveUp, this, &QETDiagramEditor::moveDiagramUp); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveDown, this, &QETDiagramEditor::moveDiagramDown); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveUpTop, this, &QETDiagramEditor::moveDiagramUpTop); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveUpx10, this, &QETDiagramEditor::moveDiagramUpx10); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveDownx10, this, &QETDiagramEditor::moveDiagramDownx10); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveUpx100, this, &QETDiagramEditor::moveDiagramUpx100); + connect(pa, &ElementsPanelWidget::requestForDiagramMoveDownx100, this, &QETDiagramEditor::moveDiagramDownx100); } /** @@ -850,8 +844,7 @@ void QETDiagramEditor::setUpMenu() // File menu QMenu *recentfile = menu_fichier -> addMenu(QET::Icons::DocumentOpenRecent, tr("&Récemment ouverts")); recentfile->addActions(QETApp::projectsRecentFiles()->menu()->actions()); - connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), - this, SLOT(openRecentFile(const QString &))); + connect(QETApp::projectsRecentFiles(), &RecentFiles::fileOpeningRequested, this, &QETDiagramEditor::openRecentFile); menu_fichier -> addActions(m_file_actions_group.actions()); menu_fichier -> addSeparator(); //menu_fichier -> addAction(import_diagram); @@ -1928,15 +1921,12 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) diagramWasAdded(dv); //Manage the close event of project - connect(project_view, SIGNAL(projectClosed(ProjectView*)), - this, SLOT(projectWasClosed(ProjectView *))); + connect(project_view, &ProjectView::projectClosed, this, &QETDiagramEditor::projectWasClosed); //Manage the adding of diagram - connect(project_view, SIGNAL(diagramAdded(DiagramView *)), - this, SLOT(diagramWasAdded(DiagramView *))); + connect(project_view, &ProjectView::diagramAdded, this, &QETDiagramEditor::diagramWasAdded); if (QETProject *project = project_view -> project()) - connect(project, SIGNAL(readOnlyChanged(QETProject *, bool)), - this, SLOT(slot_updateActions())); + connect(project, &QETProject::readOnlyChanged, this, &QETDiagramEditor::slot_updateActions); //Manage request for edit or find element and titleblock connect (project_view, &ProjectView::findElementRequired, @@ -2510,10 +2500,7 @@ void QETDiagramEditor::diagramWasAdded(DiagramView *dv) this, &QETDiagramEditor::selectionChanged, Qt::DirectConnection); - connect(dv, - SIGNAL(modeChanged()), - this, - SLOT(slot_updateModeActions())); + connect(dv, &DiagramView::modeChanged, this, &QETDiagramEditor::slot_updateModeActions); } /** diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index 4f00b6b53..847342238 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -113,10 +113,8 @@ void CrossRefItem::setUpConnection() set=true; else if(m_properties.snapTo() == XRefProperties::Bottom && !m_text && !m_group) //Snap to bottom of element and parent is the element itself { - m_update_connection << connect(m_element, SIGNAL(yChanged()), - this, SLOT(autoPos())); - m_update_connection << connect(m_element, SIGNAL(rotationChanged()), - this, SLOT(autoPos())); + m_update_connection << connect(m_element, &Element::yChanged, this, &CrossRefItem::autoPos); + m_update_connection << connect(m_element, &Element::rotationChanged, this, &CrossRefItem::autoPos); set=true; } diff --git a/sources/qetmainwindow.cpp b/sources/qetmainwindow.cpp index 6061e99d8..58e17713b 100644 --- a/sources/qetmainwindow.cpp +++ b/sources/qetmainwindow.cpp @@ -146,7 +146,7 @@ void QETMainWindow::initCommonMenus() settings_menu_ = new QMenu(tr("&Configuration", "window menu"), this); settings_menu_ -> addAction(fullscreen_action_); settings_menu_ -> addAction(configure_action_); - connect(settings_menu_, SIGNAL(aboutToShow()), this, SLOT(checkToolbarsmenu())); + connect(settings_menu_, &QMenu::aboutToShow, this, &QETMainWindow::checkToolbarsmenu); help_menu_ = new QMenu(tr("&Aide", "window menu"), this); help_menu_ -> addAction(whatsthis_action_); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 9b115458d..1f323cc95 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -199,7 +199,7 @@ void QETProject::init() connect(&m_titleblocks_collection, &TitleBlockTemplatesCollection::aboutToRemove, this, &QETProject::removeDiagramsTitleBlockTemplate); m_undo_stack = new QUndoStack(this); - connect(m_undo_stack, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackChanged(bool))); + connect(m_undo_stack, &QUndoStack::cleanChanged, this, &QETProject::undoStackChanged); m_save_backup_timer.setInterval(BACKUP_INTERVAL); connect(&m_save_backup_timer, &QTimer::timeout, this, &QETProject::writeBackup); diff --git a/sources/qfilenameedit.cpp b/sources/qfilenameedit.cpp index d81a86344..38bfa28c6 100644 --- a/sources/qfilenameedit.cpp +++ b/sources/qfilenameedit.cpp @@ -82,7 +82,7 @@ void QFileNameEdit::init() "tooltip content when editing a filename" ) ); - connect(validator_, SIGNAL(validationFailed()), this, SLOT(validationFailed())); + connect(validator_, &QETRegExpValidator::validationFailed, this, &QFileNameEdit::validationFailed); } /** diff --git a/sources/qtextorientationspinboxwidget.cpp b/sources/qtextorientationspinboxwidget.cpp index 0ca18d56b..14eefbb17 100644 --- a/sources/qtextorientationspinboxwidget.cpp +++ b/sources/qtextorientationspinboxwidget.cpp @@ -122,9 +122,9 @@ void QTextOrientationSpinBoxWidget::build() orientation_widget_, SLOT(setOrientation(double))); connect(orientation_widget_, - SIGNAL(orientationChanged(double)), + &QTextOrientationWidget::orientationChanged, spin_box_, - SLOT(setValue(double))); + &QDoubleSpinBox::setValue); // cliquer sur un des carres du QTextOrientationWidget revient a finir une saisie dans le SpinBox connect(orientation_widget_, @@ -134,8 +134,7 @@ void QTextOrientationSpinBoxWidget::build() // lorsque l'utilisateur a change l'orientation, // on emet un signal avec la valeur de la nouvelle orientation - connect(spin_box_, SIGNAL(editingFinished()), - this, SLOT(emitChangeSignals())); + connect(spin_box_, &QDoubleSpinBox::editingFinished, this, &QTextOrientationSpinBoxWidget::emitChangeSignals); // dispose les widgets : le QTextOrientationWidget a gauche, le SpinBox a droite QHBoxLayout *main_layout = new QHBoxLayout(); diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index 20afb4cc0..41515d02b 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -540,8 +540,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor, addSeparator(); // Text color button - connect(m_color_action, SIGNAL(colorChanged(QColor)), - this, SLOT(colorChanged(QColor))); + connect(m_color_action, &ColorAction::colorChanged, this, &RichTextEditorToolBar::colorChanged); addAction(m_color_action); @@ -550,8 +549,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor, QIcon(":/ico/32x32/simplifyrichtext.png"), tr("Simplify Rich Text"), editor, SLOT(setSimplifyRichText(bool)),this); m_simplify_richtext_action->setChecked(editor->simplifyRichText()); - connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), - m_simplify_richtext_action, SLOT(setChecked(bool))); + connect(m_editor, &RichTextEditor::simplifyRichTextChanged, m_simplify_richtext_action, &QAction::setChecked); addAction(m_simplify_richtext_action); connect(editor, SIGNAL(textChanged()), this, SLOT(updateActions())); @@ -779,7 +777,7 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) : m_text_edit->setAcceptRichText(false); connect(m_editor, SIGNAL(textChanged()), this, SLOT(richTextChanged())); - connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged())); + connect(m_editor, &RichTextEditor::simplifyRichTextChanged, this, &RichTextEditorDialog::richTextChanged); connect(m_text_edit, SIGNAL(textChanged()), this, SLOT(sourceChanged())); // The toolbar needs to be created after the RichTextEditor @@ -798,16 +796,15 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) : m_tab_widget->setTabPosition(QTabWidget::South); m_tab_widget->addTab(rich_edit, tr("Rich Text")); m_tab_widget->addTab(plain_edit, tr("Source")); - connect(m_tab_widget, SIGNAL(currentChanged(int)), - SLOT(tabIndexChanged(int))); + connect(m_tab_widget, &QTabWidget::currentChanged, this, &RichTextEditorDialog::tabIndexChanged); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); QPushButton *ok_button = buttonBox->button(QDialogButtonBox::Ok); ok_button->setText(tr("&OK")); ok_button->setDefault(true); buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel")); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &RichTextEditorDialog::on_buttonBox_accepted); + connect(buttonBox, &QDialogButtonBox::rejected, this, &RichTextEditorDialog::reject); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(m_tab_widget); diff --git a/sources/titleblock/dimensionwidget.cpp b/sources/titleblock/dimensionwidget.cpp index 4d9a154fd..62d20df56 100644 --- a/sources/titleblock/dimensionwidget.cpp +++ b/sources/titleblock/dimensionwidget.cpp @@ -150,8 +150,8 @@ void TitleBlockDimensionWidget::initWidgets() // buttons, for the user to validate its input buttons_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttons_, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttons_, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttons_, &QDialogButtonBox::accepted, this, &TitleBlockDimensionWidget::accept); + connect(buttons_, &QDialogButtonBox::rejected, this, &TitleBlockDimensionWidget::reject); } /** diff --git a/sources/titleblock/integrationmovetemplateshandler.cpp b/sources/titleblock/integrationmovetemplateshandler.cpp index 4589a72f7..dd324466f 100644 --- a/sources/titleblock/integrationmovetemplateshandler.cpp +++ b/sources/titleblock/integrationmovetemplateshandler.cpp @@ -226,10 +226,10 @@ void IntegrationMoveTitleBlockTemplatesHandler::initDialog() dialog_vlayout_ -> addLayout(dialog_glayout); dialog_vlayout_ -> addWidget(buttons_); - connect(use_existing_template_, SIGNAL(toggled(bool)), this, SLOT(correctRadioButtons())); - connect(integrate_new_template_, SIGNAL(toggled(bool)), this, SLOT(correctRadioButtons())); - connect(buttons_, SIGNAL(accepted()), integ_dialog_, SLOT(accept())); - connect(buttons_, SIGNAL(rejected()), integ_dialog_, SLOT(reject())); + connect(use_existing_template_, &QRadioButton::toggled, this, &IntegrationMoveTitleBlockTemplatesHandler::correctRadioButtons); + connect(integrate_new_template_, &QRadioButton::toggled, this, &IntegrationMoveTitleBlockTemplatesHandler::correctRadioButtons); + connect(buttons_, &QDialogButtonBox::accepted, integ_dialog_, &QDialog::accept); + connect(buttons_, &QDialogButtonBox::rejected, integ_dialog_, &QDialog::reject); } /** diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 9f41c88d2..65d06cbfc 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -342,7 +342,7 @@ void QETTitleBlockTemplateEditor::editLogos() QDialog d(this); d.setWindowTitle(logo_manager_ -> windowTitle()); d.setLayout(vlayout0); - connect(buttons, SIGNAL(rejected()), &d, SLOT(reject())); + connect(buttons, &QDialogButtonBox::rejected, &d, &QDialog::reject); d.exec(); // prevent the logo manager from being deleted along with the dialog @@ -553,35 +553,37 @@ void QETTitleBlockTemplateEditor::initWidgets() template_cell_editor_widget_ -> setVisible(false); connect( - template_edition_area_view_, - SIGNAL(selectedCellsChanged(QList)), - this, - SLOT(selectedCellsChanged(QList)) + template_edition_area_view_, + &TitleBlockTemplateView::selectedCellsChanged, + this, + &QETTitleBlockTemplateEditor::selectedCellsChanged + ); + connect( + template_cell_editor_widget_, + &TitleBlockTemplateCellWidget::logoEditionRequested, + this, + &QETTitleBlockTemplateEditor::editLogos ); - connect(template_cell_editor_widget_, SIGNAL(logoEditionRequested()), - this, SLOT(editLogos())); connect( template_cell_editor_widget_, - SIGNAL(cellModified(ModifyTitleBlockCellCommand *)), + &TitleBlockTemplateCellWidget::cellModified, this, - SLOT(pushCellUndoCommand(ModifyTitleBlockCellCommand *)) + &QETTitleBlockTemplateEditor::pushCellUndoCommand ); connect( template_edition_area_view_, - SIGNAL(gridModificationRequested(TitleBlockTemplateCommand *)), + &TitleBlockTemplateView::gridModificationRequested, this, - SLOT(pushGridUndoCommand(TitleBlockTemplateCommand *)) + &QETTitleBlockTemplateEditor::pushGridUndoCommand ); connect( template_edition_area_view_, - SIGNAL(previewWidthChanged(int,int)), + &TitleBlockTemplateView::previewWidthChanged, this, - SLOT(savePreviewWidthToApplicationSettings(int, int)) + &QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings ); - connect(undo_stack_, SIGNAL(cleanChanged(bool)), - this, SLOT(updateEditorTitle())); - connect(QApplication::clipboard(), SIGNAL(dataChanged()), - this, SLOT(updateActions())); + connect(undo_stack_, &QUndoStack::cleanChanged, this, &QETTitleBlockTemplateEditor::updateEditorTitle); + connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &QETTitleBlockTemplateEditor::updateActions); } /** @@ -960,8 +962,8 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc dialog.setWindowTitle(title); dialog.setLayout(dialog_layout); - connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject())); + connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); if (dialog.exec() == QDialog::Accepted) { return(widget -> location()); @@ -1027,10 +1029,8 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() : QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog_layout -> addWidget(dialog_buttons); - connect(dialog_buttons, SIGNAL(accepted()), - &dialog_author, SLOT(accept())); - connect(dialog_buttons, SIGNAL(rejected()), - &dialog_author, SLOT(reject())); + connect(dialog_buttons, &QDialogButtonBox::accepted, &dialog_author, &QDialog::accept); + connect(dialog_buttons, &QDialogButtonBox::rejected, &dialog_author, &QDialog::reject); // run the dialog if (dialog_author.exec() == QDialog::Accepted && !read_only_) { diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index b98759aca..2cbb6fbd2 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -150,10 +150,10 @@ void TitleBlockTemplateCellWidget::initWidgets() // handle cell modifications connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(updateFormType(int))); connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(editType())); - connect(name_input_, SIGNAL(editingFinished()), this, SLOT(editName())); + connect(name_input_, &QLineEdit::editingFinished, this, &TitleBlockTemplateCellWidget::editName); connect(label_checkbox_, SIGNAL(clicked(bool)), this, SLOT(editLabelDisplayed())); - connect(label_edit_, SIGNAL(released()), this, SLOT(editLabel())); - connect(value_edit_, SIGNAL(released()), this, SLOT(editValue())); + connect(label_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editLabel); + connect(value_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editValue); connect(horiz_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment())); connect(vert_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment())); connect(font_size_input_, SIGNAL(valueChanged(int)), this, SLOT(editFontSize())); diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index 8b4d04cd4..c9ca7a36b 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -129,10 +129,10 @@ void TitleBlockTemplateLogoManager::initWidgets() this, SLOT(updateLogoInformations(QListWidgetItem *, QListWidgetItem *)) ); - connect(add_button_, SIGNAL(released()), this, SLOT(addLogo())); - connect(export_button_, SIGNAL(released()), this, SLOT(exportLogo())); - connect(delete_button_, SIGNAL(released()), this, SLOT(removeLogo())); - connect(rename_button_, SIGNAL(released()), this, SLOT(renameLogo())); + connect(add_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::addLogo); + connect(export_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::exportLogo); + connect(delete_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::removeLogo); + connect(rename_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::renameLogo); } /** @@ -217,11 +217,12 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); - #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done); - #else // TOD Qt6 only: remove, mappedInt() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int))); - #endif + +#else + connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done); +#endif } rd_label -> setText( QString(tr( diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 5ffc44caf..e26646c70 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -383,7 +383,7 @@ TitleBlockTemplatesFilesCollection::TitleBlockTemplatesFilesCollection(const QSt if (dir_.exists()) { watcher_.addPath(dir_.canonicalPath()); } - connect(&watcher_, SIGNAL(directoryChanged(const QString &)), this, SLOT(fileSystemChanged(const QString &))); + connect(&watcher_, &QFileSystemWatcher::directoryChanged, this, &TitleBlockTemplatesFilesCollection::fileSystemChanged); } /** diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 096f96c0f..ca5f5421b 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -597,7 +597,7 @@ void TitleBlockTemplateView::init() setTransformationAnchor(QGraphicsView::AnchorUnderMouse); setBackgroundBrush(QBrush(QColor(248, 255, 160))); - connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); + connect(scene(), &QGraphicsScene::selectionChanged, this, &TitleBlockTemplateView::selectionChanged); } /** @@ -626,7 +626,7 @@ void TitleBlockTemplateView::applyColumnsWidths(bool animate) { animation -> setStartValue(QVariant(tbgrid_ -> columnMinimumWidth(COL_OFFSET + i))); animation -> setEndValue(QVariant(1.0 * applied_width)); animation -> setDuration(500); - connect(animation, SIGNAL(finished()), this, SLOT(updateColumnsHelperCells())); + connect(animation, &GridLayoutAnimation::finished, this, &TitleBlockTemplateView::updateColumnsHelperCells); animation -> start(QAbstractAnimation::DeleteWhenStopped); } total_applied_width += applied_width; @@ -747,10 +747,8 @@ void TitleBlockTemplateView::addCells() updateTotalWidthLabel(); total_width_helper_cell_ -> orientation = Qt::Horizontal; total_width_helper_cell_ -> setActions(QList() << change_preview_width_); - connect(total_width_helper_cell_, SIGNAL(contextMenuTriggered(HelperCell *)), - this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(total_width_helper_cell_, SIGNAL(doubleClicked(HelperCell*)), - this, SLOT(changePreviewWidth())); + connect(total_width_helper_cell_, &HelperCell::contextMenuTriggered, this, &TitleBlockTemplateView::updateLastContextMenuCell); + connect(total_width_helper_cell_, &HelperCell::doubleClicked, this, &TitleBlockTemplateView::changePreviewWidth); tbgrid_ -> addItem(total_width_helper_cell_, 0, COL_OFFSET, 1, col_count); // we also initialize an extra helper cells that shows the preview width is @@ -767,10 +765,8 @@ void TitleBlockTemplateView::addCells() current_col_cell -> setActions(columnsActions()); current_col_cell -> orientation = Qt::Horizontal; current_col_cell -> index = i; - connect(current_col_cell, SIGNAL(contextMenuTriggered(HelperCell *)), - this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(current_col_cell, SIGNAL(doubleClicked(HelperCell*)), - this, SLOT(editColumn(HelperCell *))); + connect(current_col_cell, &HelperCell::contextMenuTriggered, this, &TitleBlockTemplateView::updateLastContextMenuCell); + connect(current_col_cell, &HelperCell::doubleClicked, this, &TitleBlockTemplateView::editColumn); tbgrid_ -> addItem(current_col_cell, 1, COL_OFFSET + i, 1, 1); } @@ -783,10 +779,8 @@ void TitleBlockTemplateView::addCells() current_row_cell -> orientation = Qt::Vertical; current_row_cell -> index = i; current_row_cell -> setActions(rowsActions()); - connect(current_row_cell, SIGNAL(contextMenuTriggered(HelperCell *)), - this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(current_row_cell, SIGNAL(doubleClicked(HelperCell*)), - this, SLOT(editRow(HelperCell *))); + connect(current_row_cell, &HelperCell::contextMenuTriggered, this, &TitleBlockTemplateView::updateLastContextMenuCell); + connect(current_row_cell, &HelperCell::doubleClicked, this, &TitleBlockTemplateView::editRow); tbgrid_ -> addItem(current_row_cell, ROW_OFFSET + i, 0, 1, 1); } diff --git a/sources/ui/configpage/configpages.cpp b/sources/ui/configpage/configpages.cpp index 1a01a343e..25da62af2 100644 --- a/sources/ui/configpage/configpages.cpp +++ b/sources/ui/configpage/configpages.cpp @@ -110,7 +110,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, xrefpw -> setProperties (m_project -> defaultXRefProperties()); } - connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); + connect(ipw, &TitleBlockPropertiesWidget::openAutoNumFolioEditor, this, &NewDiagramPage::changeToAutoFolioTab); // main tab widget QTabWidget *tab_widget = new QTabWidget(this); @@ -138,7 +138,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, */ NewDiagramPage::~NewDiagramPage() { - disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); + disconnect(ipw, &TitleBlockPropertiesWidget::openAutoNumFolioEditor, this, &NewDiagramPage::changeToAutoFolioTab); } /** diff --git a/sources/ui/configpage/projectconfigpages.cpp b/sources/ui/configpage/projectconfigpages.cpp index f12df6866..22da41ebe 100644 --- a/sources/ui/configpage/projectconfigpages.cpp +++ b/sources/ui/configpage/projectconfigpages.cpp @@ -391,37 +391,37 @@ void ProjectAutoNumConfigPage::adjustReadOnly() void ProjectAutoNumConfigPage::buildConnections() { //Management Tab - connect (m_amw, SIGNAL(applyPressed()), this, SLOT(applyManagement())); + connect(m_amw, &AutoNumberingManagementW::applyPressed, this, &ProjectAutoNumConfigPage::applyManagement); //Conductor Tab connect(m_saw_conductor, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextConductor); connect(m_saw_conductor, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextConductor); - #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - connect(m_saw_conductor->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextConductor); - #else // TODO Qt6 only: remove, textActivated() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available connect(m_saw_conductor->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextConductor(QString))); - #endif +#else + connect(m_saw_conductor->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextConductor); +#endif //Element Tab connect(m_saw_element, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextElement); connect(m_saw_element, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextElement); - #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - connect(m_saw_element->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextElement); - #else // TODO Qt6 only: remove, textActivated() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available connect(m_saw_element->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextElement(QString))); - #endif +#else + connect(m_saw_element->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextElement); +#endif //Folio Tab connect(m_saw_folio, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextFolio); connect(m_saw_folio, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextFolio); - #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - connect(m_saw_folio->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextFolio); - #else // TODO Qt6 only: remove, textActivated() always available +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available connect(m_saw_folio->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextFolio(QString))); - #endif +#else + connect(m_saw_folio->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextFolio); +#endif // Auto Folio Numbering - connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum())); + connect(m_faw, &FolioAutonumberingW::applyPressed, this, &ProjectAutoNumConfigPage::applyAutoNum); } /** diff --git a/sources/ui/diagramcontextwidget.cpp b/sources/ui/diagramcontextwidget.cpp index 9cacb2685..396c89b2e 100644 --- a/sources/ui/diagramcontextwidget.cpp +++ b/sources/ui/diagramcontextwidget.cpp @@ -25,7 +25,7 @@ DiagramContextWidget::DiagramContextWidget(QWidget *parent) : ui(new Ui::DiagramContextWidget) { ui->setupUi(this); - connect(ui->m_table, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(checkTableRows())); + connect(ui->m_table, &QTableWidget::itemChanged, this, &DiagramContextWidget::checkTableRows); } DiagramContextWidget::~DiagramContextWidget() diff --git a/sources/ui/diagrampropertiesdialog.cpp b/sources/ui/diagrampropertiesdialog.cpp index 3496fcdae..e07de4a6a 100644 --- a/sources/ui/diagrampropertiesdialog.cpp +++ b/sources/ui/diagrampropertiesdialog.cpp @@ -62,7 +62,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this); titleblock_infos -> setReadOnly(diagram_is_read_only); - connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum())); + connect(titleblock_infos, &TitleBlockPropertiesWidget::openAutoNumFolioEditor, this, &DiagramPropertiesDialog::editAutoFolioNum); //titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display //Conductor widget @@ -77,8 +77,8 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare // Buttons QDialogButtonBox boutons(diagram_is_read_only ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(&boutons, SIGNAL(accepted()), this, SLOT(accept())); - connect(&boutons, SIGNAL(rejected()), this, SLOT(reject())); + connect(&boutons, &QDialogButtonBox::accepted, this, &DiagramPropertiesDialog::accept); + connect(&boutons, &QDialogButtonBox::rejected, this, &DiagramPropertiesDialog::reject); QGridLayout *glayout = new QGridLayout; glayout->addWidget(border_infos,0,0); diff --git a/sources/ui/diagrampropertieseditordockwidget.cpp b/sources/ui/diagrampropertieseditordockwidget.cpp index 21ca88f13..13be007f8 100644 --- a/sources/ui/diagrampropertieseditordockwidget.cpp +++ b/sources/ui/diagrampropertieseditordockwidget.cpp @@ -45,19 +45,15 @@ void DiagramPropertiesEditorDockWidget::setDiagram(Diagram *diagram) if (m_diagram) { - disconnect(m_diagram, SIGNAL(selectionChanged()), - this, SLOT(selectionChanged())); - disconnect(m_diagram, SIGNAL(destroyed()), - this, SLOT(diagramWasDeleted())); + disconnect(m_diagram, &Diagram::selectionChanged, this, &DiagramPropertiesEditorDockWidget::selectionChanged); + disconnect(m_diagram, &QObject::destroyed, this, &DiagramPropertiesEditorDockWidget::diagramWasDeleted); } if (diagram) { m_diagram = diagram; - connect(m_diagram, SIGNAL(selectionChanged()), - this, SLOT(selectionChanged()), Qt::QueuedConnection); - connect(m_diagram, SIGNAL(destroyed()), - this, SLOT(diagramWasDeleted())); + connect(m_diagram, &Diagram::selectionChanged, this, &DiagramPropertiesEditorDockWidget::selectionChanged, Qt::QueuedConnection); + connect(m_diagram, &QObject::destroyed, this, &DiagramPropertiesEditorDockWidget::diagramWasDeleted); selectionChanged(); } else diff --git a/sources/ui/linksingleelementwidget.cpp b/sources/ui/linksingleelementwidget.cpp index 528a20e8a..08c65cc55 100644 --- a/sources/ui/linksingleelementwidget.cpp +++ b/sources/ui/linksingleelementwidget.cpp @@ -717,8 +717,7 @@ void LinkSingleElementWidget::on_m_tree_widget_itemDoubleClicked( if (m_showed_element) { - disconnect(m_showed_element, SIGNAL(destroyed()), - this, SLOT(showedElementWasDeleted())); + disconnect(m_showed_element, &QObject::destroyed, this, &LinkSingleElementWidget::showedElementWasDeleted); m_showed_element->setHighlighted(false); } @@ -726,8 +725,7 @@ void LinkSingleElementWidget::on_m_tree_widget_itemDoubleClicked( elmt->diagram()->showMe(); elmt->setHighlighted(true); m_showed_element = elmt; - connect(m_showed_element, SIGNAL(destroyed()), - this, SLOT(showedElementWasDeleted())); + connect(m_showed_element, &QObject::destroyed, this, &LinkSingleElementWidget::showedElementWasDeleted); } diff --git a/sources/ui/masterpropertieswidget.cpp b/sources/ui/masterpropertieswidget.cpp index e5952a5e5..813ac95cb 100644 --- a/sources/ui/masterpropertieswidget.cpp +++ b/sources/ui/masterpropertieswidget.cpp @@ -154,14 +154,12 @@ void MasterPropertiesWidget::setElement(Element *element) m_element->setHighlighted(false); if (m_project) - disconnect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), - this, SLOT(diagramWasdeletedFromProject())); + disconnect(m_project, &QETProject::diagramRemoved, this, &MasterPropertiesWidget::diagramWasdeletedFromProject); if(Q_LIKELY(element->diagram() && element->diagram()->project())) { m_project = element->diagram()->project(); - connect(m_project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), - this, SLOT(diagramWasdeletedFromProject())); + connect(m_project, &QETProject::diagramRemoved, this, &MasterPropertiesWidget::diagramWasdeletedFromProject); } else m_project = nullptr; @@ -397,8 +395,7 @@ void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int colum Q_UNUSED(column); if (m_showed_element) { - disconnect(m_showed_element, SIGNAL(destroyed()), - this, SLOT(showedElementWasDeleted())); + disconnect(m_showed_element, &QObject::destroyed, this, &MasterPropertiesWidget::showedElementWasDeleted); m_showed_element -> setHighlighted(false); } if (m_element) @@ -407,8 +404,7 @@ void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int colum m_showed_element = m_qtwi_hash[qtwi]; m_showed_element->diagram()->showMe(); m_showed_element->setHighlighted(true); - connect(m_showed_element, SIGNAL(destroyed()), - this, SLOT(showedElementWasDeleted())); + connect(m_showed_element, &QObject::destroyed, this, &MasterPropertiesWidget::showedElementWasDeleted); } /** diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index b9bea1c71..28dfc07c0 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -45,8 +45,8 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent }); connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString))); - connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp())); - connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp())); + connect(projectAutoNumConfigPage, &ProjectAutoNumConfigPage::saveCurrentTbp, newDiagramPage, &NewDiagramPage::saveCurrentTbp); + connect(projectAutoNumConfigPage, &ProjectAutoNumConfigPage::loadSavedTbp, newDiagramPage, &NewDiagramPage::loadSavedTbp); } /** diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index 94c03a72a..7909c44df 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -37,7 +37,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash prope { ui->setupUi(this); buildUi(); - connect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_cross_properties_gb, SLOT(setEnabled(bool))); + connect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); connect(ui->m_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); connect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); updateDisplay(); @@ -49,7 +49,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash prope */ XRefPropertiesWidget::~XRefPropertiesWidget() { - disconnect(ui->m_display_has_cross_rb, SIGNAL(toggled(bool)), ui->m_cross_properties_gb, SLOT(setEnabled(bool))); + disconnect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); disconnect(ui->m_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); disconnect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); delete ui;