spinetoolbox.widgets.custom_qgraphicsscene¶
Custom QGraphicsScene used in the Design View.
| author: |
|
|---|---|
| date: | 13.2.2019 |
Module Contents¶
Classes¶
CustomGraphicsScene |
A custom QGraphicsScene. It provides signals to notify about items, |
DesignGraphicsScene |
A scene for the Design view. |
-
class
spinetoolbox.widgets.custom_qgraphicsscene.CustomGraphicsScene[source]¶ Bases:
PySide2.QtWidgets.QGraphicsSceneA 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:
spinetoolbox.widgets.custom_qgraphicsscene.CustomGraphicsSceneA scene for the Design view.
Mainly, it handles drag and drop events of ProjectItemFactoryModel or ProjectItemSpecFactoryModel 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”
-
static
_is_project_item_drag(source)[source]¶ Checks whether or not source corresponds to a project item being dragged into the scene.
-
dragEnterEvent(self, event)[source]¶ Accept event. Then call the super class method only if drag source is not a ProjectItemFactoryModel or ProjectItemSpecFactoryModel.
-
dragMoveEvent(self, event)[source]¶ Accept event. Then call the super class method only if drag source is not a ProjectItemFactoryModel or ProjectItemSpecFactoryModel.
-
dropEvent(self, event)[source]¶ Only accept drops when the source is an instance of ProjectItemFactoryModel or ProjectItemSpecFactoryModel. 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.