summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 12:01:25 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 12:02:41 +0100
commit79f2480c868523a7d8ffc9fb15055e8eab3237ba (patch)
tree8336143e8c09810dc97324970fed61af27e26a97 /src/widgets/graphicsview
parent7e4f32993498db0e06346e32458a1ec7d0c7b3ec (diff)
parent12f221410fbe41d0b2efda4cd3289dfcf9044aa8 (diff)
Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp78
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.cpp22
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp68
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp16
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h14
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp156
9 files changed, 185 insertions, 181 deletions
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index 1ccf6fcffe..348d8f2d09 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -107,11 +107,11 @@
avoid any future regressions in behaviour:
\list
- \o Stretch factors are not respected.
+ \li Stretch factors are not respected.
- \o QSizePolicy::ExpandFlag is not respected.
+ \li QSizePolicy::ExpandFlag is not respected.
- \o Height for width is not respected.
+ \li Height for width is not respected.
\endlist
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index ab03ff7a9e..dab1965da5 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -59,14 +59,14 @@
common shapes. These are:
\list
- \o QGraphicsEllipseItem provides an ellipse item
- \o QGraphicsLineItem provides a line item
- \o QGraphicsPathItem provides an arbitrary path item
- \o QGraphicsPixmapItem provides a pixmap item
- \o QGraphicsPolygonItem provides a polygon item
- \o QGraphicsRectItem provides a rectangular item
- \o QGraphicsSimpleTextItem provides a simple text label item
- \o QGraphicsTextItem provides an advanced text browser item
+ \li QGraphicsEllipseItem provides an ellipse item
+ \li QGraphicsLineItem provides a line item
+ \li QGraphicsPathItem provides an arbitrary path item
+ \li QGraphicsPixmapItem provides a pixmap item
+ \li QGraphicsPolygonItem provides a polygon item
+ \li QGraphicsRectItem provides a rectangular item
+ \li QGraphicsSimpleTextItem provides a simple text label item
+ \li QGraphicsTextItem provides an advanced text browser item
\endlist
All of an item's geometric information is based on its local coordinate
@@ -112,12 +112,12 @@
\list 1
- \o Reimplement shape() to return an accurate shape for your item,
+ \li Reimplement shape() to return an accurate shape for your item,
and rely on the default implementation of collidesWithItem() to do
shape-shape intersection. This can be rather expensive if the
shapes are complex.
- \o Reimplement collidesWithItem() to provide your own custom item
+ \li Reimplement collidesWithItem() to provide your own custom item
and shape collision algorithm.
\endlist
@@ -165,10 +165,10 @@
QGraphicsItem always applies the properties in a fixed, defined order:
\list
- \o The item's base transform is applied (transform())
- \o The item's transformations list is applied in order (transformations())
- \o The item is rotated relative to its transform origin point (rotation(), transformOriginPoint())
- \o The item is scaled relative to its transform origin point (scale(), transformOriginPoint())
+ \li The item's base transform is applied (transform())
+ \li The item's transformations list is applied in order (transformations())
+ \li The item is rotated relative to its transform origin point (rotation(), transformOriginPoint())
+ \li The item is scaled relative to its transform origin point (scale(), transformOriginPoint())
\endlist
\section1 Painting
@@ -215,14 +215,14 @@
For advanced users, there are ways to alter how your items are sorted:
\list
- \o You can call setZValue() on an item to explicitly stack it on top of, or
+ \li You can call setZValue() on an item to explicitly stack it on top of, or
under, other sibling items. The default Z value for an item is 0. Items
with the same Z value are stacked by insertion order.
- \o You can call stackBefore() to reorder the list of children. This will
+ \li You can call stackBefore() to reorder the list of children. This will
directly modify the insertion order.
- \o You can set the ItemStacksBehindParent flag to stack a child item behind
+ \li You can set the ItemStacksBehindParent flag to stack a child item behind
its parent.
\endlist
@@ -238,13 +238,13 @@
to a set of convenience event handlers:
\list
- \o contextMenuEvent() handles context menu events
- \o focusInEvent() and focusOutEvent() handle focus in and out events
- \o hoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles
+ \li contextMenuEvent() handles context menu events
+ \li focusInEvent() and focusOutEvent() handle focus in and out events
+ \li hoverEnterEvent(), hoverMoveEvent(), and hoverLeaveEvent() handles
hover enter, move and leave events
- \o inputMethodEvent() handles input events, for accessibility support
- \o keyPressEvent() and keyReleaseEvent() handle key press and release events
- \o mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and
+ \li inputMethodEvent() handles input events, for accessibility support
+ \li keyPressEvent() and keyReleaseEvent() handle key press and release events
+ \li mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), and
mouseDoubleClickEvent() handles mouse press, move, release, click and
doubleclick events
\endlist
@@ -783,7 +783,7 @@ static inline void _q_adjustRect(QRect *rect)
class QGraphicsItemCustomDataStore
{
public:
- QMap<const QGraphicsItem *, QMap<int, QVariant> > data;
+ QHash<const QGraphicsItem *, QMap<int, QVariant> > data;
};
Q_GLOBAL_STATIC(QGraphicsItemCustomDataStore, qt_dataStore)
@@ -1379,7 +1379,7 @@ void QGraphicsItemCache::purge()
{
QPixmapCache::remove(key);
key = QPixmapCache::Key();
- QMutableMapIterator<QPaintDevice *, DeviceData> it(deviceData);
+ QMutableHashIterator<QPaintDevice *, DeviceData> it(deviceData);
while (it.hasNext()) {
DeviceData &data = it.next().value();
QPixmapCache::remove(data.key);
@@ -3469,11 +3469,11 @@ QGraphicsItem *QGraphicsItem::focusScopeItem() const
following events occurs:
\list
- \o The item becomes invisible
- \o The item is removed from the scene
- \o The item is deleted
- \o The item call ungrabMouse()
- \o Another item calls grabMouse(); the item will regain the mouse grab
+ \li The item becomes invisible
+ \li The item is removed from the scene
+ \li The item is deleted
+ \li The item call ungrabMouse()
+ \li Another item calls grabMouse(); the item will regain the mouse grab
when the other item calls ungrabMouse().
\endlist
@@ -3531,11 +3531,11 @@ void QGraphicsItem::ungrabMouse()
following events occur:
\list
- \o The item becomes invisible
- \o The item is removed from the scene
- \o The item is deleted
- \o The item calls ungrabKeyboard()
- \o Another item calls grabKeyboard(); the item will regain the keyboard grab
+ \li The item becomes invisible
+ \li The item is removed from the scene
+ \li The item is deleted
+ \li The item calls ungrabKeyboard()
+ \li Another item calls grabKeyboard(); the item will regain the keyboard grab
when the other item calls ungrabKeyboard().
\endlist
@@ -5730,7 +5730,7 @@ void QGraphicsItem::update(const QRectF &rect)
viewport, which does not benefit from scroll optimizations), this function
is equivalent to calling update(\a rect).
- \bold{Note:} Scrolling is only supported when QGraphicsItem::ItemCoordinateCache
+ \b{Note:} Scrolling is only supported when QGraphicsItem::ItemCoordinateCache
is enabled; in all other cases calling this function is equivalent to calling
update(\a rect). If you for sure know that the item is opaque and not overlapped
by other items, you can map the \a rect to viewport coordinates and scroll the
@@ -7124,7 +7124,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if ((event->buttons() & Qt::LeftButton) && (flags() & ItemIsMovable)) {
// Determine the list of items that need to be moved.
QList<QGraphicsItem *> selectedItems;
- QMap<QGraphicsItem *, QPointF> initialPositions;
+ QHash<QGraphicsItem *, QPointF> initialPositions;
if (d_ptr->scene) {
selectedItems = d_ptr->scene->selectedItems();
initialPositions = d_ptr->scene->d_func()->movingItemsInitialPositions;
@@ -8652,8 +8652,8 @@ QVariant QGraphicsRectItem::extension(const QVariant &variant) const
\table
\row
- \o \inlineimage graphicsview-ellipseitem.png
- \o \inlineimage graphicsview-ellipseitem-pie.png
+ \li \inlineimage graphicsview-ellipseitem.png
+ \li \inlineimage graphicsview-ellipseitem-pie.png
\endtable
To set the item's ellipse, pass a QRectF to QGraphicsEllipseItem's
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index aebb22a0ee..1783fdb713 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -145,7 +145,7 @@ public:
QPoint cacheIndent;
QPixmapCache::Key key;
};
- QMap<QPaintDevice *, DeviceData> deviceData;
+ QHash<QPaintDevice *, DeviceData> deviceData;
// List of logical exposed rects
QVector<QRectF> exposed;
@@ -508,7 +508,7 @@ public:
QRectF childrenBoundingRect;
QRectF needsRepaint;
- QMap<QWidget *, QRect> paintedViewBoundingRects;
+ QHash<QWidget *, QRect> paintedViewBoundingRects;
QPointF pos;
qreal z;
qreal opacity;
diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp
index 63f04f67bc..6f93dd511d 100644
--- a/src/widgets/graphicsview/qgraphicslayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout.cpp
@@ -77,19 +77,19 @@ QT_BEGIN_NAMESPACE
minimum:
\table
- \header \o Function \o Description
- \row \o QGraphicsLayoutItem::setGeometry()
- \o Notifies you when the geometry of the layout is set. You can
+ \header \li Function \li Description
+ \row \li QGraphicsLayoutItem::setGeometry()
+ \li Notifies you when the geometry of the layout is set. You can
store the geometry in your own layout class in a reimplementation
of this function.
- \row \o QGraphicsLayoutItem::sizeHint()
- \o Returns the layout's size hints.
- \row \o QGraphicsLayout::count()
- \o Returns the number of items in your layout.
- \row \o QGraphicsLayout::itemAt()
- \o Returns a pointer to an item in your layout.
- \row \o QGraphicsLayout::removeAt()
- \o Removes an item from your layout without destroying it.
+ \row \li QGraphicsLayoutItem::sizeHint()
+ \li Returns the layout's size hints.
+ \row \li QGraphicsLayout::count()
+ \li Returns the number of items in your layout.
+ \row \li QGraphicsLayout::itemAt()
+ \li Returns a pointer to an item in your layout.
+ \row \li QGraphicsLayout::removeAt()
+ \li Removes an item from your layout without destroying it.
\endtable
For more details on how to implement each function, refer to the individual
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index d532c4e541..4cda3e51fb 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -136,45 +136,45 @@ QT_BEGIN_NAMESPACE
QGraphicsProxyWidget maintains symmetry for the following states:
\table
- \header \o QWidget state \o QGraphicsProxyWidget state \o Notes
- \row \o QWidget::enabled
- \o QGraphicsProxyWidget::enabled
- \o
- \row \o QWidget::visible
- \o QGraphicsProxyWidget::visible
- \o The explicit state is also symmetric.
- \row \o QWidget::geometry
- \o QGraphicsProxyWidget::geometry
- \o Geometry is only guaranteed to be symmetric while
+ \header \li QWidget state \li QGraphicsProxyWidget state \li Notes
+ \row \li QWidget::enabled
+ \li QGraphicsProxyWidget::enabled
+ \li
+ \row \li QWidget::visible
+ \li QGraphicsProxyWidget::visible
+ \li The explicit state is also symmetric.
+ \row \li QWidget::geometry
+ \li QGraphicsProxyWidget::geometry
+ \li Geometry is only guaranteed to be symmetric while
the embedded widget is visible.
- \row \o QWidget::layoutDirection
- \o QGraphicsProxyWidget::layoutDirection
- \o
- \row \o QWidget::style
- \o QGraphicsProxyWidget::style
- \o
- \row \o QWidget::palette
- \o QGraphicsProxyWidget::palette
- \o
- \row \o QWidget::font
- \o QGraphicsProxyWidget::font
- \o
- \row \o QWidget::cursor
- \o QGraphicsProxyWidget::cursor
- \o The embedded widget overrides the proxy widget
+ \row \li QWidget::layoutDirection
+ \li QGraphicsProxyWidget::layoutDirection
+ \li
+ \row \li QWidget::style
+ \li QGraphicsProxyWidget::style
+ \li
+ \row \li QWidget::palette
+ \li QGraphicsProxyWidget::palette
+ \li
+ \row \li QWidget::font
+ \li QGraphicsProxyWidget::font
+ \li
+ \row \li QWidget::cursor
+ \li QGraphicsProxyWidget::cursor
+ \li The embedded widget overrides the proxy widget
cursor. The proxy cursor changes depending on
which embedded subwidget is currently under the
mouse.
- \row \o QWidget::sizeHint()
- \o QGraphicsProxyWidget::sizeHint()
- \o All size hint functionality from the embedded
+ \row \li QWidget::sizeHint()
+ \li QGraphicsProxyWidget::sizeHint()
+ \li All size hint functionality from the embedded
widget is forwarded by the proxy.
- \row \o QWidget::getContentsMargins()
- \o QGraphicsProxyWidget::getContentsMargins()
- \o Updated once by setWidget().
- \row \o QWidget::windowTitle
- \o QGraphicsProxyWidget::windowTitle
- \o Updated once by setWidget().
+ \row \li QWidget::getContentsMargins()
+ \li QGraphicsProxyWidget::getContentsMargins()
+ \li Updated once by setWidget().
+ \row \li QWidget::windowTitle
+ \li QGraphicsProxyWidget::windowTitle
+ \li Updated once by setWidget().
\endtable
\note QGraphicsScene keeps the embedded widget in a special state that
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 280aa7af8e..015cd254d4 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1082,7 +1082,7 @@ void QGraphicsScenePrivate::enableMouseTrackingOnViews()
/*!
Returns all items for the screen position in \a event.
*/
-QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*screenPos*/,
+QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos,
const QPointF &scenePos,
QWidget *widget) const
{
@@ -1091,12 +1091,16 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*sc
if (!view)
return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());
- const QRectF pointRect(scenePos, QSizeF(1, 1));
+ const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
if (!view->isTransformed())
return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);
const QTransform viewTransform = view->viewportTransform();
- return q->items(pointRect, Qt::IntersectsItemShape,
+ if (viewTransform.type() <= QTransform::TxScale) {
+ return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
+ Qt::DescendingOrder, viewTransform);
+ }
+ return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
Qt::DescendingOrder, viewTransform);
}
@@ -3114,12 +3118,12 @@ bool QGraphicsScene::stickyFocus() const
the following events occur:
\list
- \o If the item receives a mouse release event when there are no other
+ \li If the item receives a mouse release event when there are no other
buttons pressed, it loses the mouse grab.
- \o If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}),
+ \li If the item becomes invisible (i.e., someone calls \c {item->setVisible(false)}),
or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false)}),
it loses the mouse grab.
- \o If the item is removed from the scene, it loses the mouse grab.
+ \li If the item is removed from the scene, it loses the mouse grab.
\endlist
If the item loses its mouse grab, the scene will ignore all mouse events
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index b0410e38ce..0f5a0a6fc1 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -128,7 +128,7 @@ public:
QVector<QGraphicsItem *> unpolishedItems;
QList<QGraphicsItem *> topLevelItems;
- QMap<QGraphicsItem *, QPointF> movingItemsInitialPositions;
+ QHash<QGraphicsItem *, QPointF> movingItemsInitialPositions;
void registerTopLevelItem(QGraphicsItem *item);
void unregisterTopLevelItem(QGraphicsItem *item);
void _q_updateLater();
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index be93c47476..95de435846 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -66,7 +66,7 @@ class QGraphicsSceneEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent
{
public:
- QGraphicsSceneEvent(Type type);
+ explicit QGraphicsSceneEvent(Type type);
~QGraphicsSceneEvent();
QWidget *widget() const;
@@ -84,7 +84,7 @@ class QGraphicsSceneMouseEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneMouseEvent(Type type = None);
+ explicit QGraphicsSceneMouseEvent(Type type = None);
~QGraphicsSceneMouseEvent();
QPointF pos() const;
@@ -132,7 +132,7 @@ class QGraphicsSceneWheelEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneWheelEvent(Type type = None);
+ explicit QGraphicsSceneWheelEvent(Type type = None);
~QGraphicsSceneWheelEvent();
QPointF pos() const;
@@ -167,7 +167,7 @@ class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEve
public:
enum Reason { Mouse, Keyboard, Other };
- QGraphicsSceneContextMenuEvent(Type type = None);
+ explicit QGraphicsSceneContextMenuEvent(Type type = None);
~QGraphicsSceneContextMenuEvent();
QPointF pos() const;
@@ -194,7 +194,7 @@ class QGraphicsSceneHoverEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneHoverEvent(Type type = None);
+ explicit QGraphicsSceneHoverEvent(Type type = None);
~QGraphicsSceneHoverEvent();
QPointF pos() const;
@@ -227,7 +227,7 @@ class QGraphicsSceneHelpEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneHelpEvent(Type type = None);
+ explicit QGraphicsSceneHelpEvent(Type type = None);
~QGraphicsSceneHelpEvent();
QPointF scenePos() const;
@@ -245,7 +245,7 @@ class QGraphicsSceneDragDropEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneDragDropEvent(Type type = None);
+ explicit QGraphicsSceneDragDropEvent(Type type = None);
~QGraphicsSceneDragDropEvent();
QPointF pos() const;
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index c179aeff2b..4ad8513050 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -81,10 +81,10 @@ QT_BEGIN_NAMESPACE
over QGraphicsItem. It is similar to QWidget in many ways:
\list
- \o Provides a \l palette, a \l font and a \l style().
- \o Has a defined geometry().
- \o Supports layouts with setLayout() and layout().
- \o Supports shortcuts and actions with grabShortcut() and insertAction()
+ \li Provides a \l palette, a \l font and a \l style().
+ \li Has a defined geometry().
+ \li Supports layouts with setLayout() and layout().
+ \li Supports shortcuts and actions with grabShortcut() and insertAction()
\endlist
Unlike QGraphicsItem, QGraphicsWidget is not an abstract class; you can
@@ -106,23 +106,23 @@ QT_BEGIN_NAMESPACE
Noticeable differences between QGraphicsWidget and QWidget are:
\table
- \header \o QGraphicsWidget
- \o QWidget
- \row \o Coordinates and geometry are defined with qreals (doubles or
+ \header \li QGraphicsWidget
+ \li QWidget
+ \row \li Coordinates and geometry are defined with qreals (doubles or
floats, depending on the platform).
- \o QWidget uses integer geometry (QPoint, QRect).
- \row \o The widget is already visible by default; you do not have to
+ \li QWidget uses integer geometry (QPoint, QRect).
+ \row \li The widget is already visible by default; you do not have to
call show() to display the widget.
- \o QWidget is hidden by default until you call show().
- \row \o A subset of widget attributes are supported.
- \o All widget attributes are supported.
- \row \o A top-level item's style defaults to QGraphicsScene::style
- \o A top-level widget's style defaults to QApplication::style
- \row \o Graphics View provides a custom drag and drop framework, different
+ \li QWidget is hidden by default until you call show().
+ \row \li A subset of widget attributes are supported.
+ \li All widget attributes are supported.
+ \row \li A top-level item's style defaults to QGraphicsScene::style
+ \li A top-level widget's style defaults to QApplication::style
+ \row \li Graphics View provides a custom drag and drop framework, different
from QWidget.
- \o Standard drag and drop framework.
- \row \o Widget items do not support modality.
- \o Full modality support.
+ \li Standard drag and drop framework.
+ \row \li Widget items do not support modality.
+ \li Full modality support.
\endtable
QGraphicsWidget supports a subset of Qt's widget attributes,
@@ -130,32 +130,32 @@ QT_BEGIN_NAMESPACE
listed in this table are unsupported, or otherwise unused.
\table
- \header \o Widget Attribute \o Usage
- \row \o Qt::WA_SetLayoutDirection
- \o Set by setLayoutDirection(), cleared by
+ \header \li Widget Attribute \li Usage
+ \row \li Qt::WA_SetLayoutDirection
+ \li Set by setLayoutDirection(), cleared by
unsetLayoutDirection(). You can test this attribute to
check if the widget has been explicitly assigned a
\l{QGraphicsWidget::layoutDirection()}
{layoutDirection}. If the attribute is not set, the
\l{QGraphicsWidget::layoutDirection()}
{layoutDirection()} is inherited.
- \row \o Qt::WA_RightToLeft
- \o Toggled by setLayoutDirection(). Inherited from the
+ \row \li Qt::WA_RightToLeft
+ \li Toggled by setLayoutDirection(). Inherited from the
parent/scene. If set, the widget's layout will order
horizontally arranged widgets from right to left.
- \row \o Qt::WA_SetStyle
- \o Set and cleared by setStyle(). If this attribute is
+ \row \li Qt::WA_SetStyle
+ \li Set and cleared by setStyle(). If this attribute is
set, the widget has been explicitly assigned a style.
If it is unset, the widget will use the scene's or the
application's style.
- \row \o Qt::WA_Resized
- \o Set by setGeometry() and resize().
- \row \o Qt::WA_SetPalette
- \o Set by setPalette().
- \row \o Qt::WA_SetFont
- \o Set by setFont().
- \row \o Qt::WA_WindowPropagation
- \o Enables propagation to window widgets.
+ \row \li Qt::WA_Resized
+ \li Set by setGeometry() and resize().
+ \row \li Qt::WA_SetPalette
+ \li Set by setPalette().
+ \row \li Qt::WA_SetFont
+ \li Set by setFont().
+ \row \li Qt::WA_WindowPropagation
+ \li Enables propagation to window widgets.
\endtable
Although QGraphicsWidget inherits from both QObject and QGraphicsItem,
@@ -222,7 +222,7 @@ public:
}
private:
- QMap<const QGraphicsWidget *, QStyle *> styles;
+ QHash<const QGraphicsWidget *, QStyle *> styles;
mutable QMutex mutex;
};
Q_GLOBAL_STATIC(QGraphicsWidgetStyles, widgetStyles)
@@ -646,29 +646,29 @@ QRectF QGraphicsWidget::windowFrameRect() const
\table
\header
- \o Style Option Property
- \o Value
+ \li Style Option Property
+ \li Value
\row
- \o state & QStyle::State_Enabled
- \o Corresponds to QGraphicsItem::isEnabled().
+ \li state & QStyle::State_Enabled
+ \li Corresponds to QGraphicsItem::isEnabled().
\row
- \o state & QStyle::State_HasFocus
- \o Corresponds to QGraphicsItem::hasFocus().
+ \li state & QStyle::State_HasFocus
+ \li Corresponds to QGraphicsItem::hasFocus().
\row
- \o state & QStyle::State_MouseOver
- \o Corresponds to QGraphicsItem::isUnderMouse().
+ \li state & QStyle::State_MouseOver
+ \li Corresponds to QGraphicsItem::isUnderMouse().
\row
- \o direction
- \o Corresponds to QGraphicsWidget::layoutDirection().
+ \li direction
+ \li Corresponds to QGraphicsWidget::layoutDirection().
\row
- \o rect
- \o Corresponds to QGraphicsWidget::rect().toRect().
+ \li rect
+ \li Corresponds to QGraphicsWidget::rect().toRect().
\row
- \o palette
- \o Corresponds to QGraphicsWidget::palette().
+ \li palette
+ \li Corresponds to QGraphicsWidget::palette().
\row
- \o fontMetrics
- \o Corresponds to QFontMetrics(QGraphicsWidget::font()).
+ \li fontMetrics
+ \li Corresponds to QFontMetrics(QGraphicsWidget::font()).
\endtable
Subclasses of QGraphicsWidget should call the base implementation, and
@@ -1201,11 +1201,11 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
QGraphicsWidget delivers notifications for the following properties:
- \table \o propertyName \o Property
- \row \o layoutDirection \o QGraphicsWidget::layoutDirection
- \row \o size \o QGraphicsWidget::size
- \row \o font \o QGraphicsWidget::font
- \row \o palette \o QGraphicsWidget::palette
+ \table \li propertyName \li Property
+ \row \li layoutDirection \li QGraphicsWidget::layoutDirection
+ \row \li size \li QGraphicsWidget::size
+ \row \li font \li QGraphicsWidget::font
+ \row \li palette \li QGraphicsWidget::palette
\endtable
\sa itemChange()
@@ -1347,33 +1347,33 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos)
Handles the \a event. QGraphicsWidget handles the following
events:
- \table \o Event \o Usage
- \row \o Polish
- \o Delivered to the widget some time after it has been
+ \table \li Event \li Usage
+ \row \li Polish
+ \li Delivered to the widget some time after it has been
shown.
- \row \o GraphicsSceneMove
- \o Delivered to the widget after its local position has
+ \row \li GraphicsSceneMove
+ \li Delivered to the widget after its local position has
changed.
- \row \o GraphicsSceneResize
- \o Delivered to the widget after its size has changed.
- \row \o Show
- \o Delivered to the widget before it has been shown.
- \row \o Hide
- \o Delivered to the widget after it has been hidden.
- \row \o PaletteChange
- \o Delivered to the widget after its palette has changed.
- \row \o FontChange
- \o Delivered to the widget after its font has changed.
- \row \o EnabledChange
- \o Delivered to the widget after its enabled state has
+ \row \li GraphicsSceneResize
+ \li Delivered to the widget after its size has changed.
+ \row \li Show
+ \li Delivered to the widget before it has been shown.
+ \row \li Hide
+ \li Delivered to the widget after it has been hidden.
+ \row \li PaletteChange
+ \li Delivered to the widget after its palette has changed.
+ \row \li FontChange
+ \li Delivered to the widget after its font has changed.
+ \row \li EnabledChange
+ \li Delivered to the widget after its enabled state has
changed.
- \row \o StyleChange
- \o Delivered to the widget after its style has changed.
- \row \o LayoutDirectionChange
- \o Delivered to the widget after its layout direction has
+ \row \li StyleChange
+ \li Delivered to the widget after its style has changed.
+ \row \li LayoutDirectionChange
+ \li Delivered to the widget after its layout direction has
changed.
- \row \o ContentsRectChange
- \o Delivered to the widget after its contents margins/
+ \row \li ContentsRectChange
+ \li Delivered to the widget after its contents margins/
contents rect has changed.
\endtable
*/