summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-08-11 15:59:49 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-08-11 16:13:17 (GMT)
commit262d0348f7a38a22809662e296545d07d686afde (patch)
tree7aa47dfdebbb35c9664b8476034de73df3b0009f /src/gui/graphicsview
parentc5e1630f0ca7062dd602d7e91f47362e5506f858 (diff)
downloadQt-262d0348f7a38a22809662e296545d07d686afde.zip
Qt-262d0348f7a38a22809662e296545d07d686afde.tar.gz
Qt-262d0348f7a38a22809662e296545d07d686afde.tar.bz2
Fix autotest failure in qgraphicsitem.
When autofocused child is deleted, remove from ancestors to avoid double deletion crash. Check for null receiver when auto SIP is enabled in mouseReleaseEvent
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 1e7708c..2ef78b2 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -938,6 +938,17 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
parent->itemChange(QGraphicsItem::ItemChildRemovedChange, thisPointerVariant);
}
+ // Auto-update focus proxy. Any ancestor that has this as focus proxy
+ //needs to be nulled.
+ QGraphicsItem *p = parent;
+ while (p) {
+ if ((p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) &&
+ (p->focusProxy() == q)) {
+ p->setFocusProxy(0);
+ }
+ p = p->d_ptr->parent;
+ }
+
// Update toplevelitem list. If this item is being deleted, its parent
// will be 0 but we don't want to register/unregister it in the TLI list.
if (scene && !inDestructor) {
@@ -1016,7 +1027,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
// Auto-update focus proxy. The closest parent that detects
// focus proxies is updated as the proxy gains or loses focus.
- QGraphicsItem *p = newParent;
+ p = newParent;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) {
p->setFocusProxy(q);
@@ -9092,10 +9103,13 @@ void QGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && qApp->autoSipEnabled()
&& (!dd->clickCausedFocus || qApp->autoSipOnMouseFocus())) {
QEvent _event(QEvent::RequestSoftwareInputPanel);
- QApplication::sendEvent(event->widget(), &_event);
- } else {
- QGraphicsItem::mouseReleaseEvent(event);
+ QWidget *receiver = event->widget();
+ if(receiver) {
+ QApplication::sendEvent(receiver, &_event);
+ }
}
+ QGraphicsItem::mouseReleaseEvent(event);
+
dd->clickCausedFocus = 0;
dd->sendControlEvent(event);
}