19 #include "ui_dynamicelementtextitemeditor.h" 32 #include <QUndoCommand> 41 ui->m_remove_selection->setDisabled(
true);
75 QList <QUndoCommand *> undo_list;
78 QList <DynamicElementTextItem *> deti_list;
79 deti_list <<
m_element.data()->dynamicTextItems();
81 deti_list << group->texts();
87 if (undo->childCount() == 1)
90 if (quc->text().isEmpty())
91 quc->setText(undo->text());
95 else if(undo->childCount() > 1)
106 if (undo->childCount() == 1)
109 if (quc->text().isEmpty())
110 quc->setText(undo->text());
114 else if(undo->childCount() > 1)
120 if(!undo_list.isEmpty() &&
m_element->diagram())
122 if (undo_list.size() == 1)
124 m_element->diagram()->undoStack().push(undo_list.first());
128 QUndoStack &us =
m_element->diagram()->undoStack();
129 us.beginMacro(
tr(
"Modifier des textes d'élément"));
130 for (QUndoCommand *quc : undo_list)
148 ui->m_tree_view->expand(index);
149 ui->m_tree_view->expand(index.child(0,0));
150 ui->m_tree_view->setCurrentIndex(index);
151 ui->m_remove_selection->setEnabled(
true);
165 ui->m_tree_view->expand(index);
166 ui->m_tree_view->setCurrentIndex(index);
167 ui->m_remove_selection->setEnabled(
true);
172 QUndoCommand *parent_undo =
new QUndoCommand(
tr(
"Modifier un texte d'élément"));
179 if(parent_undo->childCount() >= 1)
181 if(parent_undo->childCount() >= 2)
182 parent_undo->setText(
tr(
"Modifier %1 textes d'élément").arg(QString::number(parent_undo->childCount())));
244 QString
name = QInputDialog::getText(
this,
tr(
"Nom du groupe"),
tr(
"Entrer le nom du nouveau groupe"));
255 ui->m_remove_selection->setEnabled(
true);
257 ui->m_remove_selection->setDisabled(
true);
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
QUndoCommand * associatedUndo() const override
PropertiesEditorWidget::associatedUndo By default, return a nullptr.
bool setLiveEdit(bool live_edit) override
PropertiesEditorWidget::setLiveEdit Set the editor in live edit mode. When an editor is in live edit ...
void setElement(Element *element) override
Ui::DynamicElementTextItemEditor * ui
QUndoCommand * undoForEditedText(DynamicElementTextItem *deti, QUndoCommand *parent_undo=nullptr) const
DynamicElementTextModel::undoForEditedText.
void on_m_remove_selection_clicked()
DynamicElementTextItemEditor::on_m_remove_selection_clicked Remove the selected item.
QString name() const override
Element::name.
~DynamicElementTextItemEditor() override
void on_m_add_text_clicked()
DynamicElementTextItemEditor::on_m_add_text_clicked Add a new dynamic text.
DynamicElementTextModel * m_model
void on_m_add_group_clicked()
DynamicElementTextItemEditor::on_m_add_group_clicked Add a new group.
QSet< DynamicElementTextItem * > m_element_texts
void setCurrentGroup(ElementTextItemGroup *group)
DynamicElementTextItemEditor::setCurrentGroup Expand and select the item for group ...
void on_m_tree_view_clicked(const QModelIndex &index)
DynamicElementTextItemEditor(Element *element, QWidget *parent=nullptr)
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
bool indexIsText(const QModelIndex &index) const
DynamicElementTextModel::indexIsText.
QModelIndex indexFromGroup(ElementTextItemGroup *group) const
DynamicElementTextModel::indexFromGroup.
bool indexIsGroup(const QModelIndex &index) const
DynamicElementTextModel::indexIsGroup.
ElementTextItemGroup * groupFromIndex(const QModelIndex &index) const
DynamicElementTextModel::groupFromIndex.
void setCurrentText(DynamicElementTextItem *text)
DynamicElementTextItemEditor::setCurrentText Expand and select the item for text .
void on_m_import_pb_clicked()
The RemoveTextsGroupCommand class Manage the removinf of a texts group.
The AddTextsGroupCommand class Manage the adding of a texts group.
void on_m_export_pb_clicked()
The AddElementTextCommand class Manage the adding of element text.
QModelIndex indexFromText(DynamicElementTextItem *text) const
DynamicElementTextModel::indexFromText.
The DynamicElementTextModel class A model to use with QtView. This model display and can edit the val...
QUndoCommand * undoForEditedGroup(ElementTextItemGroup *group, QUndoCommand *parent_undo=nullptr) const
DynamicElementTextModel::undoForEditedGroup.
DynamicElementTextItem * textFromIndex(const QModelIndex &index) const
DynamicElementTextModel::textFromIndex.