Merge pull request #694 from IBSYSLevi/feature/center-rotation-option-for-textfields

Feature added: Rotation point center property for dynamic text fields
This commit is contained in:
Laurent Trinques
2026-08-09 21:09:19 +02:00
committed by GitHub
9 changed files with 83 additions and 9 deletions
+17 -2
View File
@@ -140,6 +140,7 @@ void DynamicTextFieldEditor::updateForm()
ui -> m_user_text_le -> setText(m_text_field.data() -> text());
ui -> m_size_sb -> setValue(m_text_field.data() -> font().pointSize());
ui->m_keep_visual_rotation_cb->setChecked(m_text_field.data()->keepVisualRotation());
ui->m_rotation_point_center_cb->setChecked(m_text_field.data()->rotationPointCenter());
#ifdef BUILD_WITHOUT_KF5
#else
m_color_kpb -> setColor(m_text_field.data() -> color());
@@ -197,6 +198,7 @@ void DynamicTextFieldEditor::setUpConnections()
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::textWidthChanged, this, [=](){this -> updateForm();});
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::compositeTextChanged,this, [=](){this -> updateForm();});
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::keepVisualRotationChanged, this, [=](){this -> updateForm();});
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::rotationPointCenterChanged, this, [=](){this -> updateForm();});
// Refresh info combo when element data changes (e.g. type switched to PLC-Slave)
m_connection_list << connect(elementEditor()->elementScene(), &ElementScene::elementInfoChanged,
@@ -347,8 +349,8 @@ void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
}
}
void DynamicTextFieldEditor::on_m_elmt_info_cb_activated(const QString &arg1) {
Q_UNUSED(arg1)
void DynamicTextFieldEditor::on_m_elmt_info_cb_activated(int index) {
Q_UNUSED(index)
QString info = ui -> m_elmt_info_cb -> currentData().toString();
for (int i = 0; i < m_parts.length(); i++) {
@@ -489,3 +491,16 @@ void DynamicTextFieldEditor::on_m_keep_visual_rotation_cb_clicked()
}
}
}
void DynamicTextFieldEditor::on_m_rotation_point_center_cb_clicked()
{
bool center = ui->m_rotation_point_center_cb->isChecked();
for (int i = 0; i < m_parts.length(); i++) {
if (center != m_parts[i]->rotationPointCenter()) {
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotationPointCenter", m_parts[i]->rotationPointCenter(), center);
undo->setText(tr("Modifier le point de rotation d'un champ texte"));
undoStack().push(undo);
}
}
}
+2 -1
View File
@@ -62,7 +62,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
void on_m_size_sb_editingFinished();
void on_m_frame_cb_clicked();
void on_m_width_sb_editingFinished();
void on_m_elmt_info_cb_activated(const QString &arg1);
void on_m_elmt_info_cb_activated(int index);
void on_m_text_from_cb_activated(int index);
void on_m_composite_text_pb_clicked();
void on_m_alignment_pb_clicked();
@@ -71,6 +71,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
void m_color_kpb_changed(QColor newColor);
void on_m_keep_visual_rotation_cb_clicked();
void on_m_rotation_point_center_cb_clicked();
private:
Ui::DynamicTextFieldEditor *ui;
+11 -3
View File
@@ -37,7 +37,7 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Largeur</string>
@@ -73,6 +73,13 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="m_rotation_point_center_cb">
<property name="text">
<string>Tourner autour de son propre centre</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QComboBox" name="m_elmt_info_cb"/>
</item>
@@ -92,7 +99,7 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QSpinBox" name="m_width_sb">
<property name="minimum">
<number>-1</number>
@@ -149,7 +156,7 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="4" column="2">
<widget class="QPushButton" name="m_alignment_pb">
<property name="text">
<string>Alignement</string>
@@ -236,6 +243,7 @@
<tabstop>m_y_sb</tabstop>
<tabstop>m_rotation_sb</tabstop>
<tabstop>m_keep_visual_rotation_cb</tabstop>
<tabstop>m_rotation_point_center_cb</tabstop>
<tabstop>m_width_sb</tabstop>
<tabstop>m_alignment_pb</tabstop>
<tabstop>m_size_sb</tabstop>