diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
commit | 2eb26c170920d28213b71e549d5dac4663febb14 (patch) | |
tree | 8df5223ac114d758c2112a8fc787992175556418 /src/widgets/graphicsview | |
parent | 49ddae28e0dcd1c59dd5d742cffedd5290d1224a (diff) | |
parent | 81998b4e8e440076bd22a9164f0a93481c0e597a (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/gui/text/qfontdatabase.cpp
Change-Id: I6ac1f55faa22b8e7b591386fb67f0333d0ea443d
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp | 20 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h | 4 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 4 |
6 files changed, 31 insertions, 3 deletions
diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp index 3d9c5d6de5..c9b2ecd62c 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp @@ -38,9 +38,29 @@ #include "qgraphicslayoutitem_p.h" #include "qgraphicslayout_p.h" #include "qgraphicswidget.h" +#include <private/qgraphicswidget_p.h> QT_BEGIN_NAMESPACE +bool QGraphicsGridLayoutEngineItem::isHidden() const +{ + if (QGraphicsItem *item = q_layoutItem->graphicsItem()) + return QGraphicsItemPrivate::get(item)->explicitlyHidden; + return false; +} + +/*! + \internal + + If this returns true, the layout will arrange just as if the item was never added to the layout. + (Note that this shouldn't lead to a "double spacing" where the item was hidden) + ### Qt6: Move to QGraphicsLayoutItem and make virtual +*/ +bool QGraphicsGridLayoutEngineItem::isIgnored() const +{ + return isHidden() && !q_layoutItem->sizePolicy().retainSizeWhenHidden(); +} + /* returns \c true if the size policy returns \c true for either hasHeightForWidth() or hasWidthForHeight() diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h index 4d6bdfce0a..07486514f8 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h @@ -82,6 +82,10 @@ public: return q_layoutItem->effectiveSizeHint(which, constraint); } + bool isHidden() const; + + virtual bool isIgnored() const Q_DECL_OVERRIDE; + virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE { q_layoutItem->setGeometry(rect); diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 114c45dc0f..67d135271c 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -797,7 +797,7 @@ static QPainterPath qt_graphicsItem_shapeFromPath(const QPainterPath &path, cons // if we pass a value of 0.0 to QPainterPathStroker::setWidth() const qreal penWidthZero = qreal(0.00000001); - if (path == QPainterPath()) + if (path == QPainterPath() || pen == Qt::NoPen) return path; QPainterPathStroker ps; ps.setCapStyle(pen.capStyle()); diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index fdcb66f69b..8765b8114d 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -392,7 +392,7 @@ void QGraphicsScenePrivate::_q_emitUpdated() */ void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) { - item->d_ptr->ensureSequentialSiblingIndex(); + ensureSequentialTopLevelSiblingIndexes(); needSortTopLevelItems = true; // ### maybe false item->d_ptr->siblingIndex = topLevelItems.size(); topLevelItems.append(item); diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 88d5e52204..5484ecb96e 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -765,7 +765,7 @@ void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event) } // Set the new selection area QPainterPath selectionArea; - selectionArea.addPolygon(mapToScene(rubberBandRect)); + selectionArea.addPolygon(q->mapToScene(rubberBandRect)); selectionArea.closeSubpath(); if (scene) scene->setSelectionArea(selectionArea, rubberBandSelectionMode, q->viewportTransform()); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 4a9c3b098e..5bd563e535 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1137,6 +1137,10 @@ 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()) { |