mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user