diff --git a/sources/autoNum/ui/autonumberingdockwidget.cpp b/sources/autoNum/ui/autonumberingdockwidget.cpp index 8bab40e7a..39f0aa985 100644 --- a/sources/autoNum/ui/autonumberingdockwidget.cpp +++ b/sources/autoNum/ui/autonumberingdockwidget.cpp @@ -113,33 +113,19 @@ 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 (this, - SIGNAL(folioAutoNumChanged(QString)), - &m_project_view->currentDiagram()->diagram()->border_and_titleblock, - SLOT (slot_setAutoPageNum(QString))); - disconnect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()), - this,SLOT(setActive())); + disconnect(m_project, &QETProject::folioAutoNumRemoved, this, qOverload<>(&AutoNumberingDockWidget::folioAutoNumChanged)); + disconnect(m_project, &QETProject::folioAutoNumAdded, this, qOverload<>(&AutoNumberingDockWidget::folioAutoNumChanged)); + disconnect(m_project, &QETProject::defaultTitleBlockPropertiesChanged, this, &AutoNumberingDockWidget::setActive); //Conductor, Element and Folio Signals disconnect(m_project, &QETProject::autoNumContextUpdated, @@ -152,33 +138,19 @@ 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 (this, - SIGNAL(folioAutoNumChanged(QString)), - &m_project_view->currentDiagram()->diagram()->border_and_titleblock, - SLOT (slot_setAutoPageNum(QString))); - connect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()), - this,SLOT(setActive())); + connect(m_project, &QETProject::folioAutoNumRemoved, this, qOverload<>(&AutoNumberingDockWidget::folioAutoNumChanged)); + connect(m_project, &QETProject::folioAutoNumAdded, this, qOverload<>(&AutoNumberingDockWidget::folioAutoNumChanged)); + connect(m_project, &QETProject::defaultTitleBlockPropertiesChanged, this, &AutoNumberingDockWidget::setActive); //Conductor, Element and Folio Signals connect(m_project, &QETProject::autoNumContextUpdated, @@ -382,7 +354,6 @@ void AutoNumberingDockWidget::on_m_folio_cb_activated(int) { if (new_properties != old_properties) diagram->undoStack().push(new ChangeTitleBlockCommand(diagram, old_properties, new_properties)); } - emit(folioAutoNumChanged(current_autonum)); refreshRow(AutoNumCategory::Folio); } diff --git a/sources/autoNum/ui/autonumberingdockwidget.h b/sources/autoNum/ui/autonumberingdockwidget.h index 5e86610e1..8472439bf 100644 --- a/sources/autoNum/ui/autonumberingdockwidget.h +++ b/sources/autoNum/ui/autonumberingdockwidget.h @@ -72,7 +72,6 @@ class AutoNumberingDockWidget : public QDockWidget void on_m_folio_increase_sb_valueChanged(int); signals: - void folioAutoNumChanged(QString); private: enum class AutoNumCategory { Conductor, Element, Folio }; diff --git a/sources/autoNum/ui/selectautonumw.cpp b/sources/autoNum/ui/selectautonumw.cpp index 7b07477da..1d820fde0 100644 --- a/sources/autoNum/ui/selectautonumw.cpp +++ b/sources/autoNum/ui/selectautonumw.cpp @@ -112,7 +112,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) else { for (int i=0; i editor_layout -> addWidget(part); } @@ -145,7 +145,7 @@ void SelectAutonumW::on_add_button_clicked() { applyEnable(false); NumPartEditorW *part = new NumPartEditorW(m_edited_type, this); - connect (part, SIGNAL(changed()), this, SLOT(applyEnable())); + connect(part, &NumPartEditorW::changed, this, [this]() { applyEnable(); }); num_part_list_ << part; ui -> editor_layout -> addWidget(part); ui -> remove_button -> setEnabled(true); @@ -160,7 +160,7 @@ void SelectAutonumW::on_remove_button_clicked() //remove if @num_part_list contains more than one item if (num_part_list_.size() > 1) { NumPartEditorW *part = num_part_list_.takeLast(); - disconnect(part, SIGNAL(changed()), this, SLOT(applyEnable())); + // deliberately not disconnecting as not possible to resolve with lambda and will happen automatically when the object "part" is destroyed. delete part; if (num_part_list_.size() == 1) { ui -> remove_button -> setDisabled(true); 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..c2eb0ff9d 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -79,7 +79,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : m_diagram->loadCndFolioSeq(); m_paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this); - connect(m_paste_here, SIGNAL(triggered()), this, SLOT(pasteHere())); + connect(m_paste_here, &QAction::triggered, this, &DiagramView::pasteHere); m_multi_paste = new QAction(QET::Icons::EditPaste, tr("Collage multiple"), this); connect(m_multi_paste, &QAction::triggered, [this]() { @@ -89,7 +89,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : // Setup the action to create a template m_create_template = new QAction(tr("Créer un template", "context menu action"), this); - connect(m_create_template, SIGNAL(triggered()), this, SLOT(createTemplateFromSelection())); + connect(m_create_template, &QAction::triggered, this, &DiagramView::createTemplateFromSelection); //setup three separators, to be use in context menu for(int i=0 ; i<3 ; ++i) @@ -98,10 +98,10 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : m_separators.last()->setSeparator(true); } - connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*))); - connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect())); + connect(m_diagram, &Diagram::showDiagram, this, &DiagramView::showDiagram); + 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))); + connect(diagram, &Diagram::findElementRequired, this, &DiagramView::findElementRequired); QShortcut *edit_conductor_color_shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this); connect(edit_conductor_color_shortcut, &QShortcut::activated, [this]() 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..9af082c9b 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -50,14 +50,14 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) : adjustItemPosition(1); // adjust textfield position after line additions/deletions + connect(document(), + &QTextDocument::blockCountChanged, + this, + &PartText::adjustItemPosition); connect(document(), - SIGNAL(blockCountChanged(int)), + &QTextDocument::contentsChanged, this, - SLOT(adjustItemPosition(int))); - connect(document(), - SIGNAL(contentsChanged()), - this, - SLOT(adjustItemPosition())); + [this]() { adjustItemPosition(); }); } /// Destructeur diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 1818e8bf5..30a318e3d 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -582,17 +582,25 @@ bool StyleEditor::isStyleEditable(QList cep_list) */ void StyleEditor::activeConnections(bool active) { if (active) { - connect (outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor())); - connect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle())); - connect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight())); - connect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling())); - connect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing())); + connect(outline_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartColor); + connect(line_style, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle); + connect(size_weight, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight); + connect(filling_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartFilling); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + connect(antialiasing, &QCheckBox::stateChanged, this, &StyleEditor::updatePartAntialiasing); +#else + connect(antialiasing, &QCheckBox::checkStateChanged, this, &StyleEditor::updatePartAntialiasing); +#endif } else { - disconnect(outline_color, SIGNAL(activated(int)), this, SLOT(updatePartColor())); - disconnect(line_style, SIGNAL(activated(int)), this, SLOT(updatePartLineStyle())); - disconnect(size_weight, SIGNAL(activated(int)), this, SLOT(updatePartLineWeight())); - disconnect(filling_color, SIGNAL(activated(int)), this, SLOT(updatePartFilling())); - disconnect(antialiasing, SIGNAL(stateChanged(int)), this, SLOT(updatePartAntialiasing())); + disconnect(outline_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartColor); + disconnect(line_style, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle); + disconnect(size_weight, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight); + disconnect(filling_color, qOverload(&QComboBox::activated), this, &StyleEditor::updatePartFilling); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + disconnect(antialiasing, &QCheckBox::stateChanged, this, &StyleEditor::updatePartAntialiasing); +#else + disconnect(antialiasing, &QCheckBox::checkStateChanged, this, &StyleEditor::updatePartAntialiasing); +#endif } } diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 4b5ab6f45..6a09de091 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -226,7 +226,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/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index 9a4eb2ffb..3febab0d9 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -848,7 +848,7 @@ bool QETElementEditor::event(QEvent *event) { if (m_first_activation && event->type() == QEvent::WindowActivate) { m_first_activation = false; - QTimer::singleShot(250, m_view, SLOT(zoomFit())); + QTimer::singleShot(250, m_view, &ElementView::zoomFit); } return QMainWindow::event(event); 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/elementspanel.cpp b/sources/elementspanel.cpp index 09f12cf96..9e20e2f37 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -75,7 +75,7 @@ ElementsPanel::ElementsPanel(QWidget *parent) : // we handle double click on items ourselves connect(this, &ElementsPanel::itemDoubleClicked, this, &ElementsPanel::slot_doubleClick); - connect(this, &GenericPanel::firstActivated, [this]() {QTimer::singleShot(250, this, SLOT(reload()));}); + connect(this, &GenericPanel::firstActivated, [this]() {QTimer::singleShot(250, this, &ElementsPanel::reload);}); connect(this, &ElementsPanel::panelContentChanged, this, &ElementsPanel::panelContentChange); // manage signal itemClicked diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index f9a71c947..129e49512 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -96,44 +96,42 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { context_menu = new QMenu(this); - connect(open_directory, SIGNAL(triggered()), this, SLOT(openDirectoryForSelectedItem())); - connect(copy_path, SIGNAL(triggered()), this, SLOT(copyPathForSelectedItem())); - connect(prj_activate, SIGNAL(triggered()), this, SLOT(activateProject())); - connect(prj_close, SIGNAL(triggered()), this, SLOT(closeProject())); - connect(prj_edit_prop, SIGNAL(triggered()), this, SLOT(editProjectProperties())); - connect(prj_prop_diagram, SIGNAL(triggered()), this, SLOT(editDiagramProperties())); - connect(prj_add_diagram, SIGNAL(triggered()), this, SLOT(newDiagram())); - connect(prj_insert_diagram_above, SIGNAL(triggered()), this, SLOT(insertDiagramAbove())); - connect(prj_insert_diagram_below, SIGNAL(triggered()), this, SLOT(insertDiagramBelow())); - connect(prj_del_diagram, SIGNAL(triggered()), this, SLOT(deleteDiagram())); - connect(prj_duplicate_diagram, SIGNAL(triggered()), this, SLOT(duplicateDiagram())); - connect(prj_move_diagram_up, SIGNAL(triggered()), this, SLOT(moveDiagramUp())); - connect(prj_move_diagram_down, SIGNAL(triggered()), this, SLOT(moveDiagramDown())); - connect(prj_move_diagram_top, SIGNAL(triggered()), this, SLOT(moveDiagramUpTop())); - connect(prj_move_diagram_upx10, SIGNAL(triggered()), this, SLOT(moveDiagramUpx10())); - connect(prj_move_diagram_upx100, SIGNAL(triggered()), this, SLOT(moveDiagramUpx100())); - connect(prj_move_diagram_downx10, SIGNAL(triggered()), this, SLOT(moveDiagramDownx10())); - connect(prj_move_diagram_downx100,SIGNAL(triggered()), this, SLOT(moveDiagramDownx100())); - connect(tbt_add, SIGNAL(triggered()), this, SLOT(addTitleBlockTemplate())); - connect(tbt_edit, SIGNAL(triggered()), this, SLOT(editTitleBlockTemplate())); - connect(tbt_remove, SIGNAL(triggered()), this, SLOT(removeTitleBlockTemplate())); - - 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(open_directory, &QAction::triggered, this, &ElementsPanelWidget::openDirectoryForSelectedItem); + connect(copy_path, &QAction::triggered, this, &ElementsPanelWidget::copyPathForSelectedItem); + connect(prj_activate, &QAction::triggered, this, &ElementsPanelWidget::activateProject); + connect(prj_close, &QAction::triggered, this, &ElementsPanelWidget::closeProject); + connect(prj_edit_prop, &QAction::triggered, this, &ElementsPanelWidget::editProjectProperties); + connect(prj_prop_diagram, &QAction::triggered, this, &ElementsPanelWidget::editDiagramProperties); + connect(prj_add_diagram, &QAction::triggered, this, &ElementsPanelWidget::newDiagram); + connect(prj_insert_diagram_above, &QAction::triggered, this, &ElementsPanelWidget::insertDiagramAbove); + connect(prj_insert_diagram_below, &QAction::triggered, this, &ElementsPanelWidget::insertDiagramBelow); + connect(prj_del_diagram, &QAction::triggered, this, &ElementsPanelWidget::deleteDiagram); + connect(prj_duplicate_diagram, &QAction::triggered, this, &ElementsPanelWidget::duplicateDiagram); + connect(prj_move_diagram_up, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramUp); + connect(prj_move_diagram_down, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramDown); + connect(prj_move_diagram_top, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramUpTop); + connect(prj_move_diagram_upx10, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramUpx10); + connect(prj_move_diagram_upx100, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramUpx100); + connect(prj_move_diagram_downx10, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramDownx10); + connect(prj_move_diagram_downx100, &QAction::triggered, this, &ElementsPanelWidget::moveDiagramDownx100); + connect(tbt_add, &QAction::triggered, this, &ElementsPanelWidget::addTitleBlockTemplate); + connect(tbt_edit, &QAction::triggered, this, &ElementsPanelWidget::editTitleBlockTemplate); + connect(tbt_remove, &QAction::triggered, this, &ElementsPanelWidget::removeTitleBlockTemplate); + connect(filter_textfield, &QLineEdit::textChanged, this, &ElementsPanelWidget::filterEdited); + connect(elements_panel, &ElementsPanel::currentItemChanged, this, &ElementsPanelWidget::updateButtons); + connect(elements_panel, &ElementsPanel::customContextMenuRequested, this, &ElementsPanelWidget::handleContextMenu); connect( elements_panel, - SIGNAL(requestForTitleBlockTemplate(const TitleBlockTemplateLocation &)), + &ElementsPanel::requestForTitleBlockTemplate, QETApp::instance(), - SLOT(openTitleBlockTemplate(const TitleBlockTemplateLocation &)) - ); - + [app = QETApp::instance()](const TitleBlockTemplateLocation &location) { app->openTitleBlockTemplate(location); } + ); + // manage double click on TreeWidgetItem - connect(elements_panel, SIGNAL(requestForProjectPropertiesEdition()), this, SLOT(editProjectProperties()) ); - connect(elements_panel, SIGNAL(requestForDiagramPropertiesEdition()), this, SLOT(editDiagramProperties()) ); - // manage project activation - connect(elements_panel, SIGNAL(requestForProject(QETProject*)), this, SIGNAL(requestForProject(QETProject*))); + connect(elements_panel, &ElementsPanel::requestForProjectPropertiesEdition, this, &ElementsPanelWidget::editProjectProperties); + connect(elements_panel, &ElementsPanel::requestForDiagramPropertiesEdition, this, &ElementsPanelWidget::editDiagramProperties); + // manage project activation + connect(elements_panel, &ElementsPanel::requestForProject, this, &ElementsPanelWidget::requestForProject); // disposition verticale QVBoxLayout *vlayout = new QVBoxLayout(this); diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 6e48170e5..7e2b9f7ac 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -87,8 +87,8 @@ ExportDialog::ExportDialog( deSelectAll -> setText(tr("Tout décocher")); hLayout -> addWidget(selectAll); hLayout -> addWidget(deSelectAll); - connect(selectAll, SIGNAL(clicked()), this, SLOT(slot_selectAllClicked())); - connect(deSelectAll, SIGNAL(clicked()), this, SLOT(slot_deSelectAllClicked())); + connect(selectAll, &QPushButton::clicked, this, &ExportDialog::slot_selectAllClicked); + connect(deSelectAll, &QPushButton::clicked, this, &ExportDialog::slot_deSelectAllClicked); QVBoxLayout *layout = new QVBoxLayout(this); @@ -98,10 +98,10 @@ ExportDialog::ExportDialog( layout -> addWidget(buttons); // 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::formatChanged, this, [this]() { slot_changeFilesExtension(); }); + 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); @@ -174,25 +174,25 @@ 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); height_mapper_ -> setMapping(diagram_line -> height, line_count); ratio_mapper_ -> setMapping(diagram_line -> keep_ratio, line_count); reset_mapper_ -> setMapping(diagram_line -> reset_size, line_count); - connect(diagram_line -> width, SIGNAL(valueChanged(int)), width_mapper_, SLOT(map())); - connect(diagram_line -> height, SIGNAL(valueChanged(int)), height_mapper_, SLOT(map())); - connect(diagram_line -> keep_ratio, SIGNAL(toggled(bool)), ratio_mapper_, SLOT(map())); - connect(diagram_line -> reset_size, SIGNAL(clicked(bool)), reset_mapper_, SLOT(map())); + connect(diagram_line -> width, qOverload(&QSpinBox::valueChanged), width_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> height, qOverload(&QSpinBox::valueChanged), height_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> keep_ratio, &QPushButton::toggled, ratio_mapper_, qOverload<>(&QSignalMapper::map)); + connect(diagram_line -> reset_size, &QPushButton::clicked, reset_mapper_, qOverload<>(&QSignalMapper::map)); // mappings et signaux pour l'apercu du schema preview_mapper_ -> setMapping(diagram_line -> preview, line_count); - connect(diagram_line -> preview, SIGNAL(clicked(bool)), preview_mapper_, SLOT(map())); + connect(diagram_line -> preview, &QPushButton::clicked, preview_mapper_, qOverload<>(&QSignalMapper::map)); // mappings et signaux pour l'export du schema vers le presse-papier clipboard_mapper_ -> setMapping(diagram_line -> clipboard, line_count); - connect(diagram_line -> clipboard, SIGNAL(clicked(bool)), clipboard_mapper_, SLOT(map())); + connect(diagram_line -> clipboard, &QPushButton::clicked, clipboard_mapper_, qOverload<>(&QSignalMapper::map)); } QWidget *widget_diagrams_list = new QWidget(); @@ -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 2afbcbc09..8eccc0805 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -236,16 +236,26 @@ 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())); - connect(exported_content_choices, SIGNAL(buttonClicked(QAbstractButton *)), this, SIGNAL(exportedAreaChanged())); - connect(draw_grid, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_border, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_titleblock, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_terminals, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_terminal_names, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_bg_transparent, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); - connect(draw_colored_conductors, SIGNAL(stateChanged(int)), this, SIGNAL(optionChanged())); + connect(format, qOverload(&QComboBox::currentIndexChanged), this, &ExportPropertiesWidget::formatChanged); + connect(exported_content_choices, qOverload(&QButtonGroup::buttonClicked), this, &ExportPropertiesWidget::exportedAreaChanged); +#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO Qt 6.7: remove, checkStateChanged() always available + connect(draw_grid, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_border, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_titleblock, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminals, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminal_names, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_bg_transparent, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_colored_conductors, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged); +#else + connect(draw_grid, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_border, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_titleblock, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminals, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_terminal_names, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_bg_transparent, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); + connect(draw_colored_conductors, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged); +#endif } diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index dbb856b75..71248faa1 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -1033,7 +1033,7 @@ bool GenericPanel::event(QEvent *event) { if (first_activation_) { if (event -> type() == QEvent::WindowActivate || event -> type() == QEvent::Show) { - QTimer::singleShot(250, this, SLOT(emitFirstActivated())); + QTimer::singleShot(250, this, &GenericPanel::emitFirstActivated); first_activation_ = false; } } diff --git a/sources/projectview.cpp b/sources/projectview.cpp index a8292bba7..fa348277b 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 456676705..95d84a4d0 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -1796,7 +1796,7 @@ void QETApp::checkRemainingWindows() */ static bool sleep = true; if (sleep) { - QTimer::singleShot(500, this, SLOT(checkRemainingWindows())); + QTimer::singleShot(500, this, &QETApp::checkRemainingWindows); } else { if (!diagramEditors().count() && !elementEditors().count()) { qApp->quit(); @@ -2405,24 +2405,23 @@ void QETApp::initSystemTray() reduce_appli -> setToolTip(tr("Réduire QElectroTech dans le systray")); restore_appli -> setToolTip(tr("Restaurer QElectroTech")); - connect(quitter_qet, SIGNAL(triggered()), this, SLOT(quitQET())); - connect(reduce_appli, SIGNAL(triggered()), this, SLOT(reduceEveryEditor())); - connect(restore_appli, SIGNAL(triggered()), this, SLOT(restoreEveryEditor())); - connect(reduce_diagrams, SIGNAL(triggered()), this, SLOT(reduceDiagramEditors())); - connect(restore_diagrams, SIGNAL(triggered()), this, SLOT(restoreDiagramEditors())); - connect(reduce_elements, SIGNAL(triggered()), this, SLOT(reduceElementEditors())); - connect(restore_elements, SIGNAL(triggered()), this, SLOT(restoreElementEditors())); - connect(reduce_templates, SIGNAL(triggered()), this, SLOT(reduceTitleBlockTemplateEditors())); - connect(restore_templates,SIGNAL(triggered()), this, SLOT(restoreTitleBlockTemplateEditors())); - connect(new_diagram, SIGNAL(triggered()), this, SLOT(newDiagramEditor())); - connect(new_element, SIGNAL(triggered()), this, SLOT(newElementEditor())); + connect(quitter_qet, &QAction::triggered, this, &QETApp::quitQET); + connect(reduce_appli, &QAction::triggered, this, &QETApp::reduceEveryEditor); + connect(restore_appli, &QAction::triggered, this, &QETApp::restoreEveryEditor); + connect(reduce_diagrams, &QAction::triggered, this, &QETApp::reduceDiagramEditors); + connect(restore_diagrams, &QAction::triggered, this, &QETApp::restoreDiagramEditors); + connect(reduce_elements, &QAction::triggered, this, &QETApp::reduceElementEditors); + connect(restore_elements, &QAction::triggered, this, &QETApp::restoreElementEditors); + connect(reduce_templates, &QAction::triggered, this, &QETApp::reduceTitleBlockTemplateEditors); + connect(restore_templates, &QAction::triggered, this, &QETApp::restoreTitleBlockTemplateEditors); + connect(new_diagram, &QAction::triggered, this, &QETApp::newDiagramEditor); + connect(new_element, &QAction::triggered, this, &QETApp::newElementEditor); // initialization of the systray icon // initialisation de l'icone du systray m_qsti = new QSystemTrayIcon(QET::Icons::QETLogo, this); m_qsti -> setToolTip(tr("QElectroTech", "systray icon tooltip")); - connect(m_qsti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, SLOT(systray(QSystemTrayIcon::ActivationReason))); + connect(m_qsti, &QSystemTrayIcon::activated, this, &QETApp::systray); m_qsti -> setContextMenu(menu_systray); m_qsti -> show(); } @@ -2442,7 +2441,7 @@ template void QETApp::addWindowsListToMenu( QAction *current_menu = menu -> addAction(window -> windowTitle()); current_menu -> setCheckable(true); current_menu -> setChecked(window -> isVisible()); - connect(current_menu, SIGNAL(triggered()), &signal_map, SLOT(map())); + connect(current_menu, &QAction::triggered, &signal_map, qOverload<>(&QSignalMapper::map)); signal_map.setMapping(current_menu, window); } } diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 3ec8b28d5..44353b655 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -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(); @@ -185,20 +179,20 @@ void QETDiagramEditor::setUpElementsPanel() addDockWidget(Qt::LeftDockWidgetArea, qdw_pa); - 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, SIGNAL(requestForNewDiagramAt (QETProject *, int)), this, SLOT(addDiagramToProjectAt(QETProject *, int))); - 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::requestForProject, this, qOverload(&QETDiagramEditor::activateProject)); + connect(pa, &ElementsPanelWidget::requestForProjectClosing, this, qOverload(&QETDiagramEditor::closeProject)); + connect(pa, &ElementsPanelWidget::requestForProjectPropertiesEdition, this, qOverload(&QETDiagramEditor::editProjectProperties)); + connect(pa, &ElementsPanelWidget::requestForNewDiagram, this, &QETDiagramEditor::addDiagramToProject); + connect(pa, &ElementsPanelWidget::requestForNewDiagramAt, this, &QETDiagramEditor::addDiagramToProjectAt); + connect(pa, &ElementsPanelWidget::requestForDiagramPropertiesEdition, this, qOverload(&QETDiagramEditor::editDiagramProperties)); + 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); } /** @@ -871,8 +865,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); @@ -994,7 +987,7 @@ bool QETDiagramEditor::event(QEvent *e) if (m_first_show && e->type() == QEvent::WindowActivate) { m_first_show = false; - QTimer::singleShot(250, m_element_collection_widget, SLOT(reload())); + QTimer::singleShot(250, m_element_collection_widget, &ElementsCollectionWidget::reload); } return(QETMainWindow::event(e)); } @@ -1971,23 +1964,19 @@ 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, qOverload(&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, this, &QETDiagramEditor::findElementInPanel); // display error messages sent by the project view - connect(project_view, SIGNAL(errorEncountered(QString)), - this, SLOT(showError(const QString &))); + connect(project_view, &ProjectView::errorEncountered, this, qOverload(&QETDiagramEditor::showError)); //Highlight the current page connect(project_view, &ProjectView::diagramActivated, this, [this](DiagramView *dv) { @@ -2156,7 +2145,7 @@ void QETDiagramEditor::slot_updateWindowsMenu() action -> setStatusTip(QString(tr("Active le projet « %1 »")).arg(pv_title)); action -> setCheckable(true); action -> setChecked(project_view == currentProjectView()); - connect(action, SIGNAL(triggered()), &windowMapper, SLOT(map())); + connect(action, &QAction::triggered, &windowMapper, qOverload<>(&QSignalMapper::map)); windowMapper.setMapping(action, project_view); } } @@ -2572,10 +2561,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 4aa3e3626..fea2754be 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 8635653d2..381fe9912 100644 --- a/sources/qetmainwindow.cpp +++ b/sources/qetmainwindow.cpp @@ -83,13 +83,13 @@ void QETMainWindow::initCommonActions() fullscreen_action_ = new QAction(this); updateFullScreenAction(); - connect(fullscreen_action_, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); + connect(fullscreen_action_, &QAction::triggered, this, &QETMainWindow::toggleFullScreen); whatsthis_action_ = QWhatsThis::createAction(this); about_qet_ = new QAction(QET::Icons::QETLogo, tr("À &propos de QElectroTech"), this); about_qet_ -> setStatusTip(tr("Affiche des informations sur QElectroTech", "status bar tip")); - connect(about_qet_, SIGNAL(triggered()), qet_app, SLOT(aboutQET())); + connect(about_qet_, &QAction::triggered, qet_app, &QETApp::aboutQET); manual_online_ = new QAction(QET::Icons::QETManual, tr("Manuel en ligne"), this); manual_online_ -> setStatusTip(tr("Lance le navigateur par défaut vers le manuel en ligne de QElectroTech", "status bar tip")); @@ -135,7 +135,7 @@ void QETMainWindow::initCommonActions() about_qt_ = new QAction(QET::Icons::QtLogo, tr("À propos de &Qt"), this); about_qt_ -> setStatusTip(tr("Affiche des informations sur la bibliothèque Qt", "status bar tip")); - connect(about_qt_, SIGNAL(triggered()), qApp, SLOT(aboutQt())); + connect(about_qt_, &QAction::triggered, qApp, &QApplication::aboutQt); diagnostics_action_ = new QAction(QET::Icons::DialogInformation, tr("Enregistrer un rapport de diagnostic..."), this); diagnostics_action_ -> setStatusTip(tr("Génère un rapport avec les derniers messages de journalisation, pour l'inclure dans un rapport de bug", "status bar tip")); @@ -152,7 +152,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 31dfb6365..d296ebf74 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -203,7 +203,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..1b49798a4 100644 --- a/sources/qtextorientationspinboxwidget.cpp +++ b/sources/qtextorientationspinboxwidget.cpp @@ -117,25 +117,24 @@ void QTextOrientationSpinBoxWidget::build() spin_box_ -> setSuffix("°"); // met en place les relations entre le SpinBox et le QTextOrientationWidget - connect(spin_box_, - SIGNAL(valueChanged(double)), + connect(spin_box_, + qOverload(&QDoubleSpinBox::valueChanged), orientation_widget_, - SLOT(setOrientation(double))); + &QTextOrientationWidget::setOrientation); 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_, - SIGNAL(orientationChanged(double)), + &QTextOrientationWidget::orientationChanged, spin_box_, - SIGNAL(editingFinished())); + &QDoubleSpinBox::editingFinished); // 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..228b9ad57 100644 --- a/sources/titleblock/dimensionwidget.cpp +++ b/sources/titleblock/dimensionwidget.cpp @@ -143,15 +143,15 @@ void TitleBlockDimensionWidget::initWidgets() dimension_type_ -> addButton(relative_button_, QET::RelativeToTotalLength); dimension_type_ -> addButton(remaining_button_, QET::RelativeToRemainingLength); absolute_button_ -> setChecked(true); - connect(dimension_type_, SIGNAL(buttonClicked(int)), this, SLOT(updateSpinBoxSuffix())); + connect(dimension_type_, qOverload(&QButtonGroup::buttonClicked), this, &TitleBlockDimensionWidget::updateSpinBoxSuffix); } updateSpinBoxSuffix(); // 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..9dd025132 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -142,7 +142,7 @@ void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) Q_UNUSED(event) if (duplicate_ && !opened_from_file_ && location_.parentCollection()) { // this editor is supposed to duplicate its current location - QTimer::singleShot(250, this, SLOT(duplicateCurrentLocation())); + QTimer::singleShot(250, this, &QETTitleBlockTemplateEditor::duplicateCurrentLocation); } } @@ -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 @@ -411,26 +411,26 @@ void QETTitleBlockTemplateEditor::initActions() ShortcutManager::instance().registerAction(zoom_fit_, "titleblockeditor.zoom_fit", tr("Éditeur de cartouche"), Qt::CTRL | Qt::Key_9); ShortcutManager::instance().registerAction(zoom_reset_, "titleblockeditor.zoom_reset", tr("Éditeur de cartouche"), Qt::CTRL | Qt::Key_0); - connect(new_, SIGNAL(triggered()), this, SLOT(newTemplate())); - connect(open_, SIGNAL(triggered()), this, SLOT(open())); - connect(open_from_file_, SIGNAL(triggered()), this, SLOT(openFromFile())); - connect(save_, SIGNAL(triggered()), this, SLOT(save())); - connect(save_as_, SIGNAL(triggered()), this, SLOT(saveAs())); - connect(save_as_file_, SIGNAL(triggered()), this, SLOT(saveAsFile())); - connect(quit_, SIGNAL(triggered()), this, SLOT(quit())); - connect(cut_, SIGNAL(triggered()), template_edition_area_view_, SLOT(cut())); - connect(copy_, SIGNAL(triggered()), template_edition_area_view_, SLOT(copy())); - connect(paste_, SIGNAL(triggered()), template_edition_area_view_, SLOT(paste())); - connect(zoom_in_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomIn())); - connect(zoom_out_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomOut())); - connect(zoom_fit_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomFit())); - connect(zoom_reset_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomReset())); - connect(edit_logos_, SIGNAL(triggered()), this, SLOT(editLogos())); - connect(edit_info_, SIGNAL(triggered()), this, SLOT(editTemplateInformation())); - connect(add_row_, SIGNAL(triggered()), template_edition_area_view_, SLOT(addRowAtEnd())); - connect(add_col_, SIGNAL(triggered()), template_edition_area_view_, SLOT(addColumnAtEnd())); - connect(merge_cells_, SIGNAL(triggered()), template_edition_area_view_, SLOT(mergeSelectedCells())); - connect(split_cell_, SIGNAL(triggered()), template_edition_area_view_, SLOT(splitSelectedCell())); + connect(new_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::newTemplate); + connect(open_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::open); + connect(open_from_file_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::openFromFile); + connect(save_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::save); + connect(save_as_, &QAction::triggered, this, qOverload<>(&QETTitleBlockTemplateEditor::saveAs)); + connect(save_as_file_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::saveAsFile); + connect(quit_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::quit); + connect(cut_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::cut); + connect(copy_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::copy); + connect(paste_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::paste); + connect(zoom_in_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::zoomIn); + connect(zoom_out_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::zoomOut); + connect(zoom_fit_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::zoomFit); + connect(zoom_reset_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::zoomReset); + connect(edit_logos_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::editLogos); + connect(edit_info_, &QAction::triggered, this, &QETTitleBlockTemplateEditor::editTemplateInformation); + connect(add_row_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::addRowAtEnd); + connect(add_col_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::addColumnAtEnd); + connect(merge_cells_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::mergeSelectedCells); + connect(split_cell_, &QAction::triggered, template_edition_area_view_, &TitleBlockTemplateView::splitSelectedCell); } /** @@ -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); } /** @@ -593,9 +595,9 @@ void QETTitleBlockTemplateEditor::initLogoManager() logo_manager_ -> setReadOnly(read_only_); connect( logo_manager_, - SIGNAL(logosChanged(const TitleBlockTemplate *)), + &TitleBlockTemplateLogoManager::logosChanged, template_cell_editor_widget_, - SLOT(updateLogosComboBox(const TitleBlockTemplate *)) + &TitleBlockTemplateCellWidget::updateLogosComboBox ); } @@ -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..70c5ce371 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -145,20 +145,20 @@ void TitleBlockTemplateCellWidget::initWidgets() setLayout(cell_editor_layout_); // trigger the logo manager - connect(add_logo_input_, SIGNAL(released()), this, SIGNAL(logoEditionRequested())); + connect(add_logo_input_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::logoEditionRequested); // 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(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(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())); - connect(font_adjust_input_, SIGNAL(clicked(bool)), this, SLOT(editAdjust())); - connect(logo_input_, SIGNAL(activated(int)), this, SLOT(editLogo())); + connect(cell_type_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::updateFormType); + connect(cell_type_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editType); + connect(name_input_, &QLineEdit::editingFinished, this, &TitleBlockTemplateCellWidget::editName); + connect(label_checkbox_, &QCheckBox::clicked, this, &TitleBlockTemplateCellWidget::editLabelDisplayed); + connect(label_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editLabel); + connect(value_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editValue); + connect(horiz_align_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment); + connect(vert_align_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editAlignment); + connect(font_size_input_, qOverload(&QSpinBox::valueChanged), this, &TitleBlockTemplateCellWidget::editFontSize); + connect(font_adjust_input_, &QCheckBox::clicked, this, &TitleBlockTemplateCellWidget::editAdjust); + connect(logo_input_, qOverload(&QComboBox::activated), this, &TitleBlockTemplateCellWidget::editLogo); updateFormType(TitleBlockCell::TextCell); } diff --git a/sources/titleblock/templatelocationchooser.cpp b/sources/titleblock/templatelocationchooser.cpp index 7fc5ab37e..62d0ca700 100644 --- a/sources/titleblock/templatelocationchooser.cpp +++ b/sources/titleblock/templatelocationchooser.cpp @@ -98,8 +98,7 @@ void TitleBlockTemplateLocationChooser::init() templates_ = new QComboBox(); updateCollections(); - connect(collections_, SIGNAL(currentIndexChanged(int)), - this, SLOT(updateTemplates())); + connect(collections_, qOverload(&QComboBox::currentIndexChanged), this, &TitleBlockTemplateLocationChooser::updateTemplates); form_layout_ = new QFormLayout(); form_layout_ -> addRow( diff --git a/sources/titleblock/templatelocationsaver.cpp b/sources/titleblock/templatelocationsaver.cpp index 3af73cd6a..0c27b1896 100644 --- a/sources/titleblock/templatelocationsaver.cpp +++ b/sources/titleblock/templatelocationsaver.cpp @@ -80,7 +80,7 @@ void TitleBlockTemplateLocationSaver::setLocation(const TitleBlockTemplateLocati void TitleBlockTemplateLocationSaver::init() { new_name_ = new QLineEdit(); - connect(templates_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateNewName())); + connect(templates_, qOverload(&QComboBox::currentIndexChanged), this, &TitleBlockTemplateLocationSaver::updateNewName); form_layout_ -> addRow(tr("ou nouveau nom", "used in save as form"), new_name_); updateTemplates(); } diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index 45a756791..8a0df8e4f 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -123,16 +123,15 @@ void TitleBlockTemplateLogoManager::initWidgets() vlayout0_ -> addWidget(logo_box_); setLayout(vlayout0_); - connect( - logos_view_, - SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), + connect(logos_view_, + &QListWidget::currentItemChanged, this, - SLOT(updateLogoInformations(QListWidgetItem *, QListWidgetItem *)) + &TitleBlockTemplateLogoManager::updateLogoInformations ); - 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); } /** @@ -214,11 +213,12 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na signal_mapper -> setMapping(replace_button, QDialogButtonBox::YesRole); signal_mapper -> setMapping(rename_button, QDialogButtonBox::NoRole); signal_mapper -> setMapping(cancel_button, QDialogButtonBox::RejectRole); - 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())); + connect(replace_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map)); + connect(rename_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map)); + connect(cancel_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map)); #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))); + #else connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done); #endif 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 a9ccc33b4..644f3239b 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -584,20 +584,20 @@ void TitleBlockTemplateView::init() delete_row_ = new QAction(QET::Icons::EditTableDeleteRow, tr("Supprimer cette ligne", "context menu"), this); change_preview_width_ = new QAction( tr("Modifier la largeur de cet aperçu", "context menu"), this); - connect(add_column_before_, SIGNAL(triggered()), this, SLOT(addColumnBefore())); - connect(add_row_before_, SIGNAL(triggered()), this, SLOT(addRowBefore())); - connect(add_column_after_, SIGNAL(triggered()), this, SLOT(addColumnAfter())); - connect(add_row_after_, SIGNAL(triggered()), this, SLOT(addRowAfter())); - connect(edit_column_dim_, SIGNAL(triggered()), this, SLOT(editColumn())); - connect(edit_row_dim_, SIGNAL(triggered()), this, SLOT(editRow())); - connect(delete_column_, SIGNAL(triggered()), this, SLOT(deleteColumn())); - connect(delete_row_, SIGNAL(triggered()), this, SLOT(deleteRow())); - connect(change_preview_width_, SIGNAL(triggered()), this, SLOT(changePreviewWidth())); + connect(add_column_before_, &QAction::triggered, this, &TitleBlockTemplateView::addColumnBefore); + connect(add_row_before_, &QAction::triggered, this, &TitleBlockTemplateView::addRowBefore); + connect(add_column_after_, &QAction::triggered, this, &TitleBlockTemplateView::addColumnAfter); + connect(add_row_after_, &QAction::triggered, this, &TitleBlockTemplateView::addRowAfter); + connect(edit_column_dim_, &QAction::triggered, this, [this]() { editColumn(); }); + connect(edit_row_dim_, &QAction::triggered, this, [this]() { editRow(); }); + connect(delete_column_, &QAction::triggered, this, &TitleBlockTemplateView::deleteColumn); + connect(delete_row_, &QAction::triggered, this, &TitleBlockTemplateView::deleteRow); + connect(change_preview_width_, &QAction::triggered, this, &TitleBlockTemplateView::changePreviewWidth); 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; @@ -691,7 +691,7 @@ void TitleBlockTemplateView::applyRowsHeights(bool animate) { animation -> setStartValue(QVariant(tbgrid_ -> rowMinimumHeight(ROW_OFFSET + i))); animation -> setEndValue(QVariant(1.0 * heights.at(i))); animation -> setDuration(500); - connect(animation, SIGNAL(finished()), this, SLOT(updateRowsHelperCells())); + connect(animation, &GridLayoutAnimation::finished, this, &TitleBlockTemplateView::updateRowsHelperCells); animation -> start(QAbstractAnimation::DeleteWhenStopped); } @@ -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); } @@ -869,7 +863,7 @@ void TitleBlockTemplateView::fillWithEmptyCells() */ bool TitleBlockTemplateView::event(QEvent *event) { if (first_activation_ && event -> type() == QEvent::WindowActivate) { - QTimer::singleShot(250, this, SLOT(zoomFit())); + QTimer::singleShot(250, this, &TitleBlockTemplateView::zoomFit); first_activation_ = false; } return(QGraphicsView::event(event)); diff --git a/sources/ui/configpage/configpages.cpp b/sources/ui/configpage/configpages.cpp index 26711a18c..8c027ccac 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 2f8ea06e4..0a95c3c10 100644 --- a/sources/ui/configpage/projectconfigpages.cpp +++ b/sources/ui/configpage/projectconfigpages.cpp @@ -391,7 +391,7 @@ 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); @@ -421,7 +421,7 @@ void ProjectAutoNumConfigPage::buildConnections() #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/elementinfowidget.cpp b/sources/ui/elementinfowidget.cpp index a566643c5..0b8a41111 100644 --- a/sources/ui/elementinfowidget.cpp +++ b/sources/ui/elementinfowidget.cpp @@ -148,7 +148,7 @@ bool ElementInfoWidget::event(QEvent *event) { if (event -> type() == QEvent::WindowActivate || event -> type() == QEvent::Show) { - QTimer::singleShot(250, this, SLOT(firstActivated())); + QTimer::singleShot(250, this, &ElementInfoWidget::firstActivated); m_first_activation = false; } } diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index 870984bdd..47a5b482a 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -403,9 +403,9 @@ QWidget *ElementPropertiesWidget::generalWidget() //button widget QPushButton *find_in_panel = new QPushButton(QET::Icons::ZoomDraw, tr("Retrouver dans le panel"), general_widget); - connect(find_in_panel, SIGNAL(clicked()), this, SLOT(findInPanel())); + connect(find_in_panel, &QPushButton::clicked, this, &ElementPropertiesWidget::findInPanel); QPushButton *edit_element = new QPushButton(QET::Icons::ElementEdit, tr("Éditer l'élément"), general_widget); - connect(edit_element, SIGNAL(clicked()), this, SLOT(editElement())); + connect(edit_element, &QPushButton::clicked, this, &ElementPropertiesWidget::editElement); QHBoxLayout *hlayout_ = new QHBoxLayout; hlayout_->addWidget(find_in_panel); hlayout_->addWidget(edit_element); diff --git a/sources/ui/linksingleelementwidget.cpp b/sources/ui/linksingleelementwidget.cpp index 528a20e8a..026ca251d 100644 --- a/sources/ui/linksingleelementwidget.cpp +++ b/sources/ui/linksingleelementwidget.cpp @@ -528,7 +528,7 @@ void LinkSingleElementWidget::diagramWasRemovedFromProject() // contains the master element linked to the edited element // we must wait for this elements to be unlinked, // or else the list of available master isn't up to date - QTimer::singleShot(10, this, SLOT(updateUi())); + QTimer::singleShot(10, this, &LinkSingleElementWidget::updateUi); } void LinkSingleElementWidget::showedElementWasDeleted() @@ -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 43beef074..03200943a 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); } /** @@ -431,7 +427,7 @@ void MasterPropertiesWidget::diagramWasdeletedFromProject() // contains slave element linked to the edited element // we must wait for this elements be unlinked, // or else the linked list provides deleted elements. - QTimer::singleShot(10, this, SLOT(updateUi())); + QTimer::singleShot(10, this, &MasterPropertiesWidget::updateUi); } /** diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index b9bea1c71..f427d923e 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -44,9 +44,9 @@ 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, qOverload(&ProjectAutoNumConfigPage::setAutoNum), newDiagramPage, &NewDiagramPage::setFolioAutonum); + connect(projectAutoNumConfigPage, &ProjectAutoNumConfigPage::saveCurrentTbp, newDiagramPage, &NewDiagramPage::saveCurrentTbp); + connect(projectAutoNumConfigPage, &ProjectAutoNumConfigPage::loadSavedTbp, newDiagramPage, &NewDiagramPage::loadSavedTbp); } /** diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index d561a3c57..b3ff972cc 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -353,23 +353,23 @@ void TitleBlockPropertiesWidget::initDialog( this); connect(m_tbt_edit, - SIGNAL(triggered()), + &QAction::triggered, this, - SLOT(editCurrentTitleBlockTemplate())); + &TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate); connect(m_tbt_duplicate, - SIGNAL(triggered()), + &QAction::triggered, this, - SLOT(duplicateCurrentTitleBlockTemplate())); + &TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate); m_tbt_menu = new QMenu(tr("Title block templates actions"), ui->m_tbt_pb); m_tbt_menu -> addAction(m_tbt_edit); m_tbt_menu -> addAction(m_tbt_duplicate); ui -> m_tbt_pb -> setMenu(m_tbt_menu); - connect(ui->m_tbt_cb, - SIGNAL(currentIndexChanged(int)), - this, - SLOT(changeCurrentTitleBlockTemplate(int))); + connect(ui->m_tbt_cb, + qOverload(&QComboBox::currentIndexChanged), + this, + &TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate); if (project!= nullptr){ keys_2 = project -> folioAutoNum().keys(); diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index 94c03a72a..54bebd143 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -37,9 +37,9 @@ 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_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); - connect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); + connect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); + connect(ui->m_type_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged); + connect(ui->m_snap_to_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB); updateDisplay(); } @@ -49,9 +49,9 @@ 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_type_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged())); - disconnect(ui->m_snap_to_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(enableOffsetSB(int))); + disconnect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled); + disconnect(ui->m_type_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged); + disconnect(ui->m_snap_to_cb, qOverload(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB); delete ui; } diff --git a/sources/undocommand/rotatetextscommand.cpp b/sources/undocommand/rotatetextscommand.cpp index 929507e48..f2248479f 100644 --- a/sources/undocommand/rotatetextscommand.cpp +++ b/sources/undocommand/rotatetextscommand.cpp @@ -120,8 +120,8 @@ void RotateTextsCommand::openDialog() ori_widget->spinBox()->selectAll(); QDialogButtonBox buttons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - QObject::connect(&buttons, SIGNAL(accepted()), &ori_text_dialog, SLOT(accept())); - QObject::connect(&buttons, SIGNAL(rejected()), &ori_text_dialog, SLOT(reject())); + QObject::connect(&buttons, &QDialogButtonBox::accepted, &ori_text_dialog, &QDialog::accept); + QObject::connect(&buttons, &QDialogButtonBox::rejected, &ori_text_dialog, &QDialog::reject); QVBoxLayout layout_v(&ori_text_dialog); layout_v.setSizeConstraint(QLayout::SetFixedSize);