![]() |
OpenWalnut
1.5.0dev
|
This class extends the basic functionality of QGraphicsView to allow comfortable panning and zooming. More...
#include <WQtNetworkEditorView.h>
Inheritance diagram for WQtNetworkEditorView:
Collaboration diagram for WQtNetworkEditorView:Signals | |
| void | loadAction () |
| Emitted whenever the user caused a load event. More... | |
| void | dragDrop (QDropEvent *event) |
| Emitted whenever the user drops something into the widget. More... | |
Public Member Functions | |
| WQtNetworkEditorView (QWidget *parent=NULL) | |
| Constructs empty view. More... | |
| void | focusOn (QGraphicsItem *item) |
| The Item to focus on. More... | |
| void | ensureVisibleSmooth (QGraphicsItem *item, int xmargin=50, int ymargin=50) |
| Improved version of QGraphicsView::ensureVisible for smooth scrolling. More... | |
| void | setGlobalAddMenu (QMenu *menu) |
| Set the given menu as new global add-modules menu. More... | |
Protected Member Functions | |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
| Double clicked into the view. More... | |
| virtual void | mousePressEvent (QMouseEvent *event) |
| Mouse button pressed. More... | |
| virtual void | mouseReleaseEvent (QMouseEvent *event) |
| Mouse button released. More... | |
| virtual void | mouseMoveEvent (QMouseEvent *event) |
| Mouse moved. More... | |
| virtual void | wheelEvent (QWheelEvent *event) |
| Mouse wheel used. More... | |
| virtual void | resizeEvent (QResizeEvent *event) |
| View resized. More... | |
| void | keyPressEvent (QKeyEvent *event) |
| Key pressed. More... | |
| void | leaveEvent (QEvent *event) |
| Mouse leaves the widget. More... | |
| virtual void | dropEvent (QDropEvent *event) |
| Handles the drop event for a tree item. More... | |
| void | moveBy (const QPointF &delta) |
| Move scene in the view by delta units. More... | |
| void | moveTo (const QPointF &target) |
| Move scrollarea to absolute position. More... | |
Private Slots | |
| void | autoPanTick (qreal value) |
| Called every tick of the auto pan timer. More... | |
Private Attributes | |
| QPoint | m_lastPanPoint |
| To keep track of mouse movement, cache last known mouse event point. More... | |
| bool | m_panning |
| If true, we are in pan mode. More... | |
| QMenu * | m_addMenu |
| The menu containing the add actions in m_addModuleActionList. More... | |
| QPoint | m_autoPanTarget |
| Auto-pan vector. More... | |
| QPoint | m_autoPanOrig |
| Origin of auto-pan movement for proper interpolation. More... | |
| QTimeLine * | m_autoPanTimer |
| Auto-pan timer. More... | |
This class extends the basic functionality of QGraphicsView to allow comfortable panning and zooming.
Definition at line 36 of file WQtNetworkEditorView.h.
|
explicit |
Constructs empty view.
| parent | parent widgets containing the view |
Definition at line 40 of file WQtNetworkEditorView.cpp.
References autoPanTick(), m_addMenu, m_autoPanTimer, and m_panning.
Here is the call graph for this function:
|
privateslot |
Called every tick of the auto pan timer.
| value |
Definition at line 109 of file WQtNetworkEditorView.cpp.
References m_autoPanOrig, m_autoPanTarget, and moveTo().
Referenced by WQtNetworkEditorView().
Here is the call graph for this function:
Here is the caller graph for this function:
|
signal |
Emitted whenever the user drops something into the widget.
| event | event containing further info on the dropped item. |
Referenced by dropEvent().
Here is the caller graph for this function:
|
protectedvirtual |
Handles the drop event for a tree item.
| event | the event. |
Definition at line 275 of file WQtNetworkEditorView.cpp.
References dragDrop().
| void WQtNetworkEditorView::ensureVisibleSmooth | ( | QGraphicsItem * | item, |
| int | xmargin = 50, |
||
| int | ymargin = 50 |
||
| ) |
Improved version of QGraphicsView::ensureVisible for smooth scrolling.
| item | the item to make visible. |
| xmargin | the margin to ensure between item border and visible scene border (x direction) |
| ymargin | the margin to ensure between item border and visible scene border (y direction) |
Definition at line 69 of file WQtNetworkEditorView.cpp.
References m_autoPanOrig, m_autoPanTarget, and m_autoPanTimer.
Referenced by focusOn(), and WQtNetworkItem::mouseReleaseEvent().
Here is the caller graph for this function:| void WQtNetworkEditorView::focusOn | ( | QGraphicsItem * | item | ) |
The Item to focus on.
Use this instead of QGraphicsView::ensureVisible.
| item | the item. |
Definition at line 63 of file WQtNetworkEditorView.cpp.
References ensureVisibleSmooth().
Referenced by WQtNetworkEditor::event(), and WQtNetworkItem::moveFinished().
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Key pressed.
| event | contains event information. |
Definition at line 258 of file WQtNetworkEditorView.cpp.
|
protected |
Mouse leaves the widget.
| event | the event |
Definition at line 128 of file WQtNetworkEditorView.cpp.
References m_lastPanPoint.
|
signal |
Emitted whenever the user caused a load event.
Referenced by mouseDoubleClickEvent().
Here is the caller graph for this function:
|
protectedvirtual |
Double clicked into the view.
| event | contains event information. |
Definition at line 141 of file WQtNetworkEditorView.cpp.
References loadAction(), and m_addMenu.
|
protectedvirtual |
Mouse moved.
| event | contains event information. |
Definition at line 211 of file WQtNetworkEditorView.cpp.
References m_lastPanPoint, m_panning, and moveBy().
Here is the call graph for this function:
|
protectedvirtual |
Mouse button pressed.
| event | contains event information. |
Definition at line 167 of file WQtNetworkEditorView.cpp.
References m_lastPanPoint, and m_panning.
|
protectedvirtual |
Mouse button released.
| event | contains event information. |
Definition at line 193 of file WQtNetworkEditorView.cpp.
References m_addMenu, m_lastPanPoint, and m_panning.
|
protected |
Move scene in the view by delta units.
| delta | move vector. |
Definition at line 114 of file WQtNetworkEditorView.cpp.
Referenced by mouseMoveEvent().
Here is the caller graph for this function:
|
protected |
Move scrollarea to absolute position.
| target | the new scroll position |
Definition at line 122 of file WQtNetworkEditorView.cpp.
Referenced by autoPanTick().
Here is the caller graph for this function:
|
protectedvirtual |
View resized.
This automatically updates the virtual center for zooming after resize
| event | contains event information. |
Definition at line 252 of file WQtNetworkEditorView.cpp.
| void WQtNetworkEditorView::setGlobalAddMenu | ( | QMenu * | menu | ) |
Set the given menu as new global add-modules menu.
Can be NULL to disable.
| menu | the menu to set. |
Definition at line 58 of file WQtNetworkEditorView.cpp.
References m_addMenu.
Referenced by WQtControlPanel::createCompatibleButtons().
Here is the caller graph for this function:
|
protectedvirtual |
Mouse wheel used.
| event | contains event information. |
Definition at line 230 of file WQtNetworkEditorView.cpp.
|
private |
The menu containing the add actions in m_addModuleActionList.
Definition at line 174 of file WQtNetworkEditorView.h.
Referenced by mouseDoubleClickEvent(), mouseReleaseEvent(), setGlobalAddMenu(), and WQtNetworkEditorView().
|
private |
Origin of auto-pan movement for proper interpolation.
Definition at line 184 of file WQtNetworkEditorView.h.
Referenced by autoPanTick(), and ensureVisibleSmooth().
|
private |
Auto-pan vector.
Definition at line 179 of file WQtNetworkEditorView.h.
Referenced by autoPanTick(), and ensureVisibleSmooth().
|
private |
Auto-pan timer.
Definition at line 189 of file WQtNetworkEditorView.h.
Referenced by ensureVisibleSmooth(), and WQtNetworkEditorView().
|
private |
To keep track of mouse movement, cache last known mouse event point.
Definition at line 164 of file WQtNetworkEditorView.h.
Referenced by leaveEvent(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().
|
private |
If true, we are in pan mode.
Definition at line 169 of file WQtNetworkEditorView.h.
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and WQtNetworkEditorView().