spinetoolbox.widgets.custom_qgraphicsscene
¶
Custom QGraphicsScene used in the Design View.
- author
Savolainen (VTT)
- date
13.2.2019
Module Contents¶
Classes¶
A custom QGraphicsScene. It provides signals to notify about items, |
|
A scene for the Design view. |
- class spinetoolbox.widgets.custom_qgraphicsscene.CustomGraphicsScene[source]¶
Bases:
PySide2.QtWidgets.QGraphicsScene
A custom QGraphicsScene. It provides signals to notify about items, and a method to center all items in the scene.
At the moment it’s used by DesignGraphicsScene and the GraphViewMixin
- class spinetoolbox.widgets.custom_qgraphicsscene.DesignGraphicsScene(parent, toolbox)[source]¶
Bases:
CustomGraphicsScene
A scene for the Design view.
Mainly, it handles drag and drop events of ProjectItemDragMixin sources.
- Parameters
parent (QObject) – scene’s parent object
toolbox (ToolboxUI) – reference to the main window
- mousePressEvent(self, event)[source]¶
Puts link drawer to sleep and log message if it looks like the user doesn’t know what they’re doing.
- mouseReleaseEvent(self, event)[source]¶
Makes link if drawer is released over a valid connector button.
- set_bg_color(self, color)[source]¶
Change background color when this is changed in Settings.
- Parameters
color (QColor) – Background color
- set_bg_choice(self, bg_choice)[source]¶
Set background choice when this is changed in Settings.
- Parameters
bg (str) – “grid”, “tree”, or “solid”
- dragEnterEvent(self, event)[source]¶
Accept event. Then call the super class method only if drag source is not a ProjectItemDragMixin.
- dragMoveEvent(self, event)[source]¶
Accept event. Then call the super class method only if drag source is not a ProjectItemDragMixin.
- dropEvent(self, event)[source]¶
Only accept drops when the source is an instance of ProjectItemDragMixin. Capture text from event’s mimedata and show the appropriate ‘Add Item form.’
- event(self, event)[source]¶
Accepts GraphicsSceneHelp events without doing anything, to not interfere with our usage of QToolTip.showText in graphics_items.ExclamationIcon.