summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-26 19:10:45 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-26 19:10:45 (GMT)
commit84f35321b867894470391d4997b5d58e34bce0ed (patch)
treecb66294f39a2660bfac73b5dbccd21b85dfb65bc /src
parent4837518d3161c77b4e811057d638dcbd22b89195 (diff)
parent11a8c52498e8dc74fdfef48e953055338c8f18d7 (diff)
downloadQt-84f35321b867894470391d4997b5d58e34bce0ed.zip
Qt-84f35321b867894470391d4997b5d58e34bce0ed.tar.gz
Qt-84f35321b867894470391d4997b5d58e34bce0ed.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Redraw issues when removing a fully transparent QGraphicsItem from the scene. Fixes a proxymodel sorting odity.
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp18
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp2
2 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index ae0abf9..22c3f92 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4889,6 +4889,24 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
if (updateAll)
return;
+ if (removingItemFromScene && !ignoreOpacity && !item->d_ptr->ignoreOpacity) {
+ // If any of the item's ancestors ignore opacity, it means that the opacity
+ // was set to 0 (and the update request has not yet been processed). That
+ // also means that we have to ignore the opacity for the item itself; otherwise
+ // things like: parent->setOpacity(0); scene->removeItem(child) won't work.
+ // Note that we only do this when removing items from the scene. In all other
+ // cases the ignoreOpacity bit propagates properly in processDirtyItems, but
+ // since the item is removed immediately it won't be processed there.
+ QGraphicsItem *p = item->d_ptr->parent;
+ while (p) {
+ if (p->d_ptr->ignoreOpacity) {
+ item->d_ptr->ignoreOpacity = true;
+ break;
+ }
+ p = p->d_ptr->parent;
+ }
+ }
+
if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force,
/*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren,
/*ignoreOpacity=*/ignoreOpacity)) {
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index b12cd45..f9b6b94 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -2392,7 +2392,7 @@ bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex
QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant());
switch (l.userType()) {
case QVariant::Invalid:
- return (r.type() == QVariant::Invalid);
+ return (r.type() != QVariant::Invalid);
case QVariant::Int:
return l.toInt() < r.toInt();
case QVariant::UInt: