spinetoolbox.widgets.custom_qgraphicsscene
Custom QGraphicsScene used in the Design View.
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:
PySide6.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(event)[source]
Puts link drawer to sleep and logs message if it looks like the user doesn’t know what they’re doing.
- mouseReleaseEvent(event)[source]
Makes link if drawer is released over a valid connector button or cancel link drawing on right button.
- handle_selection_changed()[source]
Activates items or links based on currently selected items (or links).
- set_bg_color(color)[source]
Change background color when this is changed in Settings.
- Parameters
color (QColor) – Background color
- set_bg_choice(bg_choice)[source]
Set background choice when this is changed in Settings.
- Parameters
bg (str) – “grid”, “tree”, or “solid”
- dragEnterEvent(event)[source]
Accept event. Then call the super class method only if drag source is not a ProjectItemDragMixin.
- dragMoveEvent(event)[source]
Accept event. Then call the super class method only if drag source is not a ProjectItemDragMixin.
- dropEvent(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(event)[source]
Accepts GraphicsSceneHelp events without doing anything, to not interfere with our usage of QToolTip.showText in graphics_items.ExclamationIcon.