diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-24 17:36:04 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-24 17:36:04 +0100 |
commit | ad67ec26d0cbc98e3440dd38bb20eef4da2ee96d (patch) | |
tree | 9f8135751df2f995a4f55837ea065a4687245b71 /src | |
parent | 83a16630c13969e68cd3a5aaab73335ccb0d4414 (diff) | |
parent | 20d160d0513a04be187ed851a25b029f47c27b27 (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
.qmake.conf
LICENSE.GPLv2
examples/qml/networkaccessmanagerfactory/view.qml
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4stringobject.cpp
Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
Diffstat (limited to 'src')
43 files changed, 159 insertions, 115 deletions
diff --git a/src/3rdparty/masm/masm.pri b/src/3rdparty/masm/masm.pri index 3fd4aa6cec..3655af36b6 100644 --- a/src/3rdparty/masm/masm.pri +++ b/src/3rdparty/masm/masm.pri @@ -71,18 +71,16 @@ retgen.commands = python $$retgen.script > ${QMAKE_FILE_OUT} QMAKE_EXTRA_COMPILERS += retgen # Taken from WebKit/Tools/qmake/mkspecs/features/unix/default_post.prf -linux-g++* { - greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) { - !contains(QMAKE_CXXFLAGS, -std=(c|gnu)\\+\\+(0x|11)) { +!c++11:!intel_icc { + # Don't warn about OVERRIDE and FINAL, since they are feature-checked anyways + clang { + QMAKE_CXXFLAGS += -Wno-c++11-extensions -Wno-c++0x-extensions + QMAKE_OBJECTIVE_CFLAGS += -Wno-c++11-extensions -Wno-c++0x-extensions + } else: gcc { + greaterThan(QT_GCC_MAJOR_VERSION, 4)|greaterThan(QT_GCC_MINOR_VERSION, 5) { # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr). QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat QMAKE_CXXFLAGS += -Wno-c++0x-compat } } } - -# Don't warn about OVERRIDE and FINAL, since they are feature-checked anyways -*clang:!contains(QMAKE_CXXFLAGS, -std=c++11) { - QMAKE_CXXFLAGS += -Wno-c++11-extensions - QMAKE_OBJECTIVE_CFLAGS += -Wno-c++11-extensions -} diff --git a/src/3rdparty/masm/wtf/PageBlock.cpp b/src/3rdparty/masm/wtf/PageBlock.cpp index a6f5585925..e715ed262a 100644 --- a/src/3rdparty/masm/wtf/PageBlock.cpp +++ b/src/3rdparty/masm/wtf/PageBlock.cpp @@ -44,7 +44,7 @@ static size_t s_pageMask; inline size_t systemPageSize() { - return getpagesize(); + return ::sysconf(_SC_PAGESIZE); } #elif OS(WINDOWS) diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp index 78bd748f61..c4ca1502ac 100644 --- a/src/imports/statemachine/state.cpp +++ b/src/imports/statemachine/state.cpp @@ -221,15 +221,15 @@ QQmlListProperty<QObject> State::children() \brief The type of history that this history state records. - The default value of this property is QHistoryState.ShallowHistory. + The default value of this property is HistoryState.ShallowHistory. - This enum specifies the type of history that a QHistoryState records. + This enum specifies the type of history that a HistoryState records. \list - \li QHistoryState.ShallowHistory Only the immediate child states of the + \li HistoryState.ShallowHistory Only the immediate child states of the parent state are recorded. In this case, a transition with the history state as its target will end up in the immediate child state that the parent was in the last time it was exited. This is the default. - \li QHistoryState.DeepHistory Nested states are recorded. In this case + \li HistoryState.DeepHistory Nested states are recorded. In this case a transition with the history state as its target will end up in the most deeply nested descendant state the parent was in the last time it was exited. diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index 6369c8e801..54b184b4eb 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -179,7 +179,7 @@ void IRDecoder::visitMove(IR::Move *s) } else if (Subscript *ss = c->base->asSubscript()) { callSubscript(ss->base, ss->index, c->args, s->target); return; - } else if (c->base->asTemp() || c->base->asArgLocal()) { + } else if (c->base->asTemp() || c->base->asArgLocal() || c->base->asConst()) { callValue(c->base, c->args, s->target); return; } diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 7806a1103f..5729a60ea3 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -33,7 +33,7 @@ qhp.QtQml.subprojects.qmltypes.sortPages = true tagfile = ../../../doc/qtqml/qtqml.tags -depends += qtcore qtxmlpatterns qtgui qtquick qtdoc qtlinguist +depends += qtcore qtxmlpatterns qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets headerdirs += .. \ ../../imports/models diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index ed08d293f2..a8177d29d8 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -893,11 +893,11 @@ property in question is \c isCurrentItem, hence the attached property is referred to as \c ListView.isCurrentItem. An attached signal handler is referred to in the same way. For example, the -\c Component.isCompleted attached signal handler is commonly used to execute -some JavaScript code when a component's creation process has been completed. -In the example below, once the \l ListModel has been fully created, its -\c Component.onCompleted signal handler will automatically be invoked to -populate the model: +\l{Component::completed}{Component.onCompleted} attached signal handler is +commonly used to execute some JavaScript code when a component's creation +process has been completed. In the example below, once the \l ListModel has +been fully created, its \c Component.onCompleted signal handler will +automatically be invoked to populate the model: \qml import QtQuick 2.0 @@ -916,8 +916,8 @@ ListView { \endqml Since the name of the \e {attaching type} is \c Component and that type has a -\c completed signal, the attached signal handler is referred to as -\c Component.isCompleted. +\l{Component::completed}{completed} signal, the attached signal handler is +referred to as \c Component.onCompleted. \section3 A Note About Accessing Attached Properties and Signal Handlers diff --git a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc index 266cb11726..e7d75a89bc 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc @@ -144,7 +144,9 @@ Rectangle { An \l {Attached Properties and Attached Signal Handlers}{attached signal handler} is a signal handler that receives a signal from an \e {attaching type} rather than the object within which the handler is declared. -For example, \c \l {Component::isCompleted}{Component.isCompleted} is an attached signal handler. This handler is often used to execute some JavaScript code when its creation process has been completed, as in the example below: +For example, \l{Component::completed}{Component.onCompleted} is an attached +signal handler. This handler is often used to execute some JavaScript code when +its creation process has been completed, as in the example below: \qml import QtQuick 2.0 diff --git a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc index 4f2e5b2496..780086cfc7 100644 --- a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc +++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc @@ -499,9 +499,6 @@ property is only invoked when the property is reassigned to a different object v may also explicitly preserve the scarce resource by calling the "preserve" method on the \c var property from within JavaScript. - For more information regarding the usage of a scarce resource, please - see \l{Scarce Resources in JavaScript}. - This basic type is provided by the QML language. */ @@ -543,8 +540,6 @@ property is only invoked when the property is reassigned to a different object v "destroy" method on the \c variant property from within JavaScript. They may also explicitly preserve the scarce resource by calling the "preserve" method on the \c variant property from within JavaScript. - For more information on the usage of a scarce resource, please - see \l{Scarce Resources in JavaScript}. \section1 Storing Arrays and Objects diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 42e690c48b..6abfe8c579 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -95,7 +95,6 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the \li New \l var property type. This is a general-purpose property type which obsoletes the \l variant type. Properties of the \l var type may hold JavaScript references. \li QML properties of type \l var and \l variant can now hold pixmaps. - See \l {Scarce Resources in JavaScript} for more information. \li Value type improvements: \list \li QML now supports defining properties of value type basic types within QML documents. Supported types include diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index 9b2754a344..4bc8e14fbf 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -34,6 +34,7 @@ #include <QtCore/QBuffer> #include <QtCore/QDebug> #include "qv4regalloc_p.h" +#include "qv4alloca_p.h" #include <private/qv4value_inl_p.h> #include <algorithm> diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 48913f8138..1275e2a1d0 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -128,7 +128,8 @@ quintptr getStackLimit() void* stackBottom = 0; pthread_attr_t attr; #if HAVE(PTHREAD_NP_H) && OS(FREEBSD) - if (pthread_attr_get_np(pthread_self(), &attr) == 0) { + // on FreeBSD pthread_attr_init() must be called otherwise getting the attrs crashes + if (pthread_attr_init(&attr) == 0 && pthread_attr_get_np(pthread_self(), &attr) == 0) { #else if (pthread_getattr_np(pthread_self(), &attr) == 0) { #endif diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index f575d4e47b..8e33cec57f 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -497,7 +497,7 @@ ReturnedValue GlobalFunctions::method_parseInt(CallContext *ctx) } if (overflow) { - double result = (double) v_overflow * pow(R, overflow_digit_count); + double result = (double) v_overflow * pow(static_cast<double>(R), static_cast<double>(overflow_digit_count)); result += v; return Encode(sign * result); } else { diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 20707d073b..c31de6a9f0 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1005,7 +1005,7 @@ ReturnedValue Runtime::callElement(ExecutionEngine *engine, const Value &index, ReturnedValue Runtime::callValue(ExecutionEngine *engine, const Value &func, CallData *callData) { if (!func.isObject()) - return engine->throwTypeError(); + return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow())); return func.objectValue()->call(callData); } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index a589ae94c3..e0b84f6da3 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -38,7 +38,7 @@ #include "qv4objectproto_p.h" #include "qv4mm_p.h" #include "qv4scopedvalue_p.h" - +#include "qv4alloca_p.h" #include <QtCore/QDateTime> #include <QtCore/QDebug> #include <QtCore/QStringList> diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 33be4c321f..916f848bbe 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -368,7 +368,7 @@ The following functions are also on the Qt object. /*! \qmlproperty object Qt::platform - \since 4.8 + \since 5.1 The \c platform object provides info about the underlying platform. @@ -392,6 +392,8 @@ The following functions are also on the Qt object. \li \c "unix" - Other Unix-based OS \li \c "windows" - Windows \li \c "wince" - Windows CE + \li \c "winrt" - Windows RT + \li \c "winphone" - Windows Phone \endlist \endtable */ diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index ac4dcbdd4d..ea9b83cee3 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -885,15 +885,18 @@ Thus QQmlDataBlob::done() will always eventually be called, even if the blob has void QQmlTypeLoader::invalidate() { - for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) - (*iter)->release(); - m_networkReplies.clear(); - if (m_thread) { shutdownThread(); delete m_thread; m_thread = 0; } + + // Need to delete the network replies after + // the loader thread is shutdown as it could be + // getting new replies while we clear them + for (NetworkReplies::Iterator iter = m_networkReplies.begin(); iter != m_networkReplies.end(); ++iter) + (*iter)->release(); + m_networkReplies.clear(); } void QQmlTypeLoader::lock() diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 9bd3b474b2..b38190336e 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1358,6 +1358,11 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count) const QList<QQmlDelegateModelItem *> cache = d->m_cache; for (int i = 0, c = cache.count(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); + // layout change triggered by removal of a previous item might have + // already invalidated this item in d->m_cache and deleted it + if (!d->m_cache.contains(item)) + continue; + if (item->modelIndex() >= index + count) item->setModelIndex(item->modelIndex() - count); else if (item->modelIndex() >= index) diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp index 879970b962..fb500426f3 100644 --- a/src/qml/types/qqmltimer.cpp +++ b/src/qml/types/qqmltimer.cpp @@ -329,7 +329,11 @@ bool QQmlTimer::event(QEvent *e) ticked(); return true; } else if (e->type() == QEvent_Triggered) { - emit triggered(); + if (d->running && d->pause.isStopped()) { + d->running = false; + emit triggered(); + emit runningChanged(); + } return true; } return QObject::event(e); @@ -340,10 +344,8 @@ void QQmlTimerPrivate::animationFinished(QAbstractAnimationJob *) Q_Q(QQmlTimer); if (repeating || !running) return; - running = false; firstTick = false; QCoreApplication::postEvent(q, new QEvent(QEvent_Triggered)); - emit q->runningChanged(); } QT_END_NAMESPACE diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp index 49bab67f3d..5fe73ec0e0 100644 --- a/src/qml/types/qquickpackage.cpp +++ b/src/qml/types/qquickpackage.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE \snippet package/Delegate.qml 0 These named items are used as the delegates by the two views who - reference the special \l{VisualDataModel::parts} property to select + reference the special \l{DelegateModel::parts} property to select a model which provides the chosen delegate. \snippet package/view.qml 0 diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 9175a7c1fb..947039f60e 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -369,6 +369,10 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD } view->show(); view->requestActivate(); + + while (view->status() == QQuickView::Loading) + QTest::qWait(10); + QTest::qWaitForWindowActive(view); if (view->isExposed()) QTestRootObject::instance()->setWindowShown(true); diff --git a/src/quick/doc/images/qml-item-canvas.arc.png b/src/quick/doc/images/qml-item-canvas-arc.png Binary files differindex 5f9d32d8d3..5f9d32d8d3 100644 --- a/src/quick/doc/images/qml-item-canvas.arc.png +++ b/src/quick/doc/images/qml-item-canvas-arc.png diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 41fe42777b..afe1b9708f 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -33,7 +33,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs qtsensors qtwidgets +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs qtsensors qtwidgets qmake qtmultimedia qtgraphicaleffects headerdirs += ..\ ../../quickwidgets diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc index 2af463e4bf..edad89b1e5 100644 --- a/src/quick/doc/src/concepts/effects/sprites.qdoc +++ b/src/quick/doc/src/concepts/effects/sprites.qdoc @@ -144,14 +144,12 @@ to some graphics memory limitations. Because it requires all the sprites for a s texture, attempting to load many different animations can run into texture memory limits on embedded devices. In these situations, a warning will be output to the console containing the maximum texture size. -There are several software tools to help turn images into sprite sheets, here are some examples: -Photoshop plugin: -http://www.personal.psu.edu/zez1/blogs/my_blog/2011/05/scripts-4-photoshop-file-sequence-to-layers-to-sprite-sheet.html -Gimp plugin: -http://registry.gimp.org/node/20943 -Cmd-line tool: -http://www.imagemagick.org/script/montage.php - +There are several tools to help turn a set of images into sprite sheets, here are some examples: +\list + \li Photoshop plugin: \l http://www.johnwordsworth.com/projects/photoshop-sprite-sheet-generator-script + \li Gimp plugin: \l http://registry.gimp.org/node/20943 + \li Cmd-line tool: \l http://www.imagemagick.org/script/montage.php +\endlist \section2 QML Types Using the Sprite Engine diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc index 90999d8b5e..db84961d20 100644 --- a/src/quick/doc/src/concepts/input/focus.qdoc +++ b/src/quick/doc/src/concepts/input/focus.qdoc @@ -138,7 +138,7 @@ similar to when there are no focus scopes. \li When a focus scope receives active focus, the contained type with \c focus set (if any) also gets the active focus. If this type is also a \l FocusScope, the proxying behavior continues. Both the -focus scope and the sub-focused item will have \c activeFocus property set. +focus scope and the sub-focused item will have the \c activeFocus property set. \endlist Note that, since the FocusScope type is not a visual type, the properties diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc index 7e6a5166a3..f87f94f264 100644 --- a/src/quick/doc/src/dynamicview-tutorial.qdoc +++ b/src/quick/doc/src/dynamicview-tutorial.qdoc @@ -165,14 +165,14 @@ to the index of the item it was dragged over. To move the items within the view we use a DelegateModel. The DelegateModel type is used by the view types to instantiate delegate items from model data and when constructed explicitly can be used to filter and re-order the model items provided to ListView. The -\l {QtQuick::DelegateModel::items}{items} property of DelegateModel provides access to the +\l [QML]{DelegateModel::}{items} property of DelegateModel provides access to the view's items and allows us to change the visible order without modifying the source model. To -determine the current visible index of the items we use \l {QtQuick::DelegateModel::itemsIndex} +determine the current visible index of the items we use \l {DelegateModel::}{itemsIndex} {itemsIndex} property on the DelegateModel attached property of the delegate item. -To utilize a DelegateModel with a ListView we bind it to the \l {QtQuick::ListView::model}{model} -property of the view and bind the \l {QtQuick::DelegateModel::model}{model} and -\l {QtQuick::DelegateModel::delegate}{delegate} to the DelegateModel. +To utilize a DelegateModel with a ListView we bind it to the \l {ListView::}{model} +property of the view and bind the \l {DelegateModel::}{model} and +\l {DelegateModel::}{delegate} to the DelegateModel. \snippet tutorials/dynamicview/dynamicview3/dynamicview.qml 4 @@ -194,7 +194,7 @@ like this: \section2 Walkthrough Items in a DelegateModel are filtered into groups represented by the DelegateModelGroup type, -normally all items in the model belong to a default \l {QtQuick::DelegateModel::items}{items} +normally all items in the model belong to a default \l {DelegateModel::}{items} group but this default can be changed with the includeByDefault property. To implement our sorting we want items to first be added to an unsorted group from where we can transfer them to a sorted position in the items group. To do that we clear includeByDefault on the items group and set it on @@ -208,7 +208,7 @@ item and then transfer the item to the items group before moving it to the pre-d repeat until the unsorted group is empty. To find the insert position for an item we request a handle for the item from the unsorted group -with the \l {QtQuick::DelegateModel::get} {get} function. Through the model property on this +with the \l {DelegateModel::}{get} function. Through the model property on this handle we can access the same model data that is available in a delegate instance of that item and compare against other items to determine relative position. @@ -220,7 +220,7 @@ of the list. In this example it can be one of the following: \snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 4 A sort is triggered whenever new items are added to the unsorted DelegateModel which we are -notified of by the \l {QtQuick::DelegateModelGroup::onChanged}{onChanged} handler. If no sort +notified of by the \l {DelegateModelGroup} \c onChanged handler. If no sort function is currently selected we simply transfer all items from the unsorted group to the items group, otherwise we call sort with the selected sort function. @@ -228,8 +228,8 @@ group, otherwise we call sort with the selected sort function. Finally when the selected sort order changes we can trigger a full re-sort of the list by moving all items from the items group to the unsorted group, which will trigger the -\l {QtQuick::DelegateModelGroup::onChanged}{onChanged} handler and transfer the items back to the -items group in correct order. Note that the \l {QtQuick::DelegateModelGroup::onChanged}{onChanged} +\l {DelegateModelGroup} \c onChanged handler and transfer the items back to the +items group in correct order. Note that the \l {DelegateModelGroup} \c onChanged handler will not be invoked recursively so there's no issue with it being invoked during a sort. \snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 6 diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index 21ab4a2731..b0a39e1dd3 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -193,7 +193,7 @@ relative to its start. \endlist -\section2 Text +\section2 Text Rendering and Input \list \li Changes common to \l Text, TextEdit and TextInput: @@ -312,8 +312,8 @@ the window loses focus. \li VisualDataModel: \list \li Now has features to filter the items to be displayed in a view. This is supported by the new - \l {VisualDataModel::}{groups}, \l {VisualDataModel::}{filterOnGroup}, \l {VisualDataModel::}{items} - and \l {VisualDataModel::}{persistedItems} properties. + \l {DelegateModel::}{groups}, \l {DelegateModel::}{filterOnGroup}, \l {DelegateModel::}{items} + and \l {DelegateModel::}{persistedItems} properties. \endlist \li Changes common to both ListView and GridView: \list diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 4145b2f6ff..11aff9b95d 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -592,7 +592,9 @@ void QQuickCanvasItem::geometryChanged(const QRectF &newGeometry, const QRectF & QQuickItem::geometryChanged(newGeometry, oldGeometry); - QSizeF newSize = newGeometry.size(); + // Due to indirect recursion, newGeometry may be outdated + // after this call, so we use width and height instead. + QSizeF newSize = QSizeF(width(), height()); if (!d->hasCanvasSize && d->canvasSize != newSize) { d->canvasSize = newSize; emit canvasSizeChanged(); @@ -1124,6 +1126,9 @@ bool QQuickCanvasItem::createContext(const QString &contextType) { Q_D(QQuickCanvasItem); + if (!window()) + return false; + if (contextType == QLatin1String("2d")) { if (d->contextType.compare(QLatin1String("2d"), Qt::CaseInsensitive) != 0) { d->contextType = QLatin1String("2d"); diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 7b9cb9e9f1..99b9311ee0 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE } \endqml The \l role is set to \c Button to indicate the type of control. - \l Accessible.name is the most important information and bound to the text on the button. + \l {Accessible::}{name} is the most important information and bound to the text on the button. The name is a short and consise description of the control and should reflect the visual label. In this case it is not clear what the button does with the name only, so \l description contains an explanation. @@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE \li All interactive elements \li \l focusable and \l focused \li All elements that the user can interact with should have focusable set to \c true and - set \l focus to \c true when they have the focus. This is important even for applications + set \c focus to \c true when they have the focus. This is important even for applications that run on touch-only devices since screen readers often implement a virtual focus that can be moved from item to item. \row diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index c23b8bb8a4..7ce649c7eb 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -516,8 +516,8 @@ void QQuickDragAttached::setProposedAction(Qt::DropAction action) \endlist When using \c Drag.Automatic you should also define \l mimeData and bind the - \l active property to the active property of \l MouseArea.drag. - */ + \l active property to the active property of MouseArea : \l {MouseArea::drag.active} +*/ QQuickDrag::DragType QQuickDragAttached::dragType() const { diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 951532e8b9..b54c34765f 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -323,7 +323,7 @@ static QString image2xPath(const QString &path) { const int dotIndex = path.lastIndexOf(QLatin1Char('.')); if (dotIndex == -1) - return path; + return path + QLatin1String("@2x"); if (path.contains(QLatin1String("@2x."))) return path; diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index b1aeda4091..4157fc4a66 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1757,11 +1757,9 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) QQmlProperty(), or QMetaProperty::write() when you need to modify those properties from C++. This ensures that the QML engine knows about the property change. Otherwise, the engine won't be able to carry out your - requested animation. For example, if you call \l setPosition() directly, - any behavior that reacts to changes in the x or y properties will not take - effect, as you are bypassing Qt's meta-object system. Note that these - functions incur a slight performance penalty. For more details, see - \l {Accessing Members of a QML Object Type from C++}. + requested animation. + Note that these functions incur a slight performance penalty. For more + details, see \l {Accessing Members of a QML Object Type from C++}. \sa QQuickWindow, QQuickPaintedItem */ @@ -5053,7 +5051,7 @@ void QQuickItem::setZ(qreal v) \endqml \endtable - \sa transform, Rotation + \sa Transform, Rotation */ /*! \property QQuickItem::rotation @@ -5079,7 +5077,7 @@ void QQuickItem::setZ(qreal v) \endqml \endtable - \sa transform, Rotation + \sa Transform, Rotation */ qreal QQuickItem::rotation() const { @@ -5139,7 +5137,7 @@ void QQuickItem::setRotation(qreal r) \endqml \endtable - \sa transform, Scale + \sa Transform, Scale */ /*! \property QQuickItem::scale @@ -5178,7 +5176,7 @@ void QQuickItem::setRotation(qreal r) \endqml \endtable - \sa transform, Scale + \sa Transform, Scale */ qreal QQuickItem::scale() const { @@ -6368,7 +6366,7 @@ void QQuickItem::setSize(const QSizeF &size) d->heightValid = true; d->widthValid = true; - if (QSizeF(d->width, d->height) == size) + if (d->width == size.width() && d->height == size.height()) return; qreal oldHeight = d->height; diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index b78c58854e..6227329fbc 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -1305,6 +1305,8 @@ void QQuickMouseArea::setCursorShape(Qt::CursorShape shape) started. If set to \c false, the target will be moved straight to the current mouse position. By default, this property is \c true. This property was added in Qt Quick 2.4 + See the \l Drag attached property and \l DropArea if you want to make a drop. + \snippet qml/mousearea/mouseareadragfilter.qml dragfilter */ diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 24fc4b6af8..5bd6430f2d 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -198,7 +198,7 @@ QT_BEGIN_NAMESPACE This contains the update mask for the orientation. Screen::orientation only emits changes for the screen orientations matching this mask. - The default, \c 0, means Screen::orientation never updates. + By default it is set to the value of the QScreen that the window uses. */ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) @@ -206,6 +206,7 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) , m_screen(NULL) , m_window(NULL) , m_updateMask(0) + , m_updateMaskSet(false) { m_attachee = qobject_cast<QQuickItem*>(attachee); @@ -301,6 +302,7 @@ Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const void QQuickScreenAttached::setOrientationUpdateMask(Qt::ScreenOrientations mask) { + m_updateMaskSet = true; if (m_updateMask == mask) return; @@ -342,7 +344,12 @@ void QQuickScreenAttached::screenChanged(QScreen *screen) if (!screen) return; //Don't bother emitting signals, because the new values are garbage anyways - screen->setOrientationUpdateMask(m_updateMask); + if (m_updateMaskSet) { + screen->setOrientationUpdateMask(m_updateMask); + } else if (m_updateMask != screen->orientationUpdateMask()) { + m_updateMask = screen->orientationUpdateMask(); + emit orientationUpdateMaskChanged(); + } if (!oldScreen || screen->size() != oldScreen->size()) { emit widthChanged(); diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index 68dbff7138..3d0f00b22c 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -106,6 +106,7 @@ private: QQuickWindow* m_window; QQuickItem* m_attachee; Qt::ScreenOrientations m_updateMask; + bool m_updateMaskSet; }; class Q_AUTOTEST_EXPORT QQuickScreen : public QObject diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 4cd055594c..9311b9d9c9 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -961,7 +961,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) // If the horizontal alignment is not left and the width was not valid we need to relayout // now that we know the maximum line width. - if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) { + if (!q->widthValid() && !implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) { widthExceeded = false; heightExceeded = false; continue; @@ -2755,7 +2755,7 @@ void QQuickText::invalidateFontCaches() { Q_D(QQuickText); - if (d->richText && d->extra->doc != 0) { + if (d->richText && d->extra.isAllocated() && d->extra->doc != 0) { QTextBlock block; for (block = d->extra->doc->firstBlock(); block.isValid(); block = block.next()) { if (block.layout() != 0 && block.layout()->engine() != 0) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 85ff6735bb..1d86b4b000 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -578,6 +578,7 @@ void QQuickTextInput::setVAlign(QQuickTextInput::VAlignment alignment) emit verticalAlignmentChanged(d->vAlign); if (isComponentComplete()) { updateCursorRectangle(); + d->updateBaselineOffset(); } } diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 2db04ab378..369570f657 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -408,7 +408,7 @@ void QQuickTextNodeEngine::addImage(const QRectF &rect, const QImage &image, qre QRectF searchRect = rect; if (layoutPosition == QTextFrameFormat::InFlow) { if (m_currentLineTree.isEmpty()) { - searchRect.moveTopLeft(m_position + m_currentLine.position()); + searchRect.moveTopLeft(m_position + m_currentLine.position() + QPointF(0,1)); } else { const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1; if (lastNode->glyphRun.isRightToLeft()) { diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 12be50ba6d..b88a3aecbc 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -249,20 +249,22 @@ void QQuickWindow::focusInEvent(QFocusEvent *ev) void QQuickWindowPrivate::polishItems() { - int maxPolishCycles = 100000; - - while (!itemsToPolish.isEmpty() && --maxPolishCycles > 0) { - QSet<QQuickItem *> itms = itemsToPolish; - itemsToPolish.clear(); - - for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) { - QQuickItem *item = *it; - QQuickItemPrivate::get(item)->polishScheduled = false; - item->updatePolish(); - } + // An item can trigger polish on another item, or itself for that matter, + // during its updatePolish() call. Because of this, we cannot simply + // iterate through the set, we must continue pulling items out until it + // is empty. + // In the case where polish is called from updatePolish() either directly + // or indirectly, we use a recursionSafeguard to print a warning to + // the user. + int recursionSafeguard = INT_MAX; + while (!itemsToPolish.isEmpty() && --recursionSafeguard > 0) { + QQuickItem *item = *itemsToPolish.begin(); + itemsToPolish.remove(item); + QQuickItemPrivate::get(item)->polishScheduled = false; + item->updatePolish(); } - if (maxPolishCycles == 0) + if (recursionSafeguard == 0) qWarning("QQuickWindow: possible QQuickItem::polish() loop"); updateFocusItemTransform(); @@ -3143,7 +3145,7 @@ bool QQuickWindow::isSceneGraphInitialized() const (e.g. the user clicked the title bar close button). The CloseEvent contains an accepted property which can be set to false to abort closing the window. - \sa Window.closing() + \sa QQuickWindow::closing() */ /*! @@ -3167,7 +3169,7 @@ bool QQuickWindow::isSceneGraphInitialized() const This signal is emitted when the user tries to close the window. - This signal includes a \a close parameter. The \a close \l accepted + This signal includes a \a close parameter. The \c {close.accepted} property is true by default so that the window is allowed to close; but you can implement an \c onClosing handler and set \c {close.accepted = false} if you need to do something else before the window can be closed. @@ -4038,7 +4040,7 @@ void QQuickWindow::resetOpenGLState() This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags. - \sa showFullScreen(), showMaximized(), showNormal(), hide(), flags() + \sa showFullScreen(), showMaximized(), showNormal(), hide(), QQuickItem::flags() */ /*! @@ -4084,14 +4086,14 @@ void QQuickWindow::resetOpenGLState() */ /*! - \enum QQuickWindow::RenderJobSchedule + \enum QQuickWindow::RenderStage \since 5.4 - \value ScheduleBeforeSynchronizing Before synchronization. - \value ScheduleAfterSynchronizing After synchronization. - \value ScheduleBeforeRendering Before rendering. - \value ScheduleAfterRendering After rendering. - \value ScheduleAfterSwap After the frame is swapped. + \value BeforeSynchronizingStage Before synchronization. + \value AfterSynchronizingStage After synchronization. + \value BeforeRenderingStage Before rendering. + \value AfterRenderingStage After rendering. + \value AfterSwapStage After the frame is swapped. \sa {Scene Graph and Rendering} */ diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index d70dc7bdaa..ffee43852d 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -53,6 +53,10 @@ QT_BEGIN_NAMESPACE #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif +#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE +#define GL_FRAMEBUFFER_SRGB_CAPABLE 0x8DBA +#endif + static inline QVector4D qsg_premultiply(const QVector4D &c, float globalOpacity) { float o = c.w() * globalOpacity; @@ -199,7 +203,11 @@ void QSG24BitTextMaskShader::initialize() if (QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_ARB_framebuffer_sRGB")) && m_glyphFormat == QFontEngine::Format_A32 && qAbs(fontSmoothingGamma() - 2.2) < 0.25) { - m_useSRGB = true; + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + GLint srgbCapable = 0; + funcs->glGetIntegerv(GL_FRAMEBUFFER_SRGB_CAPABLE, &srgbCapable); + if (srgbCapable) + m_useSRGB = true; } } diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index 91d2c8674d..c89ad7a608 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -35,6 +35,7 @@ #include <qopenglfunctions.h> #include <QtQuick/private/qsgcontext_p.h> #include <qthread.h> +#include <qmath.h> #include <private/qquickprofiler_p.h> #include <private/qqmlglobal_p.h> #include <QtGui/qguiapplication.h> @@ -75,13 +76,11 @@ static bool qsg_leak_check = !qgetenv("QML_LEAK_CHECK").isEmpty(); QT_BEGIN_NAMESPACE -#ifndef QT_NO_DEBUG inline static bool isPowerOfTwo(int x) { // Assumption: x >= 1 return x == (x & -x); } -#endif QSGTexturePrivate::QSGTexturePrivate() : wrapChanged(false) @@ -688,6 +687,16 @@ void QSGPlainTexture::bind() m_texture_size = tmp.size(); } + // Scale to a power of two size if mipmapping is requested and the + // texture is npot and npot textures are not properly supported. + if (mipmapFiltering() != QSGTexture::None + && (!isPowerOfTwo(m_texture_size.width()) || !isPowerOfTwo(m_texture_size.height())) + && !funcs->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures)) { + tmp = tmp.scaled(qNextPowerOfTwo(m_texture_size.width()), qNextPowerOfTwo(m_texture_size.height()), + Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + m_texture_size = tmp.size(); + } + if (tmp.width() * 4 != tmp.bytesPerLine()) tmp = tmp.copy(); diff --git a/src/quick/util/qquickfontmetrics.cpp b/src/quick/util/qquickfontmetrics.cpp index 1d357ac11f..a87ec7d60a 100644 --- a/src/quick/util/qquickfontmetrics.cpp +++ b/src/quick/util/qquickfontmetrics.cpp @@ -277,7 +277,7 @@ qreal QQuickFontMetrics::lineWidth() const \l {QQuickTextMetrics::advanceWidth}{advanceWidth} property of \l {QQuickTextMetrics::advanceWidth}{TextMetrics}. - \sa {QFontMetricsF::width()}, height() + \sa {QFontMetricsF::width()}, {QFontMetricsF::height()} */ qreal QQuickFontMetrics::advanceWidth(const QString &text) const { diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index fe7334a513..a231209cd0 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -184,7 +184,8 @@ QImage QQuickTextureFactory::image() const { ... - QQmlEngine engine; + QQuickView view; + QQmlEngine *engine = view.engine(); engine->addImageProvider(QLatin1String("colors"), new ColorPixmapProvider); ... diff --git a/src/quick/util/qquicktextmetrics.cpp b/src/quick/util/qquicktextmetrics.cpp index a0b8ecaa6e..1dd787f4a5 100644 --- a/src/quick/util/qquicktextmetrics.cpp +++ b/src/quick/util/qquicktextmetrics.cpp @@ -131,7 +131,7 @@ void QQuickTextMetrics::setText(const QString &text) \li \c Qt::ElideRight - For example: "Hello..." \endlist - \sa elideWidth, elidedText + \sa elideWidth, QFontMetrics::elidedText */ Qt::TextElideMode QQuickTextMetrics::elide() const { @@ -153,7 +153,7 @@ void QQuickTextMetrics::setElide(Qt::TextElideMode elide) This property holds the largest width the text can have (in pixels) before eliding will occur. - \sa elide, elidedText + \sa elide, QFontMetrics::elidedText */ qreal QQuickTextMetrics::elideWidth() const { |