diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-03 18:15:53 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-03 18:15:55 +0100 |
commit | a79d616501f028183c154f175ec3ed0fa45ffd85 (patch) | |
tree | 1d4290d0e61db71571dcec2d250f4d5d07ef2c5f /src/quick | |
parent | 9e77d6c31b406e5941a2d287f3c8842954815db4 (diff) | |
parent | 3b7a8d9d5e214a88f5855800e7bf54da4425d7b9 (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: I894ad7b4888744833f487b481950c087fa960a5c
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 5 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 98 | ||||
-rw-r--r-- | src/quick/items/qquickwindowmodule.cpp | 80 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 11 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 16 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop_p.h | 2 |
7 files changed, 139 insertions, 77 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index c11bf904be..a0329f7afc 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -7012,7 +7012,10 @@ bool QQuickItem::event(QEvent *ev) } else #endif // QT_NO_IM if (ev->type() == QEvent::StyleAnimationUpdate) { - update(); + if (isVisible()) { + ev->accept(); + update(); + } return true; } return QObject::event(ev); diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index d62bf8efa1..ad904a2579 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -297,44 +297,6 @@ qreal QQuickTextPrivate::getImplicitHeight() const return implicitHeight; } -/*! - \qmlproperty enumeration QtQuick::Text::renderType - - Override the default rendering type for this component. - - Supported render types are: - \list - \li Text.QtRendering - the default - \li Text.NativeRendering - \endlist - - Select Text.NativeRendering if you prefer text to look native on the target platform and do - not require advanced features such as transformation of the text. Using such features in - combination with the NativeRendering render type will lend poor and sometimes pixelated - results. - - On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored - and QtRendering is always used. -*/ -QQuickText::RenderType QQuickText::renderType() const -{ - Q_D(const QQuickText); - return d->renderType; -} - -void QQuickText::setRenderType(QQuickText::RenderType renderType) -{ - Q_D(QQuickText); - if (d->renderType == renderType) - return; - - d->renderType = renderType; - emit renderTypeChanged(); - - if (isComponentComplete()) - d->updateLayout(); -} - void QQuickText::q_imagesLoaded() { Q_D(QQuickText); @@ -641,17 +603,6 @@ void QQuickTextLine::setY(qreal y) m_line->setPosition(QPointF(m_line->x(), y)); } -/*! - \qmlmethod QtQuick::Text::doLayout() - - Triggers a re-layout of the displayed text. -*/ -void QQuickText::doLayout() -{ - Q_D(QQuickText); - d->updateSize(); -} - bool QQuickTextPrivate::isLineLaidOutConnected() { Q_Q(QQuickText); @@ -2665,4 +2616,53 @@ void QQuickText::hoverLeaveEvent(QHoverEvent *event) d->processHoverEvent(event); } +/*! + \qmlproperty enumeration QtQuick::Text::renderType + + Override the default rendering type for this component. + + Supported render types are: + \list + \li Text.QtRendering - the default + \li Text.NativeRendering + \endlist + + Select Text.NativeRendering if you prefer text to look native on the target platform and do + not require advanced features such as transformation of the text. Using such features in + combination with the NativeRendering render type will lend poor and sometimes pixelated + results. + + On HighDpi "retina" displays and mobile and embedded platforms, this property is ignored + and QtRendering is always used. +*/ +QQuickText::RenderType QQuickText::renderType() const +{ + Q_D(const QQuickText); + return d->renderType; +} + +void QQuickText::setRenderType(QQuickText::RenderType renderType) +{ + Q_D(QQuickText); + if (d->renderType == renderType) + return; + + d->renderType = renderType; + emit renderTypeChanged(); + + if (isComponentComplete()) + d->updateLayout(); +} + +/*! + \qmlmethod QtQuick::Text::doLayout() + + Triggers a re-layout of the displayed text. +*/ +void QQuickText::doLayout() +{ + Q_D(QQuickText); + d->updateSize(); +} + QT_END_NAMESPACE diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index b91edc2fd5..cd1b68991d 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -45,12 +45,50 @@ #include <QtCore/QCoreApplication> #include <QtQml/QQmlEngine> +#include <private/qguiapplication_p.h> +#include <private/qqmlengine_p.h> +#include <qpa/qplatformintegration.h> + QT_BEGIN_NAMESPACE class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus { Q_INTERFACES(QQmlParserStatus) Q_OBJECT + + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) + +public: + QQuickWindowQmlImpl(QWindow *parent = 0) + : QQuickWindow(parent) + , m_complete(false) + , m_visible(isVisible()) + , m_visibility(AutomaticVisibility) + { + connect(this, &QWindow::visibleChanged, this, &QQuickWindowQmlImpl::visibleChanged); + connect(this, &QWindow::visibilityChanged, this, &QQuickWindowQmlImpl::visibilityChanged); + } + + void setVisible(bool visible) { + if (!m_complete) + m_visible = visible; + else + QQuickWindow::setVisible(visible); + } + + void setVisibility(Visibility visibility) + { + if (!m_complete) + m_visibility = visibility; + else + QQuickWindow::setVisibility(m_visibility); + } + +Q_SIGNALS: + void visibleChanged(bool arg); + void visibilityChanged(QWindow::Visibility visibility); + protected: void classBegin() { //Give QQuickView behavior when created from QML with QQmlApplicationEngine @@ -61,7 +99,47 @@ protected: } } - void componentComplete() {} + void componentComplete() { + m_complete = true; + + // We have deferred window creation until we have the full picture of what + // the user wanted in terms of window state, geometry, visibility, etc. + + if ((m_visibility == Hidden && m_visible) || (m_visibility > AutomaticVisibility && !m_visible)) { + QQmlData *data = QQmlData::get(this); + Q_ASSERT(data && data->context); + + QQmlError error; + error.setObject(this); + + const QQmlContextData* urlContext = data->context; + while (urlContext && urlContext->url.isEmpty()) + urlContext = urlContext->parent; + error.setUrl(urlContext ? urlContext->url : QUrl()); + + QString objectId = data->context->findObjectId(this); + if (!objectId.isEmpty()) + error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl", + "Conflicting properties 'visible' and 'visibility' for Window '%1'").arg(objectId)); + else + error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl", + "Conflicting properties 'visible' and 'visibility'")); + + QQmlEnginePrivate::get(data->context->engine)->warning(error); + } + + if (m_visibility == AutomaticVisibility) { + setWindowState(QGuiApplicationPrivate::platformIntegration()->defaultWindowState(flags())); + setVisible(m_visible); + } else { + setVisibility(m_visibility); + } + } + +private: + bool m_complete; + bool m_visible; + Visibility m_visibility; }; void QQuickWindowModule::defineModule() diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 79b5de72c0..676efe84bc 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -590,15 +590,18 @@ void Element::computeBounds() } bounds.map(*node->matrix()); - if (!qIsFinite(bounds.tl.x)) + if (!qIsFinite(bounds.tl.x) || bounds.tl.x == FLT_MAX) bounds.tl.x = -FLT_MAX; - if (!qIsFinite(bounds.tl.y)) + if (!qIsFinite(bounds.tl.y) || bounds.tl.y == FLT_MAX) bounds.tl.y = -FLT_MAX; - if (!qIsFinite(bounds.br.x)) + if (!qIsFinite(bounds.br.x) || bounds.br.x == -FLT_MAX) bounds.br.x = FLT_MAX; - if (!qIsFinite(bounds.br.y)) + if (!qIsFinite(bounds.br.y) || bounds.br.y == -FLT_MAX) bounds.br.y = FLT_MAX; + Q_ASSERT(bounds.tl.x <= bounds.br.x); + Q_ASSERT(bounds.tl.y <= bounds.br.y); + boundsOutsideFloatRange = bounds.isOutsideFloatRange(); } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 95e111552d..5404b669a0 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -104,8 +104,6 @@ struct Rect { tl.y = pt.y; if (pt.y > br.y) br.y = pt.y; - Q_ASSERT(tl.x <= br.x); - Q_ASSERT(tl.y <= br.y); } void operator |= (const Rect &r) { @@ -117,8 +115,6 @@ struct Rect { br.x = r.br.x; if (r.br.y > br.y) br.y = r.br.y; - Q_ASSERT(tl.x <= br.x); - Q_ASSERT(tl.y <= br.y); } void map(const QMatrix4x4 &m); diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index bfd24e727a..2759d82e77 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -817,7 +817,6 @@ void QSGThreadedRenderLoop::show(QQuickWindow *window) win.thread = new QSGRenderThread(this, QQuickWindowPrivate::get(window)->context); win.timerId = 0; win.updateDuringSync = false; - win.gotBrokenExposeFromPlatformPlugin = false; m_windows << win; } @@ -883,19 +882,6 @@ void QSGThreadedRenderLoop::exposureChanged(QQuickWindow *window) } } -void QSGThreadedRenderLoop::resize(QQuickWindow *window) -{ - Window *w = windowFor(m_windows, window); - if (w - && w->gotBrokenExposeFromPlatformPlugin - && window->width() > 0 && window->height() > 0 - && w->window->geometry().intersects(w->window->screen()->availableGeometry())) { - w->gotBrokenExposeFromPlatformPlugin = false; - handleExposure(w); - } -} - - /*! Will post an event to the render thread that this window should start to render. @@ -909,8 +895,6 @@ void QSGThreadedRenderLoop::handleExposure(Window *w) #ifndef QT_NO_DEBUG qWarning("QSGThreadedRenderLoop: expose event received for window with invalid geometry."); #endif - w->gotBrokenExposeFromPlatformPlugin = true; - return; } // Because we are going to bind a GL context to it, make sure it diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index 844d180788..5943d0bd08 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -60,7 +60,6 @@ public: void show(QQuickWindow *window); void hide(QQuickWindow *window); - void resize(QQuickWindow *window); void windowDestroyed(QQuickWindow *window); void exposureChanged(QQuickWindow *window); @@ -90,7 +89,6 @@ private: QSGRenderThread *thread; int timerId; uint updateDuringSync : 1; - uint gotBrokenExposeFromPlatformPlugin : 1; }; friend class QSGRenderThread; |