From f6cc21f08441f1aa6fa0c4acd9e41efedb4e3823 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 20 Jun 2017 11:56:58 +0200 Subject: Doc: Add \keyword for "Grouped" and "Attached" property topics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables searching the index list for the \keyword in Qt Creator Change-Id: Ic8fde82def48c4d0f4cbf0e75bc862e00ca3ca65 Reviewed-by: Topi Reiniö --- src/qml/doc/src/cppintegration/definetypes.qdoc | 4 ++-- src/qml/doc/src/cppintegration/exposecppattributes.qdoc | 1 + src/qml/doc/src/qmlfunctions.qdoc | 2 +- src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc index 32084bd308..1ce00c6ad0 100644 --- a/src/qml/doc/src/cppintegration/definetypes.qdoc +++ b/src/qml/doc/src/cppintegration/definetypes.qdoc @@ -346,8 +346,8 @@ demonstrates a usage of extension objects. \section1 Defining QML-Specific Types and Attributes - -\section2 Providing Attached Objects for Data Annotations +\section2 Providing Attached Properties +\keyword Integrating QML and C++ - Attached Properties In the QML language syntax, there is a notion of \l{Attached properties and attached signal handlers}{\e {attached properties} and \e {attached signal diff --git a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc index c4c58c2821..2121c1f291 100644 --- a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc +++ b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc @@ -301,6 +301,7 @@ Note that the template class type for the QQmlListProperty — in this case, \section2 Grouped Properties +\keyword Integrating QML and C++ - Grouped Properties Any read-only object-type property is accessible from QML code as a \e {grouped property}. This can be used to expose a group of related diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index 834684fe6d..e73f1cb59c 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -354,7 +354,7 @@ Returns 0 if type \e T is not a valid attaching type, or if \a create is false and no attachment object instance has previously been created for \a attachee. - \sa {Providing Attached Objects for Data Annotations} + \sa {Providing Attached Properties} */ diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index 33f58dc1b9..df65a0942f 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -856,8 +856,7 @@ are otherwise unavailable to the object. In particular, they allow objects to access properties or signals that are specifically relevant to the individual object. -A QML type implementation may choose to \l {Providing Attached Objects for -Data Annotations}{create an \e {attaching type} in C++} with +A QML type implementation may choose to \l {Providing Attached Properties}{create an \e {attaching type} in C++} with particular properties and signals. Instances of this type can then be created and \e attached to specific objects at run time, allowing those objects to access the properties and signals of the attaching type. These are accessed by -- cgit v1.2.3 From 6d471d6ec79c10e564f2c05bfac7ffab3560f54d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 4 Jul 2017 12:27:24 +0200 Subject: QQuickFBO: Keep devicePixelRatio qreal as long as possible Task-number: QTBUG-61686 Change-Id: I9637be13f701d32d87a42fc4ae0f013b8843503e Reviewed-by: Andy Shaw Reviewed-by: Allan Sandfeld Jensen --- src/quick/items/qquickframebufferobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 52b19d994c..3c00e956cc 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -260,7 +260,7 @@ public: bool renderPending; bool invalidatePending; - int devicePixelRatio; + qreal devicePixelRatio; }; static inline bool isOpenGL(QSGRenderContext *rc) -- cgit v1.2.3 From b9767f03bdfcc06dae49661150fbeb0f19a8547b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 13 Jun 2017 16:34:07 +0200 Subject: Doc: explain ListView default Z values in detail This should save users some time when they are trying to figure out why the delegate items are rendered underneath the header when headerPositioning is set to ListView.OverlayHeader, for example. Task-number: QTBUG-61346 Change-Id: I490250f2a64a8bbda463b3a31be6f820d0cfe881 Reviewed-by: J-P Nurmi Reviewed-by: Robin Burchell --- src/quick/items/qquicklistview.cpp | 62 +++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 18f9b8512d..979a3557a1 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1835,6 +1835,38 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte \snippet qml/listview/listview.qml flickBothDirections + \section1 Stacking Order in ListView + + The \l {QQuickItem::z}{Z value} of items determines whether they are + rendered above or below other items. ListView uses several different + default Z values, depending on what type of item is being created: + + \table + \header + \li Property + \li Default Z value + \row + \li \l delegate + \li 1 + \row + \li \l footer + \li 1 + \row + \li \l header + \li 1 + \row + \li \l highlight + \li 0 + \row + \li \l section.delegate + \li 2 + \endtable + + These default values are set if the Z value of the item is \c 0, so setting + the Z value of these items to \c 0 has no effect. Note that the Z value is + of type \l [QML] {real}, so it is possible to set fractional + values like \c 0.1. + \sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views} */ QQuickListView::QQuickListView(QQuickItem *parent) @@ -1963,6 +1995,8 @@ QQuickListView::~QQuickListView() \note Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's \l {Flickable::contentItem}{contentItem}, not to the view itself. State should \e never be stored in a delegate. + + \sa {Stacking Order in ListView} */ /*! \qmlproperty int QtQuick::ListView::currentIndex @@ -1990,7 +2024,7 @@ QQuickListView::~QQuickListView() The default \l {QQuickItem::z}{stacking order} of the highlight item is \c 0. - \sa highlight, highlightFollowsCurrentItem + \sa highlight, highlightFollowsCurrentItem, {Stacking Order in ListView} */ /*! @@ -2009,7 +2043,8 @@ QQuickListView::~QQuickListView() highlight item is \c 0. \sa highlightItem, highlightFollowsCurrentItem, - {Qt Quick Examples - Views#Highlight}{ListView highlight example} + {Qt Quick Examples - Views#Highlight}{ListView highlight example}, + {Stacking Order in ListView} */ /*! @@ -2352,7 +2387,8 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) differing sections will result in a section header being created even if that section exists elsewhere. - \sa {Qt Quick Examples - Views}{ListView examples} + \sa {Qt Quick Examples - Views}{ListView examples}, + {Stacking Order in ListView} */ QQuickViewSection *QQuickListView::sectionCriteria() { @@ -2503,7 +2539,7 @@ void QQuickListView::setSnapMode(SnapMode mode) footer is positioned at the end of the view, after any items. The default \l {QQuickItem::z}{stacking order} of the footer is \c 1. - \sa header, footerItem + \sa header, footerItem, {Stacking Order in ListView} */ @@ -2515,7 +2551,7 @@ void QQuickListView::setSnapMode(SnapMode mode) header is positioned at the beginning of the view, before any items. The default \l {QQuickItem::z}{stacking order} of the header is \c 1. - \sa footer, headerItem + \sa footer, headerItem, {Stacking Order in ListView} */ /*! @@ -2526,7 +2562,7 @@ void QQuickListView::setSnapMode(SnapMode mode) header is positioned at the beginning of the view, before any items. The default \l {QQuickItem::z}{stacking order} of the header is \c 1. - \sa header, footerItem + \sa header, footerItem, {Stacking Order in ListView} */ /*! @@ -2537,7 +2573,7 @@ void QQuickListView::setSnapMode(SnapMode mode) footer is positioned at the end of the view, after any items. The default \l {QQuickItem::z}{stacking order} of the footer is \c 1. - \sa footer, headerItem + \sa footer, headerItem, {Stacking Order in ListView} */ /*! @@ -2555,6 +2591,12 @@ void QQuickListView::setSnapMode(SnapMode mode) The header can be pushed away by moving the content forwards, and pulled back by moving the content backwards. \endlist + + \note This property has no effect on the \l {QQuickItem::z}{stacking order} + of the header. For example, if the header should be shown above the + \l delegate items when using \c ListView.OverlayHeader, its Z value + should be set to a value higher than that of the delegates. For more + information, see \l {Stacking Order in ListView}. */ QQuickListView::HeaderPositioning QQuickListView::headerPositioning() const { @@ -2592,6 +2634,12 @@ void QQuickListView::setHeaderPositioning(QQuickListView::HeaderPositioning posi The footer can be pushed away by moving the content backwards, and pulled back by moving the content forwards. \endlist + + \note This property has no effect on the \l {QQuickItem::z}{stacking order} + of the footer. For example, if the footer should be shown above the + \l delegate items when using \c ListView.OverlayFooter, its Z value + should be set to a value higher than that of the delegates. For more + information, see \l {Stacking Order in ListView}. */ QQuickListView::FooterPositioning QQuickListView::footerPositioning() const { -- cgit v1.2.3 From 33624629d36acd63b5179e39a288df960e348955 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 7 Jul 2017 16:55:24 +0200 Subject: Fix test for highdpi systems In this specific case, the original image is rendered at 212x300. If it is then scales (preserving aspect ratio) to 200x200, the width "should be" (212/300)*200 = 141.333.. Now when the backing store is not using highdpi, it will be rendered at 1x, so the width gets rounded to 141. However, if the backing store renders it at (say) 2x (so width 282.66..) it gets rounded to 283, which is then divided by 2, which makes 141.5. By rounding the width down, the result is always the same as on non-highdpi. Change-Id: I8c967edf60ddbe97496cfb3d561357887a177d3f Reviewed-by: Simon Hausmann --- tests/auto/quick/qquickimage/tst_qquickimage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index e439db543f..115fe53430 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -398,11 +398,11 @@ void tst_qquickimage::svg() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); - QCOMPARE(obj->width(), 212.0); + QCOMPARE(int(obj->width()), 212); // round down: highdpi can give back fractional values QCOMPARE(obj->height(), 300.0); obj->setSourceSize(QSize(200,200)); - QCOMPARE(obj->width(), 141.0); + QCOMPARE(int(obj->width()), 141); // round down: highdpi can give back fractional values QCOMPARE(obj->height(), 200.0); delete obj; } -- cgit v1.2.3 From c7b22fd4d3bc8e5e4ea17b5f101d5d062d7f5d62 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 11 Jul 2017 11:42:10 +0200 Subject: =?UTF-8?q?Doc:=20finish=20incomplete=20sentence=20in=20Loader?= =?UTF-8?q?=E2=80=99s=20detailed=20description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-61889 Change-Id: Ib6adcabc79b75fe2ee9a31fc4808a2a5f303df74 Reviewed-by: Topi Reiniö --- src/quick/items/qquickloader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 5d5934bbd2..2c8f854d4d 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -270,6 +270,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const In some cases you may wish to use a Loader within a view delegate to improve delegate loading performance. This works well in most cases, but there is one important issue to + be aware of related to the \l{QtQml::Component#Creation Context}{creation context} of a Component. In the following example, the \c index context property inserted by the ListView into \c delegateComponent's context will be inaccessible to Text, as the Loader will use the creation context of \c myComponent as the parent -- cgit v1.2.3 From 8b0c90be00887a99c638f6834c53ee31104e1217 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 12 Jul 2017 14:28:53 +0200 Subject: QDoc: Fix syntax error on the definition of the Q_GADGET Change-Id: I1a0ec09441e7791bcdaf34f16a71be9e535625f0 Reviewed-by: Simon Hausmann --- src/qml/doc/src/cppintegration/data.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index 4523ee39d8..b5c5505628 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -352,7 +352,7 @@ properties: private: QString m_name; - } + }; Q_DECLARE_METATYPE(Actor) \endcode -- cgit v1.2.3 From f812edbb5f3edc8a2349ce386139ad08144e665d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 13 Jul 2017 09:48:05 +0200 Subject: Doc: link to Qt::WindowFlags in Window's flag doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0d5f03bcdcf9154431ed38eac2b41b622ad0c3d6 Reviewed-by: Topi Reiniö --- src/quick/items/qquickwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 31f367ed96..c124150b8d 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -4085,6 +4085,8 @@ void QQuickWindow::resetOpenGLState() The flags which you read from this property might differ from the ones that you set if the requested flags could not be fulfilled. + + \sa Qt::WindowFlags */ /*! -- cgit v1.2.3 From ab5d4c78224c9ec79165e8890e5f8b8e838e0709 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 10 Jul 2017 17:26:59 +0100 Subject: Rebuild QQmlData::propertyCache if deleted by another engine QQmlData is shared between engines, but the relevant QObjectWrapper is not. Since 749a7212e903d8e8c6f256edb1836b9449cc7fe1 when a QObjectWrapper is deleted it resets the shared QQmlData propertyCache. In most cases the propertyCache except when a property updated in an existing binding in the first engine, where it currently asserts. Task-number: QTBUG-61681 Change-Id: I6efdc506e5c7e30b95cda1be282afa9feb781cd2 Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlbinding.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 62288a5845..325f752cd5 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -515,7 +515,12 @@ void QQmlBinding::getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyD Q_ASSERT(propertyData); QQmlData *data = QQmlData::get(*m_target, false); - Q_ASSERT(data && data->propertyCache); + Q_ASSERT(data); + + if (Q_UNLIKELY(!data->propertyCache)) { + data->propertyCache = QQmlEnginePrivate::get(context()->engine)->cache(m_target->metaObject()); + data->propertyCache->addref(); + } *propertyData = data->propertyCache->property(m_targetIndex.coreIndex()); Q_ASSERT(*propertyData); -- cgit v1.2.3 From 86cf1f0d919549420b39016ac27ffdb0cd690dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 20 Jun 2017 21:15:48 +0100 Subject: Add a unit-test for QQuickWidget::grab() Test that it actually didn't grab a blank pixmap, as happened with QOpenGLWidget in the past. Change-Id: Iee8e7ff2f3fa2f2223a2a284fec96d96f62e36a6 Reviewed-by: Robin Burchell --- tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 60495596d1..ee49c9c7ad 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -55,6 +55,7 @@ private slots: void engine(); void readback(); void renderingSignals(); + void grab(); void grabBeforeShow(); void reparentToNewWindow(); void nullEngine(); @@ -298,6 +299,15 @@ void tst_qquickwidget::renderingSignals() QTRY_VERIFY(afterRenderingSpy.size() > 0); } +void tst_qquickwidget::grab() +{ + QQuickWidget view; + view.setSource(testFileUrl("rectangle.qml")); + QPixmap pixmap = view.grab(); + QRgb pixel = pixmap.toImage().pixel(5, 5); + QCOMPARE(pixel, qRgb(255, 0, 0)); +} + // QTBUG-49929, verify that Qt Designer grabbing the contents before drag // does not crash due to missing GL contexts or similar. void tst_qquickwidget::grabBeforeShow() -- cgit v1.2.3 From 5d072dbb583050fe9338ca65e1c2b159c3f77692 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Fri, 14 Jul 2017 12:16:03 +0200 Subject: Software Adaptation: Fix nested clipping logic Task-number: QTBUG-61939 Change-Id: Ibb7f242241df0a7a418ab4f268487e72d5595622 Reviewed-by: Eirik Aavitsland --- .../adaptations/software/qsgsoftwarerenderablenodeupdater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp index 4937565aa9..666f1d0616 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp @@ -83,7 +83,7 @@ void QSGSoftwareRenderableNodeUpdater::endVisit(QSGTransformNode *) bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) { // Make sure to translate the clip rect into world coordinates - if (m_clipState.count() == 1) { + if (m_clipState.count() == 0 || m_clipState.top().isNull()) { m_clipState.push(m_transformState.top().map(QRegion(node->clipRect().toRect()))); m_hasClip = true; } else { @@ -97,7 +97,7 @@ bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) void QSGSoftwareRenderableNodeUpdater::endVisit(QSGClipNode *) { m_clipState.pop(); - if (m_clipState.count() == 1) + if (m_clipState.count() == 0 || m_clipState.top().isNull()) m_hasClip = false; } -- cgit v1.2.3 From fd1612d9b640fa80c49d3de17f8707318df6640c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 17 Jul 2017 11:26:19 +0200 Subject: QQuickWindowQmlImpl: declare attached properties in the header QQuickWindowQmlImpl is inherited by QQuickApplicationWindow in Qt Quick Controls 2, which must register revisions (qmlRegisterRevision) in base classes to make revisioned base class members available in AppWindow. The fact that QQuickWindowQmlImpl provides attached properties must be declared in the header so that qmlRegisterRevision in Qt Quick Controls 2 does not lose the Window-attached properties. Task-number: QTBUG-61935 Change-Id: I634c8fe980b06279610953d9ded2c27d8627d5ea Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindowmodule.cpp | 2 -- src/quick/items/qquickwindowmodule_p.h | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index a5234d4f77..c1cc02568c 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -204,6 +204,4 @@ void QQuickWindowModule::defineModule() QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) - #include "moc_qquickwindowmodule_p.cpp" diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h index 16130bc8a0..869d5b9a8e 100644 --- a/src/quick/items/qquickwindowmodule_p.h +++ b/src/quick/items/qquickwindowmodule_p.h @@ -54,10 +54,10 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -class QQuickWindowAttached; class QQuickWindowQmlImplPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus @@ -105,4 +105,7 @@ public: QT_END_NAMESPACE +QML_DECLARE_TYPE(QQuickWindowQmlImpl) +QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) + #endif -- cgit v1.2.3 From 65e52acf4027c6c6731942e8a67f8e30e26c9655 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 18 Jul 2017 16:17:23 +0200 Subject: Export QQuickWindowAttached fd1612d9 broke the qqc2 build: error: undefined reference to 'QQuickWindowAttached::staticMetaObject' Change-Id: Ia52f0e124fa81fecdee0ed006837a93636aa9622 Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindowattached_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h index 3212508fd8..191f22137c 100644 --- a/src/quick/items/qquickwindowattached_p.h +++ b/src/quick/items/qquickwindowattached_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include #include #include @@ -59,7 +60,7 @@ QT_BEGIN_NAMESPACE class QQuickItem; class QQuickWindow; -class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject +class Q_QUICK_PRIVATE_EXPORT QQuickWindowAttached : public QObject { Q_OBJECT -- cgit v1.2.3 From 6b8695dbdbb381566c28d5d10d9de14e8eb99205 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 22 Jul 2017 13:13:39 -0700 Subject: Use __builtin_trap in GCC too It has had that for longer than Clang has existed. Change-Id: I84e45059a888497fb55ffffd14d3c03160312537 Reviewed-by: Simon Hausmann --- src/3rdparty/masm/wtf/Assertions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/masm/wtf/Assertions.h b/src/3rdparty/masm/wtf/Assertions.h index af65f5325c..491e434498 100644 --- a/src/3rdparty/masm/wtf/Assertions.h +++ b/src/3rdparty/masm/wtf/Assertions.h @@ -167,7 +167,7 @@ WTF_EXPORT_PRIVATE void WTFInstallReportBacktraceOnCrashHook(); Signals are ignored by the crash reporter on OS X so we must do better. */ #ifndef CRASH -#if COMPILER(CLANG) +#if COMPILER(CLANG) || COMPILER(GCC) #define CRASH() \ (WTFReportBacktrace(), \ WTFInvokeCrashHook(), \ -- cgit v1.2.3 From 9c515a6de24bc8d5709136cc099ceeae8e3e642c Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 25 Jul 2017 13:14:21 +0200 Subject: Do not (dis)connectNotify on dynamically created model item objects These item objects are direct subclasses of QObject, and cannot override connectNotify/disconnectNotify. This prevents the creation of the backing QMetaObject during disconnect, which happens during destruction, which in turn will call back into the model that is being destroyed. Task-number: QTBUG-59704 Change-Id: I7f997e5d2fda242b38e67b9147224d72aa4508ba Reviewed-by: Simon Hausmann --- src/qml/qml/qqmljavascriptexpression.cpp | 4 ++-- src/qml/qml/qqmljavascriptexpression_p.h | 2 +- src/qml/qml/qqmlnotifier.cpp | 9 ++++++--- src/qml/qml/qqmlnotifier_p.h | 10 ++++++---- src/qml/types/qqmllistmodel.cpp | 10 +++------- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 9d4e46e254..eec5d1ae57 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -283,7 +283,7 @@ void QQmlPropertyCapture::captureProperty(QQmlNotifier *n, Duration duration) \a n is in the signal index range (see QObjectPrivate::signalIndex()). */ -void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration duration) +void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration duration, bool doNotify) { if (watcher->wasDeleted()) return; @@ -319,7 +319,7 @@ void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration dur Q_ASSERT(g->isConnected(o, n)); } else { g = QQmlJavaScriptExpressionGuard::New(expression, engine); - g->connect(o, n, engine); + g->connect(o, n, engine, doNotify); } if (duration == Permanently) diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 646cc5ab3d..eeed272793 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -204,7 +204,7 @@ public: static void registerQmlDependencies(const QV4::CompiledData::Function *compiledFunction, const QV4::Scope &scope); void captureProperty(QQmlNotifier *, Duration duration = OnlyOnce); - void captureProperty(QObject *, int, int, Duration duration = OnlyOnce); + void captureProperty(QObject *, int, int, Duration duration = OnlyOnce, bool doNotify = true); QQmlEngine *engine; QQmlJavaScriptExpression *expression; diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index 538ca822ee..938e2b77e2 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -117,7 +117,7 @@ void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a) \a sourceSignal MUST be in the signal index range (see QObjectPrivate::signalIndex()). This is different from QMetaMethod::methodIndex(). */ -void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine *engine) +void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify) { disconnect(); @@ -142,8 +142,11 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine QQmlPropertyPrivate::flushSignal(source, sourceSignal); QQmlData *ddata = QQmlData::get(source, true); ddata->addNotify(sourceSignal, this); - QObjectPrivate * const priv = QObjectPrivate::get(source); - priv->connectNotify(QMetaObjectPrivate::signal(source->metaObject(), sourceSignal)); + if (doNotify) { + needsConnectNotify = doNotify; + QObjectPrivate * const priv = QObjectPrivate::get(source); + priv->connectNotify(QMetaObjectPrivate::signal(source->metaObject(), sourceSignal)); + } } QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index dad79e0e55..6e91369793 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -100,7 +100,7 @@ public: inline bool isConnected(QObject *source, int sourceSignal) const; inline bool isConnected(QQmlNotifier *) const; - void connect(QObject *source, int sourceSignal, QQmlEngine *engine); + void connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify = true); inline void connect(QQmlNotifier *); inline void disconnect(); @@ -121,9 +121,10 @@ private: inline QQmlNotifier *senderAsNotifier() const; Callback callback:4; + int needsConnectNotify:1; // The index is in the range returned by QObjectPrivate::signalIndex(). // This is different from QMetaMethod::methodIndex(). - signed int sourceSignal:28; + signed int sourceSignal:27; }; QQmlNotifier::QQmlNotifier() @@ -155,7 +156,7 @@ void QQmlNotifier::notify() } QQmlNotifierEndpoint::QQmlNotifierEndpoint(Callback callback) -: next(0), prev(0), senderPtr(0), callback(callback), sourceSignal(-1) +: next(0), prev(0), senderPtr(0), callback(callback), needsConnectNotify(false), sourceSignal(-1) { } @@ -205,7 +206,8 @@ void QQmlNotifierEndpoint::disconnect() if (sourceSignal != -1) { QObject * const obj = senderAsObject(); QObjectPrivate * const priv = QObjectPrivate::get(obj); - priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal)); + if (needsConnectNotify) + priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal)); } if (isNotifying()) *((qintptr *)(senderPtr & ~0x1)) = 0; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 4d8f213284..9d0f1afb32 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1361,13 +1361,9 @@ ReturnedValue ModelObject::get(const Managed *m, String *name, bool *hasProperty if (QQmlEngine *qmlEngine = that->engine()->qmlEngine()) { QQmlEnginePrivate *ep = QQmlEnginePrivate::get(qmlEngine); - if (ep && ep->propertyCapture) { - QObjectPrivate *op = QObjectPrivate::get(that->object()); - // Temporarily hide the dynamic meta-object, to prevent it from being created when the capture - // triggers a QObject::connectNotify() by calling obj->metaObject(). - QScopedValueRollback metaObjectBlocker(op->metaObject, 0); - ep->propertyCapture->captureProperty(that->object(), -1, role->index); - } + if (ep && ep->propertyCapture) + ep->propertyCapture->captureProperty(that->object(), -1, role->index, + QQmlPropertyCapture::OnlyOnce, false); } const int elementIndex = that->d()->m_elementIndex; -- cgit v1.2.3 From 264989606420f940cdab14f3f39362b9c82c3885 Mon Sep 17 00:00:00 2001 From: Wieland Hagen Date: Tue, 25 Jul 2017 12:46:38 +0200 Subject: Fix QQuickFramebufferObject::Renderer::invalidateFramebufferObject() invalidateFramebufferObject() sets the invalidatePending flag, which should then trigger the deletion of the old FBO and allocation via Renderer::createFramebufferObject(). This does only happen though, if the size has changed. Instead, always create a new FBO if invalidateFramebufferObject() has been called, regardless of whether the size changes or not. Change-Id: I849cb858afac89038343457c6362233c34956d58 Task-number: QTBUG-54434 Reviewed-by: Laszlo Agocs --- src/quick/items/qquickframebufferobject.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 3c00e956cc..042ee21aec 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -312,14 +312,12 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode n->devicePixelRatio = window()->effectiveDevicePixelRatio(); desiredFboSize *= n->devicePixelRatio; - if (n->fbo && (d->followsItemSize || n->invalidatePending)) { - if (n->fbo->size() != desiredFboSize) { - delete n->fbo; - n->fbo = 0; - delete n->msDisplayFbo; - n->msDisplayFbo = 0; - n->invalidatePending = false; - } + if (n->fbo && ((d->followsItemSize && n->fbo->size() != desiredFboSize) || n->invalidatePending)) { + delete n->fbo; + n->fbo = 0; + delete n->msDisplayFbo; + n->msDisplayFbo = 0; + n->invalidatePending = false; } if (!n->fbo) { -- cgit v1.2.3 From 39061af50cc3092289cdd71d17802139590ecb59 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 24 Jul 2017 15:00:37 +0200 Subject: Fix memory leak in QSGAtlasTexture::Manager::create() Parent the Atlas to the manager. Task-number: QTBUG-61754 Change-Id: Ida8b0622d1dbcaafa622f72a1d210969fa61d5bf Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/util/qsgatlastexture.cpp | 7 ++++--- src/quick/scenegraph/util/qsgatlastexture_p.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index 22f0b13f46..d5f836a525 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -116,7 +116,7 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel) Texture *t = 0; if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) { if (!m_atlas) - m_atlas = new Atlas(m_atlas_size); + m_atlas = new Atlas(m_atlas_size, this); // t may be null for atlas allocation failure t = m_atlas->create(image); if (t && !hasAlphaChannel && t->hasAlphaChannel()) @@ -125,8 +125,9 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel) return t; } -Atlas::Atlas(const QSize &size) - : m_allocator(size) +Atlas::Atlas(const QSize &size, QObject *parent) + : QObject(parent) + , m_allocator(size) , m_texture_id(0) , m_size(size) , m_atlas_transient_image_threshold(0) diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h index 3dee539547..0bb07e8e89 100644 --- a/src/quick/scenegraph/util/qsgatlastexture_p.h +++ b/src/quick/scenegraph/util/qsgatlastexture_p.h @@ -88,7 +88,7 @@ private: class Atlas : public QObject { public: - Atlas(const QSize &size); + Atlas(const QSize &size, QObject *parent); ~Atlas(); void invalidate(); -- cgit v1.2.3 From 5952cb93cc93702124aaa5dec938581b0312761a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 24 Jul 2017 12:56:48 +0200 Subject: Fix compilation with namespace I am not sure why this hasn't failed in CI, but the function is declared inside the namespace, so the definition needs to go in there as well. Seems to be a merge error all the way back to 5.8. Change-Id: Iedd25d3e9e756c55cc302da90bab11535bdc1b01 Reviewed-by: Simon Hausmann --- src/quick/scenegraph/qsgdefaultrendercontext.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index e42979934e..b343f89cc0 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -289,9 +289,6 @@ QSGDefaultRenderContext *QSGDefaultRenderContext::from(QOpenGLContext *context) return qobject_cast(context->property(QSG_RENDERCONTEXT_PROPERTY).value()); } -QT_END_NAMESPACE - - QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font) { if (!m_distanceFieldCacheManager) @@ -306,4 +303,6 @@ QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(con return cache; } +QT_END_NAMESPACE + #include "moc_qsgdefaultrendercontext_p.cpp" -- cgit v1.2.3 From ed90226834f8d4ef76149e995e2aecff68e4df43 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 26 Jul 2017 12:13:03 +0200 Subject: Fix loading of QML plugins with old IID in static builds After commit 709f6370884b110def2e4665df8fa7bbf5fae734 we required the use of QQmlExtensionInterface_iid in qml plugins for static linkage. This mean that plugins using the "/1.0" variant would also continue to load, but those not would fail to load. This is annoying when porting apps from older Qt versions. To make the upgrade path easier, let's just support both IIDs. [ChangeLog][Qml] Fix loading of static qml plugins using the old plugin interface id Change-Id: I1c662b1fedad3f32b7dea1eddc32838d2eb9f3be Reviewed-by: J-P Nurmi --- src/qml/qml/qqmlextensioninterface.h | 3 +++ src/qml/qml/qqmlimport.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qml/qml/qqmlextensioninterface.h b/src/qml/qml/qqmlextensioninterface.h index ef56d5e312..62b9b26569 100644 --- a/src/qml/qml/qqmlextensioninterface.h +++ b/src/qml/qml/qqmlextensioninterface.h @@ -66,7 +66,10 @@ public: Q_DECLARE_INTERFACE(QQmlTypesExtensionInterface, "org.qt-project.Qt.QQmlTypesExtensionInterface/1.0") +// NOTE: When changing this to a new version and deciding to add backup code to +// continue to support the previous version, make sure to support both of these iids. #define QQmlExtensionInterface_iid "org.qt-project.Qt.QQmlExtensionInterface/1.0" +#define QQmlExtensionInterface_iid_old "org.qt-project.Qt.QQmlExtensionInterface" Q_DECLARE_INTERFACE(QQmlExtensionInterface, QQmlExtensionInterface_iid) diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index ee5b38717b..ec748d1ca9 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -966,8 +966,8 @@ static QVector makePlugins() // the list the first time called to only contain QML plugins: const auto staticPlugins = QPluginLoader::staticPlugins(); for (const QStaticPlugin &plugin : staticPlugins) { - if (plugin.metaData().value(QLatin1String("IID")).toString() - == QLatin1String(QQmlExtensionInterface_iid)) { + const QString iid = plugin.metaData().value(QLatin1String("IID")).toString(); + if (iid == QLatin1String(QQmlExtensionInterface_iid) || iid == QLatin1String(QQmlExtensionInterface_iid_old)) { plugins.append(plugin); } } -- cgit v1.2.3 From bb199cc8ad4111808260f6255312b08c7d81dcbc Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 4 Mar 2016 11:34:59 +0100 Subject: QQuickTextInput: Don't move the cursor after internalInsert() has done so internalInsert() will set the cursor to the right position which accounts for any input mask set on the control as well. Therefore it will already be placed at the next correct position and should not be changed again after that. Task-number: QTBUG-40943 Change-Id: Ic80193ee94d2aa002b5a14a88df719a5a2cf51b1 Reviewed-by: Mitch Curtis --- src/quick/items/qquicktextinput.cpp | 4 +- .../quick/qquicktextinput/tst_qquicktextinput.cpp | 46 +++++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index a378359c95..43899ba457 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -3407,10 +3407,10 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) if (!event->commitString().isEmpty()) { internalInsert(event->commitString()); cursorPositionChanged = true; + } else { + m_cursor = qBound(0, c, m_text.length()); } - m_cursor = qBound(0, c, m_text.length()); - for (int i = 0; i < event->attributes().size(); ++i) { const QInputMethodEvent::Attribute &a = event->attributes().at(i); if (a.type == QInputMethodEvent::Selection) { diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 67921e1fd0..2e20275193 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -215,6 +215,7 @@ private slots: void clearInputMask(); void keypress_inputMask_data(); void keypress_inputMask(); + void keypress_inputMethod_inputMask(); void hasAcceptableInputMask_data(); void hasAcceptableInputMask(); void maskCharacter_data(); @@ -2291,8 +2292,9 @@ void tst_qquicktextinput::inputMethods() QGuiApplication::sendEvent(input, &event); QCOMPARE(input->text(), QString("Our Goodbye world!")); QCOMPARE(input->displayText(), QString("Our Goodbye world!")); - QCOMPARE(input->cursorPosition(), 7); + QCOMPARE(input->cursorPosition(), 3); + input->setCursorPosition(7); QInputMethodEvent preeditEvent("PREEDIT", QList()); QGuiApplication::sendEvent(input, &preeditEvent); QCOMPARE(input->text(), QString("Our Goodbye world!")); @@ -6481,6 +6483,48 @@ void tst_qquicktextinput::keypress_inputMask() QCOMPARE(textInput->displayText(), expectedDisplayText); } +void tst_qquicktextinput::keypress_inputMethod_inputMask() +{ + // Similar to the keypress_inputMask test, but this is done solely via + // input methods + QString componentStr = "import QtQuick 2.0\nTextInput { focus: true; inputMask: \"AA.AA.AA\" }"; + QQmlComponent textInputComponent(&engine); + textInputComponent.setData(componentStr.toLatin1(), QUrl()); + QQuickTextInput *textInput = qobject_cast(textInputComponent.create()); + QVERIFY(textInput != 0); + + QQuickWindow window; + textInput->setParentItem(window.contentItem()); + window.show(); + window.requestActivate(); + QTest::qWaitForWindowActive(&window); + QVERIFY(textInput->hasActiveFocus()); + + { + QList attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QGuiApplication::sendEvent(textInput, &event); + } + QCOMPARE(textInput->cursorPosition(), 3); + QCOMPARE(textInput->text(), QStringLiteral("EE..")); + { + QList attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QGuiApplication::sendEvent(textInput, &event); + } + QCOMPARE(textInput->cursorPosition(), 6); + QCOMPARE(textInput->text(), QStringLiteral("EE.EE.")); + { + QList attributes; + QInputMethodEvent event("", attributes); + event.setCommitString("EE"); + QGuiApplication::sendEvent(textInput, &event); + } + QCOMPARE(textInput->cursorPosition(), 8); + QCOMPARE(textInput->text(), QStringLiteral("EE.EE.EE")); +} void tst_qquicktextinput::hasAcceptableInputMask_data() { -- cgit v1.2.3 From 08569a0981308f2d3c164d89aa4a00f321fd8e21 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 27 Jul 2017 11:47:28 +0200 Subject: QJSEngine: document limitation of dynamic QObject properties Dynamic QObject properties can not be accessed through C++ (via QJSValue) nor JavaScript. Task-number: QTBUG-38181 Change-Id: I78bb9898fef615a647234ae8df444e8855870258 Reviewed-by: Simon Hausmann --- src/qml/doc/snippets/code/src_script_qjsengine.cpp | 13 +++++++++++++ src/qml/jsapi/qjsengine.cpp | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/qml/doc/snippets/code/src_script_qjsengine.cpp b/src/qml/doc/snippets/code/src_script_qjsengine.cpp index c9bd7dfcd9..0305574d34 100644 --- a/src/qml/doc/snippets/code/src_script_qjsengine.cpp +++ b/src/qml/doc/snippets/code/src_script_qjsengine.cpp @@ -91,3 +91,16 @@ myEngine.evaluate("button.checkable = true"); qDebug() << scriptButton.property("checkable").toBool(); scriptButton.property("show").call(); // call the show() slot //! [5] + + +//! [6] +QJSEngine engine; + +QObject *myQObject = new QObject(); +myQObject->setProperty("dynamicProperty", 3); + +QJSValue myScriptQObject = engine.newQObject(myQObject); +engine.globalObject().setProperty("myObject", myScriptQObject); + +qDebug() << engine.evaluate("myObject.dynamicProperty").toInt(); +//! [6] diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index e4c150057a..c678f8037a 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -175,9 +175,14 @@ Q_DECLARE_METATYPE(QList) called from the script to create a new QObject instance with JavaScriptOwnership. + \snippet code/src_script_qjsengine.cpp 5 + \section2 Dynamic QObject Properties - \snippet code/src_script_qjsengine.cpp 5 + Dynamic QObject properties are not supported. For example, the following code + will not work: + + \snippet code/src_script_qjsengine.cpp 6 \section1 Extensions -- cgit v1.2.3 From 50bc2ac834502b2051dccaaec22da010a3ef5e70 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Wed, 26 Jul 2017 17:28:43 +0200 Subject: Add QDebugStateSaver to operator<<(QDebug, const QSGRootNode) CID 54558 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE) 4. end_of_path: Changing format state of stream d for category basefield without later restoring it. Coverity-Id: 54558 Change-Id: Iad6e6103684c57d3ab98e78e7c91e23731632913 Reviewed-by: Simon Hausmann --- src/quick/scenegraph/coreapi/qsgnode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index e400928d4e..264b30b897 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1582,6 +1582,7 @@ QDebug operator<<(QDebug d, const QSGRootNode *n) d << "RootNode(null)"; return d; } + QDebugStateSaver saver(d); d << "RootNode" << hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : ""); #ifdef QSG_RUNTIME_DESCRIPTION d << QSGNodePrivate::description(n); -- cgit v1.2.3 From 80e03bbd9a42401d50af450aff5351c3a0c95444 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 27 Jul 2017 09:44:58 +0200 Subject: Ignore debugger failures with GCC on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capturing the output of the started process mysteriously fails on Windows with gcc. While the nested event loop is run, the readyRead() signal is never emitted. Only after the timer fired and the event loop is terminated, we receive the output we were expecting. Some tests needed adapting to the initializing sub-function failing in QVERIFY/QCOMPARE calls, in order for the process to not crash and the blacklisting to work. Task-number: QTQAINFRA-1334 Change-Id: I4804d94580e7db65595137d19d7b75d75c243257 Reviewed-by: Jędrzej Nowacki --- .../auto/qml/debugger/qdebugmessageservice/BLACKLIST | 2 ++ .../qqmldebuggingenabler/BLACKLIST | 2 ++ .../qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST | 2 ++ tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST | 2 ++ .../debugger/qqmlenginecontrol/qqmlenginecontrol.pro | 2 +- .../qqmlenginecontrol/tst_qqmlenginecontrol.cpp | 5 +++++ .../qqmlenginedebuginspectorintegrationtest.pro | 2 +- .../tst_qqmlenginedebuginspectorintegration.cpp | 20 ++++++++++++++++++++ tests/auto/qml/debugger/qqmlinspector/BLACKLIST | 2 ++ .../qqmlprofilerservice/qqmlprofilerservice.pro | 2 +- .../qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 15 +++++++++++++++ 11 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST create mode 100644 tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST create mode 100644 tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST create mode 100644 tests/auto/qml/debugger/qqmlinspector/BLACKLIST diff --git a/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST b/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qdebugmessageservice/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST b/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmlenginecontrol/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro index 2518650493..40ec1230d6 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private core-private +QT += core qml testlib testlib-private gui-private core-private OTHER_FILES += \ data/test.qml \ diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp index 3f8731ce6b..2c515d7cf5 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp +++ b/tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #define STR_PORT_FROM "13773" @@ -154,6 +155,8 @@ void tst_QQmlEngineControl::startEngine() QFETCH(bool, restrictMode); connect("test.qml", restrictMode); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QTRY_VERIFY(!m_client->blockedEngines().empty()); m_client->releaseEngine(m_client->blockedEngines().last()); @@ -172,6 +175,8 @@ void tst_QQmlEngineControl::stopEngine() QFETCH(bool, restrictMode); connect("exit.qml", restrictMode); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QTRY_VERIFY(!m_client->blockedEngines().empty()); m_client->releaseEngine(m_client->blockedEngines().last()); diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro index e11ccdc6ca..b8b4c3fc8b 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlenginedebuginspectorintegration -QT += qml testlib gui-private core-private +QT += qml testlib testlib-private gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qqmlenginedebuginspectorintegration.cpp diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 940f89e936..738da048a3 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -101,6 +102,10 @@ QmlDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRootObject( void tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices) { +#if defined(Q_OS_WIN) && defined(Q_CC_MINGW) + QSKIP("Capturing output while running nested event loop is not reliable on Windows/GCC"); +#endif + const QString argument = QString::fromLatin1("-qmljsdebugger=port:%1,%2,block%3") .arg(STR_PORT_FROM).arg(STR_PORT_TO) .arg(restrictServices ? QStringLiteral(",services:QmlDebugger,QmlInspector") : @@ -164,6 +169,8 @@ void tst_QQmlEngineDebugInspectorIntegration::connect() void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; bool success = false; QmlDebugObjectReference rootObject = findRootObject(); @@ -190,6 +197,9 @@ void tst_QQmlEngineDebugInspectorIntegration::objectLocationLookup() void tst_QQmlEngineDebugInspectorIntegration::select() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + QmlDebugObjectReference rootObject = findRootObject(); QList childIds; int requestId = 0; @@ -207,6 +217,8 @@ void tst_QQmlEngineDebugInspectorIntegration::select() void tst_QQmlEngineDebugInspectorIntegration::createObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; QString qml = QLatin1String("Rectangle {\n" " id: xxxyxxx\n" @@ -234,6 +246,10 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() void tst_QQmlEngineDebugInspectorIntegration::moveObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + + QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QmlDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); QCOMPARE(rootObject.children.length(), 2); @@ -257,6 +273,10 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() void tst_QQmlEngineDebugInspectorIntegration::destroyObject() { init(true); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + + QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QmlDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); QCOMPARE(rootObject.children.length(), 2); diff --git a/tests/auto/qml/debugger/qqmlinspector/BLACKLIST b/tests/auto/qml/debugger/qqmlinspector/BLACKLIST new file mode 100644 index 0000000000..5fb1dc193b --- /dev/null +++ b/tests/auto/qml/debugger/qqmlinspector/BLACKLIST @@ -0,0 +1,2 @@ +# QTQAINFRA-1334 +windows gcc diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 71a58d6f34..f5e3dbdc2f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -10,7 +10,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private core-private +QT += core qml testlib testlib-private gui-private core-private OTHER_FILES += \ data/pixmapCacheTest.qml \ diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 692e70d7da..b8e1f1f21d 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #define STR_PORT_FROM "13773" @@ -562,6 +563,8 @@ void tst_QQmlProfilerService::connect() void tst_QQmlProfilerService::pixmapCacheData() { connect(true, "pixmapCacheTest.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); @@ -599,6 +602,8 @@ void tst_QQmlProfilerService::pixmapCacheData() void tst_QQmlProfilerService::scenegraphData() { connect(true, "scenegraphTest.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); @@ -656,6 +661,8 @@ void tst_QQmlProfilerService::scenegraphData() void tst_QQmlProfilerService::profileOnExit() { connect(true, "exit.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); @@ -666,6 +673,8 @@ void tst_QQmlProfilerService::profileOnExit() void tst_QQmlProfilerService::controlFromJS() { connect(true, "controlFromJS.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(false); checkTraceReceived(); @@ -675,6 +684,8 @@ void tst_QQmlProfilerService::controlFromJS() void tst_QQmlProfilerService::signalSourceLocation() { connect(true, "signalSourceLocation.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("500")))) @@ -698,6 +709,8 @@ void tst_QQmlProfilerService::signalSourceLocation() void tst_QQmlProfilerService::javascript() { connect(true, "javascript.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true); while (!(m_process->output().contains(QLatin1String("done")))) @@ -728,6 +741,8 @@ void tst_QQmlProfilerService::javascript() void tst_QQmlProfilerService::flushInterval() { connect(true, "timer.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; m_client->sendRecordingStatus(true, -1, 1); -- cgit v1.2.3