diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-21 11:08:23 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-21 11:08:24 +0200 |
commit | 0aaca005c0bb6267ddd14a84634c33c813e2d2c4 (patch) | |
tree | 2c09a2498618830b32e92f13450fab2210aae446 | |
parent | 186cbe30939947e3a2d33b250fc861cbee361dfe (diff) | |
parent | 749a7212e903d8e8c6f256edb1836b9449cc7fe1 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: Ibed6ee74d36b4ce37391c82db00a0abd30d09e7a
-rw-r--r-- | examples/quick/demos/demos.pro | 6 | ||||
-rw-r--r-- | examples/quick/demos/photoviewer/main.cpp | 4 | ||||
-rw-r--r-- | examples/quick/demos/photoviewer/photoviewer.pro | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlerror.cpp | 3 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgtexture.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 14 | ||||
-rw-r--r-- | src/quick/util/qquickfontloader.cpp | 4 | ||||
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 1 | ||||
-rw-r--r-- | src/quick/util/qquickshortcut_p.h | 1 | ||||
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 15 | ||||
-rw-r--r-- | tools/qml/main.cpp | 7 |
15 files changed, 55 insertions, 22 deletions
diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro index 5a6fd52baf..0644b81a22 100644 --- a/examples/quick/demos/demos.pro +++ b/examples/quick/demos/demos.pro @@ -7,7 +7,5 @@ SUBDIRS = samegame \ photosurface \ stocqt -qtHaveModule(xmlpatterns) { - SUBDIRS += rssnews - qtHaveModule(widgets): SUBDIRS += photoviewer -} +qtHaveModule(xmlpatterns): SUBDIRS += rssnews photoviewer + diff --git a/examples/quick/demos/photoviewer/main.cpp b/examples/quick/demos/photoviewer/main.cpp index 172d14307e..a269a61dcb 100644 --- a/examples/quick/demos/photoviewer/main.cpp +++ b/examples/quick/demos/photoviewer/main.cpp @@ -48,14 +48,14 @@ ** ****************************************************************************/ -#include <QApplication> +#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QTranslator> #include <QDebug> int main(int argc, char *argv[]) { - QApplication app(argc, argv); + QGuiApplication app(argc, argv); QTranslator qtTranslator; qtTranslator.load("qml_" + QLocale::system().name(), ":/i18n/"); diff --git a/examples/quick/demos/photoviewer/photoviewer.pro b/examples/quick/demos/photoviewer/photoviewer.pro index 4bfdb86f31..68e43e13f9 100644 --- a/examples/quick/demos/photoviewer/photoviewer.pro +++ b/examples/quick/demos/photoviewer/photoviewer.pro @@ -1,6 +1,6 @@ TEMPLATE = app -QT += qml quick widgets xmlpatterns +QT += qml quick xmlpatterns SOURCES += main.cpp diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 2ac2b0b64d..1dd90995d3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -992,6 +992,10 @@ void QObjectWrapper::destroyObject(bool lastCall) // If the object is C++-owned, we still have to release the weak reference we have // to it. ddata->jsWrapper.clear(); + if (lastCall && ddata->propertyCache) { + ddata->propertyCache->release(); + ddata->propertyCache = nullptr; + } } } } diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index 7a1e02eec6..64f008cd32 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -44,6 +44,7 @@ #include <QtCore/qfile.h> #include <QtCore/qstringlist.h> #include <QtCore/qvector.h> +#include <QtCore/qpointer.h> #include <private/qv4errorobject_p.h> @@ -86,7 +87,7 @@ public: quint16 line; quint16 column; QtMsgType messageType; - QObject *object; + QPointer<QObject> object; }; QQmlErrorPrivate::QQmlErrorPrivate() diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 15042082fe..0bbf21607d 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -7179,6 +7179,8 @@ void QQuickItemPrivate::setHasCursorInChild(bool hasCursor) QQuickItemPrivate *parentPrivate = QQuickItemPrivate::get(parent); parentPrivate->setHasCursorInChild(hasCursor); } +#else + Q_UNUSED(hasCursor); #endif } diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 1720377046..c8bc76aef8 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -274,15 +274,9 @@ void QQuickTextPrivate::updateLayout() elideLayout->clearFormats(); QString tmp = text; multilengthEos = tmp.indexOf(QLatin1Char('\x9c')); - if (multilengthEos != -1) { + if (multilengthEos != -1) tmp = tmp.mid(0, multilengthEos); - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - } else if (tmp.contains(QLatin1Char('\n'))) { - // Replace always does a detach. Checking for the new line character first - // means iterating over those items again if found but prevents a realloc - // otherwise. - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - } + tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); layout.setText(tmp); } textHasChanged = false; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index a023ad8a8c..1edff3ff83 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -4403,7 +4403,9 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) } bool unknown = false; +#if QT_CONFIG(shortcut) bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; +#endif if (false) { } diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 591b679ec4..bfe5642deb 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -295,6 +295,8 @@ static void qt_debug_remove_texture(QSGTexture* texture) \value Anisotropy8x 8x anisotropic filtering. \value Anisotropy16x 16x anisotropic filtering. + + \since 5.9 */ /*! diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 89007cff1f..caf702bde5 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -140,6 +140,14 @@ QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a void QQuickAnimatorProxyJob::updateCurrentTime(int) { + if (m_internalState != State_Running) + return; + + // A proxy which is being ticked should be associated with a window, (see + // setWindow() below). If we get here when there is no more controller we + // have a problem. + Q_ASSERT(m_controller); + // We do a simple check here to see if the animator has run and stopped on // the render thread. isPendingStart() will perform a check against jobs // that have been scheduled for start, but that will not yet have entered @@ -150,8 +158,7 @@ void QQuickAnimatorProxyJob::updateCurrentTime(int) // we might get the wrong value for this update, but then we'll simply // pick it up on the next iterationm when the job is stopped and render // thread is no longer using it. - if (m_internalState == State_Running - && !m_controller->isPendingStart(m_job) + if (!m_controller->isPendingStart(m_job) && !m_job->isRunning()) { stop(); } @@ -167,9 +174,9 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState, } } else if (newState == Stopped) { - syncBackCurrentValues(); m_internalState = State_Stopped; if (m_controller) { + syncBackCurrentValues(); m_controller->cancel(m_job); } } @@ -193,6 +200,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) if (m_job && m_controller) m_controller->cancel(m_job); m_controller = nullptr; + stop(); } else if (!m_controller && m_job) { m_controller = QQuickWindowPrivate::get(window)->animationController; diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 3761a37a6d..21e8eda365 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -236,7 +236,7 @@ QQuickFontLoader::~QQuickFontLoader() /*! \qmlproperty url QtQuick::FontLoader::source - The url of the font to load. + The URL of the font to load. */ QUrl QQuickFontLoader::source() const { @@ -317,7 +317,7 @@ void QQuickFontLoader::updateFontInfo(const QString& name, QQuickFontLoader::Sta \qmlproperty string QtQuick::FontLoader::name This property holds the name of the font family. - It is set automatically when a font is loaded using the \c url property. + It is set automatically when a font is loaded using the \l source property. Use this to set the \c font.family property of a \c Text item. diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 20bb23338d..2070fd7ff0 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -810,6 +810,7 @@ public: #ifndef QT_NO_DESKTOPSERVICES return QDesktopServices::openUrl(url); #else + Q_UNUSED(url); return false; #endif } diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h index 93430ad893..db918058b2 100644 --- a/src/quick/util/qquickshortcut_p.h +++ b/src/quick/util/qquickshortcut_p.h @@ -111,6 +111,7 @@ protected: bool event(QEvent *event) Q_DECL_OVERRIDE; struct Shortcut { + Shortcut() : id(0) { } bool matches(QShortcutEvent *event) const; int id; QVariant userValue; diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 39f6d80fa0..a3a2efd565 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -29,6 +29,7 @@ #include <QtTest/QtTest> +#include <private/qqmldata_p.h> #include <qjsengine.h> #include <qjsvalueiterator.h> #include <qgraphicsitem.h> @@ -73,6 +74,7 @@ private slots: void newQObject(); void newQObject_ownership(); void newQObject_deletedEngine(); + void newQObjectPropertyCache(); void newQMetaObject(); void exceptionInSlot(); void globalObjectProperties(); @@ -749,6 +751,19 @@ private: int m_called; }; +void tst_QJSEngine::newQObjectPropertyCache() +{ + QScopedPointer<QObject> obj(new QObject); + QQmlEngine::setObjectOwnership(obj.data(), QQmlEngine::CppOwnership); + + { + QJSEngine engine; + engine.newQObject(obj.data()); + QVERIFY(QQmlData::get(obj.data())->propertyCache); + } + QVERIFY(!QQmlData::get(obj.data())->propertyCache); +} + void tst_QJSEngine::newQMetaObject() { { QJSEngine engine; diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 3b20fba5d4..83680a5ba1 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -71,7 +71,9 @@ static Config *conf = 0; static QQmlApplicationEngine *qae = 0; +#if defined(Q_OS_DARWIN) || defined(QT_GUI_LIB) static int exitTimerId = -1; +#endif bool verboseMode = false; static void loadConf(const QString &override, bool quiet) // Terminates app on failure @@ -388,6 +390,9 @@ void getAppFlags(int &argc, char **argv) argc -= 2; } } +#else + Q_UNUSED(argc) + Q_UNUSED(argv) #endif // QT_GUI_LIB } @@ -552,7 +557,7 @@ int main(int argc, char *argv[]) qInstallMessageHandler(quietMessageHandler); if (files.count() <= 0) { -#if defined(Q_OS_MAC) +#if defined(Q_OS_DARWIN) if (applicationType == QmlApplicationTypeGui) exitTimerId = static_cast<LoaderApplication *>(app)->startTimer(FILE_OPEN_EVENT_WAIT_TIME); else |