diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-07-14 01:02:04 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-16 09:38:30 +0200 |
commit | 43645fd59c6bcb0a3e37eef530ef970f51ed48af (patch) | |
tree | d377a19c36e9e853377db59b58d937db0ea67e0d /src/quick/items | |
parent | ad0f200df54e5afcb1fdcb977794259bdb9216b5 (diff) | |
parent | f42207cbdb0cbe5e345bfd9e000b3e77b34a503c (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/quick/items/qquickloader.cpp
tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
Change-Id: I0cb9f637d24ccd0ecfb50c455cc210119f744b02
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 27 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 31 | ||||
-rw-r--r-- | src/quick/items/qquickloader.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickrendercontrol.cpp | 3 |
4 files changed, 65 insertions, 4 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 5a3db5e1eb..b47d055ca4 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -633,6 +633,31 @@ void QQuickFlickablePrivate::updateBeginningEnd() \c contentItem that are relevant. For example, the bound of Items added to the Flickable will be available by \c contentItem.childrenRect + \section1 Examples of contentX and contentY + + The following images demonstrate a flickable being flicked in various + directions and the resulting \l contentX and \l contentY values. + The blue square represents the flickable's content, and the black + border represents the bounds of the flickable. + + \table + \row + \li \image flickable-contentXY-resting.png + \li The \c contentX and \c contentY are both \c 0. + \row + \li \image flickable-contentXY-top-left.png + \li The \c contentX and the \c contentY are both \c 50. + \row + \li \image flickable-contentXY-top-right.png + \li The \c contentX is \c -50 and the \c contentY is \c 50. + \row + \li \image flickable-contentXY-bottom-right.png + \li The \c contentX and the \c contentY are both \c -50. + \row + \li \image flickable-contentXY-bottom-left.png + \li The \c contentX is \c 50 and the \c contentY is \c -50. + \endtable + \section1 Limitations \note Due to an implementation detail, items placed inside a Flickable @@ -738,7 +763,7 @@ QQuickFlickable::~QQuickFlickable() for the position; another way is to use the normalized values in \l {QtQuick::Flickable::visibleArea}{visibleArea}. - \sa originX, originY + \sa {Examples of contentX and contentY}, originX, originY */ qreal QQuickFlickable::contentX() const { diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index b09dbdad84..c1e625ef95 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2356,6 +2356,9 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) \fn QQuickItem::QQuickItem(QQuickItem *parent) Constructs a QQuickItem with the given \a parent. + + The \c parent will be used as both the \l {setParentItem()}{visual parent} + and the \l QObject parent. */ QQuickItem::QQuickItem(QQuickItem* parent) : QObject(*(new QQuickItemPrivate), parent) @@ -4407,6 +4410,8 @@ void QQuickItem::polish() item's coordinate system, to this item's coordinate system, and returns a \l point or \l rect matching the mapped coordinate. + \input item.qdocinc mapping + If \a item is a \c null value, this maps the point or rect from the coordinate system of the root QML view. */ @@ -4495,6 +4500,8 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const item's coordinate system, to \a item's coordinate system, and returns a \l point or \l rect matching the mapped coordinate. + \input item.qdocinc mapping + If \a item is a \c null value, this maps the point or rect to the coordinate system of the root QML view. */ @@ -4564,6 +4571,8 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const Maps the point (\a x, \a y), which is in the global coordinate system, to the item's coordinate system, and returns a \l point matching the mapped coordinate. + + \input item.qdocinc mapping */ /*! \internal @@ -4599,6 +4608,8 @@ void QQuickItem::mapFromGlobal(QQmlV4Function *args) const Maps the point (\a x, \a y), which is in this item's coordinate system, to the global coordinate system, and returns a \l point matching the mapped coordinate. + + \input item.qdocinc mapping */ /*! \internal @@ -7701,6 +7712,8 @@ void QQuickItem::setContainmentMask(QObject *mask) point within \a item's coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + If \a item is 0, this maps \a point to the coordinate system of the scene. @@ -7719,6 +7732,8 @@ QPointF QQuickItem::mapToItem(const QQuickItem *item, const QPointF &point) cons point within the scene's coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + \sa {Concepts - Visual Coordinates in Qt Quick} */ QPointF QQuickItem::mapToScene(const QPointF &point) const @@ -7732,6 +7747,8 @@ QPointF QQuickItem::mapToScene(const QPointF &point) const point within global screen coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + For example, this may be helpful to add a popup to a Qt Quick component. \note Window positioning is done by the window manager and this value is @@ -7753,6 +7770,8 @@ QPointF QQuickItem::mapToGlobal(const QPointF &point) const rectangular area within \a item's coordinate system, and returns the mapped rectangle value. + \input item.qdocinc mapping + If \a item is 0, this maps \a rect to the coordinate system of the scene. @@ -7772,6 +7791,8 @@ QRectF QQuickItem::mapRectToItem(const QQuickItem *item, const QRectF &rect) con rectangular area within the scene's coordinate system, and returns the mapped rectangle value. + \input item.qdocinc mapping + \sa {Concepts - Visual Coordinates in Qt Quick} */ QRectF QQuickItem::mapRectToScene(const QRectF &rect) const @@ -7785,6 +7806,8 @@ QRectF QQuickItem::mapRectToScene(const QRectF &rect) const point within this item's coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + If \a item is 0, this maps \a point from the coordinate system of the scene. @@ -7801,6 +7824,8 @@ QPointF QQuickItem::mapFromItem(const QQuickItem *item, const QPointF &point) co point within this item's coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + \sa {Concepts - Visual Coordinates in Qt Quick} */ QPointF QQuickItem::mapFromScene(const QPointF &point) const @@ -7814,6 +7839,8 @@ QPointF QQuickItem::mapFromScene(const QPointF &point) const equivalent point within this item's coordinate system, and returns the mapped coordinate. + \input item.qdocinc mapping + For example, this may be helpful to add a popup to a Qt Quick component. \note Window positioning is done by the window manager and this value is @@ -7835,6 +7862,8 @@ QPointF QQuickItem::mapFromGlobal(const QPointF &point) const rectangular area within this item's coordinate system, and returns the mapped rectangle value. + \input item.qdocinc mapping + If \a item is 0, this maps \a rect from the coordinate system of the scene. @@ -7853,6 +7882,8 @@ QRectF QQuickItem::mapRectFromItem(const QQuickItem *item, const QRectF &rect) c rectangular area within this item's coordinate system, and returns the mapped rectangle value. + \input item.qdocinc mapping + \sa {Concepts - Visual Coordinates in Qt Quick} */ QRectF QQuickItem::mapRectFromScene(const QRectF &rect) const diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 0de9d6c49a..f32f25a42f 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -112,6 +112,8 @@ void QQuickLoaderPrivate::clear() q, SIGNAL(progressChanged())); component->deleteLater(); component.setObject(nullptr, q); + } else if (component) { + component.setObject(nullptr, q); } source = QUrl(); @@ -437,7 +439,8 @@ void QQuickLoader::loadFromSource() if (isComponentComplete()) { QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; - d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); + if (!d->component) + d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); d->load(); } } @@ -823,7 +826,8 @@ void QQuickLoader::componentComplete() if (active()) { if (d->loadingFromSource) { QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; - d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); + if (!d->component) + d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); } d->load(); } diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index b06b0821d2..86a64cdeeb 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -385,7 +385,8 @@ QImage QQuickRenderControl::grab() cd->syncSceneGraph(); d->rc->endSync(); render(); - grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false); + const bool alpha = d->window->format().alphaBufferSize() > 0 && d->window->color().alpha() < 255; + grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), alpha, alpha); if (QQuickRenderControl::renderWindowFor(d->window)) { grabContent.setDevicePixelRatio(d->window->effectiveDevicePixelRatio()); } |