QElectroTech
0.70
|
#include <diagramview.h>
Public Slots | |
void | selectNothing () |
void | selectAll () |
void | selectInvert () |
void | setVisualisationMode () |
void | setSelectionMode () |
void | zoom (const qreal zoom_factor) |
DiagramView::zoom Zomm the view. A zoom_factor > 1 zoom in. A zoom_factor < 1 zoom out. More... | |
void | zoomFit () |
void | zoomContent () |
void | zoomReset () |
void | cut () |
void | copy () |
void | paste (const QPointF &=QPointF(), QClipboard::Mode=QClipboard::Clipboard) |
DiagramView::paste Import the element stored in the clipboard to the diagram. More... | |
void | pasteHere () |
void | adjustSceneRect () |
DiagramView::adjustSceneRect Calcul and set the area of the scene visualized by this view. More... | |
void | updateWindowTitle () |
void | editSelectedConductorColor () |
DiagramView::editSelectedConductorColor Edit the color of the selected conductor; does nothing if multiple conductors are selected. More... | |
void | editConductorColor (Conductor *) |
void | resetConductors () |
Signals | |
void | selectionChanged () |
Signal emitted after the selection changed. More... | |
void | modeChanged () |
Signal emitted after the selection mode changed. More... | |
void | titleChanged (DiagramView *, const QString &) |
Signal emitted after the diagram title changed. More... | |
void | findElementRequired (const ElementsLocation &) |
Signal emitted when users wish to locate an element from the diagram within elements collection. More... | |
void | editElementRequired (const ElementsLocation &) |
Signal emitted when users wish to edit an element from the diagram. More... | |
void | showDiagram (Diagram *) |
Signal emmitted when diagram must be show. More... | |
void | freeRubberBandChanged (QPolygonF polygon) |
Public Member Functions | |
DiagramView (Diagram *diagram, QWidget *=nullptr) | |
~DiagramView () override | |
QString | title () const |
void | editDiagramProperties () |
DiagramView::editDiagramProperties Edit the properties of the viewed digram. More... | |
Diagram * | diagram () |
QETDiagramEditor * | diagramEditor () const |
void | editSelection () |
DiagramView::editSelection Edit the selected item if he can be edited and if only one item is selected. More... | |
void | setEventInterface (DVEventInterface *event_interface) |
DiagramView::setEventInterface Set an event interface to diagram view. If diagram view already have an event interface, he delete it before. Diagram view take ownership of event interface and delete it when event interface is finish. More... | |
QList< QAction * > | contextMenuActions () const |
DiagramView::contextMenuActions. More... | |
Protected Member Functions | |
void | mouseDoubleClickEvent (QMouseEvent *) override |
DiagramView::mouseDoubleClickEvent. More... | |
void | contextMenuEvent (QContextMenuEvent *) override |
DiagramView::contextMenuEvent. More... | |
void | wheelEvent (QWheelEvent *) override |
void | focusInEvent (QFocusEvent *) override |
void | keyPressEvent (QKeyEvent *) override |
DiagramView::keyPressEvent Handles "key press" events. Reimplemented here to switch to visualisation mode if needed. More... | |
void | keyReleaseEvent (QKeyEvent *) override |
bool | event (QEvent *) override |
DiagramView::event Manage the event on this diagram view. -At first activation (QEvent::WindowActivate or QEvent::Show) we zoomFit. -Convert event interpreted to mouse event to gesture event if needed. -send Shortcut to view (by default send to QMenu /QAction) More... | |
void | paintEvent (QPaintEvent *event) override |
DiagramView::paintEvent Reimplemented from QGraphicsView. More... | |
void | mousePressEvent (QMouseEvent *) override |
void | mouseMoveEvent (QMouseEvent *) override |
DiagramView::mouseMoveEvent Manage the event move mouse. More... | |
void | mouseReleaseEvent (QMouseEvent *) override |
DiagramView::mouseReleaseEvent Manage event release click mouse. More... | |
void | dragEnterEvent (QDragEnterEvent *) override |
void | dragMoveEvent (QDragMoveEvent *) override |
void | dropEvent (QDropEvent *) override |
virtual bool | switchToVisualisationModeIfNeeded (QInputEvent *e) |
virtual bool | switchToSelectionModeIfNeeded (QInputEvent *e) |
virtual bool | isCtrlShifting (QInputEvent *) |
virtual bool | selectedItemHasFocus () |
Private Slots | |
void | adjustGridToZoom () |
void | applyReadOnly () |
Private Member Functions | |
DiagramView (const DiagramView &) | |
void | handleElementDrop (QDropEvent *) |
void | handleTitleBlockDrop (QDropEvent *) |
DiagramView::handleTitleBlockDrop Handle the dropEvent that contain data of a titleblock. More... | |
void | handleTextDrop (QDropEvent *) |
DiagramView::handleTextDrop handle the drop of text. More... | |
void | scrollOnMovement (QKeyEvent *) |
bool | gestureEvent (QGestureEvent *event) |
DiagramView::gestureEvent Use the pinch of the trackpad for zoom. More... | |
QRectF | viewedSceneRect () const |
bool | mustIntegrateTitleBlockTemplate (const TitleBlockTemplateLocation &) const |
bool | gestures () const |
DiagramView::gestures. More... | |
Private Attributes | |
Diagram * | m_diagram = nullptr |
DVEventInterface * | m_event_interface = nullptr |
QAction * | m_paste_here = nullptr |
QAction * | m_multi_paste = nullptr |
QPoint | m_paste_here_pos |
QPointF | m_drag_last_pos |
bool | m_fresh_focus_in |
bool | m_first_activation = true |
QList< QAction * > | m_separators |
QPolygonF | m_free_rubberband |
bool | m_free_rubberbanding = false |
This class provides a widget to render an electric diagram in an editable, interactive way.
Definition at line 37 of file diagramview.h.
DiagramView::DiagramView | ( | Diagram * | diagram, |
QWidget * | parent = nullptr |
||
) |
Constructeur
diagram | Schema a afficher ; si diagram vaut 0, un nouveau Diagram est utilise |
parent | Le QWidget parent de cette vue de schema |
Definition at line 54 of file diagramview.cpp.
References adjustSceneRect(), diagram(), editElementRequired(), QET::Icons::EditPaste, editSelectedConductorColor(), findElementRequired(), Diagram::loadCndFolioSeq(), Diagram::loadElmtFolioSeq(), m_diagram, m_multi_paste, m_paste_here, m_separators, pasteHere(), QET::Icons::QETLogo, selectionChanged(), setSelectionMode(), showDiagram(), QET::Icons::tr, and updateWindowTitle().
|
override |
Destructeur
Definition at line 117 of file diagramview.cpp.
|
private |
|
privateslot |
Enables or disables the drawing grid according to the amount of pixels display
Definition at line 863 of file diagramview.cpp.
References diagramEditor(), m_diagram, Diagram::setDisplayGrid(), and viewedSceneRect().
Referenced by zoom(), zoomContent(), zoomFit(), and zoomReset().
|
slot |
DiagramView::adjustSceneRect Calcul and set the area of the scene visualized by this view.
Definition at line 836 of file diagramview.cpp.
References m_diagram, and Diagram::margin.
Referenced by DiagramView(), handleTitleBlockDrop(), mouseMoveEvent(), paste(), QETDiagramEditor::selectionGroupTriggered(), zoom(), and zoomFit().
|
privateslot |
Fait en sorte que le schema ne soit editable que s'il n'est pas en lecture seule
Definition at line 907 of file diagramview.cpp.
References m_diagram.
Referenced by setSelectionMode(), and setVisualisationMode().
QList< QAction * > DiagramView::contextMenuActions | ( | ) | const |
DiagramView::contextMenuActions.
Definition at line 1154 of file diagramview.cpp.
References diagramEditor(), Diagram::isEmpty(), m_diagram, m_multi_paste, m_paste_here, and m_separators.
Referenced by contextMenuEvent(), and QetShapeItem::contextMenuEvent().
|
overrideprotected |
DiagramView::contextMenuEvent.
e |
Definition at line 1196 of file diagramview.cpp.
References Diagram::clipboardMayContainDiagram(), contextMenuActions(), Diagram::isEmpty(), m_diagram, m_paste_here, and m_paste_here_pos.
|
slot |
Copie les elements selectionnes du schema dans le presse-papier
Definition at line 353 of file diagramview.cpp.
References m_diagram.
Referenced by cut().
|
slot |
Copie les elements selectionnes du schema dans le presse-papier puis les supprime
Definition at line 343 of file diagramview.cpp.
|
inline |
Definition at line 67 of file diagramview.h.
References m_diagram.
Referenced by QETDiagramEditor::addItemGroupTriggered(), QETDiagramEditor::currentElement(), DiagramView(), editConductorColor(), handleElementDrop(), ProjectView::loadDiagrams(), mouseReleaseEvent(), AutoNumberingDockWidget::on_m_conductor_cb_activated(), AutoNumberingDockWidget::on_m_element_cb_activated(), QETDiagramEditor::rowColumnGroupTriggered(), QETDiagramEditor::selectionChanged(), QETDiagramEditor::selectionGroupTriggered(), AutoNumberingDockWidget::setActive(), AutoNumberingDockWidget::setConductorActive(), AutoNumberingDockWidget::setProject(), QETDiagramEditor::setUpActions(), QETDiagramEditor::slot_updateComplexActions(), and ProjectView::updateTabTitle().
QETDiagramEditor * DiagramView::diagramEditor | ( | ) | const |
Definition at line 1230 of file diagramview.cpp.
Referenced by adjustGridToZoom(), contextMenuActions(), editDiagramProperties(), and keyPressEvent().
|
overrideprotected |
Accepte ou refuse le drag'n drop en fonction du type de donnees entrant
e | le QDragEnterEvent correspondant au drag'n drop tente |
Definition at line 145 of file diagramview.cpp.
|
overrideprotected |
Accepte ou refuse le drag'n drop en fonction du type de donnees entrant
e | le QDragMoveEvent correspondant au drag'n drop tente |
Definition at line 161 of file diagramview.cpp.
|
overrideprotected |
Handle the drops accepted on diagram (elements and title block templates).
e | the QDropEvent describing the current drag'n drop |
Definition at line 170 of file diagramview.cpp.
References handleElementDrop(), handleTextDrop(), and handleTitleBlockDrop().
|
slot |
Edit the color of the given conductor
edited_conductor | Conductor we want to change the color |
Definition at line 935 of file diagramview.cpp.
References ConductorProperties::color, diagram(), m_diagram, and QET::Icons::tr.
Referenced by editSelectedConductorColor().
void DiagramView::editDiagramProperties | ( | ) |
DiagramView::editDiagramProperties Edit the properties of the viewed digram.
Definition at line 828 of file diagramview.cpp.
References diagramEditor(), DiagramPropertiesDialog::diagramPropertiesDialog(), and m_diagram.
Referenced by mouseDoubleClickEvent().
|
signal |
Signal emitted when users wish to edit an element from the diagram.
Referenced by DiagramView().
|
slot |
DiagramView::editSelectedConductorColor Edit the color of the selected conductor; does nothing if multiple conductors are selected.
Definition at line 919 of file diagramview.cpp.
References DiagramContent::AnyConductor, DiagramContent::conductors(), editConductorColor(), m_diagram, and DiagramContent::SelectedOnly.
Referenced by DiagramView().
void DiagramView::editSelection | ( | ) |
DiagramView::editSelection Edit the selected item if he can be edited and if only one item is selected.
Definition at line 1120 of file diagramview.cpp.
References m_diagram.
Referenced by QETDiagramEditor::selectionGroupTriggered().
|
overrideprotected |
DiagramView::event Manage the event on this diagram view. -At first activation (QEvent::WindowActivate or QEvent::Show) we zoomFit. -Convert event interpreted to mouse event to gesture event if needed. -send Shortcut to view (by default send to QMenu /QAction)
Gere les evenements de la DiagramView
e | Evenement |
e | the event. |
Definition at line 1008 of file diagramview.cpp.
References gestureEvent(), m_first_activation, selectedItemHasFocus(), and zoomFit().
Referenced by gestureEvent(), handleElementDrop(), paintEvent(), and wheelEvent().
|
signal |
Signal emitted when users wish to locate an element from the diagram within elements collection.
Referenced by DiagramView().
|
overrideprotected |
Handles "Focus in" events. Reimplemented here to store the fact the focus was freshly acquired again using the mouse. This information is later used in DiagramView::mousePressEvent().
Definition at line 636 of file diagramview.cpp.
References m_fresh_focus_in.
|
signal |
Signal emmtted when free rubberband changed. When free rubberband selection ends this signal will be emitted with null value.
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
|
private |
DiagramView::gestureEvent Use the pinch of the trackpad for zoom.
event |
Definition at line 615 of file diagramview.cpp.
References event(), and zoom().
Referenced by event().
|
private |
|
private |
Handle the drop of an element.
e | the QDropEvent describing the current drag'n drop |
Definition at line 185 of file diagramview.cpp.
References diagram(), event(), and Diagram::setEventInterface().
Referenced by dropEvent().
|
private |
DiagramView::handleTextDrop handle the drop of text.
e | the QDropEvent describing the current drag'n drop |
Definition at line 255 of file diagramview.cpp.
References m_diagram.
Referenced by dropEvent().
|
private |
DiagramView::handleTitleBlockDrop Handle the dropEvent that contain data of a titleblock.
e |
Definition at line 206 of file diagramview.cpp.
References adjustSceneRect(), Diagram::border_and_titleblock, BorderTitleBlock::exportTitleBlock(), TitleBlockTemplateLocation::fromString(), QETProject::integrateTitleBlockTemplate(), TitleBlockTemplateLocation::isValid(), m_diagram, mustIntegrateTitleBlockTemplate(), TitleBlockTemplateLocation::name(), TitleBlockTemplateLocation::parentProject(), Diagram::project(), TitleBlockProperties::template_name, and Diagram::undoStack().
Referenced by dropEvent().
|
protectedvirtual |
Definition at line 1089 of file diagramview.cpp.
Referenced by switchToSelectionModeIfNeeded(), and switchToVisualisationModeIfNeeded().
|
overrideprotected |
DiagramView::keyPressEvent Handles "key press" events. Reimplemented here to switch to visualisation mode if needed.
e |
Definition at line 648 of file diagramview.cpp.
References DiagramContent::All, ProjectView::changeFirstTab(), ProjectView::changeLastTab(), ProjectView::changeTabDown(), ProjectView::changeTabUp(), QETDiagramEditor::currentProjectView(), diagramEditor(), DiagramContent::hasTextEditing(), DiagramContent::items(), DVEventInterface::keyPressEvent(), m_diagram, m_event_interface, scrollOnMovement(), DiagramContent::selectedTexts(), switchToVisualisationModeIfNeeded(), and zoom().
|
overrideprotected |
Handles "key release" events. Reimplemented here to switch to selection mode if needed.
Definition at line 733 of file diagramview.cpp.
References DVEventInterface::KeyReleaseEvent(), m_event_interface, and switchToSelectionModeIfNeeded().
|
signal |
Signal emitted after the selection mode changed.
Referenced by setSelectionMode(), and setVisualisationMode().
|
overrideprotected |
DiagramView::mouseDoubleClickEvent.
e |
Definition at line 1244 of file diagramview.cpp.
References BorderTitleBlock::columnsRect(), editDiagramProperties(), m_diagram, m_event_interface, BorderTitleBlock::rowsRect(), and BorderTitleBlock::titleBlockRect().
|
overrideprotected |
DiagramView::mouseMoveEvent Manage the event move mouse.
Definition at line 455 of file diagramview.cpp.
References adjustSceneRect(), freeRubberBandChanged(), m_diagram, m_drag_last_pos, m_event_interface, m_free_rubberband, m_free_rubberbanding, and DVEventInterface::mouseMoveEvent().
|
overrideprotected |
Manage the events press click : click to add an independent text field
Definition at line 398 of file diagramview.cpp.
References m_drag_last_pos, m_event_interface, m_free_rubberband, m_free_rubberbanding, m_fresh_focus_in, DVEventInterface::mousePressEvent(), and switchToVisualisationModeIfNeeded().
|
overrideprotected |
DiagramView::mouseReleaseEvent Manage event release click mouse.
Definition at line 516 of file diagramview.cpp.
References ConductorCreator::create(), diagram(), freeRubberBandChanged(), m_diagram, m_event_interface, m_free_rubberband, m_free_rubberbanding, DVEventInterface::mouseReleaseEvent(), and QET::Icons::tr.
|
private |
tbt_loc | A title block template location |
Definition at line 895 of file diagramview.cpp.
References m_diagram, and TitleBlockTemplateLocation::parentProject().
Referenced by handleTitleBlockDrop().
|
overrideprotected |
DiagramView::paintEvent Reimplemented from QGraphicsView.
event |
Definition at line 1039 of file diagramview.cpp.
References event(), m_free_rubberband, and m_free_rubberbanding.
|
slot |
DiagramView::paste Import the element stored in the clipboard to the diagram.
pos | : top left corner of the bounding rect of imported elements |
clipboard_mode |
Definition at line 366 of file diagramview.cpp.
References adjustSceneRect(), DiagramContent::count(), Diagram::fromXml(), and m_diagram.
Referenced by pasteHere().
|
slot |
Colle le contenu du presse-papier sur le schema a la position de la souris
Definition at line 390 of file diagramview.cpp.
References m_paste_here_pos, and paste().
Referenced by DiagramView().
|
slot |
Reinitialise le profil des conducteurs selectionnes
Definition at line 972 of file diagramview.cpp.
References m_diagram.
|
private |
Handles element movement when editor is zoomed in and scrolls vertical and horizontal bar. If element is moved to the right side of the editor or below the editor SceneRect is expanded
Definition at line 745 of file diagramview.cpp.
References Diagram::adjustSceneRect(), DiagramContent::All, DiagramContent::items(), m_diagram, and viewedSceneRect().
Referenced by keyPressEvent().
|
slot |
Selectionne tous les objets du schema
Definition at line 123 of file diagramview.cpp.
References m_diagram.
Referenced by QETDiagramEditor::selectGroupTriggered().
|
protectedvirtual |
Definition at line 1108 of file diagramview.cpp.
References m_diagram.
Referenced by event(), switchToSelectionModeIfNeeded(), and switchToVisualisationModeIfNeeded().
|
slot |
Inverse l'etat de selection de tous les objets du schema
Definition at line 137 of file diagramview.cpp.
References m_diagram.
Referenced by QETDiagramEditor::selectGroupTriggered().
|
signal |
Signal emitted after the selection changed.
Referenced by DiagramView().
|
slot |
Deslectionne tous les objets selectionnes
Definition at line 130 of file diagramview.cpp.
References m_diagram.
Referenced by QETDiagramEditor::selectGroupTriggered().
void DiagramView::setEventInterface | ( | DVEventInterface * | event_interface | ) |
DiagramView::setEventInterface Set an event interface to diagram view. If diagram view already have an event interface, he delete it before. Diagram view take ownership of event interface and delete it when event interface is finish.
Definition at line 1142 of file diagramview.cpp.
References DVEventInterface::finish(), and m_event_interface.
|
slot |
Set the Diagram in Selection mode
Definition at line 280 of file diagramview.cpp.
References applyReadOnly(), and modeChanged().
Referenced by DiagramView(), and switchToSelectionModeIfNeeded().
|
slot |
Set the Diagram in visualisation mode
Definition at line 270 of file diagramview.cpp.
References applyReadOnly(), and modeChanged().
Referenced by switchToVisualisationModeIfNeeded().
|
signal |
Signal emmitted when diagram must be show.
Referenced by DiagramView().
|
protectedvirtual |
Switch back to selection mode if the user is not pressing Ctrl and Shift.
Definition at line 1078 of file diagramview.cpp.
References isCtrlShifting(), selectedItemHasFocus(), and setSelectionMode().
Referenced by keyReleaseEvent().
|
protectedvirtual |
Switch to visualisation mode if the user is pressing Ctrl and Shift.
Definition at line 1063 of file diagramview.cpp.
References isCtrlShifting(), selectedItemHasFocus(), and setVisualisationMode().
Referenced by keyPressEvent(), and mousePressEvent().
QString DiagramView::title | ( | ) | const |
Definition at line 813 of file diagramview.cpp.
References m_diagram, and QET::Icons::tr.
Referenced by updateWindowTitle().
|
signal |
Signal emitted after the diagram title changed.
Referenced by updateWindowTitle().
|
slot |
Met a jour le titre du widget
Definition at line 856 of file diagramview.cpp.
References title(), and titleChanged().
Referenced by DiagramView().
|
private |
Definition at line 874 of file diagramview.cpp.
Referenced by adjustGridToZoom(), and scrollOnMovement().
|
overrideprotected |
Manage wheel event of mouse
e | QWheelEvent |
Definition at line 580 of file diagramview.cpp.
References event(), gestures(), m_event_interface, DVEventInterface::wheelEvent(), and zoom().
|
slot |
DiagramView::zoom Zomm the view. A zoom_factor > 1 zoom in. A zoom_factor < 1 zoom out.
zoom_factor |
Definition at line 294 of file diagramview.cpp.
References adjustGridToZoom(), adjustSceneRect(), Diagram::adjustSceneRect(), and m_diagram.
Referenced by gestureEvent(), keyPressEvent(), wheelEvent(), and QETDiagramEditor::zoomGroupTriggered().
|
slot |
Adjust zoom to fit all elements in the view, regardless of diagram borders.
Definition at line 327 of file diagramview.cpp.
References adjustGridToZoom(), and m_diagram.
Referenced by QETDiagramEditor::zoomGroupTriggered().
|
slot |
Agrandit ou rectrecit le schema de facon a ce que tous les elements du schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, le zoom est reinitialise
Definition at line 318 of file diagramview.cpp.
References adjustGridToZoom(), adjustSceneRect(), and m_diagram.
Referenced by event(), and QETDiagramEditor::zoomGroupTriggered().
|
slot |
Reinitialise le zoom
Definition at line 335 of file diagramview.cpp.
References adjustGridToZoom().
Referenced by QETDiagramEditor::zoomGroupTriggered().
|
private |
Definition at line 51 of file diagramview.h.
Referenced by adjustGridToZoom(), adjustSceneRect(), applyReadOnly(), contextMenuActions(), contextMenuEvent(), copy(), cut(), diagram(), DiagramView(), editConductorColor(), editDiagramProperties(), editSelectedConductorColor(), editSelection(), handleTextDrop(), handleTitleBlockDrop(), keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mouseReleaseEvent(), mustIntegrateTitleBlockTemplate(), paste(), resetConductors(), scrollOnMovement(), selectAll(), selectedItemHasFocus(), selectInvert(), selectNothing(), title(), zoom(), zoomContent(), and zoomFit().
|
private |
Definition at line 56 of file diagramview.h.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
private |
Definition at line 52 of file diagramview.h.
Referenced by keyPressEvent(), keyReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), setEventInterface(), and wheelEvent().
|
private |
Definition at line 58 of file diagramview.h.
Referenced by event().
|
private |
Definition at line 60 of file diagramview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and paintEvent().
|
private |
Definition at line 61 of file diagramview.h.
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and paintEvent().
|
private |
Definition at line 57 of file diagramview.h.
Referenced by focusInEvent(), and mousePressEvent().
|
private |
Definition at line 54 of file diagramview.h.
Referenced by contextMenuActions(), and DiagramView().
|
private |
Definition at line 53 of file diagramview.h.
Referenced by contextMenuActions(), contextMenuEvent(), and DiagramView().
|
private |
Definition at line 55 of file diagramview.h.
Referenced by contextMenuEvent(), and pasteHere().
|
private |
Definition at line 59 of file diagramview.h.
Referenced by contextMenuActions(), and DiagramView().