Element text item group : Add new property for edit the adjustment of the space between texts

Dynamic element text item editor : Add new entry for edit the alignment, rotation and vertical adjustment of a group
Element Mover : Minor, remove the group texts from the moved content


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5165 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-12-10 14:31:27 +00:00
parent c8efc1102f
commit 292c45166a
7 changed files with 345 additions and 55 deletions

View File

@@ -65,7 +65,7 @@ void DynamicElementTextItemEditor::setElement(Element *element)
DynamicElementTextModel *old_model = m_model;
m_model = new DynamicElementTextModel(element, m_tree_view);
connect(m_model, &DynamicElementTextModel::dataForTextChanged, this, &DynamicElementTextItemEditor::dataEdited);
connect(m_model, &DynamicElementTextModel::dataChanged, this, &DynamicElementTextItemEditor::dataEdited);
m_tree_view->setModel(m_model);
if(old_model)
@@ -106,6 +106,25 @@ void DynamicElementTextItemEditor::apply()
delete undo;
}
//Get all texts groups of the edited element
for (ElementTextItemGroup *group : m_element.data()->textGroups())
{
QUndoCommand *undo = m_model->undoForEditedGroup(group);
if (undo->childCount() == 1)
{
QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
if (quc->text().isEmpty())
quc->setText(undo->text());
undo_list << quc;
delete undo;
}
else if(undo->childCount() > 1)
undo_list << undo;
else
delete undo;
}
if(!undo_list.isEmpty() && m_element->diagram())
{
if (undo_list.size() == 1)
@@ -172,9 +191,8 @@ QUndoCommand *DynamicElementTextItemEditor::associatedUndo() const
return nullptr;
}
void DynamicElementTextItemEditor::dataEdited(DynamicElementTextItem *deti)
void DynamicElementTextItemEditor::dataEdited()
{
Q_UNUSED(deti)
if (m_live_edit)
apply();
}