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

QGraphicsScene subclass with logging support and typed-item search helpers. More...

#include <graphicsscene.h>

+ Inheritance diagram for GraphicsScene:
+ Collaboration diagram for GraphicsScene:

Public Member Functions

 GraphicsScene (QObject *parent=nullptr)
 Construct with an optional parent object.
 
template<typename T >
QList< T > findChildItems () const
 Return all scene items that dynamic_cast to type T.
 
template<typename T >
findFirstChildItem () const
 Return the first scene item that dynamic_cast to type T.
 

Detailed Description

QGraphicsScene subclass with logging support and typed-item search helpers.

GraphicsScene adds findChildItems<T>() and findFirstChildItem<T>() template helpers that search all items in the scene and return only those that dynamic_cast to the requested pointer type.

Definition at line 16 of file graphicsscene.h.

Constructor & Destructor Documentation

◆ GraphicsScene()

GraphicsScene::GraphicsScene ( QObject *  parent = nullptr)
explicit

Construct with an optional parent object.

Parameters
parentOptional QObject parent

Member Function Documentation

◆ findChildItems()

template<typename T >
QList< T > GraphicsScene::findChildItems ( ) const
inline

Return all scene items that dynamic_cast to type T.

Template Parameters
TPointer type to search for (must derive from QGraphicsItem)
Returns
List of matching items cast to T

Definition at line 33 of file graphicsscene.h.

◆ findFirstChildItem()

template<typename T >
T GraphicsScene::findFirstChildItem ( ) const
inline

Return the first scene item that dynamic_cast to type T.

Template Parameters
TPointer type to search for (must derive from QGraphicsItem)
Returns
First matching item cast to T, or nullptr if none found

Definition at line 51 of file graphicsscene.h.


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