diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-04-22 07:34:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-04-22 07:34:02 +0200 |
commit | 1dafbae0006de63621b7721cca7557756fcfd8ba (patch) | |
tree | c127743200fb1696e146aa782826b886ab6b6794 | |
parent | 5728f48834b9225a36d3e1dae44ced7579cde358 (diff) | |
parent | 6555642db7b3b992335f98dc01863db4beea3fd4 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Iafb7061945e011542fbf0f6ebe776f0a4187b0a4
-rw-r--r-- | src/qml/qml/qqml.h | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlplatform.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmltype.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 15 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 1 | ||||
-rw-r--r-- | tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml | 20 | ||||
-rw-r--r-- | tests/auto/quick/qquickanimations/tst_qquickanimations.cpp | 37 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/BLACKLIST | 2 |
9 files changed, 82 insertions, 3 deletions
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 76a4740101..252e4a5baf 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -716,10 +716,15 @@ inline int qmlRegisterSingletonType( return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &api); } +#ifdef Q_QDOC +template <typename T> +int qmlRegisterSingletonType(const char *uri, int versionMajor, int versionMinor, const char *typeName, std::function<QObject*(QQmlEngine *, QJSEngine *)> callback) +#else template <typename T, typename F, typename std::enable_if<std::is_convertible<F, std::function<QObject *(QQmlEngine *, QJSEngine *)>>::value && !std::is_convertible<F, QObject *(*)(QQmlEngine *, QJSEngine *)>::value, void>::type* = nullptr> inline int qmlRegisterSingletonType(const char *uri, int versionMajor, int versionMinor, const char *typeName, F&& callback) +#endif { QQmlPrivate::RegisterSingletonType api = { 0, diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 97cbfc1342..861b888942 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -391,6 +391,7 @@ The following functions are also on the Qt object. \li \c "unix" - Other Unix-based OS \li \c "windows" - Windows \li \c "winrt" - WinRT / UWP + \li \c "wasm" - WebAssembly \endlist \row diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp index 0acf20bbb4..c1ad5c0886 100644 --- a/src/qml/qml/qqmlplatform.cpp +++ b/src/qml/qml/qqmlplatform.cpp @@ -76,6 +76,8 @@ QString QQmlPlatform::os() return QStringLiteral("qnx"); #elif defined(Q_OS_UNIX) return QStringLiteral("unix"); +#elif defined(Q_OS_WASM) + return QStringLiteral("wasm"); #else return QStringLiteral("unknown"); #endif diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp index b02df4a3e4..0b21cc22ee 100644 --- a/src/qml/qml/qqmltype.cpp +++ b/src/qml/qml/qqmltype.cpp @@ -275,7 +275,7 @@ void QQmlTypePrivate::initEnums(QQmlEnginePrivate *engine) const ? compositePropertyCache(engine) : nullptr; - const QMetaObject *metaObject = !isEnumFromCacheSetup + const QMetaObject *metaObject = !isEnumFromBaseSetup ? baseMetaObject // beware: It could be a singleton type without metaobject : nullptr; diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index b9a81789e0..2a49a0958d 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -38,10 +38,15 @@ ****************************************************************************/ #include "qsgrhisupport_p.h" -#include "qsgdefaultrendercontext_p.h" +#include "qsgcontext_p.h" +#if QT_CONFIG(opengl) +# include "qsgdefaultrendercontext_p.h" +#endif + #include <QtQuick/private/qquickitem_p.h> #include <QtQuick/private/qquickwindow_p.h> +#include <QtGui/qwindow.h> #if QT_CONFIG(vulkan) #include <QtGui/qvulkaninstance.h> #endif @@ -382,9 +387,15 @@ static const void *qsgrhi_mtl_rifResource(QSGRendererInterface::Resource res, co } #endif -const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res, const QSGDefaultRenderContext *rc) +const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res, + const QSGDefaultRenderContext *rc) { +#if QT_CONFIG(opengl) QRhi *rhi = rc->rhi(); +#else + Q_UNUSED(rc) + QRhi *rhi = nullptr; +#endif if (res == QSGRendererInterface::RhiResource || !rhi) return rhi; diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 7b6b8bc878..642329dcaf 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -583,6 +583,7 @@ void QQuickOpacityAnimatorJob::postSync() } d->extra.value().opacityNode = m_opacityNode; + updateCurrentTime(0); } Q_ASSERT(m_opacityNode); } diff --git a/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml b/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml new file mode 100644 index 0000000000..bfb8211706 --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/opacityAnimationFromZero.qml @@ -0,0 +1,20 @@ +import QtQuick 2.14 +import QtQuick.Window 2.14 + +Window { + width: 640 + height: 480 + Rectangle { + id: rect + width: 200 + height: 200 + color: "black" + OpacityAnimator { + target: rect + from: 0 + to: 1 + duration: 1000 + running: true + } + } +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index e62d49ed6b..b4eb33eb7a 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -114,6 +114,7 @@ private slots: void replacingTransitions(); void animationJobSelfDestruction(); void fastFlickingBug(); + void opacityAnimationFromZero(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1858,6 +1859,42 @@ void tst_qquickanimations::fastFlickingBug() } } +void tst_qquickanimations::opacityAnimationFromZero() +{ + if ((QGuiApplication::platformName() == QLatin1String("offscreen")) + || (QGuiApplication::platformName() == QLatin1String("minimal"))) + QSKIP("Skipping due to grabWindow not functional on offscreen/minimimal platforms"); + + // not easy to verify this in threaded render loop + // since it's difficult to capture the first frame when scene graph + // is renderred in another thread + qputenv("QSG_RENDER_LOOP", "basic"); + auto cleanup = qScopeGuard([]() { qputenv("QSG_RENDER_LOOP", ""); }); + + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("opacityAnimationFromZero.qml")); + QScopedPointer<QQuickWindow> win(qobject_cast<QQuickWindow*>(c.create())); + if (!c.errors().isEmpty()) + qDebug() << c.errorString(); + QVERIFY(win); + win->setTitle(QTest::currentTestFunction()); + win->show(); + QVERIFY(QTest::qWaitForWindowExposed(win.data())); + + QImage img; + bool firstFrameSwapped = false; + QObject::connect(win.get(), &QQuickWindow::frameSwapped, win.get(), [&win, &img, &firstFrameSwapped]() { + if (firstFrameSwapped) + return; + else + firstFrameSwapped = true; + img = win->grabWindow(); + if (img.width() < win->width()) + QSKIP("Skipping due to grabWindow not functional"); + }); + QTRY_VERIFY(!img.isNull() && img.pixel(100, 100) > qRgb(10, 10, 10)); +} + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST index b551575e9d..ad037c5db9 100644 --- a/tests/auto/quick/qquicktext/BLACKLIST +++ b/tests/auto/quick/qquicktext/BLACKLIST @@ -6,3 +6,5 @@ macos opensuse-42.1 [contentSize] windows gcc +[hAlignVisual] +sles |