QtBase
v6.3.1
|
[0] More...
#include <customitem.h>
Public Attributes | |
int | numRepaints |
QPainter * | m_painter |
const QStyleOption * | m_styleOption |
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 75 of file src_gui_graphicsview_qgraphicsitem.cpp.
Definition at line 41 of file tst_qgraphicseffectsource.cpp.
|
inlinevirtual |
Definition at line 51 of file customitem.h.
|
inlineoverridevirtual |
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect. QGraphicsView uses this to determine whether the item requires redrawing.
Although the item's shape can be arbitrary, the bounding rect is always rectangular, and it is unaffected by the items' transformation.
If you want to change the item's bounding rectangle, you must first call prepareGeometryChange(). This notifies the scene of the imminent change, so that it can update its item geometry index; otherwise, the scene will be unaware of the item's new geometry, and the results are undefined (typically, rendering artifacts are left within the view).
Reimplement this function to let QGraphicsView determine what parts of the widget, if any, need to be redrawn.
Note: For shapes that paint an outline / stroke, it is important to include half the pen width in the bounding rect. It is not necessary to compensate for antialiasing, though.
Example:
Implements QGraphicsItem.
Definition at line 4122 of file tst_qgraphicsitem.cpp.
QStandardItem * QStandardItem::clone |
Returns a copy of this item. The item's children are not copied.
When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.
Definition at line 226 of file qstandarditemmodel.cpp.
|
inlineoverridevirtual |
Returns a copy of this item. The item's children are not copied.
When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.
Reimplemented from QStandardItem.
Definition at line 94 of file graphicsview.cpp.
|
inlineoverridevirtual |
Returns a copy of this item. The item's children are not copied.
When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.
Reimplemented from QStandardItem.
Definition at line 1029 of file tst_qstandarditemmodel.cpp.
void QStandardItem::emitDataChanged |
Causes the model associated with this item to emit a \l{QAbstractItemModel::dataChanged()}{dataChanged}() signal for this item.
You normally only need to call this function if you have subclassed QStandardItem and reimplemented data() and/or setData().
Definition at line 243 of file qstandarditemmodel.cpp.
|
virtual |
[5]
Reimplemented from QGraphicsItem.
Definition at line 130 of file graphicsview.cpp.
|
inlineoverridevirtual |
Returns true
if this item is less than other; otherwise returns false
.
The default implementation uses the data for the item's sort role (see QStandardItemModel::sortRole) to perform the comparison if the item belongs to a model; otherwise, the data for the item's Qt::DisplayRole (text()) is used to perform the comparison.
sortChildren() and QStandardItemModel::sort() use this function when sorting items. If you want custom sorting, you can subclass QStandardItem and reimplement this function.
Reimplemented from QStandardItem.
Definition at line 1028 of file tst_qstandarditem.cpp.
|
inlineoverridevirtual |
This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates.
Reimplement this function in a QGraphicsItem subclass to provide the item's painting implementation, using painter. The option parameter provides style options for the item, such as its state, exposed area and its level-of-detail hints. The widget argument is optional. If provided, it points to the widget that is being painted on; otherwise, it is 0. For cached painting, widget is always 0.
The painter's pen is 0-width by default, and its pen is initialized to the QPalette::Text brush from the paint device's palette. The brush is initialized to QPalette::Window.
Make sure to constrain all painting inside the boundaries of boundingRect() to avoid rendering artifacts (as QGraphicsView does not clip the painter for you). In particular, when QPainter renders the outline of a shape using an assigned QPen, half of the outline will be drawn outside, and half inside, the shape you're rendering (e.g., with a pen width of 2 units, you must draw outlines 1 unit inside boundingRect()). QGraphicsItem does not support use of cosmetic pens with a non-zero width.
All painting is done in local coordinates.
Implements QGraphicsItem.
Definition at line 4125 of file tst_qgraphicsitem.cpp.
|
inlineoverridevirtual |
This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates.
Reimplement this function in a QGraphicsItem subclass to provide the item's painting implementation, using painter. The option parameter provides style options for the item, such as its state, exposed area and its level-of-detail hints. The widget argument is optional. If provided, it points to the widget that is being painted on; otherwise, it is 0. For cached painting, widget is always 0.
The painter's pen is 0-width by default, and its pen is initialized to the QPalette::Text brush from the paint device's palette. The brush is initialized to QPalette::Window.
Make sure to constrain all painting inside the boundaries of boundingRect() to avoid rendering artifacts (as QGraphicsView does not clip the painter for you). In particular, when QPainter renders the outline of a shape using an assigned QPen, half of the outline will be drawn outside, and half inside, the shape you're rendering (e.g., with a pen width of 2 units, you must draw outlines 1 unit inside boundingRect()). QGraphicsItem does not support use of cosmetic pens with a non-zero width.
All painting is done in local coordinates.
Implements QGraphicsItem.
Definition at line 76 of file tst_qgraphicseffect.cpp.
|
inlineoverridevirtual |
This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates.
Reimplement this function in a QGraphicsItem subclass to provide the item's painting implementation, using painter. The option parameter provides style options for the item, such as its state, exposed area and its level-of-detail hints. The widget argument is optional. If provided, it points to the widget that is being painted on; otherwise, it is 0. For cached painting, widget is always 0.
The painter's pen is 0-width by default, and its pen is initialized to the QPalette::Text brush from the paint device's palette. The brush is initialized to QPalette::Window.
Make sure to constrain all painting inside the boundaries of boundingRect() to avoid rendering artifacts (as QGraphicsView does not clip the painter for you). In particular, when QPainter renders the outline of a shape using an assigned QPen, half of the outline will be drawn outside, and half inside, the shape you're rendering (e.g., with a pen width of 2 units, you must draw outlines 1 unit inside boundingRect()). QGraphicsItem does not support use of cosmetic pens with a non-zero width.
All painting is done in local coordinates.
Implements QGraphicsItem.
Definition at line 46 of file tst_qgraphicseffectsource.cpp.
QStandardItem::QStandardItem |
Constructs an item.
Definition at line 62 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs an item.
Definition at line 62 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs an item.
Definition at line 62 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs an item with the given icon and text.
Definition at line 64 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs an item with the given icon and text.
Definition at line 64 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs an item with the given icon and text.
Definition at line 64 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs a copy of other. Note that model() is not copied.
This function is useful when reimplementing clone().
Definition at line 238 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs a copy of other. Note that model() is not copied.
This function is useful when reimplementing clone().
Definition at line 238 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Constructs a copy of other. Note that model() is not copied.
This function is useful when reimplementing clone().
Definition at line 238 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with the given text.
Definition at line 63 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with the given text.
Definition at line 63 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with the given text.
Definition at line 63 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with rows rows and columns columns of child items.
Definition at line 65 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with rows rows and columns columns of child items.
Definition at line 65 of file qstandarditemmodel.cpp.
|
explicit |
Constructs an item with rows rows and columns columns of child items.
Definition at line 65 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Definition at line 239 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Definition at line 239 of file qstandarditemmodel.cpp.
QStandardItem::QStandardItem |
Definition at line 239 of file qstandarditemmodel.cpp.
|
inline |
|
inline |
Definition at line 53 of file tst_qgraphicseffectsource.cpp.
|
inlineoverridevirtual |
Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.
Reimplemented from QStandardItem.
Definition at line 77 of file src_gui_graphicsview_qgraphicsitem.cpp.
|
inlineoverridevirtual |
Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.
Reimplemented from QStandardItem.
Definition at line 92 of file graphicsview.cpp.
|
inlineoverridevirtual |
Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.
Reimplemented from QStandardItem.
Definition at line 1026 of file tst_qstandarditem.cpp.
|
inlineoverridevirtual |
Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.
Reimplemented from QStandardItem.
Definition at line 1028 of file tst_qstandarditemmodel.cpp.
QPainter * CustomItem::m_painter |
Definition at line 92 of file tst_qgraphicseffect.cpp.
const QStyleOption* CustomItem::m_styleOption |
Definition at line 93 of file tst_qgraphicseffect.cpp.
int CustomItem::numRepaints |
Definition at line 91 of file tst_qgraphicseffect.cpp.