Merge pull request #726 from ispyisail/fix/bugtracker-333-multiselect-text-color

Fix bugtracker #333: selecting several dynamic texts overwrites their colours
This commit is contained in:
plc-user
2026-08-13 09:39:36 +02:00
committed by GitHub
@@ -31,6 +31,7 @@
#include <QColorDialog>
#include <QGraphicsItem>
#include <QPointer>
#include <QSignalBlocker>
DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor,
PartDynamicTextField *text_field,
@@ -143,7 +144,18 @@ void DynamicTextFieldEditor::updateForm()
ui->m_rotation_point_center_cb->setChecked(m_text_field.data()->rotationPointCenter());
#ifdef BUILD_WITHOUT_KF5
#else
//Block signals while loading the colour into the button.
//KColorButton::changed fires on a programmatic setColor() as well
//as on user interaction, and m_color_kpb_changed() applies the new
//colour to *every* selected part -- so merely showing the first
//part's colour would overwrite the colour of all the others.
//The other widgets above are immune because they are wired to
//user-only signals (editingFinished, clicked), which setValue()
//and setChecked() do not emit.
{
const QSignalBlocker blocker(m_color_kpb);
m_color_kpb -> setColor(m_text_field.data() -> color());
}
#endif
ui -> m_width_sb -> setValue(m_text_field.data() -> textWidth());
ui -> m_font_pb -> setText(m_text_field -> font().family());