mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Clean (and reduce the size) the class QETDiagramEditor, mostly by replacing the connection syntax "signal -> slot" by "signal -> lambda".
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5401 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -797,45 +797,6 @@ void DiagramView::applyReadOnly() {
|
||||
setAcceptDrops(is_writable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::editSelectionProperties
|
||||
* Edit the properties of the selected items
|
||||
*/
|
||||
void DiagramView::editSelectionProperties()
|
||||
{
|
||||
// get selection
|
||||
DiagramContent selection(m_diagram);
|
||||
|
||||
// if selection contains nothing return
|
||||
int selected_items_count = selection.count(DiagramContent::All | DiagramContent::SelectedOnly);
|
||||
if (!selected_items_count) return;
|
||||
|
||||
// if selection contains one item and this item can be editable, edit this item with an appropriate dialog
|
||||
if (selected_items_count == 1 && selection.items(DiagramContent::Elements |
|
||||
DiagramContent::AnyConductor |
|
||||
DiagramContent::SelectedOnly).size()) {
|
||||
// edit conductor
|
||||
if (selection.conductors(DiagramContent::AnyConductor | DiagramContent::SelectedOnly).size())
|
||||
selection.conductors().first()->editProperty();
|
||||
// edit element
|
||||
else if (selection.m_elements.size())
|
||||
selection.m_elements.first() -> editProperty();
|
||||
}
|
||||
|
||||
else {
|
||||
QET::QetMessageBox::information(
|
||||
this,
|
||||
tr("Propriétés de la sélection"),
|
||||
QString(
|
||||
tr(
|
||||
"La sélection contient %1.",
|
||||
"%1 is a sentence listing the selected objects"
|
||||
)
|
||||
).arg(selection.sentence(DiagramContent::All | DiagramContent::SelectedOnly))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DiagramView::editSelectedConductorColor
|
||||
* Edit the color of the selected conductor; does nothing if multiple conductors are selected
|
||||
@@ -1063,7 +1024,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
m_paste_here -> setEnabled(Diagram::clipboardMayContainDiagram());
|
||||
m_context_menu -> addAction(m_paste_here);
|
||||
m_context_menu -> addSeparator();
|
||||
m_context_menu -> addAction(qde -> infos_diagram);
|
||||
m_context_menu -> addAction(qde -> m_edit_diagram_properties);
|
||||
m_context_menu -> addActions(qde -> m_row_column_actions_group.actions());
|
||||
} else {
|
||||
m_context_menu -> addAction(qde -> m_cut);
|
||||
@@ -1073,6 +1034,8 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
m_context_menu -> addAction(qde -> m_conductor_reset);
|
||||
m_context_menu -> addSeparator();
|
||||
m_context_menu -> addActions(qde -> m_selection_actions_group.actions());
|
||||
m_context_menu -> addSeparator();
|
||||
m_context_menu -> addActions(qde->m_depth_action_group->actions());
|
||||
}
|
||||
|
||||
//Remove from the context menu the actions which are disabled.
|
||||
|
||||
Reference in New Issue
Block a user