diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index c72b00b16..b872b3ce7 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -631,8 +631,10 @@ void QETElementEditor::slot_updateInformations() cep_list << cep; if (cep->xmlName() != selection_xml_name) same_xml_name = false; - } else + } else { style_editable = false; + same_xml_name = false; + } } if (style_editable) style_editable = StyleEditor::isStyleEditable(cep_list); @@ -645,10 +647,10 @@ void QETElementEditor::slot_updateInformations() // if(editor->currentPart() == cep_list.first()) // return; - if (selection_xml_name == "terminal") { + if (selection_xml_name == "terminal" || selection_xml_name == "text") { clearToolsDock(); //We add the editor widget - TerminalEditor *editor = static_cast(m_editors[selection_xml_name]); + ElementItemEditor *editor = static_cast(m_editors[selection_xml_name]); if (editor) { if (editor->setParts(cep_list)) diff --git a/sources/editor/ui/texteditor.cpp b/sources/editor/ui/texteditor.cpp index 2c6dc2c65..eb33af30e 100644 --- a/sources/editor/ui/texteditor.cpp +++ b/sources/editor/ui/texteditor.cpp @@ -110,7 +110,7 @@ bool TextEditor::setPart(CustomElementPart *part) return true; } - if (PartText *part_text = dynamic_cast(part)) + if (PartText *part_text = static_cast(part)) { if (part_text == m_text) { return true; @@ -215,11 +215,27 @@ void TextEditor::setUpEditConnection() undoStack().push(undo); } } + }); + m_edit_connection << connect(ui->m_rotation_sb, QOverload::of(&QSpinBox::valueChanged), [this]() + { + for (int i=0; i < m_parts.length(); i++) { + PartText* partText = m_parts[i]; + if (ui->m_rotation_sb->value() != partText->rotation()) + { + QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "rotation", partText->rotation(), ui->m_rotation_sb->value()); undo->setText(tr("Pivoter un champ texte")); undo->setAnimated(true, false); undoStack().push(undo); } } + }); + m_edit_connection << connect(ui->m_size_sb, QOverload::of(&QSpinBox::valueChanged), [this]() + { + for (int i=0; i < m_parts.length(); i++) { + PartText* partText = m_parts[i]; + if (partText->font().pointSize() != ui->m_size_sb->value()) + { + QFont font_ = partText->font(); font_.setPointSize(ui->m_size_sb->value()); QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_); undo->setText(tr("Modifier la police d'un texte")); @@ -242,6 +258,14 @@ void TextEditor::on_m_font_pb_clicked() ui->m_size_sb->setValue(font_.pointSize()); ui->m_size_sb->blockSignals(false); + ui->m_font_pb->setText(font_.family()); + } + + for (int i=0; i < m_parts.length(); i++) { + PartText* partText = m_parts[i]; + if (ok && font_ != partText->font()) + { + QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "font", partText->font(), font_); undo->setText(tr("Modifier la police d'un texte")); undoStack().push(undo); } @@ -251,6 +275,14 @@ void TextEditor::on_m_font_pb_clicked() /** * @brief TextEditor::on_m_color_pb_changed * @param newColor + */ +void TextEditor::on_m_color_pb_changed(const QColor &newColor) +{ + for (int i=0; i < m_parts.length(); i++) { + PartText* partText = m_parts[i]; + if (newColor != partText->defaultTextColor()) + { + QPropertyUndoCommand *undo = new QPropertyUndoCommand(partText, "color", partText->defaultTextColor(), newColor); undo->setText(tr("Modifier la couleur d'un texte")); undoStack().push(undo); } diff --git a/sources/editor/ui/texteditor.h b/sources/editor/ui/texteditor.h index 7a7102d26..1f2e3d2e3 100644 --- a/sources/editor/ui/texteditor.h +++ b/sources/editor/ui/texteditor.h @@ -55,7 +55,7 @@ class TextEditor : public ElementItemEditor Ui::TextEditor *ui; QPointer m_text; - QList> m_parts; + QList m_parts; QList m_edit_connection; QList m_change_connection; };