summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2014-10-20 13:40:18 (GMT)
committerJan Arve Sæther <jan-arve.saether@theqtcompany.com>2014-10-31 07:07:08 (GMT)
commite93db692f88ad788a89a229ca974d5598dc104c2 (patch)
tree079e2bae035dee298609065d8e512dba44f807f8 /src/gui/graphicsview
parent809119d7a42ebfa5dec9c842e510e569e385513a (diff)
downloadQt-e93db692f88ad788a89a229ca974d5598dc104c2.zip
Qt-e93db692f88ad788a89a229ca974d5598dc104c2.tar.gz
Qt-e93db692f88ad788a89a229ca974d5598dc104c2.tar.bz2
Adjust the layout if a QGraphicsWidget is explicitly hidden
Task-number: QTBUG-20132 Change-Id: Iab59fc9b61d4ca1bb2208c479a027da6eb0283a9 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> (cherry picked from qtbase/bf200fc948d89e1a735a8bcca879654028f944d2)
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp3
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp11
-rw-r--r--src/gui/graphicsview/qgridlayoutengine_p.h1
3 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 2883945..2497742 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1138,6 +1138,9 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
setAttribute(Qt::WA_Resized, false);
}
}
+ // layout size hint only changes if an item changes from/to explicitly hidden state
+ if (value.toBool() || d->explicitlyHidden)
+ updateGeometry();
break;
case ItemVisibleHasChanged:
if (!value.toBool()) {
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index b2e963b..74a074f 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -49,6 +49,7 @@
#include "qgridlayoutengine_p.h"
#include "qstyleoption.h"
#include "qvarlengtharray.h"
+#include "qgraphicswidget_p.h"
#include <QtDebug>
#include <QtCore/qmath.h>
@@ -698,6 +699,14 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
}
}
+bool QGridLayoutItem::isIgnored()
+{
+ if (QGraphicsItem *item = layoutItem()->graphicsItem()) {
+ return QGraphicsItemPrivate::get(item)->explicitlyHidden;
+ }
+ return false;
+}
+
void QGridLayoutItem::setGeometry(const QRectF &rect)
{
q_layoutItem->setGeometry(rect);
@@ -1410,7 +1419,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt
if (rowIsIdenticalToPrevious && item != itemAt(row - 1, column, orientation))
rowIsIdenticalToPrevious = false;
- if (item)
+ if (item && !item->isIgnored())
rowIsEmpty = false;
}
diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h
index 1f1078d..88e3501 100644
--- a/src/gui/graphicsview/qgridlayoutengine_p.h
+++ b/src/gui/graphicsview/qgridlayoutengine_p.h
@@ -289,6 +289,7 @@ public:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const;
QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent) const;
+ bool isIgnored();
QGraphicsLayoutItem *layoutItem() const { return q_layoutItem; }