Qt 4.8
Classes | Functions
qgraphicsitem.h File Reference
#include <QtCore/qglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
#include <QtCore/qrect.h>
#include <QtCore/qscopedpointer.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/qpixmap.h>

Go to the source code of this file.

Classes

class  QAbstractGraphicsShapeItem
 The QAbstractGraphicsShapeItem class provides a common base for all path items. More...
 
class  QGraphicsEllipseItem
 The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene. More...
 
class  QGraphicsItem
 The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene. More...
 
class  QGraphicsItemGroup
 The QGraphicsItemGroup class provides a container that treats a group of items as a single item. More...
 
class  QGraphicsLineItem
 The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene. More...
 
class  QGraphicsObject
 The QGraphicsObject class provides a base class for all graphics items that require signals, slots and properties. More...
 
class  QGraphicsPathItem
 The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene. More...
 
class  QGraphicsPixmapItem
 The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene. More...
 
class  QGraphicsPolygonItem
 The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene. More...
 
class  QGraphicsRectItem
 The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene. More...
 
class  QGraphicsSimpleTextItem
 The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene. More...
 
class  QGraphicsTextItem
 The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display formatted text. More...
 

Functions

Q_GUI_EXPORT QDebug operator<< (QDebug debug, QGraphicsItem *item)
 
Q_GUI_EXPORT QDebug operator<< (QDebug debug, QGraphicsObject *item)
 
Q_GUI_EXPORT QDebug operator<< (QDebug debug, QGraphicsItem::GraphicsItemChange change)
 
Q_GUI_EXPORT QDebug operator<< (QDebug debug, QGraphicsItem::GraphicsItemFlag flag)
 
Q_GUI_EXPORT QDebug operator<< (QDebug debug, QGraphicsItem::GraphicsItemFlags flags)
 
template<class T >
qgraphicsitem_cast (QGraphicsItem *item)
 
template<class T >
qgraphicsitem_cast (const QGraphicsItem *item)
 

Function Documentation

◆ operator<<() [1/5]

Q_GUI_EXPORT QDebug operator<< ( QDebug  debug,
QGraphicsItem item 
)

Definition at line 11946 of file qgraphicsitem.cpp.

Referenced by qgraphicsitem_cast().

11947 {
11948  if (!item) {
11949  debug << "QGraphicsItem(0)";
11950  return debug;
11951  }
11952 
11953  if (QGraphicsObject *o = item->toGraphicsObject())
11954  debug << o->metaObject()->className();
11955  else
11956  debug << "QGraphicsItem";
11957  debug << "(this =" << (void*)item
11958  << ", parent =" << (void*)item->parentItem()
11959  << ", pos =" << item->pos()
11960  << ", z =" << item->zValue() << ", flags = "
11961  << item->flags() << ")";
11962  return debug;
11963 }
QPointF pos() const
Returns the position of the item in parent coordinates.
qreal zValue() const
Returns the Z-value of the item.
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
QGraphicsItem * parentItem() const
Returns a pointer to this item&#39;s parent item.
The QGraphicsObject class provides a base class for all graphics items that require signals...

◆ operator<<() [2/5]

Q_GUI_EXPORT QDebug operator<< ( QDebug  debug,
QGraphicsObject item 
)

Definition at line 11965 of file qgraphicsitem.cpp.

11966 {
11967  if (!item) {
11968  debug << "QGraphicsObject(0)";
11969  return debug;
11970  }
11971 
11972  debug.nospace() << item->metaObject()->className() << '(' << (void*)item;
11973  if (!item->objectName().isEmpty())
11974  debug << ", name = " << item->objectName();
11975  debug.nospace() << ", parent = " << ((void*)item->parentItem())
11976  << ", pos = " << item->pos()
11977  << ", z = " << item->zValue() << ", flags = "
11978  << item->flags() << ')';
11979  return debug.space();
11980 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
qreal zValue() const
Returns the Z-value of the item.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
QPointF pos
the position of the item
QGraphicsItem * parentItem() const
Returns a pointer to this item&#39;s parent item.
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
QString objectName() const
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ operator<<() [3/5]

Q_GUI_EXPORT QDebug operator<< ( QDebug  debug,
QGraphicsItem::GraphicsItemChange  change 
)

Definition at line 11982 of file qgraphicsitem.cpp.

11983 {
11984  const char *str = "UnknownChange";
11985  switch (change) {
11987  str = "ItemChildAddedChange";
11988  break;
11990  str = "ItemChildRemovedChange";
11991  break;
11993  str = "ItemCursorChange";
11994  break;
11996  str = "ItemCursorHasChanged";
11997  break;
11999  str = "ItemEnabledChange";
12000  break;
12002  str = "ItemEnabledHasChanged";
12003  break;
12005  str = "ItemFlagsChange";
12006  break;
12008  str = "ItemFlagsHaveChanged";
12009  break;
12011  str = "ItemMatrixChange";
12012  break;
12014  str = "ItemParentChange";
12015  break;
12017  str = "ItemParentHasChanged";
12018  break;
12020  str = "ItemPositionChange";
12021  break;
12023  str = "ItemPositionHasChanged";
12024  break;
12026  str = "ItemSceneChange";
12027  break;
12029  str = "ItemSceneHasChanged";
12030  break;
12032  str = "ItemSelectedChange";
12033  break;
12035  str = "ItemSelectedHasChanged";
12036  break;
12038  str = "ItemToolTipChange";
12039  break;
12041  str = "ItemToolTipHasChanged";
12042  break;
12044  str = "ItemTransformChange";
12045  break;
12047  str = "ItemTransformHasChanged";
12048  break;
12050  str = "ItemVisibleChange";
12051  break;
12053  str = "ItemVisibleHasChanged";
12054  break;
12056  str = "ItemZValueChange";
12057  break;
12059  str = "ItemZValueHasChanged";
12060  break;
12062  str = "ItemOpacityChange";
12063  break;
12065  str = "ItemOpacityHasChanged";
12066  break;
12068  str = "ItemScenePositionHasChanged";
12069  break;
12071  str = "ItemRotationChange";
12072  break;
12074  str = "ItemRotationHasChanged";
12075  break;
12077  str = "ItemScaleChange";
12078  break;
12080  str = "ItemScaleHasChanged";
12081  break;
12083  str = "ItemTransformOriginPointChange";
12084  break;
12086  str = "ItemTransformOriginPointHasChanged";
12087  break;
12088  }
12089  debug << str;
12090  return debug;
12091 }

◆ operator<<() [4/5]

Q_GUI_EXPORT QDebug operator<< ( QDebug  debug,
QGraphicsItem::GraphicsItemFlag  flag 
)

Definition at line 12093 of file qgraphicsitem.cpp.

12094 {
12095  const char *str = "UnknownFlag";
12096  switch (flag) {
12098  str = "ItemIsMovable";
12099  break;
12101  str = "ItemIsSelectable";
12102  break;
12104  str = "ItemIsFocusable";
12105  break;
12107  str = "ItemClipsToShape";
12108  break;
12110  str = "ItemClipsChildrenToShape";
12111  break;
12113  str = "ItemIgnoresTransformations";
12114  break;
12116  str = "ItemIgnoresParentOpacity";
12117  break;
12119  str = "ItemDoesntPropagateOpacityToChildren";
12120  break;
12122  str = "ItemStacksBehindParent";
12123  break;
12125  str = "ItemUsesExtendedStyleOption";
12126  break;
12128  str = "ItemHasNoContents";
12129  break;
12131  str = "ItemSendsGeometryChanges";
12132  break;
12134  str = "ItemAcceptsInputMethod";
12135  break;
12137  str = "ItemNegativeZStacksBehindParent";
12138  break;
12140  str = "ItemIsPanel";
12141  break;
12143  str = "ItemIsFocusScope";
12144  break;
12146  str = "ItemSendsScenePositionChanges";
12147  break;
12149  str = "ItemStopsClickFocusPropagation";
12150  break;
12152  str = "ItemStopsFocusHandling";
12153  break;
12154  }
12155  debug << str;
12156  return debug;
12157 }

◆ operator<<() [5/5]

Q_GUI_EXPORT QDebug operator<< ( QDebug  debug,
QGraphicsItem::GraphicsItemFlags  flags 
)

Definition at line 12159 of file qgraphicsitem.cpp.

12160 {
12161  debug << '(';
12162  bool f = false;
12163  for (int i = 0; i < 17; ++i) {
12164  if (flags & (1 << i)) {
12165  if (f)
12166  debug << '|';
12167  f = true;
12168  debug << QGraphicsItem::GraphicsItemFlag(int(flags & (1 << i)));
12169  }
12170  }
12171  debug << ')';
12172  return debug;
12173 }
GraphicsItemFlag
This enum describes different flags that you can set on an item to toggle different features in the i...
Definition: qgraphicsitem.h:92

◆ qgraphicsitem_cast() [1/2]

template<class T >
T qgraphicsitem_cast ( QGraphicsItem item)
related

Definition at line 1139 of file qgraphicsitem.h.

1140 {
1141  return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type)
1142  || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0;
1143 }
The type value returned by the virtual type() function in standard graphics item classes in Qt...
virtual int type() const
Returns the type of an item as an int.

◆ qgraphicsitem_cast() [2/2]

template<class T >
T qgraphicsitem_cast ( const QGraphicsItem item)
inline

Definition at line 1145 of file qgraphicsitem.h.

1146 {
1147  return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type)
1148  || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0;
1149 }
The type value returned by the virtual type() function in standard graphics item classes in Qt...
virtual int type() const
Returns the type of an item as an int.