Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
Visualization::Item Class Referenceabstract
Inheritance diagram for Visualization::Item:

Public Types

enum  CursorMoveDirection { MoveUp , MoveDown , MoveLeft , MoveRight , MoveOnPosition , MoveOnTop , MoveOnLeft , MoveOnBottom , MoveOnRight , MoveOnTopLeft , MoveOnBottomRight , MoveOnCenter , MoveUpOf , MoveDownOf , MoveLeftOf , MoveRightOf , MoveDefault }
 
enum  CursorMoveOption { None = 0 , NoLimitDistance = 0x00000001 , LinelikeAlongX = 0x00000002 , LinelikeAlongY = 0x00000004 }
 
using CursorMoveOptions = QFlags< CursorMoveOption >
 
enum  PositionConstraint { NoConstraints = 0x0 , Below = 0x1 , Above = 0x2 , LeftOf = 0x4 , RightOf = 0x8 , Overlap = 0x10 }
 
using PositionConstraints = QFlags< PositionConstraint >
 
typedef ItemStyle StyleType
 
enum  UpdateType { NoUpdate , StandardUpdate , FullUpdate , RepeatUpdate }
 

Public Member Functions

 Item (Item *parent, const StyleType *style=nullptr)
 
virtual ~Item ()
 
virtual QList< VisualizationAddOn * > addOns ()
 Returns all visualization add-ons of this and inherited classes. More...
 
template<typename OverlayType >
OverlayType * addOverlay (OverlayType *overlay, QString groupName)
 Adds overlay to this item. More...
 
virtual QRectF boundingRect () const
 
virtual void changeGeometry (int availableWidth=0, int availableHeight=0)
 Requests that the item updates the position of its children and its size. More...
 
virtual ItemchildClosestTo (const QPoint &point, PositionConstraints childConstraint=NoConstraints) const
 Returns the child item (if any) that has the least distance to the point point. More...
 
virtual QList< Item * > childItems () const
 Returns a list of all direct children items which are an instance of Item. More...
 
int childNodePurpose (const Model::Node *node) const
 
int childNodeSemanticZoomLevel (const Model::Node *node) const
 
void clearChildNodePurpose (const Model::Node *node)
 
void clearChildNodeSemanticZoomLevel (const Model::Node *node)
 
void clearPurpose ()
 
void clearSemanticZoomLevel ()
 
template<typename T >
T * correspondingSceneCursor ()
 
virtual QColor customShapeColor () const
 
bool definesChildNodePurpose (const Model::Node *node) const
 
bool definesChildNodeSemanticZoomLevel (const Model::Node *node) const
 
int distanceTo (const QPoint &point) const
 Returns the distance between the item and point. More...
 
void execute (const QString &command, const std::unique_ptr< Cursor > &)
 
virtual QList< Item * > findAllVisualizationsOf (Model::Node *node)
 
template<typename ItemType >
ItemType * findAncestorOfType ()
 Returns the first ancestor which is of the given template type, or nullptr if none exists. More...
 
ItemfindAncestorWithNode ()
 Returns the first ancestor with a node, or nullptr if none such exists. More...
 
virtual ItemfindVisualizationOf (Model::Node *node)
 Returns the child item that is visualizing node or nullptr if no such child exists. More...
 
virtual ItemfocusedChild () const
 Returns the child item which is focused or which contains a child that is focused or nullptr if no child has focus. More...
 
int fromParent (int x) const
 
int fromScene (int x) const
 
ShapegetShape () const
 
virtual InteractionHandlerhandler () const
 
virtual bool hasNode () const
 
bool hasSceneCursor () const
 
bool hasShape () const
 
int heightInLocal () const
 
int heightInParent () const
 
int heightInScene () const
 
virtual bool ignoresCopyAndPaste ()
 Returns whether this item should ignore copy and paste hanling and let the parent handler take care of this. More...
 
bool isCategoryHiddenDuringPaint ()
 
virtual bool isEmpty () const
 
virtual bool isSensitiveToScale () const
 Returns true if the item should be updated if its scale changes, e.g. More...
 
Scene::ItemCategory itemCategory ()
 
bool itemOrChildHasFocus () const
 
qreal mainViewScalingFactor () const
 Returns the scaling factor applied by the main view associated of this item's scene. More...
 
bool moveCursor (CursorMoveDirection dir, QPoint reference, CursorMoveOptions options=None)
 Overloaded version. More...
 
virtual bool moveCursor (CursorMoveDirection dir=MoveDefault, QRect reference={}, CursorMoveOptions options=None)
 Moves the position of the current main scene cursor within the item and returns true on success. More...
 
virtual UpdateType needsUpdate ()
 
virtual Model::Nodenode () const
 
template<typename OverlayType >
OverlayType * overlay (QString overlayGroup=QString())
 Returns the overlay of the specified OverlayType that is associated with this item. More...
 
QList< OverlayAccessor * > overlays (QString overlayGroup=QString()) const
 Returns all the overlays of this item for the specified group. More...
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
Itemparent () const
 
qreal previousMainViewScalingFactor () const
 Returns the scaling factor used before the active one. More...
 
int purpose () const
 Returns what purpose should the children of this item be chosen for when deciding what visualizations to use. More...
 
virtual QList< ItemRegionregions ()
 Returns a list of regions that determine where there are curosrs and where there are child items in this item. More...
 
void removeFromScene ()
 
void removeShape ()
 
ModelRendererrenderer ()
 
virtual int revision () const
 
PositionConstraints satisfiedPositionConstraints (const QPoint &point) const
 Returns all position constraints with respect to the point point satisfied by this item. More...
 
Scenescene () const
 
int semanticZoomLevel () const
 Returns what semantic zoom level should the children of this item be chosen for when deciding what visualizations to use. More...
 
void setChildNodePurpose (const Model::Node *node, int purpose)
 
void setChildNodeSemanticZoomLevel (const Model::Node *node, int semanticZoomLevel)
 
void setDefaultMoveCursorProxy (Item *proxy)
 
void setItemCategory (Scene::ItemCategory cat=Scene::NoItemCategory)
 
void setPurpose (int purpose)
 
virtual void setRevision (int newRevision)
 
void setScale (qreal newScale)
 Sets the item's scale and schedules an update for all descendant items that are sensitive to scale changes. More...
 
void setSemanticZoomLevel (int semanticZoomLevel)
 
virtual void setStyle (const ItemStyle *style)
 
void setUpdateNeeded (UpdateType updateType)
 
void setUpdateNeededForChildItem (UpdateType updateType, Model::Node *nodeVisualizedByChild)
 Finds the currently existing direct or indirect child Item that visualizes nodeVisualizedByChild and sets it update status to updateType. More...
 
virtual bool sizeDependsOnParent () const
 
QSizeF sizeInLocal () const
 
QSizeF sizeInParent () const
 
QSizeF sizeInScene () const
 
const ItemStylestyle () const
 
qreal totalScale () const
 
virtual void updateSubtree ()
 
void useShape ()
 
int widthInLocal () const
 
int widthInParent () const
 
int widthInScene () const
 
qreal xEndInParent () const
 
qreal yEndInParent () const
 

Static Public Member Functions

static void addAddOn (VisualizationAddOn *addOn)
 Adds the add-on addOn for the class. More...
 
static InteractionHandlerdefaultClassHandler ()
 
static ItemenvisionItem (QGraphicsItem *item)
 Returns item if it is an instance of Item* or the closest of its ancestors that is an Item*. More...
 
static QMultiHash< Model::Node *, Item * > & nodeItemsMap ()
 
static bool removeAddOn (VisualizationAddOn *addOn)
 Removes the add-on addOn from the class. More...
 
static void setDefaultClassHandler (InteractionHandler *handler)
 
template<typename Definition , typename Store , typename CompareFunction , typename CreateFunction , typename SyncFunction , typename DeleteFunction >
static bool synchronizeCollections (Item *parent, const Definition &def, Store &store, CompareFunction compare, CreateFunction create, SyncFunction sync, DeleteFunction deleter)
 Inserts elements that are not yet in store and adjusts the order to match that in def. More...
 

Static Public Attributes

static const int LAYER_AUTOCOMPLETE_Z = 50
 
static const int LAYER_COMMAND = 25
 
static const int LAYER_CURSOR_Z = 200
 
static const int LAYER_DEFAULT_Z = 0
 
static const int LAYER_OVERLAY_Z = 10
 
static const int LAYER_SELECTION_Z = 100
 

Protected Member Functions

const QMultiMap< VisualizationAddOn *, Item * > & addOnItems ()
 Returns a map that associates each registered add-on with all items corresponding to it. More...
 
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 
virtual void determineChildren ()=0
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
void putAddOnItemsInSequence (SequentialLayout *layout)
 Puts all items generated by add-ons inside a sequential layout. More...
 
virtual bool sceneEvent (QEvent *event)
 
void setHeight (int height)
 
void setSize (const QSizeF &size)
 
void setSize (int width, int height)
 
void setWidth (int width)
 
template<typename FieldType , typename VisualizationType = FieldType>
bool synchronizeItem (FieldType *&item, bool present, const typename VisualizationType::StyleType *style)
 
template<typename FieldType , typename VisualizationType = FieldType>
bool synchronizeItem (FieldType *&item, typename VisualizationType::NodeType *node, const typename VisualizationType::StyleType *style)
 
bool synchronizeItem (Item *&item, Model::Node *node)
 
virtual void updateGeometry (int availableWidth, int availableHeight)=0
 This method sets the position of child elements, stretching them if needed, and determines the final size of the item. More...
 
void updateGeometry (Item *content, int availableWidth, int availableHeight)
 This is a helper method that classes can use when reimplementing updateGeometry(). More...
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 

Private Member Functions

void defaultContextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 
void defaultDragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
void defaultDragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
void defaultDragMoveEvent (QGraphicsSceneDragDropEvent *event)
 
void defaultDropEvent (QGraphicsSceneDragDropEvent *event)
 
void defaultFocusInEvent (QFocusEvent *event)
 
void defaultFocusOutEvent (QFocusEvent *event)
 
void defaultHoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
void defaultHoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
void defaultHoverMoveEvent (QGraphicsSceneHoverEvent *event)
 
void defaultKeyPressEvent (QKeyEvent *event)
 
void defaultKeyReleaseEvent (QKeyEvent *event)
 
void defaultMouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
void defaultMouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
void defaultMousePressEvent (QGraphicsSceneMouseEvent *event)
 
void defaultMouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
void defaultWheelEvent (QGraphicsSceneWheelEvent *event)
 
void updateAddOnItems ()
 

Static Private Member Functions

static QList< VisualizationAddOn * > & staticAddOns ()
 Returns a list of all add-on that have been added to this class. More...
 

Private Attributes

QMultiMap< VisualizationAddOn *, Item * > addOnItems_
 
QRectF boundingRect_
 
QMap< const Model::Node *, int > childNodePurpose_
 
QMap< const Model::Node *, int > childNodeSemanticZoomLevel_
 
ItemdefaultMoveCursorProxy_ {}
 
Scene::ItemCategory itemCategory_
 
UpdateType needsUpdate_
 
int purpose_
 
int semanticZoomLevel_
 
Shapeshape_
 
const ItemStylestyle_
 

Static Private Attributes

static InteractionHandlerdefaultClassHandler_ = InteractionHandler::instance()
 

Friends

class DynamicGridFormElement
 
class InteractionHandler
 
template<typename ParentType >
class NodeItemWrapperFormElement
 
template<typename ParentType , typename VisualizationType >
class NodeWithVisualizationItemWrapperFormElement
 
class SequentialLayoutFormElement
 
class Shape
 
template<typename ParentType , typename VisualizationType , bool externalSynchronization>
class VisualizationItemWrapperFormElement
 
template<typename ChildItem , typename Style , bool use>
struct VisualizationItemWrapperFormElementSyncMethod
 

Member Typedef Documentation

◆ CursorMoveOptions

◆ PositionConstraints

◆ StyleType

Member Enumeration Documentation

◆ CursorMoveDirection

Enumerator
MoveUp 

Move the cursor up from its current position within the item.

MoveDown 

Move the cursor down from its current position within the item.

MoveLeft 

Move the cursor left from its current position within the item.

MoveRight 

Move the cursor right from its current position within the item.

MoveOnPosition 

Move the cursor as close as possible to the specified reference rect within the item.

MoveOnTop 

Move the cursor to the top of the item.

MoveOnLeft 

Move the cursor to the left of the item.

MoveOnBottom 

Move the cursor to the bottom of the item.

MoveOnRight 

Move the cursor to the right of the item.

MoveOnTopLeft 

Move the cursor to the top-left corner of the item.

MoveOnBottomRight 

Move the cursor to the bottom-right corner of the item.

MoveOnCenter 

Move the cursor to the center of the item.

MoveUpOf 

Move the cursor as close as possible above the specified reference rect.

MoveDownOf 

Move the cursor as close as possible below the specified reference rect.

MoveLeftOf 

Move the cursor as close as possible to left of the specified reference rect.

MoveRightOf 

Move the cursor as close as possible to right of the specified reference rect.

MoveDefault 

Move the cursor to the default location.

This is typically used after the item is created. The default behavior is to move the cursor to the top left corner. If a defaultMove cursor proxy is set, it will be selected instead. Subclasses might reimplement moveCursor to customize this behavior.

◆ CursorMoveOption

Enumerator
None 
NoLimitDistance 

If set, the cursor can be moved to any other location on the canvas.

Otherwise, the move distance is limited to a specific number of pixels, in order to avoid big jumps that disorient the user.

LinelikeAlongX 

If set, overrides the ItemStyle::linelikeCursorMovementAlongX property.

LinelikeAlongY 

If set, overrides the ItemStyle::linelikeCursorMovementAlongY property.

◆ PositionConstraint

Enumerator
NoConstraints 
Below 
Above 
LeftOf 
RightOf 
Overlap 

◆ UpdateType

Enumerator
NoUpdate 

The item should not be updated.

StandardUpdate 

Update the geometry of the item and properties depending on child items.

This update should be used when a child item has changed and the parent just needs to account for this change.

FullUpdate 

The item and all its children will be updated using a StandardUpdate.

RepeatUpdate 

This update is similar to StandardUpdate but can also be requested while the item is being updated.

Normally, update requests which happen while an item is being updated are disregarded. If a RepeatUpdate is requested, the item will be updated one more time after the current update is finished. This is useful when the item needs to consider how its children are drawn (their size) and update accordingly.

Constructor & Destructor Documentation

◆ Item()

Visualization::Item::Item ( Item parent,
const StyleType style = nullptr 
)

◆ ~Item()

Visualization::Item::~Item ( )
virtual

Member Function Documentation

◆ addAddOn()

void Visualization::Item::addAddOn ( VisualizationAddOn addOn)
static

Adds the add-on addOn for the class.

◆ addOnItems()

const QMultiMap< VisualizationAddOn *, Item * > & Visualization::Item::addOnItems ( )
inlineprotected

Returns a map that associates each registered add-on with all items corresponding to it.

◆ addOns()

QList< VisualizationAddOn * > Visualization::Item::addOns ( )
virtual

Returns all visualization add-ons of this and inherited classes.

◆ addOverlay()

template<typename OverlayType >
OverlayType * Visualization::Item::addOverlay ( OverlayType *  overlay,
QString  groupName 
)

Adds overlay to this item.

The overlay becomes part of the groupName overlay group.

Returns the added overlay.

◆ boundingRect()

QRectF Visualization::Item::boundingRect ( ) const
virtual

◆ changeGeometry()

void Visualization::Item::changeGeometry ( int  availableWidth = 0,
int  availableHeight = 0 
)
virtual

Requests that the item updates the position of its children and its size.

If any of availableWidth or availableHeight are different from 0, the item is allowed to stretch to fill any available space as indicated. Both arguments are in the parent coordinate system and will be transformed using the item's transformations before they are used.

This method adjusts the passed arguments and calls updateGeometry() to do the actual rearranging.

◆ childClosestTo()

Item * Visualization::Item::childClosestTo ( const QPoint &  point,
PositionConstraints  childConstraint = NoConstraints 
) const
virtual

Returns the child item (if any) that has the least distance to the point point.

The point point must be in the current item's local coordinates.

The childConstraint argument can be used to limit which children are considered. Only children that match all specified constraints may be returned by this method. The childConstraint argument specifies the constraints from a child item's point of view, e.g. a constraint LeftOf will be satisfied if a child is left of the specified point.

See also
satisfiedPositionConstraints

◆ childItems()

QList< Item * > Visualization::Item::childItems ( ) const
virtual

Returns a list of all direct children items which are an instance of Item.

The default implementation assumes that all children are instances of Item and simply calls QGraphicsView::childItems(). Reimplement this in items that can contain non-Item children to return the correct list.

This method hides QGraphicsItem::childItems();

◆ childNodePurpose()

int Visualization::Item::childNodePurpose ( const Model::Node node) const

◆ childNodeSemanticZoomLevel()

int Visualization::Item::childNodeSemanticZoomLevel ( const Model::Node node) const

◆ clearChildNodePurpose()

void Visualization::Item::clearChildNodePurpose ( const Model::Node node)

◆ clearChildNodeSemanticZoomLevel()

void Visualization::Item::clearChildNodeSemanticZoomLevel ( const Model::Node node)

◆ clearPurpose()

void Visualization::Item::clearPurpose ( )

◆ clearSemanticZoomLevel()

void Visualization::Item::clearSemanticZoomLevel ( )

◆ contextMenuEvent()

void Visualization::Item::contextMenuEvent ( QGraphicsSceneContextMenuEvent *  event)
protectedvirtual

◆ correspondingSceneCursor()

template<typename T >
T * Visualization::Item::correspondingSceneCursor

◆ customShapeColor()

QColor Visualization::Item::customShapeColor ( ) const
virtual

◆ defaultClassHandler()

InteractionHandler * Visualization::Item::defaultClassHandler ( )
inlinestatic

◆ defaultContextMenuEvent()

void Visualization::Item::defaultContextMenuEvent ( QGraphicsSceneContextMenuEvent *  event)
private

◆ defaultDragEnterEvent()

void Visualization::Item::defaultDragEnterEvent ( QGraphicsSceneDragDropEvent *  event)
private

◆ defaultDragLeaveEvent()

void Visualization::Item::defaultDragLeaveEvent ( QGraphicsSceneDragDropEvent *  event)
private

◆ defaultDragMoveEvent()

void Visualization::Item::defaultDragMoveEvent ( QGraphicsSceneDragDropEvent *  event)
private

◆ defaultDropEvent()

void Visualization::Item::defaultDropEvent ( QGraphicsSceneDragDropEvent *  event)
private

◆ defaultFocusInEvent()

void Visualization::Item::defaultFocusInEvent ( QFocusEvent *  event)
private

◆ defaultFocusOutEvent()

void Visualization::Item::defaultFocusOutEvent ( QFocusEvent *  event)
private

◆ defaultHoverEnterEvent()

void Visualization::Item::defaultHoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
private

◆ defaultHoverLeaveEvent()

void Visualization::Item::defaultHoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
private

◆ defaultHoverMoveEvent()

void Visualization::Item::defaultHoverMoveEvent ( QGraphicsSceneHoverEvent *  event)
private

◆ defaultKeyPressEvent()

void Visualization::Item::defaultKeyPressEvent ( QKeyEvent *  event)
private

◆ defaultKeyReleaseEvent()

void Visualization::Item::defaultKeyReleaseEvent ( QKeyEvent *  event)
private

◆ defaultMouseDoubleClickEvent()

void Visualization::Item::defaultMouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
private

◆ defaultMouseMoveEvent()

void Visualization::Item::defaultMouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
private

◆ defaultMousePressEvent()

void Visualization::Item::defaultMousePressEvent ( QGraphicsSceneMouseEvent *  event)
private

◆ defaultMouseReleaseEvent()

void Visualization::Item::defaultMouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
private

◆ defaultWheelEvent()

void Visualization::Item::defaultWheelEvent ( QGraphicsSceneWheelEvent *  event)
private

◆ definesChildNodePurpose()

bool Visualization::Item::definesChildNodePurpose ( const Model::Node node) const

◆ definesChildNodeSemanticZoomLevel()

bool Visualization::Item::definesChildNodeSemanticZoomLevel ( const Model::Node node) const

◆ determineChildren()

virtual void Visualization::Item::determineChildren ( )
protectedpure virtual

◆ distanceTo()

int Visualization::Item::distanceTo ( const QPoint &  point) const

Returns the distance between the item and point.

The point point must be in local item coordinates.

◆ dragEnterEvent()

void Visualization::Item::dragEnterEvent ( QGraphicsSceneDragDropEvent *  event)
protectedvirtual

◆ dragLeaveEvent()

void Visualization::Item::dragLeaveEvent ( QGraphicsSceneDragDropEvent *  event)
protectedvirtual

◆ dragMoveEvent()

void Visualization::Item::dragMoveEvent ( QGraphicsSceneDragDropEvent *  event)
protectedvirtual

◆ dropEvent()

void Visualization::Item::dropEvent ( QGraphicsSceneDragDropEvent *  event)
protectedvirtual

◆ envisionItem()

Item * Visualization::Item::envisionItem ( QGraphicsItem *  item)
inlinestatic

Returns item if it is an instance of Item* or the closest of its ancestors that is an Item*.

◆ execute()

void Visualization::Item::execute ( const QString &  command,
const std::unique_ptr< Cursor > &  cursor 
)

◆ findAllVisualizationsOf()

QList< Item * > Visualization::Item::findAllVisualizationsOf ( Model::Node node)
virtual

◆ findAncestorOfType()

template<typename ItemType >
ItemType * Visualization::Item::findAncestorOfType

Returns the first ancestor which is of the given template type, or nullptr if none exists.

◆ findAncestorWithNode()

Item * Visualization::Item::findAncestorWithNode ( )

Returns the first ancestor with a node, or nullptr if none such exists.

If the item itself contains a node, returns this.

◆ findVisualizationOf()

Item * Visualization::Item::findVisualizationOf ( Model::Node node)
virtual

Returns the child item that is visualizing node or nullptr if no such child exists.

Depth-first search is used.

◆ focusedChild()

Item * Visualization::Item::focusedChild ( ) const
virtual

Returns the child item which is focused or which contains a child that is focused or nullptr if no child has focus.

◆ focusInEvent()

void Visualization::Item::focusInEvent ( QFocusEvent *  event)
protectedvirtual

◆ focusOutEvent()

void Visualization::Item::focusOutEvent ( QFocusEvent *  event)
protectedvirtual

◆ fromParent()

int Visualization::Item::fromParent ( int  x) const
inline

◆ fromScene()

int Visualization::Item::fromScene ( int  x) const
inline

◆ getShape()

Shape * Visualization::Item::getShape ( ) const
inline

◆ handler()

InteractionHandler * Visualization::Item::handler ( ) const
virtual

◆ hasNode()

bool Visualization::Item::hasNode ( ) const
virtual

◆ hasSceneCursor()

bool Visualization::Item::hasSceneCursor ( ) const
inline

◆ hasShape()

bool Visualization::Item::hasShape ( ) const
inline

◆ heightInLocal()

int Visualization::Item::heightInLocal ( ) const
inline

◆ heightInParent()

int Visualization::Item::heightInParent ( ) const
inline

◆ heightInScene()

int Visualization::Item::heightInScene ( ) const
inline

◆ hoverEnterEvent()

void Visualization::Item::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtual

◆ hoverLeaveEvent()

void Visualization::Item::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtual

◆ hoverMoveEvent()

void Visualization::Item::hoverMoveEvent ( QGraphicsSceneHoverEvent *  event)
protectedvirtual

◆ ignoresCopyAndPaste()

bool Visualization::Item::ignoresCopyAndPaste ( )
virtual

Returns whether this item should ignore copy and paste hanling and let the parent handler take care of this.

This is useful to skip the default copy and paste handlers and let a parent handler implement specialized behavior.

The default implementation returns false. Reimplement in derived classes that belong to a special hierarchy where some parent object should handle copy and paste (e.g. Expressions or Queries).

◆ isCategoryHiddenDuringPaint()

bool Visualization::Item::isCategoryHiddenDuringPaint ( )
inline

◆ isEmpty()

bool Visualization::Item::isEmpty ( ) const
virtual

◆ isSensitiveToScale()

bool Visualization::Item::isSensitiveToScale ( ) const
virtual

Returns true if the item should be updated if its scale changes, e.g.

when the user zooms in or out.

It is assumed that this method will always return the same value for the entire lifetime of a single item.

◆ itemCategory()

Scene::ItemCategory Visualization::Item::itemCategory ( )

◆ itemOrChildHasFocus()

bool Visualization::Item::itemOrChildHasFocus ( ) const

◆ keyPressEvent()

void Visualization::Item::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

◆ keyReleaseEvent()

void Visualization::Item::keyReleaseEvent ( QKeyEvent *  event)
protectedvirtual

◆ mainViewScalingFactor()

qreal Visualization::Item::mainViewScalingFactor ( ) const

Returns the scaling factor applied by the main view associated of this item's scene.

◆ mouseDoubleClickEvent()

void Visualization::Item::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

◆ mouseMoveEvent()

void Visualization::Item::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

◆ mousePressEvent()

void Visualization::Item::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

◆ mouseReleaseEvent()

void Visualization::Item::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

◆ moveCursor() [1/2]

bool Visualization::Item::moveCursor ( CursorMoveDirection  dir,
QPoint  reference,
CursorMoveOptions  options = None 
)
inline

Overloaded version.

Uses a QPoint as a reference.

◆ moveCursor() [2/2]

bool Visualization::Item::moveCursor ( CursorMoveDirection  dir = MoveDefault,
QRect  reference = {},
CursorMoveOptions  options = None 
)
virtual

Moves the position of the current main scene cursor within the item and returns true on success.

The dir parameter determines how the cursor will be moved. Some modes of movement require a reference rect provided in reference in item local coordinates.

The options parameter specifies additional options to control the move.

The method returns false if it is not possible to move the cursor within the borders of the current item given the provided movement parameters.

The default implementation returns false when dir is any of MoveUp, MoveDown, MoveLeft, MoveRight or when the combination of dir and reference is not satisfiable. The item is assumed to have no children. If the item is focused a default cursor with no visualization will be created whose position is the item's scene position.

This method is responsible for creating a corresponding Cursor item and setting it as the main scene cursor.

◆ needsUpdate()

Item::UpdateType Visualization::Item::needsUpdate ( )
virtual

◆ node()

Model::Node * Visualization::Item::node ( ) const
virtual

◆ nodeItemsMap()

QMultiHash< Model::Node *, Item * > & Visualization::Item::nodeItemsMap ( )
static

◆ overlay()

template<typename OverlayType >
OverlayType * Visualization::Item::overlay ( QString  overlayGroup = QString())

Returns the overlay of the specified OverlayType that is associated with this item.

If overlayGroup is specified only overlays in that group will be searched, otherwise all overlay groups are searched. All overlays are searched, regardless of the position of this item in the association.

Returns null if no overlay is found.

This method will return the first found overlay, in case there are more than one overlays that match OverlayType and overlayGroup.

◆ overlays()

QList< OverlayAccessor * > Visualization::Item::overlays ( QString  overlayGroup = QString()) const

Returns all the overlays of this item for the specified group.

If no group is specified returns the overlays in all groups.

All associated overlays are returned, regardless of the position of this item in the association.

◆ paint()

void Visualization::Item::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)
virtual

◆ parent()

Item * Visualization::Item::parent ( ) const
inline

◆ previousMainViewScalingFactor()

qreal Visualization::Item::previousMainViewScalingFactor ( ) const

Returns the scaling factor used before the active one.

◆ purpose()

int Visualization::Item::purpose ( ) const

Returns what purpose should the children of this item be chosen for when deciding what visualizations to use.

If the item's own purpose has been set, it's value will be returned. Otherwise the value of the item's parent will be returned. If the item has no parent the return value is an unspecified purpose (-1).

◆ putAddOnItemsInSequence()

void Visualization::Item::putAddOnItemsInSequence ( SequentialLayout layout)
protected

Puts all items generated by add-ons inside a sequential layout.

This is a helper function that can be used by any item to quickly visualize items from add-ons. The item just needs to provide a SequentialLayout that will server as the container.

◆ regions()

QList< ItemRegion > Visualization::Item::regions ( )
virtual

Returns a list of regions that determine where there are curosrs and where there are child items in this item.

All region coordinates are in item local coordinates.

◆ removeAddOn()

bool Visualization::Item::removeAddOn ( VisualizationAddOn addOn)
static

Removes the add-on addOn from the class.

The add-on can only be removed if it was added directly to this class. Add-on from inherited classes can not be removed by calling removeAddOn on derived classes.

Returns true if the add-on was removed and false otherwise.

◆ removeFromScene()

void Visualization::Item::removeFromScene ( )

◆ removeShape()

void Visualization::Item::removeShape ( )

◆ renderer()

ModelRenderer * Visualization::Item::renderer ( )

◆ revision()

int Visualization::Item::revision ( ) const
virtual

◆ satisfiedPositionConstraints()

Item::PositionConstraints Visualization::Item::satisfiedPositionConstraints ( const QPoint &  point) const

Returns all position constraints with respect to the point point satisfied by this item.

The point point must be in the item's local coordinates.

The returned constraints are from the item's point of view, e.g. a constraint LeftOf means that the item is left of the specified point.

See also
childClosestTo

◆ scene()

Scene * Visualization::Item::scene ( ) const
inline

◆ sceneEvent()

bool Visualization::Item::sceneEvent ( QEvent *  event)
protectedvirtual

◆ semanticZoomLevel()

int Visualization::Item::semanticZoomLevel ( ) const

Returns what semantic zoom level should the children of this item be chosen for when deciding what visualizations to use.

If the item's own semantic zoom level has been set, it's value will be returned. Otherwise the value of the item's parent will be returned. If the item has no parent the return value is an unspecified semantic zoom level (-1).

◆ setChildNodePurpose()

void Visualization::Item::setChildNodePurpose ( const Model::Node node,
int  purpose 
)

◆ setChildNodeSemanticZoomLevel()

void Visualization::Item::setChildNodeSemanticZoomLevel ( const Model::Node node,
int  semanticZoomLevel 
)

◆ setDefaultClassHandler()

void Visualization::Item::setDefaultClassHandler ( InteractionHandler handler)
inlinestatic

◆ setDefaultMoveCursorProxy()

void Visualization::Item::setDefaultMoveCursorProxy ( Item proxy)
inline

◆ setHeight()

void Visualization::Item::setHeight ( int  height)
protected

◆ setItemCategory()

void Visualization::Item::setItemCategory ( Scene::ItemCategory  cat = Scene::NoItemCategory)
inline

◆ setPurpose()

void Visualization::Item::setPurpose ( int  purpose)

◆ setRevision()

void Visualization::Item::setRevision ( int  newRevision)
virtual

◆ setScale()

void Visualization::Item::setScale ( qreal  newScale)

Sets the item's scale and schedules an update for all descendant items that are sensitive to scale changes.

◆ setSemanticZoomLevel()

void Visualization::Item::setSemanticZoomLevel ( int  semanticZoomLevel)

◆ setSize() [1/2]

void Visualization::Item::setSize ( const QSizeF &  size)
protected

◆ setSize() [2/2]

void Visualization::Item::setSize ( int  width,
int  height 
)
protected

◆ setStyle()

void Visualization::Item::setStyle ( const ItemStyle style)
virtual

◆ setUpdateNeeded()

void Visualization::Item::setUpdateNeeded ( UpdateType  updateType)

◆ setUpdateNeededForChildItem()

void Visualization::Item::setUpdateNeededForChildItem ( UpdateType  updateType,
Model::Node nodeVisualizedByChild 
)

Finds the currently existing direct or indirect child Item that visualizes nodeVisualizedByChild and sets it update status to updateType.

If there is no child item which yet visualizes nodeVisualizedByChild then this method will search for the Item which visualizes the parent of nodeVisualizedByChild. This will continue recursively until an existing visualization of one of the ancestors of nodeVisualizedByChild is found.

Use this method when a new node has been created and the a visualization needs to be updated in order to display it.

◆ setWidth()

void Visualization::Item::setWidth ( int  width)
protected

◆ sizeDependsOnParent()

bool Visualization::Item::sizeDependsOnParent ( ) const
virtual

◆ sizeInLocal()

QSizeF Visualization::Item::sizeInLocal ( ) const
inline

◆ sizeInParent()

QSizeF Visualization::Item::sizeInParent ( ) const
inline

◆ sizeInScene()

QSizeF Visualization::Item::sizeInScene ( ) const
inline

◆ staticAddOns()

QList< VisualizationAddOn * > & Visualization::Item::staticAddOns ( )
staticprivate

Returns a list of all add-on that have been added to this class.

Use addAddOn() and removeAddOn() to change the contents of the list.

◆ style()

const ItemStyle * Visualization::Item::style ( ) const
inline

◆ synchronizeCollections()

template<typename Definition , typename Store , typename CompareFunction , typename CreateFunction , typename SyncFunction , typename DeleteFunction >
bool Visualization::Item::synchronizeCollections ( Item parent,
const Definition &  def,
Store &  store,
CompareFunction  compare,
CreateFunction  create,
SyncFunction  sync,
DeleteFunction  deleter 
)
static

Inserts elements that are not yet in store and adjusts the order to match that in def.

◆ synchronizeItem() [1/3]

template<typename FieldType , typename VisualizationType >
bool Visualization::Item::synchronizeItem ( FieldType *&  item,
bool  present,
const typename VisualizationType::StyleType *  style 
)
protected

◆ synchronizeItem() [2/3]

template<typename FieldType , typename VisualizationType >
bool Visualization::Item::synchronizeItem ( FieldType *&  item,
typename VisualizationType::NodeType *  node,
const typename VisualizationType::StyleType *  style 
)
protected

◆ synchronizeItem() [3/3]

bool Visualization::Item::synchronizeItem ( Item *&  item,
Model::Node node 
)
inlineprotected

◆ totalScale()

qreal Visualization::Item::totalScale ( ) const

◆ updateAddOnItems()

void Visualization::Item::updateAddOnItems ( )
private

◆ updateGeometry() [1/2]

virtual void Visualization::Item::updateGeometry ( int  availableWidth,
int  availableHeight 
)
protectedpure virtual

This method sets the position of child elements, stretching them if needed, and determines the final size of the item.

If any of availableWidth or availableHeight is different than 0, the item is allowed to stretch in the specified dimension until it fills all the available space. Both parameters are in item local coordinates.

Reimplemnet in derived classes to define the behavior.

◆ updateGeometry() [2/2]

void Visualization::Item::updateGeometry ( Item content,
int  availableWidth,
int  availableHeight 
)
protected

This is a helper method that classes can use when reimplementing updateGeometry().

It does the appropriate update, if the current item is a thin wrapper around content.

◆ updateSubtree()

void Visualization::Item::updateSubtree ( )
virtual

◆ useShape()

void Visualization::Item::useShape ( )

◆ wheelEvent()

void Visualization::Item::wheelEvent ( QGraphicsSceneWheelEvent *  event)
protectedvirtual

◆ widthInLocal()

int Visualization::Item::widthInLocal ( ) const
inline

◆ widthInParent()

int Visualization::Item::widthInParent ( ) const
inline

◆ widthInScene()

int Visualization::Item::widthInScene ( ) const
inline

◆ xEndInParent()

qreal Visualization::Item::xEndInParent ( ) const
inline

◆ yEndInParent()

qreal Visualization::Item::yEndInParent ( ) const
inline

Friends And Related Function Documentation

◆ DynamicGridFormElement

friend class DynamicGridFormElement
friend

◆ InteractionHandler

friend class InteractionHandler
friend

◆ NodeItemWrapperFormElement

template<typename ParentType >
friend class NodeItemWrapperFormElement
friend

◆ NodeWithVisualizationItemWrapperFormElement

template<typename ParentType , typename VisualizationType >
friend class NodeWithVisualizationItemWrapperFormElement
friend

◆ SequentialLayoutFormElement

friend class SequentialLayoutFormElement
friend

◆ Shape

friend class Shape
friend

◆ VisualizationItemWrapperFormElement

template<typename ParentType , typename VisualizationType , bool externalSynchronization>
friend class VisualizationItemWrapperFormElement
friend

◆ VisualizationItemWrapperFormElementSyncMethod

template<typename ChildItem , typename Style , bool use>
friend struct VisualizationItemWrapperFormElementSyncMethod
friend

Member Data Documentation

◆ addOnItems_

QMultiMap<VisualizationAddOn*, Item* > Visualization::Item::addOnItems_
private

◆ boundingRect_

QRectF Visualization::Item::boundingRect_
private

◆ childNodePurpose_

QMap<const Model::Node*, int> Visualization::Item::childNodePurpose_
private

◆ childNodeSemanticZoomLevel_

QMap<const Model::Node*, int> Visualization::Item::childNodeSemanticZoomLevel_
private

◆ defaultClassHandler_

InteractionHandler * Visualization::Item::defaultClassHandler_ = InteractionHandler::instance()
staticprivate

◆ defaultMoveCursorProxy_

Item* Visualization::Item::defaultMoveCursorProxy_ {}
private

◆ itemCategory_

Scene::ItemCategory Visualization::Item::itemCategory_
private

◆ LAYER_AUTOCOMPLETE_Z

const int Visualization::Item::LAYER_AUTOCOMPLETE_Z = 50
static

◆ LAYER_COMMAND

const int Visualization::Item::LAYER_COMMAND = 25
static

◆ LAYER_CURSOR_Z

const int Visualization::Item::LAYER_CURSOR_Z = 200
static

◆ LAYER_DEFAULT_Z

const int Visualization::Item::LAYER_DEFAULT_Z = 0
static

◆ LAYER_OVERLAY_Z

const int Visualization::Item::LAYER_OVERLAY_Z = 10
static

◆ LAYER_SELECTION_Z

const int Visualization::Item::LAYER_SELECTION_Z = 100
static

◆ needsUpdate_

UpdateType Visualization::Item::needsUpdate_
private

◆ purpose_

int Visualization::Item::purpose_
private

◆ semanticZoomLevel_

int Visualization::Item::semanticZoomLevel_
private

◆ shape_

Shape* Visualization::Item::shape_
private

◆ style_

const ItemStyle* Visualization::Item::style_
private