diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-10-04 12:08:14 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-10-13 11:22:47 +0000 |
commit | b835a36267688b29e8dd3ffccd84f129ebfdd402 (patch) | |
tree | 8faa66ec7d7caecb94cb45e07d83adb4b5d7fea6 /src/compositor/compositor_api/qwaylandquickitem.cpp | |
parent | 6c859cf7b5f1814cfcd3dabb1b82f33c2cf8a649 (diff) |
Set implicit size for QWaylandQuickItem
This is how other Quick items behave (i.e. Image, Text). It means
QWaylandQuickItem::sizeFollowsSurface is now obsolete would ideally be set to
false or removed entirely if we didn't have care about compatibility.
Change-Id: I053ee8984de3a2061e410a35e34b153416c64395
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index b22a75a12..2c30fb9e7 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -957,9 +957,14 @@ void QWaylandQuickItem::parentChanged(QWaylandSurface *newParent, QWaylandSurfac void QWaylandQuickItem::updateSize() { Q_D(QWaylandQuickItem); - if (d->sizeFollowsSurface && surface()) { - setSize(surface()->size() * (d->scaleFactor() / surface()->bufferScale())); - } + + QSize size(0, 0); + if (surface()) + size = surface()->size() * (d->scaleFactor() / surface()->bufferScale()); + + setImplicitSize(size.width(), size.height()); + if (d->sizeFollowsSurface) + setSize(size); } /*! @@ -1040,6 +1045,9 @@ bool QWaylandQuickItem::sizeFollowsSurface() const return d->sizeFollowsSurface; } +//TODO: sizeFollowsSurface became obsolete when we added an implementation for +//implicit size. The property is here for compatibility reasons only and should +//be removed or at least default to false in Qt 6. void QWaylandQuickItem::setSizeFollowsSurface(bool sizeFollowsSurface) { Q_D(QWaylandQuickItem); |