summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp25
3 files changed, 19 insertions, 22 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index b059bd2..014b61b 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -56,9 +56,9 @@
Items that are anchored are automatically added to the layout, and if items
are removed, all their anchors will be automatically removed.
- \beginfloatleft
+ \div {float-left}
\inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets.
- \endfloat
+ \enddiv
Anchors are always set up between edges of an item, where the "center" is also considered to
be an edge. Consider the following example:
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 52e4d79..f463887 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7689,11 +7689,13 @@ void QGraphicsObject::updateMicroFocus()
void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
- QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
- if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
- item->setParentItem(graphicsObject);
- } else {
- QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ if (item) {
+ QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
+ if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
+ item->setParentItem(graphicsObject);
+ } else {
+ QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ }
}
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 069f4dd..f997fc2 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -130,7 +130,7 @@
item on the scene gains focus, the scene automatically gains focus. If the
scene has focus, hasFocus() will return true, and key events will be
forwarded to the focus item, if any. If the scene loses focus, (i.e.,
- someone calls clearFocus(),) while an item has focus, the scene will
+ someone calls clearFocus()) while an item has focus, the scene will
maintain its item focus information, and once the scene regains focus, it
will make sure the last focus item regains focus.
@@ -806,28 +806,23 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
}
if (focusItem) {
- QFocusEvent event(QEvent::FocusOut, focusReason);
lastFocusItem = focusItem;
- focusItem = 0;
- sendEvent(lastFocusItem, &event);
#ifndef QT_NO_IM
if (lastFocusItem
&& (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) {
- // Reset any visible preedit text
- QInputMethodEvent imEvent;
- sendEvent(lastFocusItem, &imEvent);
-
// Close any external input method panel. This happens
// automatically by removing WA_InputMethodEnabled on
// the views, but if we are changing focus, we have to
// do it ourselves.
- if (item) {
- for (int i = 0; i < views.size(); ++i)
- if (views.at(i)->inputContext())
- views.at(i)->inputContext()->reset();
- }
+ for (int i = 0; i < views.size(); ++i)
+ if (views.at(i)->inputContext())
+ views.at(i)->inputContext()->reset();
}
+
+ focusItem = 0;
+ QFocusEvent event(QEvent::FocusOut, focusReason);
+ sendEvent(lastFocusItem, &event);
#endif //QT_NO_IM
}
@@ -3104,8 +3099,8 @@ bool QGraphicsScene::stickyFocus() const
\list
\o 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))},
- or if it becomes disabled (i.e., someone calls \c {item->setEnabled(false))},
+ \o 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.
\endlist