QtBase  v6.3.1
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
CustomScene Class Reference

#include <customitem.h>

Inheritance diagram for CustomScene:
Inheritance graph
[legend]
Collaboration diagram for CustomScene:
Collaboration graph
[legend]

Public Member Functions

 CustomScene ()
 
void drawItems (QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget=nullptr) override
 [0] More...
 
 CustomScene ()
 
 CustomScene ()
 
QList< CustomItem * > selectedCustomItems () const
 
QList< CustomGroup * > selectedCustomGroups () const
 
- Public Member Functions inherited from QGraphicsScene
 QGraphicsScene (QObject *parent=nullptr)
 
 QGraphicsScene (const QRectF &sceneRect, QObject *parent=nullptr)
 
 QGraphicsScene (qreal x, qreal y, qreal width, qreal height, QObject *parent=nullptr)
 
virtual ~QGraphicsScene ()
 
QRectF sceneRect () const
 
qreal width () const
 
qreal height () const
 
void setSceneRect (const QRectF &rect)
 
void setSceneRect (qreal x, qreal y, qreal w, qreal h)
 
void render (QPainter *painter, const QRectF &target=QRectF(), const QRectF &source=QRectF(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
 
ItemIndexMethod itemIndexMethod () const
 
void setItemIndexMethod (ItemIndexMethod method)
 
int bspTreeDepth () const
 
void setBspTreeDepth (int depth)
 
QRectF itemsBoundingRect () const
 
QList< QGraphicsItem * > items (Qt::SortOrder order=Qt::DescendingOrder) const
 
QList< QGraphicsItem * > items (const QPointF &pos, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::DescendingOrder, const QTransform &deviceTransform=QTransform()) const
 Returns all visible items that, depending on mode, are at the specified pos in a list sorted using order. In this case, "visible" defines items for which: isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 (which is fully transparent) and the parent item does not clip it. More...
 
QList< QGraphicsItem * > items (const QRectF &rect, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::DescendingOrder, const QTransform &deviceTransform=QTransform()) const
 Returns all visible items that, depending on mode, are either inside or intersect with the specified rect, in a list sorted using order. In this case, "visible" defines items for which: isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 (which is fully transparent) and the parent item does not clip it. More...
 
QList< QGraphicsItem * > items (const QPolygonF &polygon, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::DescendingOrder, const QTransform &deviceTransform=QTransform()) const
 Returns all visible items that, depending on mode, are either inside or intersect with the specified polygon, in a list sorted using order. In this case, "visible" defines items for which: isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 (which is fully transparent) and the parent item does not clip it. More...
 
QList< QGraphicsItem * > items (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, Qt::SortOrder order=Qt::DescendingOrder, const QTransform &deviceTransform=QTransform()) const
 Returns all visible items that, depending on mode, are either inside or intersect with the specified path, in a list sorted using order. In this case, "visible" defines items for which: isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 (which is fully transparent) and the parent item does not clip it. More...
 
QList< QGraphicsItem * > items (qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform=QTransform()) const
 Returns all visible items that, depending on mode, are either inside or intersect with the rectangle defined by x, y, w and h, in a list sorted using order. In this case, "visible" defines items for which: isVisible() returns true, effectiveOpacity() returns a value greater than 0.0 (which is fully transparent) and the parent item does not clip it. More...
 
QList< QGraphicsItem * > collidingItems (const QGraphicsItem *item, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 
QGraphicsItemitemAt (const QPointF &pos, const QTransform &deviceTransform) const
 
QGraphicsItemitemAt (qreal x, qreal y, const QTransform &deviceTransform) const
 
QList< QGraphicsItem * > selectedItems () const
 
QPainterPath selectionArea () const
 
void setSelectionArea (const QPainterPath &path, const QTransform &deviceTransform)
 
void setSelectionArea (const QPainterPath &path, Qt::ItemSelectionOperation selectionOperation=Qt::ReplaceSelection, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape, const QTransform &deviceTransform=QTransform())
 
QGraphicsItemGroupcreateItemGroup (const QList< QGraphicsItem * > &items)
 
void destroyItemGroup (QGraphicsItemGroup *group)
 
void addItem (QGraphicsItem *item)
 
QGraphicsEllipseItemaddEllipse (const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
QGraphicsLineItemaddLine (const QLineF &line, const QPen &pen=QPen())
 
QGraphicsPathItemaddPath (const QPainterPath &path, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
QGraphicsPixmapItemaddPixmap (const QPixmap &pixmap)
 
QGraphicsPolygonItemaddPolygon (const QPolygonF &polygon, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
QGraphicsRectItemaddRect (const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
QGraphicsTextItemaddText (const QString &text, const QFont &font=QFont())
 
QGraphicsSimpleTextItemaddSimpleText (const QString &text, const QFont &font=QFont())
 
QGraphicsProxyWidgetaddWidget (QWidget *widget, Qt::WindowFlags wFlags=Qt::WindowFlags())
 
QGraphicsEllipseItemaddEllipse (qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
QGraphicsLineItemaddLine (qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen=QPen())
 
QGraphicsRectItemaddRect (qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
 
void removeItem (QGraphicsItem *item)
 
QGraphicsItemfocusItem () const
 
void setFocusItem (QGraphicsItem *item, Qt::FocusReason focusReason=Qt::OtherFocusReason)
 
bool hasFocus () const
 
void setFocus (Qt::FocusReason focusReason=Qt::OtherFocusReason)
 
void clearFocus ()
 
void setStickyFocus (bool enabled)
 
bool stickyFocus () const
 
QGraphicsItemmouseGrabberItem () const
 
QBrush backgroundBrush () const
 
void setBackgroundBrush (const QBrush &brush)
 
QBrush foregroundBrush () const
 
void setForegroundBrush (const QBrush &brush)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
QList< QGraphicsView * > views () const
 
void update (qreal x, qreal y, qreal w, qreal h)
 
void invalidate (qreal x, qreal y, qreal w, qreal h, SceneLayers layers=AllLayers)
 
QStylestyle () const
 
void setStyle (QStyle *style)
 
QFont font () const
 
void setFont (const QFont &font)
 
QPalette palette () const
 
void setPalette (const QPalette &palette)
 
bool isActive () const
 
QGraphicsItemactivePanel () const
 
void setActivePanel (QGraphicsItem *item)
 
QGraphicsWidgetactiveWindow () const
 
void setActiveWindow (QGraphicsWidget *widget)
 
bool sendEvent (QGraphicsItem *item, QEvent *event)
 
qreal minimumRenderSize () const
 
void setMinimumRenderSize (qreal minSize)
 
bool focusOnTouch () const
 
void setFocusOnTouch (bool enabled)
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 
virtual ~QObject ()
 
QString objectName () const
 
void setObjectName (const QString &name)
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const noexcept
 
bool blockSignals (bool b) noexcept
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 
template<typename T >
T findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
const QObjectListchildren () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Public Attributes

bool gotTimerEvent = false
 

Protected Member Functions

void timerEvent (QTimerEvent *) override
 
- Protected Member Functions inherited from QGraphicsScene
bool event (QEvent *event) override
 
bool eventFilter (QObject *watched, QEvent *event) override
 
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void helpEvent (QGraphicsSceneHelpEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void drawBackground (QPainter *painter, const QRectF &rect)
 
virtual void drawForeground (QPainter *painter, const QRectF &rect)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Additional Inherited Members

- Public Types inherited from QGraphicsScene
enum  ItemIndexMethod { BspTreeIndex , NoIndex = -1 }
 
enum  SceneLayer { ItemLayer = 0x1 , BackgroundLayer = 0x2 , ForegroundLayer = 0x4 , AllLayers = 0xffff }
 
- Public Slots inherited from QGraphicsScene
void update (const QRectF &rect=QRectF())
 
void invalidate (const QRectF &rect=QRectF(), SceneLayers layers=AllLayers)
 
void advance ()
 
void clearSelection ()
 
void clear ()
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Signals inherited from QGraphicsScene
void changed (const QList< QRectF > &region)
 
void sceneRectChanged (const QRectF &rect)
 
void selectionChanged ()
 
void focusItemChanged (QGraphicsItem *newFocus, QGraphicsItem *oldFocus, Qt::FocusReason reason)
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Slots inherited from QGraphicsScene
virtual bool focusNextPrevChild (bool next)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QGraphicsScene
QBrush backgroundBrush
 the background brush of the scene. More...
 
QBrush foregroundBrush
 the foreground brush of the scene. More...
 
ItemIndexMethod itemIndexMethod
 the item indexing method. More...
 
QRectF sceneRect
 the scene rectangle; the bounding rectangle of the scene More...
 
int bspTreeDepth
 the depth of QGraphicsScene's BSP index tree More...
 
QPalette palette
 the scene's default palette More...
 
QFont font
 the scene's default font More...
 
bool stickyFocus
 whether clicking into the scene background will clear focus More...
 
qreal minimumRenderSize
 the minimal view-transformed size an item must have to be drawn More...
 
bool focusOnTouch
 whether items gain focus when receiving a {touch begin} event. More...
 
- Properties inherited from QObject
QString objectName
 the name of this object More...
 

Detailed Description

Definition at line 56 of file graphicssceneadditemsnippet.cpp.

Constructor & Destructor Documentation

◆ CustomScene() [1/3]

CustomScene::CustomScene ( )
inline

Definition at line 59 of file graphicssceneadditemsnippet.cpp.

Here is the call graph for this function:

◆ CustomScene() [2/3]

CustomScene::CustomScene ( )
inline

Definition at line 2924 of file tst_qgraphicsscene.cpp.

Here is the call graph for this function:

◆ CustomScene() [3/3]

CustomScene::CustomScene ( )
inline

Definition at line 58 of file customitem.h.

Member Function Documentation

◆ drawItems()

void CustomScene::drawItems ( QPainter painter,
int  numItems,
QGraphicsItem items[],
const QStyleOptionGraphicsItem  options[],
QWidget widget = nullptr 
)
overridevirtual

[0]

Reimplemented from QGraphicsScene.

Definition at line 68 of file graphicssceneadditemsnippet.cpp.

◆ selectedCustomGroups()

QList< CustomGroup * > CustomScene::selectedCustomGroups ( ) const

Definition at line 35 of file customitem.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectedCustomItems()

QList< CustomItem * > CustomScene::selectedCustomItems ( ) const

Definition at line 49 of file customitem.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timerEvent()

void CustomScene::timerEvent ( QTimerEvent event)
inlineoverrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive timer events for the object.

QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.

See also
startTimer(), killTimer(), event()

Reimplemented from QObject.

Definition at line 2929 of file tst_qgraphicsscene.cpp.

Member Data Documentation

◆ gotTimerEvent

bool CustomScene::gotTimerEvent = false

Definition at line 2927 of file tst_qgraphicsscene.cpp.


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