Update old fashioned SIGNAL/SLOT to point-to-member. Only simple and clear cases.

This commit is contained in:
Andre Rummler
2026-08-05 23:33:54 +02:00
parent 484ab9ed87
commit 62ad49a6d3
36 changed files with 182 additions and 238 deletions
+2 -2
View File
@@ -150,8 +150,8 @@ void TitleBlockDimensionWidget::initWidgets()
// buttons, for the user to validate its input
buttons_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttons_, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons_, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttons_, &QDialogButtonBox::accepted, this, &TitleBlockDimensionWidget::accept);
connect(buttons_, &QDialogButtonBox::rejected, this, &TitleBlockDimensionWidget::reject);
}
/**
@@ -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);
}
/**
+23 -23
View File
@@ -342,7 +342,7 @@ void QETTitleBlockTemplateEditor::editLogos()
QDialog d(this);
d.setWindowTitle(logo_manager_ -> windowTitle());
d.setLayout(vlayout0);
connect(buttons, SIGNAL(rejected()), &d, SLOT(reject()));
connect(buttons, &QDialogButtonBox::rejected, &d, &QDialog::reject);
d.exec();
// prevent the logo manager from being deleted along with the dialog
@@ -553,35 +553,37 @@ void QETTitleBlockTemplateEditor::initWidgets()
template_cell_editor_widget_ -> setVisible(false);
connect(
template_edition_area_view_,
SIGNAL(selectedCellsChanged(QList<TitleBlockCell *>)),
this,
SLOT(selectedCellsChanged(QList<TitleBlockCell *>))
template_edition_area_view_,
&TitleBlockTemplateView::selectedCellsChanged,
this,
&QETTitleBlockTemplateEditor::selectedCellsChanged
);
connect(
template_cell_editor_widget_,
&TitleBlockTemplateCellWidget::logoEditionRequested,
this,
&QETTitleBlockTemplateEditor::editLogos
);
connect(template_cell_editor_widget_, SIGNAL(logoEditionRequested()),
this, SLOT(editLogos()));
connect(
template_cell_editor_widget_,
SIGNAL(cellModified(ModifyTitleBlockCellCommand *)),
&TitleBlockTemplateCellWidget::cellModified,
this,
SLOT(pushCellUndoCommand(ModifyTitleBlockCellCommand *))
&QETTitleBlockTemplateEditor::pushCellUndoCommand
);
connect(
template_edition_area_view_,
SIGNAL(gridModificationRequested(TitleBlockTemplateCommand *)),
&TitleBlockTemplateView::gridModificationRequested,
this,
SLOT(pushGridUndoCommand(TitleBlockTemplateCommand *))
&QETTitleBlockTemplateEditor::pushGridUndoCommand
);
connect(
template_edition_area_view_,
SIGNAL(previewWidthChanged(int,int)),
&TitleBlockTemplateView::previewWidthChanged,
this,
SLOT(savePreviewWidthToApplicationSettings(int, int))
&QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings
);
connect(undo_stack_, SIGNAL(cleanChanged(bool)),
this, SLOT(updateEditorTitle()));
connect(QApplication::clipboard(), SIGNAL(dataChanged()),
this, SLOT(updateActions()));
connect(undo_stack_, &QUndoStack::cleanChanged, this, &QETTitleBlockTemplateEditor::updateEditorTitle);
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &QETTitleBlockTemplateEditor::updateActions);
}
/**
@@ -960,8 +962,8 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc
dialog.setWindowTitle(title);
dialog.setLayout(dialog_layout);
connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject()));
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
if (dialog.exec() == QDialog::Accepted) {
return(widget -> location());
@@ -1027,10 +1029,8 @@ void QETTitleBlockTemplateEditor::editTemplateInformation()
: QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
dialog_layout -> addWidget(dialog_buttons);
connect(dialog_buttons, SIGNAL(accepted()),
&dialog_author, SLOT(accept()));
connect(dialog_buttons, SIGNAL(rejected()),
&dialog_author, SLOT(reject()));
connect(dialog_buttons, &QDialogButtonBox::accepted, &dialog_author, &QDialog::accept);
connect(dialog_buttons, &QDialogButtonBox::rejected, &dialog_author, &QDialog::reject);
// run the dialog
if (dialog_author.exec() == QDialog::Accepted && !read_only_) {
+3 -3
View File
@@ -150,10 +150,10 @@ void TitleBlockTemplateCellWidget::initWidgets()
// handle cell modifications
connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(updateFormType(int)));
connect(cell_type_input_, SIGNAL(activated(int)), this, SLOT(editType()));
connect(name_input_, SIGNAL(editingFinished()), this, SLOT(editName()));
connect(name_input_, &QLineEdit::editingFinished, this, &TitleBlockTemplateCellWidget::editName);
connect(label_checkbox_, SIGNAL(clicked(bool)), this, SLOT(editLabelDisplayed()));
connect(label_edit_, SIGNAL(released()), this, SLOT(editLabel()));
connect(value_edit_, SIGNAL(released()), this, SLOT(editValue()));
connect(label_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editLabel);
connect(value_edit_, &QPushButton::released, this, &TitleBlockTemplateCellWidget::editValue);
connect(horiz_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment()));
connect(vert_align_input_, SIGNAL(activated(int)), this, SLOT(editAlignment()));
connect(font_size_input_, SIGNAL(valueChanged(int)), this, SLOT(editFontSize()));
+9 -8
View File
@@ -129,10 +129,10 @@ void TitleBlockTemplateLogoManager::initWidgets()
this,
SLOT(updateLogoInformations(QListWidgetItem *, QListWidgetItem *))
);
connect(add_button_, SIGNAL(released()), this, SLOT(addLogo()));
connect(export_button_, SIGNAL(released()), this, SLOT(exportLogo()));
connect(delete_button_, SIGNAL(released()), this, SLOT(removeLogo()));
connect(rename_button_, SIGNAL(released()), this, SLOT(renameLogo()));
connect(add_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::addLogo);
connect(export_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::exportLogo);
connect(delete_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::removeLogo);
connect(rename_button_, &QPushButton::released, this, &TitleBlockTemplateLogoManager::renameLogo);
}
/**
@@ -217,11 +217,12 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na
connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done);
#else // TOD Qt6 only: remove, mappedInt() always available
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available
connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int)));
#endif
#else
connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done);
#endif
}
rd_label -> setText(
QString(tr(
+1 -1
View File
@@ -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);
}
/**
+8 -14
View File
@@ -597,7 +597,7 @@ void TitleBlockTemplateView::init()
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
setBackgroundBrush(QBrush(QColor(248, 255, 160)));
connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
connect(scene(), &QGraphicsScene::selectionChanged, this, &TitleBlockTemplateView::selectionChanged);
}
/**
@@ -626,7 +626,7 @@ void TitleBlockTemplateView::applyColumnsWidths(bool animate) {
animation -> setStartValue(QVariant(tbgrid_ -> columnMinimumWidth(COL_OFFSET + i)));
animation -> setEndValue(QVariant(1.0 * applied_width));
animation -> setDuration(500);
connect(animation, SIGNAL(finished()), this, SLOT(updateColumnsHelperCells()));
connect(animation, &GridLayoutAnimation::finished, this, &TitleBlockTemplateView::updateColumnsHelperCells);
animation -> start(QAbstractAnimation::DeleteWhenStopped);
}
total_applied_width += applied_width;
@@ -747,10 +747,8 @@ void TitleBlockTemplateView::addCells()
updateTotalWidthLabel();
total_width_helper_cell_ -> orientation = Qt::Horizontal;
total_width_helper_cell_ -> setActions(QList<QAction *>() << 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);
}