diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-21 10:34:41 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-21 10:34:41 +0100 |
commit | c08ec43406c4ebe2e93942a8b07871c73aafde51 (patch) | |
tree | 69e84f955ce6d0f66d39eae36b07ae0f8ef65e56 | |
parent | 242067390f3bd891b162164a2d01a3a982c64fa2 (diff) | |
parent | 5b82c1b7abc515274e6348136356bbf8f1374e4a (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I3567f741394f912d4312460e85555b6c39b61cb4
28 files changed, 281 insertions, 59 deletions
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index f0645213b0..b11906ee09 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -3478,7 +3478,8 @@ Module { exports: ["QtQuick/Shortcut 2.5", "QtQuick/Shortcut 2.6"] exportMetaObjectRevisions: [0, 1] Property { name: "sequence"; type: "QVariant" } - Property { name: "sequenceString"; revision: 1; type: "string"; isReadonly: true } + Property { name: "nativeText"; revision: 1; type: "string"; isReadonly: true } + Property { name: "portableText"; revision: 1; type: "string"; isReadonly: true } Property { name: "enabled"; type: "bool" } Property { name: "autoRepeat"; type: "bool" } Property { name: "context"; type: "Qt::ShortcutContext" } diff --git a/src/qml/doc/src/external-resources.qdoc b/src/qml/doc/src/external-resources.qdoc index 202d1e4ae2..63f59bf3be 100644 --- a/src/qml/doc/src/external-resources.qdoc +++ b/src/qml/doc/src/external-resources.qdoc @@ -31,6 +31,11 @@ */ /*! + \externalpage http://qmlbook.github.io/ + \title Qt5 Cadaques +*/ + +/*! \externalpage http://www.w3schools.com/jsref/default.asp \title W3Schools JavaScript Reference */ @@ -38,4 +43,4 @@ /*! \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date \title Mozilla Developer Network Date Reference -*/
\ No newline at end of file +*/ diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index a8177d29d8..c0b74c4fc6 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -564,8 +564,7 @@ list of \l {Item::children}{children}. Default properties can be useful for reassigning the children of an item. See the \l{TabWidget Example}, which uses a default property to automatically reassign children of the TabWidget as children of an inner -ListView. - +ListView. See also \l {Extending QML}. \section3 Read-Only Properties diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index ae7c0cf8fb..4da19a5a5c 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2393,6 +2393,9 @@ bool QQml_isFileCaseCorrect(const QString &fileName, int lengthIn /* = -1 */) #if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) const QString canonical = info.canonicalFilePath(); #elif defined(Q_OS_WIN) + // No difference if the path is qrc based + if (absolute[0] == QLatin1Char(':')) + return true; const QString canonical = shellNormalizeFileName(absolute); #endif diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index b0e490b5c9..e859224aea 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -434,11 +434,16 @@ Returns a Matrix4x4 with the specified values. Alternatively, the function may be called with a single argument where that argument is a JavaScript array which contains the sixteen matrix values. +Finally, the function may be called with no arguments and the resulting +matrix will be the identity matrix. */ ReturnedValue QtObject::method_matrix4x4(QV4::CallContext *ctx) { QV4::ExecutionEngine *v4 = ctx->d()->engine; + if (ctx->argc() == 0) + return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QMatrix4x4, 0, Q_NULLPTR)); + if (ctx->argc() == 1 && ctx->args()[0].isObject()) { bool ok = false; QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(ctx->args()[0]), v4, &ok); @@ -1069,10 +1074,23 @@ If the optional \a mode parameter is set to \c Component.Asynchronous, the component will be loaded in a background thread. The Component::status property will be \c Component.Loading while it is loading. The status will change to \c Component.Ready if the component loads successfully, or \c Component.Error -if loading fails. +if loading fails. This parameter defaults to \c Component.PreferSynchronous +if omitted. + +If \a mode is set to \c Component.PreferSynchronous, Qt will attempt to load +the component synchronously, but may end up loading it asynchronously if +necessary. Scenarios that may cause asynchronous loading include, but are not +limited to, the following: + +\list +\li The URL refers to a network resource +\li The component is being created as a result of another component that is +being loaded asynchronously +\endlist If the optional \a parent parameter is given, it should refer to the object -that will become the parent for the created \l Component object. +that will become the parent for the created \l Component object. If no mode +was passed, this can be the second argument. Call \l {Component::createObject()}{Component.createObject()} on the returned component to create an object instance of the component. diff --git a/src/quick/designer/qquickdesignercustomobjectdata.cpp b/src/quick/designer/qquickdesignercustomobjectdata.cpp index 1666ffb0a5..7f074d8341 100644 --- a/src/quick/designer/qquickdesignercustomobjectdata.cpp +++ b/src/quick/designer/qquickdesignercustomobjectdata.cpp @@ -181,7 +181,11 @@ void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext *context, const if (hasValidResetBinding(propertyName)) { QQmlAbstractBinding *binding = getResetBinding(propertyName); +#if defined(QT_NO_DYNAMIC_CAST) + QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(binding); +#else QQmlBinding *qmlBinding = dynamic_cast<QQmlBinding*>(binding); +#endif if (qmlBinding) qmlBinding->setTarget(property); QQmlPropertyPrivate::setBinding(binding, QQmlPropertyPrivate::None, QQmlPropertyPrivate::DontRemoveBinding); diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 3ac9c6eb1c..65d7362e84 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -922,13 +922,13 @@ void QQuickGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte tempPosition -= bias; } FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!topItem || topItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); topItem = currentItem; } FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!bottomItem || bottomItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); bottomItem = currentItem; diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 789b5a3e55..d5c4f59ed2 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -57,7 +57,7 @@ class QQmlChangeSet; class QQuickItemViewPrivate; -class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable +class Q_QUICK_PRIVATE_EXPORT QQuickItemView : public QQuickFlickable { Q_OBJECT @@ -284,7 +284,7 @@ private: }; -class Q_AUTOTEST_EXPORT QQuickItemViewAttached : public QObject +class Q_QUICK_PRIVATE_EXPORT QQuickItemViewAttached : public QObject { Q_OBJECT diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 6a2de58318..955e1f1e00 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1477,13 +1477,13 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte tempPosition -= bias; } FxViewItem *topItem = snapItemAt(tempPosition+highlightRangeStart); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!topItem || topItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); topItem = currentItem; } FxViewItem *bottomItem = snapItemAt(tempPosition+highlightRangeEnd); - if (strictHighlightRange && currentItem) { + if (strictHighlightRange && currentItem && (!bottomItem || bottomItem->index != currentIndex)) { // StrictlyEnforceRange always keeps an item in range updateHighlight(); bottomItem = currentItem; diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp index ed9e29d599..081e572e3b 100644 --- a/src/quick/items/qquickshadereffectnode.cpp +++ b/src/quick/items/qquickshadereffectnode.cpp @@ -460,7 +460,7 @@ void QQuickShaderEffectMaterial::updateTextures() const { for (int i = 0; i < textureProviders.size(); ++i) { if (QSGTextureProvider *provider = textureProviders.at(i)) { - if (QSGLayer *texture = qobject_cast<QSGLayer *>(provider->texture())) + if (QSGDynamicTexture *texture = qobject_cast<QSGDynamicTexture *>(provider->texture())) texture->updateTexture(); } } diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp index 1f1359a3c3..c8b29dc1ad 100644 --- a/src/quick/items/qquicktextdocument.cpp +++ b/src/quick/items/qquicktextdocument.cpp @@ -68,6 +68,10 @@ public: QPointer<QTextDocument> document; }; +/*! + Constructs a QQuickTextDocument object with + \a parent as the parent object. +*/ QQuickTextDocument::QQuickTextDocument(QQuickItem *parent) : QObject(*(new QQuickTextDocumentPrivate), parent) { @@ -77,6 +81,9 @@ QQuickTextDocument::QQuickTextDocument(QQuickItem *parent) d->document = QPointer<QTextDocument>(qobject_cast<QQuickTextEdit*>(parent)->d_func()->document); } +/*! + Returns a pointer to the QTextDocument object. +*/ QTextDocument* QQuickTextDocument::textDocument() const { Q_D(const QQuickTextDocument); diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 5b7a52f1aa..fe18fc2231 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1207,7 +1207,7 @@ void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints) If you set a cursorDelegate for a TextInput, this delegate will be used for drawing the cursor instead of the standard cursor. An instance of the delegate will be created and managed by the TextInput when a cursor is - needed, and the x property of delegate instance will be set so as + needed, and the x property of the delegate instance will be set so as to be one pixel before the top left of the current character. Note that the root item of the delegate component must be a QQuickItem or diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 633cab8078..5fb0a9867e 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -188,6 +188,9 @@ QSGMaterialShader::QSGMaterialShader() { } +/*! + \internal + */ QSGMaterialShader::QSGMaterialShader(QSGMaterialShaderPrivate &dd) : d_ptr(&dd) { @@ -463,7 +466,10 @@ QMatrix4x4 QSGMaterialShader::RenderState::combinedMatrix() const Q_ASSERT(m_data); return static_cast<const QSGRenderer *>(m_data)->currentCombinedMatrix(); } - +/*! + Returns the ratio between physical pixels and device-independent pixels + to be used for rendering. +*/ float QSGMaterialShader::RenderState::devicePixelRatio() const { Q_ASSERT(m_data); diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index db79804908..0591d0fe2f 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -284,7 +284,7 @@ void QSGDefaultImageNode::update() void QSGDefaultImageNode::preprocess() { bool doDirty = false; - QSGLayer *t = qobject_cast<QSGLayer *>(m_material.texture()); + QSGDynamicTexture *t = qobject_cast<QSGDynamicTexture *>(m_material.texture()); if (t) { doDirty = t->updateTexture(); updateGeometry(); diff --git a/src/quick/scenegraph/util/qsgtextureprovider.cpp b/src/quick/scenegraph/util/qsgtextureprovider.cpp index b9f9bde476..2d05e736fe 100644 --- a/src/quick/scenegraph/util/qsgtextureprovider.cpp +++ b/src/quick/scenegraph/util/qsgtextureprovider.cpp @@ -44,7 +44,15 @@ QT_BEGIN_NAMESPACE \sa {Scene Graph - Two Texture Providers} */ +/*! + \fn QSGTexture *QSGTextureProvider::texture(); + Returns a pointer to the texture object. + */ +/*! + \fn void QSGTextureProvider::textureChanged(); + This signal is emitted when the texture changes. + */ QT_END_NAMESPACE diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 87f383f754..82c9da1d2e 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -223,22 +223,22 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimatorJob : public QQuickTransformAnimatorJob { public: - void updateCurrentTime(int time); - void writeBack(); + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; }; class Q_QUICK_PRIVATE_EXPORT QQuickXAnimatorJob : public QQuickTransformAnimatorJob { public: - void updateCurrentTime(int time); - void writeBack(); + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; }; class Q_QUICK_PRIVATE_EXPORT QQuickYAnimatorJob : public QQuickTransformAnimatorJob { public: - void updateCurrentTime(int time); - void writeBack(); + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; }; class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimatorJob : public QQuickTransformAnimatorJob @@ -246,8 +246,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimatorJob : public QQuickTransformA public: QQuickRotationAnimatorJob(); - void updateCurrentTime(int time); - void writeBack(); + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; void setDirection(QQuickRotationAnimator::RotationDirection direction) { m_direction = direction; } QQuickRotationAnimator::RotationDirection direction() const { return m_direction; } @@ -261,10 +261,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimatorJob : public QQuickAnimatorJob public: QQuickOpacityAnimatorJob(); - void initialize(QQuickAnimatorController *controller); - void updateCurrentTime(int time); - void writeBack(); - void nodeWasDestroyed(); + void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE; + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; + void nodeWasDestroyed() Q_DECL_OVERRIDE; private: QSGOpacityNode *m_opacityNode; @@ -275,16 +275,16 @@ class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob public: QQuickUniformAnimatorJob(); - void setTarget(QQuickItem *target); + void setTarget(QQuickItem *target) Q_DECL_OVERRIDE; void setUniform(const QByteArray &uniform) { m_uniform = uniform; } QByteArray uniform() const { return m_uniform; } void afterNodeSync() Q_DECL_OVERRIDE; - void updateCurrentTime(int time); - void writeBack(); - void nodeWasDestroyed(); + void updateCurrentTime(int time) Q_DECL_OVERRIDE; + void writeBack() Q_DECL_OVERRIDE; + void nodeWasDestroyed() Q_DECL_OVERRIDE; private: QByteArray m_uniform; diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 3cb7cc3b7f..d1ca02d79f 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -466,7 +466,11 @@ public: } break; case QMetaType::QMatrix4x4: - if (argc == 1) { + if (argc == 0) { + QMatrix4x4 m; + *v = QVariant(m); + return true; + } else if (argc == 1) { const qreal *vals = reinterpret_cast<const qreal*>(argv[0]); QMatrix4x4 m(vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index ff851dac30..d11229717a 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -494,5 +494,26 @@ QQuickAsyncImageProvider::~QQuickAsyncImageProvider() implementation of this method is reentrant. */ +/*! + \fn QImage QQuickImageProvider::requestImage(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform); + + \internal + For future reference. +*/ + +/*! + \fn QPixmap QQuickImageProvider::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform); + + \internal + For future reference. +*/ + +/*! + \fn QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize, bool requestedAutoTransform); + + \internal + For future reference. +*/ + QT_END_NAMESPACE diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 9f32b6c180..e6f66f7bf1 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -134,20 +134,37 @@ void QQuickShortcut::setSequence(const QVariant &sequence) } /*! - \qmlproperty string QtQuick::Shortcut::sequenceString + \qmlproperty string QtQuick::Shortcut::nativeText \since 5.6 - This property provides the shortcut's key sequence as a string, - for display purposes (tooltips, for example). + This property provides the shortcut's key sequence as a platform specific + string. This means that it will be shown translated, and on OS X it will + resemble a key sequence from the menu bar. It is best to display this text + to the user (for example, on a tooltip). - \sa sequence + \sa sequence, portableText */ -QString QQuickShortcut::sequenceString() const +QString QQuickShortcut::nativeText() const { return m_shortcut.toString(QKeySequence::NativeText); } /*! + \qmlproperty string QtQuick::Shortcut::portableText + \since 5.6 + + This property provides the shortcut's key sequence as a string in a + "portable" format, suitable for reading and writing to a file. In many + cases, it will look similar to the native text on Windows and X11. + + \sa sequence, nativeText +*/ +QString QQuickShortcut::portableText() const +{ + return m_shortcut.toString(QKeySequence::PortableText); +} + +/*! \qmlproperty bool QtQuick::Shortcut::enabled This property holds whether the shortcut is enabled. diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h index db02f8afae..d8a233af78 100644 --- a/src/quick/util/qquickshortcut_p.h +++ b/src/quick/util/qquickshortcut_p.h @@ -57,7 +57,8 @@ class QQuickShortcut : public QObject, public QQmlParserStatus Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL) - Q_PROPERTY(QString sequenceString READ sequenceString NOTIFY sequenceChanged FINAL REVISION 1) + Q_PROPERTY(QString nativeText READ nativeText NOTIFY sequenceChanged FINAL REVISION 1) + Q_PROPERTY(QString portableText READ portableText NOTIFY sequenceChanged FINAL REVISION 1) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL) Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL) @@ -69,7 +70,8 @@ public: QVariant sequence() const; void setSequence(const QVariant &sequence); - Q_REVISION(1) QString sequenceString() const; + QString nativeText() const; + QString portableText() const; bool isEnabled() const; void setEnabled(bool enabled); diff --git a/src/quick/util/qquicktransitionmanager_p_p.h b/src/quick/util/qquicktransitionmanager_p_p.h index 43e63b80d9..f39cde77b0 100644 --- a/src/quick/util/qquicktransitionmanager_p_p.h +++ b/src/quick/util/qquicktransitionmanager_p_p.h @@ -45,12 +45,12 @@ // We mean it. // -#include "qquickstatechangescript_p.h" #include "qquickanimation_p.h" QT_BEGIN_NAMESPACE -class QQuickStatePrivate; +class QQuickState; +class QQuickStateAction; class QQuickTransitionManagerPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickTransitionManager { diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 3b196da206..4c2b488660 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -255,6 +255,13 @@ public: void setM43(qreal value) { v(3, 2) = value; } void setM44(qreal value) { v(3, 3) = value; } + Q_INVOKABLE void translate(const QVector3D &t) { v.translate(t); } + Q_INVOKABLE void rotate(float angle, const QVector3D &axis) { v.rotate(angle, axis); } + Q_INVOKABLE void scale(float s) { v.scale(s); } + Q_INVOKABLE void scale(float sx, float sy, float sz) { v.scale(sx, sy, sz); } + Q_INVOKABLE void scale(const QVector3D &s) { v.scale(s); } + Q_INVOKABLE void lookAt(const QVector3D &eye, const QVector3D ¢er, const QVector3D &up) { v.lookAt(eye, center, up); } + Q_INVOKABLE QMatrix4x4 times(const QMatrix4x4 &m) const; Q_INVOKABLE QVector4D times(const QVector4D &vec) const; Q_INVOKABLE QVector3D times(const QVector3D &vec) const; diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 1f9056d062..875b68b3ac 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1099,6 +1099,12 @@ void QQuickWidget::showEvent(QShowEvent *) d->render(true); else triggerUpdate(); + QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow); + if (!offscreenPrivate->visible) { + offscreenPrivate->visible = true; + emit d->offscreenWindow->visibleChanged(true); + offscreenPrivate->updateVisibility(); + } } /*! \reimp */ @@ -1106,6 +1112,12 @@ void QQuickWidget::hideEvent(QHideEvent *) { Q_D(QQuickWidget); d->invalidateRenderControl(); + QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow); + if (offscreenPrivate->visible) { + offscreenPrivate->visible = false; + emit d->offscreenWindow->visibleChanged(false); + offscreenPrivate->updateVisibility(); + } } /*! \reimp */ @@ -1145,19 +1157,38 @@ void QQuickWidget::wheelEvent(QWheelEvent *e) } #endif - +/*! + \reimp +*/ void QQuickWidget::focusInEvent(QFocusEvent * event) { Q_D(QQuickWidget); d->offscreenWindow->focusInEvent(event); } +/*! + \reimp +*/ void QQuickWidget::focusOutEvent(QFocusEvent * event) { Q_D(QQuickWidget); d->offscreenWindow->focusOutEvent(event); } +static Qt::WindowState resolveWindowState(Qt::WindowStates states) +{ + // No more than one of these 3 can be set + if (states & Qt::WindowMinimized) + return Qt::WindowMinimized; + if (states & Qt::WindowMaximized) + return Qt::WindowMaximized; + if (states & Qt::WindowFullScreen) + return Qt::WindowFullScreen; + + // No state means "windowed" - we ignore Qt::WindowActive + return Qt::WindowNoState; +} + /*! \reimp */ bool QQuickWidget::event(QEvent *e) { @@ -1191,6 +1222,10 @@ bool QQuickWidget::event(QEvent *e) d->updatePosition(); break; + case QEvent::WindowStateChange: + d->offscreenWindow->setWindowState(resolveWindowState(windowState())); + break; + default: break; } diff --git a/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml b/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml new file mode 100644 index 0000000000..215467f0cc --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml @@ -0,0 +1,39 @@ +import QtQuick 2.4 + +ListView { + id: root + height: 400 + width: height + model: ListModel { + id: lmodel + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + } + + function removeItemZero() + { + lmodel.remove(0); + } + + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem + highlightRangeMode: ListView.StrictlyEnforceRange + + property int transitionsRun: 0 + + removeDisplaced: Transition { + id: transition + PropertyAnimation { property: "x"; duration: 500 } + onRunningChanged: if (!running) transitionsRun++; + } + + delegate: Text { + text: index + " of " + lmodel.count + width: root.width + height: root.height + } +}
\ No newline at end of file diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index e02c053208..a5de266636 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -182,6 +182,7 @@ private slots: void snapOneItemResize_QTBUG_43555(); void snapOneItem_data(); void snapOneItem(); + void snapOneItemCurrentIndexRemoveAnimation(); void QTBUG_9791(); void QTBUG_11105(); @@ -5587,6 +5588,32 @@ void tst_QQuickListView::snapOneItem() releaseView(window); } +void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() +{ + QQuickView *window = createView(); + + window->setSource(testFileUrl("snapOneItemCurrentIndexRemoveAnimation.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); + QTRY_VERIFY(listview != 0); + + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + QTRY_COMPARE(listview->currentIndex(), 0); + QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); + + QMetaObject::invokeMethod(window->rootObject(), "removeItemZero"); + QTRY_COMPARE(listview->property("transitionsRun").toInt(), 1); + + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + QCOMPARE(listview->currentIndex(), 0); + QCOMPARE(currentIndexSpy.count(), 0); + + delete window; +} + void tst_QQuickListView::attachedProperties_QTBUG_32836() { QQuickView *window = createView(); diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 7cc5dfa7c6..79ff18011d 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -75,8 +75,12 @@ void tst_qquickwidget::showHide() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(childView->quickWindow()->isVisible()); + QVERIFY(childView->quickWindow()->visibility() != QWindow::Hidden); - childView->hide(); + window.hide(); + QVERIFY(!childView->quickWindow()->isVisible()); + QCOMPARE(childView->quickWindow()->visibility(), QWindow::Hidden); } void tst_qquickwidget::reparentAfterShow() diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 56cca8fcb4..b16253a192 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -60,13 +60,20 @@ QT_USE_NAMESPACE QStringList g_qmlImportPaths; -void printUsage(const QString &appName) +static void printUsage(const QString &appNameIn) { - std::cerr << qPrintable(QString::fromLatin1( - "Usage: %1 -rootPath path/to/app/qml/directory -importPath path/to/qt/qml/directory \n" - " %1 -qmlFiles file1 file2 -importPath path/to/qt/qml/directory \n" - "Example: %1 -rootPath . -importPath /home/user/dev/qt-install/qml \n").arg( - appName)); + const std::wstring appName = appNameIn.toStdWString(); +#ifndef QT_BOOTSTRAPPED + const QString qmlPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); +#else + const QString qmlPath = QStringLiteral("/home/user/dev/qt-install/qml"); +#endif + std::wcerr + << "Usage: " << appName << " -rootPath path/to/app/qml/directory -importPath path/to/qt/qml/directory\n" + " " << appName << " -qmlFiles file1 file2 -importPath path/to/qt/qml/directory\n\n" + "Example: " << appName << " -rootPath . -importPath " + << QDir::toNativeSeparators(qmlPath).toStdWString() + << '\n'; } QVariantList findImportsInAst(QQmlJS::AST::UiHeaderItemList *headerItemList, const QString &code, const QString &path) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 98c9b54bcd..36a5c5ab76 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -152,8 +152,9 @@ public: */ static QHash<QByteArray, QSet<const QQmlType *> > qmlTypesByCppName; -// No different versioning possible for a composite type. -static QMap<QString, const QQmlType * > qmlTypesByCompositeName; +/* A composite type is completely specified by name, major version and minor version. +*/ +static QMap<QString, QSet<const QQmlType *> > qmlTypesByCompositeName; static QHash<QByteArray, QByteArray> cppToId; @@ -202,7 +203,7 @@ void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<c if (!ty->isComposite()) { collectReachableMetaObjects(engine, ty, &metas); } else { - qmlTypesByCompositeName[ty->elementName()] = ty; + qmlTypesByCompositeName[ty->elementName()].insert(ty); } } } @@ -228,7 +229,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, extensions[ty->typeName()].insert(ty->metaObject()->className()); collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas); } else { - qmlTypesByCompositeName[ty->elementName()] = ty; + qmlTypesByCompositeName[ty->elementName()].insert(ty); } } @@ -459,7 +460,13 @@ public: return prototypeName; } - void dumpComposite(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames) + void dumpComposite(QQmlEngine *engine, const QSet<const QQmlType *> &compositeType, QSet<QByteArray> &defaultReachableNames) + { + foreach (const QQmlType *type, compositeType) + dumpCompositeItem(engine, type, defaultReachableNames); + } + + void dumpCompositeItem(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames) { QQmlComponent e(engine, compositeType->sourceUrl()); if (!e.isReady()) { @@ -485,9 +492,8 @@ public: qml->writeScriptBinding(QLatin1String("prototype"), enquote(prototypeName)); QString qmlTyName = compositeType->qmlTypeName(); - // name should be unique - qml->writeScriptBinding(QLatin1String("name"), enquote(qmlTyName)); const QString exportString = getExportString(qmlTyName, compositeType->majorVersion(), compositeType->minorVersion()); + qml->writeScriptBinding(QLatin1String("name"), exportString); qml->writeArrayBinding(QLatin1String("exports"), QStringList() << exportString); qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), QStringList() << QString::number(compositeType->minorVersion())); qml->writeBooleanBinding(QLatin1String("isComposite"), true); @@ -1176,8 +1182,10 @@ int main(int argc, char *argv[]) foreach (const QMetaObject *meta, nameToMeta) { dumper.dump(QQmlEnginePrivate::get(&engine), meta, uncreatableMetas.contains(meta), singletonMetas.contains(meta)); } - foreach (const QQmlType *compositeType, qmlTypesByCompositeName) - dumper.dumpComposite(&engine, compositeType, defaultReachableNames); + + QMap<QString, QSet<const QQmlType *> >::const_iterator iter = qmlTypesByCompositeName.constBegin(); + for (; iter != qmlTypesByCompositeName.constEnd(); ++iter) + dumper.dumpComposite(&engine, iter.value(), defaultReachableNames); // define QEasingCurve as an extension of QQmlEasingValueType, this way // properties using the QEasingCurve type get useful type information. |