Remove, move and clean some functions of diagram view, among other things because it is not the role of the diagram view to provide these functions.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5294 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-04-04 11:02:40 +00:00
parent 91bfa40401
commit fb47a18b69
5 changed files with 29 additions and 92 deletions

View File

@@ -1279,16 +1279,22 @@ void QETDiagramEditor::rowColumnGroupTriggered(QAction *action)
QString value = action->data().toString();
DiagramView *dv = currentDiagram();
if (!dv || value.isEmpty()) return;
if (!dv || value.isEmpty() || dv->diagram()->isReadOnly()) return;
Diagram *d = dv->diagram();
BorderProperties old_bp = d->border_and_titleblock.exportBorder();
BorderProperties new_bp = d->border_and_titleblock.exportBorder();
if (value == "add_column")
dv->addColumn();
new_bp.columns_count += 1;
else if (value == "remove_column")
dv->removeColumn();
new_bp.columns_count -= 1;
else if (value == "add_row")
dv->addRow();
new_bp.rows_count += 1;
else if (value == "remove_row")
dv->removeRow();
new_bp.rows_count -= 1;
d->undoStack().push(new ChangeBorderCommand(d, old_bp, new_bp));
}
/**
@@ -1408,7 +1414,7 @@ void QETDiagramEditor::slot_updateComplexActions()
m_find_element->setEnabled(selected_elements_count == 1);
//Action that need items (elements, conductors, texts...) selected, to be enabled
bool copiable_items = dv->hasCopiableItems();
bool copiable_items = dc.hasCopiableItems();
bool deletable_items = dc.hasDeletableItems();
m_cut -> setEnabled(!ro && copiable_items);
m_copy -> setEnabled(copiable_items);