mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-16 11:44:13 +02:00
Merge pull request #698 from arummler/master-modernize-signal-slot
Migrate string based signal/slot to method pointer
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -582,17 +582,25 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> 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<int>(&QComboBox::activated), this, &StyleEditor::updatePartColor);
|
||||
connect(line_style, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle);
|
||||
connect(size_weight, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight);
|
||||
connect(filling_color, qOverload<int>(&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<int>(&QComboBox::activated), this, &StyleEditor::updatePartColor);
|
||||
disconnect(line_style, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineStyle);
|
||||
disconnect(size_weight, qOverload<int>(&QComboBox::activated), this, &StyleEditor::updatePartLineWeight);
|
||||
disconnect(filling_color, qOverload<int>(&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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<int>::of(&QSpinBox::valueChanged), [this](int) {
|
||||
if (ui->m_slave_groups_checkbox->isChecked()) {
|
||||
populateSlaveGroupsTable();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user