Three connects paired a zero-argument signal with a slot that has a default-valued parameter (e.g. void applyEnable(bool = true)).

Default arguments aren't part of a function's pointer-to-member type, so &Class::slot has a type requiring the argument regardless of its
default value -- incompatible with a signal providing none, and &Class::slot alone won't compile against these signals at all.
When migrating to the modern member pointer connect, replaced  with a lambda that calls the slot with no arguments, letting
the default apply exactly as before.

- SelectAutonumW::applyEnable(bool = true), connected to each  NumPartEditorW's changed() signal in both setContext() and
  on_add_button_clicked(). The corresponding disconnect() in on_remove_button_clicked() is removed rather than reimplemented: a
  lambda-based connection can't be matched and removed by a  separately-written disconnect() call, and the explicit disconnect
  was already redundant -- the very next line deletes the part object, which Qt automatically disconnects on destruction (the same
  guarantee setContext()'s own qDeleteAll() cleanup already relies  on).
- PartText::adjustItemPosition(int = 0), connected to QTextDocument::contentsChanged().
- ExportDialog::slot_changeFilesExtension(bool = false), connected to ExportPropertiesWidget::formatChanged().
This commit is contained in:
Andre Rummler
2026-08-08 21:39:31 +02:00
parent a668ccfa90
commit 90950075bf
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -55,9 +55,9 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) :
this,
&PartText::adjustItemPosition);
connect(document(),
SIGNAL(contentsChanged()),
&QTextDocument::contentsChanged,
this,
SLOT(adjustItemPosition()));
[this]() { adjustItemPosition(); });
}
/// Destructeur