|
Schim
|
The base class of all objects represented in a graphical scene. More...
#include <gobject.h>
Public Member Functions | |
| GObject (Object *obj) | |
Construct a wrapper around obj. More... | |
| virtual | ~GObject () |
| virtual Object * | get () |
| Return the object that is being wrapped by this class. More... | |
| bool | isHovered () const |
| Return whether the mouse is over this object. | |
| virtual void | setCosmetic (bool cosmetic) |
| Make the object's pen independent of any transformations. More... | |
| virtual void | reloadFromModel () |
| Update the graphical representation to match the object from the model. More... | |
| virtual void | applyToModel () |
| Apply changes to the underlying model object. More... | |
| virtual void | showHandles (bool show=true) |
| Display/hide the handles for this item. More... | |
| virtual void | handleChanged (GObjectHandle *handle) |
| Called when a handle's position has changed. More... | |
| void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) override |
Set hovered=true so that it can be used by paint. | |
| void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override |
Disable the bool hovered so that it can be used by paint. | |
| QRectF | boundingRect () const override |
| Default implementation that returns childrenBoundingRect(). | |
| void | paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override |
| GCompositeObject * | parentItem () const |
Return the parent item cast to a GObject*. | |
Static Public Member Functions | |
| static GObject * | assign (Object *obj) |
| Return a dynamically allocated GObject wrapping the specified object. More... | |
Protected Member Functions | |
| void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) override |
| QVariant | itemChange (GraphicsItemChange change, const QVariant &value) override |
| Process item changes that should behave uniformly across different object types. More... | |
Protected Attributes | |
| Object * | obj |
| The object that is being wrapped. | |
| QList< GObjectHandle * > * | handles {} |
| Dynamically allocated list of handles. | |
Friends | |
| class | GObjectHandle |
The base class of all objects represented in a graphical scene.
This class is conceptually an abstract one - it shouldn't be used on its own.
|
explicit |
Construct a wrapper around obj.
The object is movable, selectable and sends geometry changes by default. Hover events are accepted.
|
virtual |
Destroy any handles that are still active.
|
virtual |
Apply changes to the underlying model object.
Reimplemented in GText, GCompositeObject, GRect, GLine, GTerminal, and GLinearObjectArray.
Return a dynamically allocated GObject wrapping the specified object.
The actual type of the returned object is determined based on the actual type of obj. For example, if obj is of type Line*, then a GLine* will be returned.
|
virtual |
Return the object that is being wrapped by this class.
Reimplemented in GText, GLine, GComponent, GHeader, GRect, GCompositeObject, GTerminal, and GLinearObjectArray.
|
virtual |
|
overrideprotected |
Process item changes that should behave uniformly across different object types.
The following changes are processed:
ItemZValueHasChanged: display the handles above this object.ItemSelectedHasChanged: show the handles.ItemSceneHasChanged: unselect and unhover.ItemPositionChange: apply snap-to-grid before the position actually changes.ItemPositionHasChanged: apply position change to the underlying model object.
|
overrideprotected |
If the item is being dragged (left button is down), snap the cursor guides to the grid.
|
override |
This implementation applies aesthetic modifications when the object is hovered or selected.
|
virtual |
Update the graphical representation to match the object from the model.
Reimplemented in GText, GCompositeObject, GRect, GLine, GTerminal, and GLinearObjectArray.
|
virtual |
Make the object's pen independent of any transformations.
Make an object cosmetic when it is going to be rendered to an icon.
Reimplemented in GCompositeObject.
|
virtual |
Display/hide the handles for this item.
The list of handles is dynamically allocated and it exists only while the handles are visible. This way, the handles do not take up memory when they are not used.
show = true. Each subclass should implement this this method separately, optionally calling the superclass method but only as the last statement.
1.8.13