KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
RectangleGraphicsItem Class Reference

QGraphicsRectItem with an application-defined type integer and center-point helpers. More...

#include <rectanglegraphicsitem.h>

+ Inheritance diagram for RectangleGraphicsItem:
+ Collaboration diagram for RectangleGraphicsItem:

Public Member Functions

 RectangleGraphicsItem (int type, QGraphicsItem *parent=nullptr)
 Construct with a type integer and optional parent item.
 
 RectangleGraphicsItem (const Rectangle &rect, int type, QGraphicsItem *parent=nullptr)
 Construct from a Rectangle geometry object.
 
virtual int type () const override
 Return the application-defined type integer.
 
Point centerPoint () const
 Return the center of the item's bounding rect in item coordinates.
 
Point sceneCenterPoint () const
 Return the center of the item's bounding rect in scene coordinates.
 

Protected Member Functions

virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 Handle graphics item change notifications.
 

Detailed Description

QGraphicsRectItem with an application-defined type integer and center-point helpers.

RectangleGraphicsItem stores a type integer (returned by type()) that allows qgraphicsitem_cast<> and scene item-type filtering to work with custom types. It also provides centerPoint() and sceneCenterPoint() convenience accessors.

Definition at line 17 of file rectanglegraphicsitem.h.

Constructor & Destructor Documentation

◆ RectangleGraphicsItem() [1/2]

RectangleGraphicsItem::RectangleGraphicsItem ( int  type,
QGraphicsItem *  parent = nullptr 
)
explicit

Construct with a type integer and optional parent item.

Parameters
typeApplication-defined graphics item type
parentOptional parent QGraphicsItem

◆ RectangleGraphicsItem() [2/2]

RectangleGraphicsItem::RectangleGraphicsItem ( const Rectangle &  rect,
int  type,
QGraphicsItem *  parent = nullptr 
)
explicit

Construct from a Rectangle geometry object.

Parameters
rectRectangle geometry to display
typeApplication-defined graphics item type
parentOptional parent QGraphicsItem

Member Function Documentation

◆ centerPoint()

Point RectangleGraphicsItem::centerPoint ( ) const

Return the center of the item's bounding rect in item coordinates.

Returns
Center point in item coordinates

◆ sceneCenterPoint()

Point RectangleGraphicsItem::sceneCenterPoint ( ) const

Return the center of the item's bounding rect in scene coordinates.

Returns
Center point in scene coordinates

◆ type()

virtual int RectangleGraphicsItem::type ( ) const
inlineoverridevirtual

Return the application-defined type integer.

Returns
Item type value

Definition at line 39 of file rectanglegraphicsitem.h.


The documentation for this class was generated from the following file: