From d6ba9ff7e3d7e67d3718ffa7317bfc2d3941a2bb Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Apr 2010 14:34:19 +1000 Subject: Doc: make note about using clip: true in views slightly more prominent. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 562ba2a..a3d585a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -885,7 +885,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. - Note that views do not enable \e clip automatically. If the view + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 307c0a7..80db730 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1286,7 +1286,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. - Note that views do not enable \e clip automatically. If the view + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 4aaa28d..d0a3cd1 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -314,7 +314,7 @@ void QDeclarativePathViewPrivate::regenerate() \image pathview.gif - Note that views do not enable \e clip automatically. If the view + \bold Note that views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. -- cgit v0.12 From 91838257f36ef3431143d59871ecb62def735fe4 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 16 Apr 2010 14:56:36 +1000 Subject: Cleanup photoviewer demo. --- demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml | 6 ++++-- demos/declarative/photoviewer/PhotoViewerCore/Button.qml | 2 +- demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml index cd9ecbc..d39b7bc 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -77,10 +77,12 @@ Component { } ] - GridView.onAdd: NumberAnimation { target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0 } + GridView.onAdd: NumberAnimation { + target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: "OutQuad" + } GridView.onRemove: SequentialAnimation { PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } - NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0 } + NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: "OutQuad" } PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } } diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml index fd1fae9..c681064 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml @@ -4,7 +4,7 @@ Item { id: container property alias label: labelText.text - property string tint: "" + property color tint: "#FFFFFFFF" signal clicked width: labelText.width + 70 ; height: labelText.height + 18 diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml index e435425..ccfda02 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -4,7 +4,7 @@ Item { id: container property string label - property string tint: "" + property color tint: "#FFFFFFFF" signal clicked signal labelChanged(string label) -- cgit v0.12 From e1b1b11afbddbe260d4de61f20181ffd3b941996 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 16 Apr 2010 14:32:02 +1000 Subject: Add QML imports to s60installs.pro Task-number: QTBUG-9784 Reviewed-by: Martin Jones --- src/s60installs/s60installs.pro | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index dfce7d2..c3809b2 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -143,6 +143,25 @@ symbian: { contains(QT_CONFIG, declarative): { qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll + + widgetImport.sources = widgets.dll $$QT_BUILD_TREE/src/imports/widgets/qmldir + widgetImport.path = $$QT_IMPORTS_BASE_DIR/Qt/widgets + DEPLOYMENT += widgetImport + + particlesImport.sources = particles.dll $$QT_BUILD_TREE/src/imports/particles/qmldir + particlesImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/particles + DEPLOYMENT += particlesImport + + contains(QT_CONFIG, webkit): { + webkitImport.sources = webkitqmlplugin.dll $$QT_BUILD_TREE/src/imports/webkit/qmldir + webkitImport.path = $$QT_IMPORTS_BASE_DIR/org/webkit + DEPLOYMENT += webkitImport + } + contains(QT_CONFIG, multimedia): { + multimediaImport.sources = multimedia.dll $$QT_BUILD_TREE/src/imports/multimedia/qmldir + multimediaImport.path = $$QT_IMPORTS_BASE_DIR/Qt/multimedia + DEPLOYMENT += multimediaImport + } } graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems -- cgit v0.12 From 8693ed5a3fd0814802613c5a8a78b6802751bd0f Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 16 Apr 2010 14:34:36 +1000 Subject: Simplify QML import plugin deployment lines Task-number: Reviewed-by: Martin Jones --- src/imports/gestures/gestures.pro | 3 +-- src/imports/multimedia/multimedia.pro | 3 +-- src/imports/particles/particles.pro | 3 +-- src/imports/webkit/webkit.pro | 3 +-- src/imports/widgets/widgets.pro | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index b9c5b4e..f55c00e 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -17,8 +17,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = gesturesqmlplugin.dll \ - qmldir + importFiles.sources = gesturesqmlplugin.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro index 92f7ec4..c366e54 100644 --- a/src/imports/multimedia/multimedia.pro +++ b/src/imports/multimedia/multimedia.pro @@ -27,8 +27,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/multimedia.dll \ - qmldir + importFiles.sources = multimedia.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 58bfe05..79ac543 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -21,8 +21,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/particles.dll \ - qmldir + importFiles.sources = particles.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro index 62db9ac..77cbc4d 100644 --- a/src/imports/webkit/webkit.pro +++ b/src/imports/webkit/webkit.pro @@ -18,8 +18,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/webkitqmlplugin.dll \ - qmldir + importFiles.sources = webkitqmlplugin.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro index f26e4b9..234ff1e 100644 --- a/src/imports/widgets/widgets.pro +++ b/src/imports/widgets/widgets.pro @@ -21,8 +21,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/widgets.dll \ - qmldir + importFiles.sources = widgets.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles -- cgit v0.12 From ba3f33401c97c5517abe19f4ea6f6307e4374c6c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 16 Apr 2010 14:54:19 +1000 Subject: More class documentation fixes for declarative. --- src/declarative/qml/qdeclarativecontext.cpp | 7 ++- src/declarative/qml/qdeclarativeerror.cpp | 51 +++++++++++++++------- .../qml/qdeclarativeextensionplugin.cpp | 11 ++++- src/declarative/qml/qdeclarativeimageprovider.cpp | 22 +++++++--- src/declarative/qml/qdeclarativeimageprovider.h | 2 +- src/declarative/qml/qdeclarativelist.cpp | 15 ++++--- src/declarative/qml/qdeclarativeproperty.cpp | 1 + 7 files changed, 77 insertions(+), 32 deletions(-) diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 6657fea..5288923 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -114,7 +114,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() \endcode All properties added explicitly by QDeclarativeContext::setContextProperty() take - precedence over context object's properties. + precedence over the context object's properties. Contexts form a hierarchy. The root of this heirarchy is the QDeclarativeEngine's \l {QDeclarativeEngine::rootContext()}{root context}. A component instance can @@ -140,6 +140,11 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() While QML objects instantiated in a context are not strictly owned by that context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. + + \note Setting the context object or adding new context properties after an object + has been created in that context is an expensive operation (essentially forcing all bindings + to reevaluate). Thus whenever possible you should complete "setup" of the context + before using it to create any objects. */ /*! \internal */ diff --git a/src/declarative/qml/qdeclarativeerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp index 7e8aac0..17e91e3 100644 --- a/src/declarative/qml/qdeclarativeerror.cpp +++ b/src/declarative/qml/qdeclarativeerror.cpp @@ -49,8 +49,27 @@ QT_BEGIN_NAMESPACE /*! \class QDeclarativeError - \since 4.7 - \brief The QDeclarativeError class encapsulates a QML error + \since 4.7 + \brief The QDeclarativeError class encapsulates a QML error. + + QDeclarativeError includes a textual description of the error, as well + as location information (the file, line, and column). The toString() + method creates a single-line, human-readable string containing all of + this information, for example: + \code + file:///home/user/test.qml:7:8: Invalid property assignment: double expected + \endcode + + You can use qDebug() or qWarning() to output errors to the console. This method + will attempt to open the file indicated by the error + and include additional contextual information. + \code + file:///home/user/test.qml:7:8: Invalid property assignment: double expected + y: "hello" + ^ + \endcode + + \sa QDeclarativeView::errors(), QDeclarativeComponent::errors() */ class QDeclarativeErrorPrivate { @@ -69,7 +88,7 @@ QDeclarativeErrorPrivate::QDeclarativeErrorPrivate() } /*! - Create an empty error object. + Creates an empty error object. */ QDeclarativeError::QDeclarativeError() : d(0) @@ -77,7 +96,7 @@ QDeclarativeError::QDeclarativeError() } /*! - Create a copy of \a other. + Creates a copy of \a other. */ QDeclarativeError::QDeclarativeError(const QDeclarativeError &other) : d(0) @@ -86,7 +105,7 @@ QDeclarativeError::QDeclarativeError(const QDeclarativeError &other) } /*! - Assign \a other to this error object. + Assigns \a other to this error object. */ QDeclarativeError &QDeclarativeError::operator=(const QDeclarativeError &other) { @@ -112,7 +131,7 @@ QDeclarativeError::~QDeclarativeError() } /*! - Return true if this error is valid, otherwise false. + Returns true if this error is valid, otherwise false. */ bool QDeclarativeError::isValid() const { @@ -120,7 +139,7 @@ bool QDeclarativeError::isValid() const } /*! - Return the url for the file that caused this error. + Returns the url for the file that caused this error. */ QUrl QDeclarativeError::url() const { @@ -129,7 +148,7 @@ QUrl QDeclarativeError::url() const } /*! - Set the \a url for the file that caused this error. + Sets the \a url for the file that caused this error. */ void QDeclarativeError::setUrl(const QUrl &url) { @@ -138,7 +157,7 @@ void QDeclarativeError::setUrl(const QUrl &url) } /*! - Return the error description. + Returns the error description. */ QString QDeclarativeError::description() const { @@ -147,7 +166,7 @@ QString QDeclarativeError::description() const } /*! - Set the error \a description. + Sets the error \a description. */ void QDeclarativeError::setDescription(const QString &description) { @@ -156,7 +175,7 @@ void QDeclarativeError::setDescription(const QString &description) } /*! - Return the error line number. + Returns the error line number. */ int QDeclarativeError::line() const { @@ -165,7 +184,7 @@ int QDeclarativeError::line() const } /*! - Set the error \a line number. + Sets the error \a line number. */ void QDeclarativeError::setLine(int line) { @@ -174,7 +193,7 @@ void QDeclarativeError::setLine(int line) } /*! - Return the error column number. + Returns the error column number. */ int QDeclarativeError::column() const { @@ -183,7 +202,7 @@ int QDeclarativeError::column() const } /*! - Set the error \a column number. + Sets the error \a column number. */ void QDeclarativeError::setColumn(int column) { @@ -192,7 +211,7 @@ void QDeclarativeError::setColumn(int column) } /*! - Return the error as a human readable string. + Returns the error as a human readable string. */ QString QDeclarativeError::toString() const { @@ -210,7 +229,7 @@ QString QDeclarativeError::toString() const \relates QDeclarativeError \fn QDebug operator<<(QDebug debug, const QDeclarativeError &error) - Output a human readable version of \a error to \a debug. + Outputs a human readable version of \a error to \a debug. */ QDebug operator<<(QDebug debug, const QDeclarativeError &error) diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp index 762c642d..863bfc4 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.cpp +++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp @@ -59,6 +59,11 @@ QT_BEGIN_NAMESPACE function, and exporting the class using the Q_EXPORT_PLUGIN2() macro. + QML extension plugins can be used to provide either application-specific or + library-like plugins. Library plugins should limit themselves to registering types, + as any manipulation of the engine's root context may cause conflicts + or other issues in the library user's code. + See \l {Extending QML in C++} for details how to write a QML extension plugin. See \l {How to Create Qt Plugins} for general Qt plugin documentation. @@ -85,7 +90,7 @@ QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(QObject *parent) } /*! - Destructor. + Destroys the plugin. */ QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin() { @@ -94,7 +99,9 @@ QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin() /*! \fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) - Initializes the extension from the \a uri using the \a engine. + Initializes the extension from the \a uri using the \a engine. Here an application + plugin might, for example, expose some data or objects to QML, + as context properties on the engine's root context. */ void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index b992b9f..4be3472 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -45,31 +45,39 @@ QT_BEGIN_NAMESPACE /*! \class QDeclarativeImageProvider - \brief The QDeclarativeImageProvider class provides an interface for threaded image requests. + \since 4.7 + \brief The QDeclarativeImageProvider class provides an interface for threaded image requests in QML. - Note: the request() method may be called by multiple threads, so ensure the + QDeclarativeImageProvider can be used by a QDeclarativeEngine to provide images to QML asynchronously. + The image request will be run in a low priority thread, allowing potentially costly image + loading to be done in the background, without affecting the performance of the UI. + + See the QDeclarativeEngine::addImageProvider() documentation for an + example of how a custom QDeclarativeImageProvider can be constructed and used. + + \note the request() method may be called by multiple threads, so ensure the implementation of this method is reentrant. \sa QDeclarativeEngine::addImageProvider() */ /*! - The destructor is virtual. + Destroys the image provider. */ QDeclarativeImageProvider::~QDeclarativeImageProvider() { } /*! - \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requested_size) + \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requestedSize) Implement this method to return the image with \a id. - If \a requested_size is a valid size, resize the image to that size before returning. + If \a requestedSize is a valid size, the image returned should be of that size. - In any case, \a size must be set to the (original) size of the image. + In all cases, \a size must be set to the original size of the image. - Note: this method may be called by multiple threads, so ensure the + \note this method may be called by multiple threads, so ensure the implementation of this method is reentrant. */ diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h index 50b73fe..cc9c9af 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.h +++ b/src/declarative/qml/qdeclarativeimageprovider.h @@ -54,7 +54,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeImageProvider { public: virtual ~QDeclarativeImageProvider(); - virtual QImage request(const QString &id, QSize *size, const QSize& requested_size) = 0; + virtual QImage request(const QString &id, QSize *size, const QSize& requestedSize) = 0; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp index 45b8cd7..31ef4c2 100644 --- a/src/declarative/qml/qdeclarativelist.cpp +++ b/src/declarative/qml/qdeclarativelist.cpp @@ -87,9 +87,10 @@ void QDeclarativeListReferencePrivate::release() /*! \class QDeclarativeListReference +\since 4.7 \brief The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties. -QDeclarativeListReference allows programs to read from, and assign values to a QML list property in a +QDeclarativeListReference allows C++ programs to read from, and assign values to a QML list property in a simple and type safe way. A QDeclarativeListReference can be created by passing an object and property name or through a QDeclarativeProperty instance. These two are equivalant: @@ -304,6 +305,7 @@ int QDeclarativeListReference::count() const /*! \class QDeclarativeListProperty +\since 4.7 \brief The QDeclarativeListProperty class allows applications to explose list-like properties to QML. @@ -313,10 +315,10 @@ The use of a list property from QML looks like this: \code FruitBasket { fruit: [ - Apple {}, - Orange{}, - Banana {} - ] + Apple {}, + Orange{}, + Banana{} + ] } \endcode @@ -336,6 +338,9 @@ Q_PROPERTY(QDeclarativeListProperty fruit READ fruit); QML list properties are typesafe - in this case \c {Fruit} is a QObject type that \c {Apple}, \c {Orange} and \c {Banana} all derive from. + +\note QDeclarativeListProperty can only be used for lists of QObject-derived object pointers. + */ /*! diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index afd0d84..3881d0a 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE /*! \class QDeclarativeProperty +\since 4.7 \brief The QDeclarativeProperty class abstracts accessing properties on objects created from QML. As QML uses Qt's meta-type system all of the existing QMetaObject classes can be used to introspect -- cgit v0.12 From 8620548e1024c44fbff1cb1becaab8d2d9e53cd5 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 29 Mar 2010 16:57:56 +1000 Subject: ResizeMode support for QGraphicsWidgets created with QDeclarativeView Task-number: QTBUG-8814 Reviewed-by: alexis --- src/declarative/util/qdeclarativeview.cpp | 266 +++++++++++++------- src/declarative/util/qdeclarativeview.h | 2 +- tests/auto/declarative/declarative.pro | 1 + .../data/resizemodedeclarativeitem.qml | 5 + .../data/resizemodegraphicswidget.qml | 5 + .../qdeclarativeview/qdeclarativeview.pro | 7 + .../qdeclarativeview/tst_qdeclarativeview.cpp | 272 +++++++++++++++++++++ tools/qml/main.cpp | 9 +- tools/qml/qmlruntime.cpp | 112 +++++---- tools/qml/qmlruntime.h | 4 +- 10 files changed, 551 insertions(+), 132 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml create mode 100644 tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml create mode 100644 tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro create mode 100644 tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index f786898..5cfa0e8 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -59,10 +59,14 @@ #include #include #include -#include +#include +#include +#include #include #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -124,19 +128,23 @@ void FrameBreakAnimation::updateCurrentTime(int msecs) server->frameBreak(); } -class QDeclarativeViewPrivate +class QDeclarativeViewPrivate : public QDeclarativeItemChangeListener { public: QDeclarativeViewPrivate(QDeclarativeView *view) - : q(view), root(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} + : q(view), root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} ~QDeclarativeViewPrivate() { delete root; } - void execute(); + void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); + void initResize(); + void updateSize(); + inline QSize rootObjectSize(); QDeclarativeView *q; QDeclarativeGuard root; - QDeclarativeGuard qmlRoot; + QDeclarativeGuard declarativeItemRoot; + QDeclarativeGuard graphicsWidgetRoot; QUrl source; @@ -144,7 +152,6 @@ public: QDeclarativeComponent *component; QBasicTimer resizetimer; - mutable QSize initialSize; QDeclarativeView::ResizeMode resizeMode; QTime frameTimer; @@ -155,18 +162,32 @@ public: void QDeclarativeViewPrivate::execute() { - delete root; - delete component; - initialSize = QSize(); - component = new QDeclarativeComponent(&engine, source, q); - - if (!component->isLoading()) { - q->continueExecute(); - } else { - QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute())); + if (root) { + delete root; + root = 0; + } + if (component) { + delete component; + component = 0; + } + if (!source.isEmpty()) { + component = new QDeclarativeComponent(&engine, source, q); + if (!component->isLoading()) { + q->continueExecute(); + } else { + QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute())); + } } } +void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry) +{ + if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) { + // wait for both width and height to be changed + resizetimer.start(0,q); + } + QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry); +} /*! \class QDeclarativeView @@ -332,7 +353,6 @@ QDeclarativeContext* QDeclarativeView::rootContext() /*! \enum QDeclarativeView::Status - Specifies the loading status of the QDeclarativeView. \value Null This QDeclarativeView has no source set. @@ -373,7 +393,6 @@ QList QDeclarativeView::errors() const return QList(); } - /*! \property QDeclarativeView::resizeMode \brief whether the view should resize the canvas contents @@ -394,16 +413,92 @@ void QDeclarativeView::setResizeMode(ResizeMode mode) if (d->resizeMode == mode) return; + if (d->declarativeItemRoot) { + if (d->resizeMode == SizeViewToRootObject) { + QDeclarativeItemPrivate *p = + static_cast(QGraphicsItemPrivate::get(d->declarativeItemRoot)); + p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); + } + } else if (d->graphicsWidgetRoot) { + if (d->resizeMode == QDeclarativeView::SizeViewToRootObject) { + d->graphicsWidgetRoot->removeEventFilter(this); + } + } + d->resizeMode = mode; - if (d->qmlRoot) { - if (d->resizeMode == SizeRootObjectToView) { - d->qmlRoot->setWidth(width()); - d->qmlRoot->setHeight(height()); - } else { - d->qmlRoot->setWidth(d->initialSize.width()); - d->qmlRoot->setHeight(d->initialSize.height()); + if (d->root) { + d->initResize(); + } +} + +void QDeclarativeViewPrivate::initResize() +{ + if (declarativeItemRoot) { + if (resizeMode == QDeclarativeView::SizeViewToRootObject) { + QDeclarativeItemPrivate *p = + static_cast(QGraphicsItemPrivate::get(declarativeItemRoot)); + p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + } + } else if (graphicsWidgetRoot) { + if (resizeMode == QDeclarativeView::SizeViewToRootObject) { + graphicsWidgetRoot->installEventFilter(q); + } + } + updateSize(); +} + +void QDeclarativeViewPrivate::updateSize() +{ + if (!root) + return; + if (declarativeItemRoot) { + if (resizeMode == QDeclarativeView::SizeViewToRootObject) { + QSize newSize = QSize(declarativeItemRoot->width(), declarativeItemRoot->height()); + if (newSize.isValid() && newSize != q->size()) { + q->resize(newSize); + } + } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) { + if (!qFuzzyCompare(q->width(), declarativeItemRoot->width())) + declarativeItemRoot->setWidth(q->width()); + if (!qFuzzyCompare(q->height(), declarativeItemRoot->height())) + declarativeItemRoot->setHeight(q->height()); } + } else if (graphicsWidgetRoot) { + if (resizeMode == QDeclarativeView::SizeViewToRootObject) { + QSize newSize = QSize(graphicsWidgetRoot->size().width(), graphicsWidgetRoot->size().height()); + if (newSize.isValid() && newSize != q->size()) { + q->resize(newSize); + } + } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) { + QSizeF newSize = QSize(q->size().width(), q->size().height()); + if (newSize.isValid() && newSize != graphicsWidgetRoot->size()) { + graphicsWidgetRoot->resize(newSize); + } + } + } + q->updateGeometry(); +} + +QSize QDeclarativeViewPrivate::rootObjectSize() +{ + QSize rootObjectSize(0,0); + int widthCandidate = -1; + int heightCandidate = -1; + if (declarativeItemRoot) { + widthCandidate = declarativeItemRoot->width(); + heightCandidate = declarativeItemRoot->height(); + } else if (root) { + QSizeF size = root->boundingRect().size(); + widthCandidate = size.width(); + heightCandidate = size.height(); + } + if (widthCandidate > 0) { + rootObjectSize.setWidth(widthCandidate); } + if (heightCandidate > 0) { + rootObjectSize.setHeight(heightCandidate); + } + return rootObjectSize; } QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const @@ -449,55 +544,46 @@ void QDeclarativeView::continueExecute() */ void QDeclarativeView::setRootObject(QObject *obj) { - if (QDeclarativeItem *item = qobject_cast(obj)) { - d->scene.addItem(item); - - d->root = item; - d->qmlRoot = item; - connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged())); - connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged())); - if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0) - d->initialSize.setWidth(d->qmlRoot->width()); - if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0) - d->initialSize.setHeight(d->qmlRoot->height()); - resize(d->initialSize); - - if (d->resizeMode == SizeRootObjectToView) { - d->qmlRoot->setWidth(width()); - d->qmlRoot->setHeight(height()); + if (d->root == obj) + return; + if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { + d->scene.addItem(declarativeItem); + d->root = declarativeItem; + d->declarativeItemRoot = declarativeItem; + } else if (QGraphicsObject *graphicsObject = qobject_cast(obj)) { + d->scene.addItem(graphicsObject); + d->root = graphicsObject; + if (graphicsObject->isWidget()) { + d->graphicsWidgetRoot = static_cast(graphicsObject); } else { - QSize sz(d->qmlRoot->width(),d->qmlRoot->height()); - emit sceneResized(sz); - resize(sz); + qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject"; } - updateGeometry(); - } else if (QGraphicsObject *item = qobject_cast(obj)) { - d->scene.addItem(item); - qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject"; - } else if (QWidget *wid = qobject_cast(obj)) { - window()->setAttribute(Qt::WA_OpaquePaintEvent, false); - window()->setAttribute(Qt::WA_NoSystemBackground, false); - if (!layout()) { - setLayout(new QVBoxLayout); - layout()->setContentsMargins(0, 0, 0, 0); - } else if (layout()->count()) { - // Hide the QGraphicsView in GV mode. - QLayoutItem *item = layout()->itemAt(0); - if (item->widget()) - item->widget()->hide(); + } else if (obj) { + qWarning() << "QDeclarativeView only supports loading of root objects that derive from QGraphicsObject"; + if (QWidget* widget = qobject_cast(obj)) { + window()->setAttribute(Qt::WA_OpaquePaintEvent, false); + window()->setAttribute(Qt::WA_NoSystemBackground, false); + if (layout() && layout()->count()) { + // Hide the QGraphicsView in GV mode. + QLayoutItem *item = layout()->itemAt(0); + if (item->widget()) + item->widget()->hide(); + } + widget->setParent(this); + if (isVisible()) { + widget->setVisible(true); + } + resize(widget->size()); } - layout()->addWidget(wid); - emit sceneResized(wid->size()); } -} -/*! - \internal - */ -void QDeclarativeView::sizeChanged() -{ - // delay, so we catch both width and height changing. - d->resizetimer.start(0,this); + if (d->root) { + QSize initialSize = d->rootObjectSize(); + if (initialSize != size()) { + resize(initialSize); + } + d->initResize(); + } } /*! @@ -508,30 +594,36 @@ void QDeclarativeView::sizeChanged() void QDeclarativeView::timerEvent(QTimerEvent* e) { if (!e || e->timerId() == d->resizetimer.timerId()) { - if (d->qmlRoot) { - QSize sz(d->qmlRoot->width(),d->qmlRoot->height()); - emit sceneResized(sz); - //if (!d->resizable) - //resize(sz); - } + d->updateSize(); d->resizetimer.stop(); - updateGeometry(); } } +bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) +{ + if (watched == d->root && d->resizeMode == SizeViewToRootObject) { + if (d->graphicsWidgetRoot) { + if (e->type() == QEvent::GraphicsSceneResize) { + d->updateSize(); + } + } + } + return QGraphicsView::eventFilter(watched, e); +} + /*! \internal - The size hint is the size of the root item. + Preferred size follows the root object in + resize mode SizeViewToRootObject and + the view in resize mode SizeRootObjectToView. */ QSize QDeclarativeView::sizeHint() const { - if (d->qmlRoot) { - if (d->initialSize.width() <= 0) - d->initialSize.setWidth(d->qmlRoot->width()); - if (d->initialSize.height() <= 0) - d->initialSize.setHeight(d->qmlRoot->height()); + if (d->resizeMode == SizeRootObjectToView) { + return size(); + } else { // d->resizeMode == SizeViewToRootObject + return d->rootObjectSize(); } - return d->initialSize; } /*! @@ -549,17 +641,17 @@ QGraphicsObject *QDeclarativeView::rootObject() const */ void QDeclarativeView::resizeEvent(QResizeEvent *e) { - if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) { - d->qmlRoot->setWidth(width()); - d->qmlRoot->setHeight(height()); + if (d->resizeMode == SizeRootObjectToView) { + d->updateSize(); } - if (d->qmlRoot) { - setSceneRect(QRectF(0, 0, d->qmlRoot->width(), d->qmlRoot->height())); + if (d->declarativeItemRoot) { + setSceneRect(QRectF(0, 0, d->declarativeItemRoot->width(), d->declarativeItemRoot->height())); } else if (d->root) { setSceneRect(d->root->boundingRect()); } else { setSceneRect(rect()); } + emit sceneResized(e->size()); QGraphicsView::resizeEvent(e); } diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index 107f3f9..1807758 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -97,13 +97,13 @@ Q_SIGNALS: private Q_SLOTS: void continueExecute(); - void sizeChanged(); protected: virtual void resizeEvent(QResizeEvent *); virtual void paintEvent(QPaintEvent *event); virtual void timerEvent(QTimerEvent*); virtual void setRootObject(QObject *obj); + virtual bool eventFilter(QObject *watched, QEvent *e); friend class QDeclarativeViewPrivate; QDeclarativeViewPrivate *d; diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 7834650..58371c1 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -59,6 +59,7 @@ SUBDIRS += \ qdeclarativerepeater \ # Cover qdeclarativeworkerscript \ # Cover qdeclarativevaluetypes \ # Cover + qdeclarativeview \ # Cover qdeclarativexmlhttprequest \ # Cover qdeclarativeimageprovider \ # Cover qdeclarativestyledtext \ # Cover diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml new file mode 100644 index 0000000..27c8454 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml @@ -0,0 +1,5 @@ +import Qt 4.7 +Item { + width: 200 + height: 200 +} diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml new file mode 100644 index 0000000..964810c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml @@ -0,0 +1,5 @@ +import Qt 4.7 +QGraphicsWidget { + width: 200 + height: 200 +} diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro new file mode 100644 index 0000000..d6be728 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeview.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp new file mode 100644 index 0000000..1ed51c1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include +#include + +class tst_QDeclarativeView : public QObject + +{ + Q_OBJECT +public: + tst_QDeclarativeView(); + +private slots: + void resizemodedeclarativeitem(); + void resizemodegraphicswidget(); + +private: + template + T *findItem(QGraphicsObject *parent, const QString &objectName); +}; + + +tst_QDeclarativeView::tst_QDeclarativeView() +{ +} + +void tst_QDeclarativeView::resizemodedeclarativeitem() +{ + QWidget window; + QDeclarativeView *canvas = new QDeclarativeView(&window); + QVERIFY(canvas); + QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize))); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml")); + QDeclarativeItem* declarativeItem = qobject_cast(canvas->rootObject()); + QVERIFY(declarativeItem); + window.show(); + + // initial size from root object + QCOMPARE(declarativeItem->width(), 200.0); + QCOMPARE(declarativeItem->height(), 200.0); + QCOMPARE(canvas->size(), QSize(200, 200)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 1); + + // size update from view + canvas->resize(QSize(80,100)); + QCOMPARE(declarativeItem->width(), 80.0); + QCOMPARE(declarativeItem->height(), 100.0); + QCOMPARE(canvas->size(), QSize(80, 100)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 2); + + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + + // size update from view disabled + canvas->resize(QSize(60,80)); + QCOMPARE(declarativeItem->width(), 80.0); + QCOMPARE(declarativeItem->height(), 100.0); + QCOMPARE(canvas->size(), QSize(60, 80)); + QCOMPARE(sceneResizedSpy.count(), 3); + + // size update from root object + declarativeItem->setWidth(250); + declarativeItem->setHeight(350); + qApp->processEvents(); + QCOMPARE(declarativeItem->width(), 250.0); + QCOMPARE(declarativeItem->height(), 350.0); + QCOMPARE(canvas->size(), QSize(250, 350)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 4); + + // reset canvas + window.hide(); + delete canvas; + canvas = new QDeclarativeView(&window); + QVERIFY(canvas); + QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize))); + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml")); + declarativeItem = qobject_cast(canvas->rootObject()); + QVERIFY(declarativeItem); + window.show(); + + // initial size for root object + QCOMPARE(declarativeItem->width(), 200.0); + QCOMPARE(declarativeItem->height(), 200.0); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 1); + + // size update from root object + declarativeItem->setWidth(80); + declarativeItem->setHeight(100); + qApp->processEvents(); + QCOMPARE(declarativeItem->width(), 80.0); + QCOMPARE(declarativeItem->height(), 100.0); + QCOMPARE(canvas->size(), QSize(80, 100)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 2); + + // size update from root object disabled + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + declarativeItem->setWidth(60); + declarativeItem->setHeight(80); + QCOMPARE(canvas->width(), 80); + QCOMPARE(canvas->height(), 100); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 2); + + // size update from view + canvas->resize(QSize(200,300)); + QCOMPARE(declarativeItem->width(), 200.0); + QCOMPARE(declarativeItem->height(), 300.0); + QCOMPARE(canvas->size(), QSize(200, 300)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 3); + + delete canvas; +} + +void tst_QDeclarativeView::resizemodegraphicswidget() +{ + QWidget window; + QDeclarativeView *canvas = new QDeclarativeView(&window); + QVERIFY(canvas); + QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize))); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml")); + QGraphicsWidget* graphicsWidget = qobject_cast(canvas->rootObject()); + QVERIFY(graphicsWidget); + window.show(); + + // initial size from root object + QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0)); + QCOMPARE(canvas->size(), QSize(200, 200)); + QCOMPARE(canvas->size(), QSize(200, 200)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 1); + + // size update from view + canvas->resize(QSize(80,100)); + QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0)); + QCOMPARE(canvas->size(), QSize(80,100)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 2); + + // size update from view disabled + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + canvas->resize(QSize(60,80)); + QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0)); + QCOMPARE(canvas->size(), QSize(60, 80)); + QCOMPARE(sceneResizedSpy.count(), 3); + + // size update from root object + graphicsWidget->resize(QSizeF(250.0, 350.0)); + QCOMPARE(graphicsWidget->size(), QSizeF(250.0,350.0)); + QCOMPARE(canvas->size(), QSize(250, 350)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy.count(), 4); + + // reset canvas + window.hide(); + delete canvas; + canvas = new QDeclarativeView(&window); + QVERIFY(canvas); + QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize))); + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml")); + graphicsWidget = qobject_cast(canvas->rootObject()); + QVERIFY(graphicsWidget); + window.show(); + + // initial size from root object + QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0)); + QCOMPARE(canvas->size(), QSize(200, 200)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 1); + + // size update from root object + graphicsWidget->resize(QSizeF(80, 100)); + QCOMPARE(graphicsWidget->size(), QSizeF(80.0, 100.0)); + QCOMPARE(canvas->size(), QSize(80, 100)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 2); + + // size update from root object disabled + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + graphicsWidget->resize(QSizeF(60,80)); + QCOMPARE(canvas->size(), QSize(80,100)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 2); + + // size update from view + canvas->resize(QSize(200,300)); + QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 300.0)); + QCOMPARE(canvas->size(), QSize(200, 300)); + QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(sceneResizedSpy2.count(), 3); + + window.show(); + delete canvas; +} + +template +T *tst_QDeclarativeView::findItem(QGraphicsObject *parent, const QString &objectName) +{ + if (!parent) + return 0; + + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + return static_cast(item); + item = findItem(item, objectName); + if (item) + return static_cast(item); + } + + return 0; +} + +QTEST_MAIN(tst_QDeclarativeView) + +#include "tst_qdeclarativeview.moc" diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 341908e..5e829a4 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -88,6 +88,8 @@ void usage() qWarning(" -skin ...................... run with a skin window frame"); qWarning(" \"list\" for a list of built-ins"); qWarning(" -resizeview .............................. resize the view, not the skin"); + qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); + qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); qWarning(" -recordfile ..................... set video recording file"); qWarning(" - ImageMagick 'convert' for GIF)"); @@ -184,6 +186,7 @@ int main(int argc, char ** argv) bool stayOnTop = false; bool maximized = false; bool useNativeFileBrowser = true; + bool sizeToView = true; #if defined(Q_OS_SYMBIAN) maximized = true; @@ -270,6 +273,10 @@ int main(int argc, char ** argv) if (lastArg) usage(); script = QString(argv[++i]); runScript = true; + } else if (arg == "-sizeviewtorootobject") { + sizeToView = false; + } else if (arg == "-sizerootobjecttoview") { + sizeToView = true; } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -339,6 +346,7 @@ int main(int argc, char ** argv) viewer.setNetworkCacheSize(cache); viewer.setRecordFile(recordfile); + viewer.setSizeToView(sizeToView); if (resizeview) viewer.setScaleView(); if (fps>0) @@ -390,6 +398,5 @@ int main(int argc, char ** argv) } viewer.setUseGL(useGL); viewer.raise(); - return app.exec(); } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 53409c1..7b4706b 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -496,7 +496,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) canvas = new QDeclarativeView(this); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); + canvas->setFocus(); QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); @@ -519,7 +519,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) #else setCentralWidget(canvas); #endif - namFactory = new NetworkAccessManagerFactory; canvas->engine()->setNetworkAccessManagerFactory(namFactory); @@ -753,10 +752,11 @@ void QDeclarativeViewer::setScaleSkin() if (scaleSkin) return; scaleSkin = true; - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); if (skin) { - canvas->setFixedSize(canvas->sizeHint()); - skin->setScreenSize(canvas->sizeHint()); + canvas->resize(initialSize); + canvas->setFixedSize(initialSize); + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + updateSizeHints(); } } @@ -766,11 +766,8 @@ void QDeclarativeViewer::setScaleView() return; scaleSkin = false; if (skin) { - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); - canvas->setMinimumSize(QSize(0,0)); - canvas->setMaximumSize(QSize(16777215,16777215)); - canvas->resize(skin->standardScreenSize()); - skin->setScreenSize(skin->standardScreenSize()); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + updateSizeHints(); } } @@ -916,19 +913,12 @@ void QDeclarativeViewer::statusChanged() tester->executefailure(); if (canvas->status() == QDeclarativeView::Ready) { - if (!skin) { - canvas->updateGeometry(); - if (mb) - mb->updateGeometry(); - if (!isFullScreen() && !isMaximized()) - resize(sizeHint()); - } else { - if (scaleSkin) - canvas->resize(canvas->sizeHint()); - else { - canvas->setFixedSize(skin->standardScreenSize()); - canvas->resize(skin->standardScreenSize()); - } + initialSize = canvas->sizeHint(); + if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { + QSize newWindowSize = initialSize; + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + updateSizeHints(); + resize(newWindowSize); } } } @@ -1010,7 +1000,6 @@ bool QDeclarativeViewer::open(const QString& file_or_url) t.start(); canvas->setSource(url); - qWarning() << "Wall startup time:" << t.elapsed(); return true; @@ -1056,41 +1045,43 @@ void QDeclarativeViewer::setSkin(const QString& skinDirOrName) skin->deleteLater(); } - canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject); - DeviceSkinParameters parameters; if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) { layout()->setEnabled(false); - //setMenuBar(0); if (mb) mb->hide(); if (!err.isEmpty()) qWarning() << err; skin = new PreviewDeviceSkin(parameters,this); - canvas->resize(canvas->sizeHint()); if (scaleSkin) skin->setPreviewAndScale(canvas); else skin->setPreview(canvas); createMenu(0,skin->menu); + if (scaleSkin) { + canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject); + } + updateSizeHints(); skin->show(); - } else { + } else if (skin) { skin = 0; clearMask(); menuBar()->clear(); - canvas->setParent(this, Qt::SubWindow); createMenu(menuBar(),0); - mb->show(); - setMinimumSize(QSize(0,0)); - setMaximumSize(QSize(16777215,16777215)); - canvas->setMinimumSize(QSize(0,0)); - canvas->setMaximumSize(QSize(16777215,16777215)); - QRect g = geometry(); - g.setSize(sizeHint()); + canvas->setParent(this, Qt::SubWindow); setParent(0,windowFlags()); // recreate - canvas->move(0,menuBar()->sizeHint().height()); - setGeometry(g); + mb->show(); + canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + updateSizeHints(); + layout()->setEnabled(true); + if (!scaleSkin) { + canvas->resize(initialSize); + canvas->setFixedSize(initialSize); + } + QSize newWindowSize = canvas->size(); + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + resize(newWindowSize); show(); } canvas->show(); @@ -1122,9 +1113,10 @@ void QDeclarativeViewer::setRecordRate(int fps) void QDeclarativeViewer::sceneResized(QSize size) { if (size.width() > 0 && size.height() > 0) { - if (skin && scaleSkin) - skin->setScreenSize(size); - } + if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { + updateSizeHints(); + } + } } void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) @@ -1397,6 +1389,42 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use) useQmlFileBrowser = !use; } +void QDeclarativeViewer::setSizeToView(bool sizeToView) +{ + QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject; + if (resizeMode != canvas->resizeMode()) { + canvas->setResizeMode(resizeMode); + updateSizeHints(); + } +} + +void QDeclarativeViewer::updateSizeHints() +{ + if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { + QSize newWindowSize = canvas->sizeHint(); + if (!skin) { + newWindowSize.setHeight(newWindowSize.height()+menuBar()->height()); + } + if (!isFullScreen() && !isMaximized()) { + resize(newWindowSize); + setFixedSize(newWindowSize); + if (skin && scaleSkin) { + skin->setScreenSize(newWindowSize); + } + } + } else { // QDeclarativeView::SizeRootObjectToView + canvas->setMinimumSize(QSize(0,0)); + canvas->setMaximumSize(QSize(16777215,16777215)); + setMinimumSize(QSize(0,0)); + setMaximumSize(QSize(16777215,16777215)); + if (skin && !scaleSkin) { + canvas->setFixedSize(skin->standardScreenSize()); + skin->setScreenSize(skin->standardScreenSize()); + } + } + updateGeometry(); +} + void QDeclarativeViewer::registerTypes() { static bool registered = false; diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 2089dda..a00a703 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -100,7 +100,8 @@ public: void addPluginPath(const QString& plugin); void setUseGL(bool use); void setUseNativeFileBrowser(bool); - + void updateSizeHints(); + void setSizeToView(bool sizeToView); QStringList builtinSkins() const; QMenuBar *menuBar() const; @@ -149,6 +150,7 @@ private: PreviewDeviceSkin *skin; QSize skinscreensize; QDeclarativeView *canvas; + QSize initialSize; QString currentFileOrUrl; QDeclarativeTimer recordTimer; QString frame_fmt; -- cgit v0.12 From b458d672dbec892f00019edc1fe06156190401c7 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 16 Apr 2010 15:25:23 +1000 Subject: Test not reliable --- tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp index 2621d65..b8e317e 100644 --- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp @@ -111,14 +111,6 @@ void tst_QPacketProtocol::setMaximumPacketSize() QPacketProtocol out(m_serverConn); QCOMPARE(out.setMaximumPacketSize(size), expected); - - if (size == expected) { - QPacketProtocol in(m_client); - QByteArray b; - b.fill('a', size + 1); - out.send() << b.constData(); - QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(invalidPacket()))); - } } void tst_QPacketProtocol::setMaximumPacketSize_data() -- cgit v0.12 From 34a1a6b5d6399e7bcad136fdaa9a050a0f8bb2dc Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 16 Apr 2010 15:33:41 +1000 Subject: Wait for debug clients asynchronously instead of blocking creation of the engine until a debug client has connected. This makes for easier debugging from Qt Creator when debugging C++ and QML together and when debugging an application that has multiple engines. --- .../debugger/qdeclarativedebugservice.cpp | 133 +++++++++------------ .../debugger/qdeclarativedebugservice_p.h | 7 +- src/declarative/qml/qdeclarativeengine.cpp | 2 - .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 91 +++++++------- .../tst_qdeclarativedebugclient.cpp | 42 +++---- .../tst_qdeclarativedebugservice.cpp | 42 +++---- tests/auto/declarative/shared/debugutil.cpp | 81 +------------ tests/auto/declarative/shared/debugutil_p.h | 56 --------- 8 files changed, 143 insertions(+), 311 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 9d9d1d0..34e73fd 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -60,12 +60,12 @@ class QDeclarativeDebugServer : public QObject Q_DISABLE_COPY(QDeclarativeDebugServer) public: static QDeclarativeDebugServer *instance(); - void wait(); - void registerForStartNotification(QObject *object, const char *receiver); + void listen(); + bool hasDebuggingClient() const; private Q_SLOTS: void readyRead(); - void registeredObjectDestroyed(QObject *object); + void newConnection(); private: friend class QDeclarativeDebugService; @@ -78,14 +78,14 @@ class QDeclarativeDebugServerPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QDeclarativeDebugServer) public: QDeclarativeDebugServerPrivate(); - void wait(); int port; QTcpSocket *connection; QPacketProtocol *protocol; QHash plugins; QStringList enabledPlugins; - QList > notifyClients; + QTcpServer *tcpServer; + bool gotHello; }; class QDeclarativeDebugServicePrivate : public QObjectPrivate @@ -99,56 +99,41 @@ public: }; QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() -: connection(0), protocol(0) +: connection(0), protocol(0), gotHello(false) { } -void QDeclarativeDebugServerPrivate::wait() +void QDeclarativeDebugServer::listen() { - Q_Q(QDeclarativeDebugServer); - QTcpServer server; - - if (!server.listen(QHostAddress::Any, port)) { - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", port); - return; - } - - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", port); - - for (int i=0; itcpServer = new QTcpServer(this); + QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + if (d->tcpServer->listen(QHostAddress::Any, d->port)) + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); + else + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); +} - connection = server.nextPendingConnection(); - connection->setParent(q); - protocol = new QPacketProtocol(connection, q); +void QDeclarativeDebugServer::newConnection() +{ + Q_D(QDeclarativeDebugServer); - // ### Wait for hello - while (!protocol->packetsAvailable()) { - connection->waitForReadyRead(); - } - QPacket hello = protocol->read(); - QString name; - hello >> name >> enabledPlugins; - if (name != QLatin1String("QDeclarativeDebugServer")) { - qWarning("QDeclarativeDebugServer: Invalid hello message"); - delete protocol; delete connection; connection = 0; protocol = 0; + if (d->connection) { + qWarning("QDeclarativeDebugServer error: another client is already connected"); return; } - QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(readyRead())); - q->readyRead(); + d->connection = d->tcpServer->nextPendingConnection(); + d->connection->setParent(this); + d->protocol = new QPacketProtocol(d->connection, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); +} - qWarning("QDeclarativeDebugServer: Connection established"); +bool QDeclarativeDebugServer::hasDebuggingClient() const +{ + Q_D(const QDeclarativeDebugServer); + return d->gotHello; } QDeclarativeDebugServer *QDeclarativeDebugServer::instance() @@ -163,36 +148,15 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() bool ok = false; int port = env.toInt(&ok); - if (ok && port > 1024) + if (ok && port > 1024) { server = new QDeclarativeDebugServer(port); + server->listen(); + } } return server; } -void QDeclarativeDebugServer::wait() -{ - Q_D(QDeclarativeDebugServer); - d->wait(); -} - -void QDeclarativeDebugServer::registerForStartNotification(QObject *object, const char *methodName) -{ - Q_D(QDeclarativeDebugServer); - connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*))); - d->notifyClients.append(qMakePair(object, QByteArray(methodName))); -} - -void QDeclarativeDebugServer::registeredObjectDestroyed(QObject *object) -{ - Q_D(QDeclarativeDebugServer); - QMutableListIterator > i(d->notifyClients); - while (i.hasNext()) { - if (i.next().first == object) - i.remove(); - } -} - QDeclarativeDebugServer::QDeclarativeDebugServer(int port) : QObject(*(new QDeclarativeDebugServerPrivate)) { @@ -204,6 +168,23 @@ void QDeclarativeDebugServer::readyRead() { Q_D(QDeclarativeDebugServer); + if (!d->gotHello) { + QPacket hello = d->protocol->read(); + QString name; + hello >> name >> d->enabledPlugins; + if (name != QLatin1String("QDeclarativeDebugServer")) { + qWarning("QDeclarativeDebugServer: Invalid hello message"); + QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + d->protocol->deleteLater(); + d->protocol = 0; + d->connection->deleteLater(); + d->connection = 0; + return; + } + d->gotHello = true; + qWarning("QDeclarativeDebugServer: Connection established"); + } + QString debugServer(QLatin1String("QDeclarativeDebugServer")); while (d->protocol->packetsAvailable()) { @@ -375,6 +356,12 @@ bool QDeclarativeDebugService::isDebuggingEnabled() return QDeclarativeDebugServer::instance() != 0; } +bool QDeclarativeDebugService::hasDebuggingClient() +{ + return QDeclarativeDebugServer::instance() != 0 + && QDeclarativeDebugServer::instance()->hasDebuggingClient(); +} + QString QDeclarativeDebugService::objectToString(QObject *obj) { if(!obj) @@ -390,16 +377,6 @@ QString QDeclarativeDebugService::objectToString(QObject *obj) return rv; } -void QDeclarativeDebugService::waitForClients() -{ - QDeclarativeDebugServer::instance()->wait(); -} - -void QDeclarativeDebugService::notifyOnServerStart(QObject *object, const char *receiver) -{ - QDeclarativeDebugServer::instance()->registerForStartNotification(object, receiver); -} - void QDeclarativeDebugService::sendMessage(const QByteArray &message) { Q_D(QDeclarativeDebugService); diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h index 498edf3..c461ddf 100644 --- a/src/declarative/debugger/qdeclarativedebugservice_p.h +++ b/src/declarative/debugger/qdeclarativedebugservice_p.h @@ -68,19 +68,16 @@ public: static int idForObject(QObject *); static QObject *objectForId(int); - static bool isDebuggingEnabled(); static QString objectToString(QObject *obj); - static void waitForClients(); - - static void notifyOnServerStart(QObject *object, const char *receiver); + static bool isDebuggingEnabled(); + static bool hasDebuggingClient(); protected: virtual void enabledChanged(bool); virtual void messageReceived(const QByteArray &); private: - void registerForStartNotification(QObject *object, const char *methodName); friend class QDeclarativeDebugServer; }; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index cfdc79e..4dbd199 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -390,8 +390,6 @@ void QDeclarativeEnginePrivate::init() qmlEngineDebugServer(); isDebugging = true; QDeclarativeEngineDebugServer::addEngine(q); - - qmlEngineDebugServer()->waitForClients(); } } diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 133dcb8..49d430e 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -60,6 +60,7 @@ #include #include +#include "../../../shared/util.h" #include "../shared/debugutil_p.h" Q_DECLARE_METATYPE(QDeclarativeDebugWatch::State) @@ -69,14 +70,6 @@ class tst_QDeclarativeDebug : public QObject { Q_OBJECT -public: - tst_QDeclarativeDebug(QDeclarativeDebugTestData *data) - { - m_conn = data->conn; - m_engine = data->engine; - m_rootItem = data->items[0]; - } - private: QDeclarativeDebugObjectReference findRootObject(); QDeclarativeDebugPropertyReference findProperty(const QList &props, const QString &name) const; @@ -93,8 +86,11 @@ private: QDeclarativeEngine *m_engine; QDeclarativeItem *m_rootItem; + QObjectList m_components; + private slots: void initTestCase(); + void cleanupTestCase(); void watch_property(); void watch_object(); @@ -278,9 +274,50 @@ void tst_QDeclarativeDebug::compareProperties(const QDeclarativeDebugPropertyRef void tst_QDeclarativeDebug::initTestCase() { + qRegisterMetaType(); + + qputenv("QML_DEBUG_SERVER_PORT", "3768"); + m_engine = new QDeclarativeEngine(this); + + QList qml; + qml << "import Qt 4.7\n" + "Item {" + "width: 10; height: 20; scale: blueRect.scale;" + "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" + "Text { color: blueRect.color; }" + "MouseArea {" + "onEntered: { console.log('hello') }" + "}" + "}"; + // add second component to test multiple root contexts + qml << "import Qt 4.7\n" + "Item {}"; + + for (int i=0; i(component.create()); + } + m_rootItem = qobject_cast(m_components.first()); + + + // add an extra context to test for multiple contexts + QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext(), this); + context->setObjectName("tst_QDeclarativeDebug_childContext"); + + m_conn = new QDeclarativeDebugConnection(this); + m_conn->connectToHost("127.0.0.1", 3768); + bool ok = m_conn->waitForConnected(); + Q_ASSERT(ok); + QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); + m_dbg = new QDeclarativeEngineDebug(m_conn, this); +} - qRegisterMetaType(); +void tst_QDeclarativeDebug::cleanupTestCase() +{ + qDeleteAll(m_components); } void tst_QDeclarativeDebug::watch_property() @@ -804,40 +841,6 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() compareProperties(r, ref); } - -class tst_QDeclarativeDebug_Factory : public QDeclarativeTestFactory -{ -public: - QObject *createTest(QDeclarativeDebugTestData *data) - { - tst_QDeclarativeDebug *test = new tst_QDeclarativeDebug(data); - QDeclarativeContext *c = new QDeclarativeContext(data->engine->rootContext(), test); - c->setObjectName("tst_QDeclarativeDebug_childContext"); - return test; - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QList qml; - qml << "import Qt 4.7\n" - "Item {" - "width: 10; height: 20; scale: blueRect.scale;" - "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" - "Text { color: blueRect.color; }" - "MouseArea {" - "onEntered: { console.log('hello') }" - "}" - "}"; - // add second component to test multiple root contexts - qml << "import Qt 4.7\n" - "Item {}"; - tst_QDeclarativeDebug_Factory factory; - return QDeclarativeDebugTest::runTests(&factory, qml); -} - -//QTEST_MAIN(tst_QDeclarativeDebug) +QTEST_MAIN(tst_QDeclarativeDebug) #include "tst_qdeclarativedebug.moc" diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index d3679a7..fb17f90 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -52,21 +52,19 @@ #include #include +#include "../../../shared/util.h" #include "../shared/debugutil_p.h" class tst_QDeclarativeDebugClient : public QObject { Q_OBJECT -public: - tst_QDeclarativeDebugClient(QDeclarativeDebugTestData *data) - { - m_conn = data->conn; - } - +private: QDeclarativeDebugConnection *m_conn; private slots: + void initTestCase(); + void name(); void isEnabled(); void setEnabled(); @@ -74,6 +72,19 @@ private slots: void sendMessage(); }; +void tst_QDeclarativeDebugClient::initTestCase() +{ + qputenv("QML_DEBUG_SERVER_PORT", "3768"); + new QDeclarativeEngine(this); + + m_conn = new QDeclarativeDebugConnection(this); + m_conn->connectToHost("127.0.0.1", 3768); + bool ok = m_conn->waitForConnected(); + Q_ASSERT(ok); + + QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); +} + void tst_QDeclarativeDebugClient::name() { QString name = "tst_QDeclarativeDebugClient::name()"; @@ -136,22 +147,7 @@ void tst_QDeclarativeDebugClient::sendMessage() QCOMPARE(resp, msg); } - -class tst_QDeclarativeDebugClient_Factory : public QDeclarativeTestFactory -{ -public: - QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugClient(data); } -}; - - -// This does not use QTEST_MAIN because the test has to be created and run -// in a separate thread. -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - tst_QDeclarativeDebugClient_Factory factory; - return QDeclarativeDebugTest::runTests(&factory); -} +QTEST_MAIN(tst_QDeclarativeDebugClient) #include "tst_qdeclarativedebugclient.moc" + diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index c8fc001..80d7f76 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -52,21 +52,19 @@ #include #include +#include "../../../shared/util.h" #include "../shared/debugutil_p.h" + class tst_QDeclarativeDebugService : public QObject { Q_OBJECT - -public: - tst_QDeclarativeDebugService(QDeclarativeDebugTestData *data) - { - m_conn = data->conn; - } - +private: QDeclarativeDebugConnection *m_conn; private slots: + void initTestCase(); + void name(); void isEnabled(); void enabledChanged(); @@ -76,6 +74,19 @@ private slots: void objectToString(); }; +void tst_QDeclarativeDebugService::initTestCase() +{ + qputenv("QML_DEBUG_SERVER_PORT", "3768"); + new QDeclarativeEngine(this); + + m_conn = new QDeclarativeDebugConnection(this); + m_conn->connectToHost("127.0.0.1", 3768); + bool ok = m_conn->waitForConnected(); + Q_ASSERT(ok); + + QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); +} + void tst_QDeclarativeDebugService::name() { QString name = "tst_QDeclarativeDebugService::name()"; @@ -170,21 +181,6 @@ void tst_QDeclarativeDebugService::objectToString() delete obj; } - -class tst_QDeclarativeDebugService_Factory : public QDeclarativeTestFactory -{ -public: - QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugService(data); } -}; - -// This does not use QTEST_MAIN because the test has to be created and run -// in a separate thread. -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - tst_QDeclarativeDebugService_Factory factory; - return QDeclarativeDebugTest::runTests(&factory); -} +QTEST_MAIN(tst_QDeclarativeDebugService) #include "tst_qdeclarativedebugservice.moc" diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 66f04e5..c0c3eca 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -47,11 +47,11 @@ #include "debugutil_p.h" -#include bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) { QEventLoop loop; QTimer timer; + timer.setSingleShot(true); QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); QObject::connect(receiver, member, &loop, SLOT(quit())); timer.start(timeout); @@ -59,25 +59,6 @@ bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, return timer.isActive(); } - -QDeclarativeDebugTestData::QDeclarativeDebugTestData(QEventLoop *el) - : exitCode(-1), loop(el) -{ -} - -QDeclarativeDebugTestData::~QDeclarativeDebugTestData() -{ - qDeleteAll(items); -} - -void QDeclarativeDebugTestData::testsFinished(int code) -{ - exitCode = code; - loop->quit(); -} - - - QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent) : QDeclarativeDebugService(s, parent), enabled(false) { @@ -117,63 +98,3 @@ void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba) emit serverMessage(ba); } - -tst_QDeclarativeDebug_Thread::tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory) - : m_data(data), m_factory(factory) -{ -} - -void tst_QDeclarativeDebug_Thread::run() -{ - bool ok = false; - - QDeclarativeDebugConnection conn; - conn.connectToHost("127.0.0.1", 3768); - ok = conn.waitForConnected(); - Q_ASSERT(ok); - - QEventLoop loop; - connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit())); - loop.exec(); - - m_data->conn = &conn; - - Q_ASSERT(m_factory); - QObject *test = m_factory->createTest(m_data); - Q_ASSERT(test); - int code = QTest::qExec(test, QCoreApplication::arguments()); - delete test; - emit testsFinished(code); -} - -int QDeclarativeDebugTest::runTests(QDeclarativeTestFactory *factory, const QList &qml) -{ - qputenv("QML_DEBUG_SERVER_PORT", "3768"); - - QEventLoop loop; - QDeclarativeDebugTestData data(&loop); - - tst_QDeclarativeDebug_Thread thread(&data, factory); - QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int))); - - QDeclarativeDebugService::notifyOnServerStart(&thread, "start"); - - QDeclarativeEngine engine; // blocks until client connects - - foreach (const QByteArray &code, qml) { - QDeclarativeComponent c(&engine); - c.setData(code, QUrl::fromLocalFile("")); - Q_ASSERT(c.isReady()); // fails if bad syntax - data.items << qobject_cast(c.create()); - } - - // start the test - data.engine = &engine; - emit data.engineCreated(); - - loop.exec(); - thread.wait(); - - return data.exitCode; -} - diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h index c152b5a..e6bb7ad 100644 --- a/tests/auto/declarative/shared/debugutil_p.h +++ b/tests/auto/declarative/shared/debugutil_p.h @@ -51,50 +51,10 @@ #include #include -class QDeclarativeTestFactory; - class QDeclarativeDebugTest { public: static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000); - - static int runTests(QDeclarativeTestFactory *factory, const QList &qml = QList()); -}; - -class QDeclarativeDebugTestData : public QObject -{ - Q_OBJECT -public: - QDeclarativeDebugTestData(QEventLoop *el); - - ~QDeclarativeDebugTestData(); - - QDeclarativeDebugConnection *conn; - QDeclarativeEngine *engine; - - int exitCode; - QEventLoop *loop; - - QList items; - -signals: - void engineCreated(); - -public slots: - void testsFinished(int code); - -private: - friend class QDeclarativeDebugTest; -}; - - -class QDeclarativeTestFactory -{ -public: - QDeclarativeTestFactory() {} - virtual ~QDeclarativeTestFactory() {} - - virtual QObject *createTest(QDeclarativeDebugTestData *data) = 0; }; class QDeclarativeDebugTestService : public QDeclarativeDebugService @@ -131,20 +91,4 @@ private: QByteArray lastMsg; }; -class tst_QDeclarativeDebug_Thread : public QThread -{ - Q_OBJECT -public: - tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory); - - void run(); - -signals: - void testsFinished(int); - -private: - QDeclarativeDebugTestData *m_data; - QDeclarativeTestFactory *m_factory; -}; - -- cgit v0.12 From daa12d2d6658924aae22cfbb93cfbc77240f26ba Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Apr 2010 15:39:42 +1000 Subject: Doc: Put "default" property label on same line as property name Task-number: QTBUG-6336 --- doc/src/template/style/style.css | 6 ++++++ tools/qdoc3/htmlgenerator.cpp | 13 +++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 4668c23..94a95a5 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -904,6 +904,12 @@ color: red; } + .qmldefault + { + float: right; + color: red; + } + .qmldoc { } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 4985f64..a13fc7a 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4412,18 +4412,11 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << ""; if (!qpn->isWritable()) - out() << "read-only"; + out() << "read-only "; + if (qpgn->isDefault()) + out() << "default "; generateQmlItem(qpn, relative, marker, false); out() << ""; - if (qpgn->isDefault()) { - out() << "" - << "" - << "
" - << "
" - << "" - << ""; - } } ++p; } -- cgit v0.12 From ecdc0ebacd97f0d607dcbe884751c203a296a88c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Apr 2010 15:41:26 +1000 Subject: Doc: in QML use "real" and "enumeration", not "qreal" and "enum" --- doc/src/declarative/elements.qdoc | 7 +------ .../graphicsitems/qdeclarativeborderimage.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeevents.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeimage.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- src/declarative/graphicsitems/qdeclarativeloader.cpp | 4 ++-- src/declarative/util/qdeclarativeanimation.cpp | 4 ++-- src/declarative/util/qdeclarativefontloader.cpp | 2 +- src/declarative/util/qdeclarativesmoothedanimation.cpp | 4 ++-- src/declarative/util/qdeclarativesmoothedfollow.cpp | 4 ++-- src/declarative/util/qdeclarativespringfollow.cpp | 16 ++++++++-------- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- 12 files changed, 23 insertions(+), 28 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index ce3a6e3..355c0f4 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -46,8 +46,6 @@ The following table lists the QML elements provided by the Qt Declarative module. -\bold {Standard Qt Declarative Elements} - \table 80% \header \o \bold {States} @@ -81,6 +79,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l PropertyAction \o \l ScriptAction \o \l Transition +\o \l SmoothedFollow \o \l SpringFollow \o \l Behavior \endlist @@ -109,11 +108,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l QtObject \o \l WorkerScript \endlist -\endtable -\bold {QML Items} - -\table 80% \header \o \bold {Basic Visual Items} \o \bold {Basic Interaction Items} diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index be9d8bd..7858a7a 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -82,7 +82,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() QDeclarativePixmapCache::cancel(d->sciurl, this); } /*! - \qmlproperty enum BorderImage::status + \qmlproperty enumeration BorderImage::status This property holds the status of image loading. It can be one of: \list diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index a181071..4425c97 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -145,7 +145,7 @@ Item { */ /*! - \qmlproperty enum MouseEvent::button + \qmlproperty enumeration MouseEvent::button This property holds the button that caused the event. It can be one of: \list diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index ca86637..37b07bf 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -221,7 +221,7 @@ qreal QDeclarativeImage::paintedHeight() const } /*! - \qmlproperty enum Image::status + \qmlproperty enumeration Image::status This property holds the status of image loading. It can be one of: \list diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 0e4e327..843dfdc 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1415,7 +1415,7 @@ QDeclarativeItem::~QDeclarativeItem() } /*! - \qmlproperty enum Item::transformOrigin + \qmlproperty enumeration Item::transformOrigin This property holds the origin point around which scale and rotation transform. Nine transform origins are available, as shown in the image below. diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 409c228..8cf8235 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -325,7 +325,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() } /*! - \qmlproperty enum Loader::status + \qmlproperty enumeration Loader::status This property holds the status of QML loading. It can be one of: \list @@ -383,7 +383,7 @@ qreal QDeclarativeLoader::progress() const } /*! - \qmlproperty enum Loader::resizeMode + \qmlproperty enumeration Loader::resizeMode This property determines how the Loader or item are resized: \list diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 7e20428..fd85d91 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1316,7 +1316,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t) } /*! - \qmlproperty enum RotationAnimation::direction + \qmlproperty enumeration RotationAnimation::direction The direction in which to rotate. Possible values are Numerical, Clockwise, Counterclockwise, or Shortest. @@ -1741,7 +1741,7 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) } /*! - \qmlproperty enum PropertyAnimation::easing.type + \qmlproperty enumeration PropertyAnimation::easing.type \qmlproperty real PropertyAnimation::easing.amplitude \qmlproperty real PropertyAnimation::easing.overshoot \qmlproperty real PropertyAnimation::easing.period diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index b577b81..41740a8 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -181,7 +181,7 @@ void QDeclarativeFontLoader::setName(const QString &name) } /*! - \qmlproperty enum FontLoader::status + \qmlproperty enumeration FontLoader::status This property holds the status of font loading. It can be one of: \list diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 48a7583..19a00ee 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -438,7 +438,7 @@ qreal QDeclarativeSmoothedAnimation::velocity() const } /*! - \qmlproperty qreal SmoothedAnimation::velocity + \qmlproperty real SmoothedAnimation::velocity This property holds the average velocity allowed when tracking the 'to' value. @@ -457,7 +457,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) } /*! - \qmlproperty qreal SmoothedAnimation::maximumEasingTime + \qmlproperty int SmoothedAnimation::maximumEasingTime This property specifies the maximum time, in msecs, an "eases" during the follow should take. Setting this property causes the velocity to "level out" after at a time. Setting diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp index 9f155fc..3ed9257 100644 --- a/src/declarative/util/qdeclarativesmoothedfollow.cpp +++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp @@ -195,7 +195,7 @@ qreal QDeclarativeSmoothedFollow::velocity() const } /*! - \qmlproperty qreal SmoothedFollow::velocity + \qmlproperty real SmoothedFollow::velocity This property holds the average velocity allowed when tracking the 'to' value. @@ -214,7 +214,7 @@ void QDeclarativeSmoothedFollow::setVelocity(qreal v) } /*! - \qmlproperty qreal SmoothedFollow::maximumEasingTime + \qmlproperty int SmoothedFollow::maximumEasingTime This property specifies the maximum time, in msecs, an "eases" during the follow should take. Setting this property causes the velocity to "level out" after at a time. Setting diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp index 7921735..70077f3 100644 --- a/src/declarative/util/qdeclarativespringfollow.cpp +++ b/src/declarative/util/qdeclarativespringfollow.cpp @@ -267,7 +267,7 @@ qreal QDeclarativeSpringFollow::to() const } /*! - \qmlproperty qreal SpringFollow::to + \qmlproperty real SpringFollow::to This property holds the target value which will be tracked. Bind to a property in order to track its changes. @@ -284,7 +284,7 @@ void QDeclarativeSpringFollow::setTo(qreal value) } /*! - \qmlproperty qreal SpringFollow::velocity + \qmlproperty real SpringFollow::velocity This property holds the maximum velocity allowed when tracking the source. */ @@ -303,7 +303,7 @@ void QDeclarativeSpringFollow::setVelocity(qreal velocity) } /*! - \qmlproperty qreal SpringFollow::spring + \qmlproperty real SpringFollow::spring This property holds the spring constant The spring constant describes how strongly the target is pulled towards the @@ -326,7 +326,7 @@ void QDeclarativeSpringFollow::setSpring(qreal spring) } /*! - \qmlproperty qreal SpringFollow::damping + \qmlproperty real SpringFollow::damping This property holds the spring damping constant The damping constant describes how quickly a sprung follower comes to rest. @@ -349,7 +349,7 @@ void QDeclarativeSpringFollow::setDamping(qreal damping) /*! - \qmlproperty qreal SpringFollow::epsilon + \qmlproperty real SpringFollow::epsilon This property holds the spring epsilon The epsilon is the rate and amount of change in the value which is close enough @@ -371,7 +371,7 @@ void QDeclarativeSpringFollow::setEpsilon(qreal epsilon) } /*! - \qmlproperty qreal SpringFollow::modulus + \qmlproperty real SpringFollow::modulus This property holds the modulus value. Setting a \a modulus forces the target value to "wrap around" at the modulus. @@ -394,7 +394,7 @@ void QDeclarativeSpringFollow::setModulus(qreal modulus) } /*! - \qmlproperty qreal SpringFollow::mass + \qmlproperty real SpringFollow::mass This property holds the "mass" of the property being moved. mass is 1.0 by default. Setting a different mass changes the dynamics of @@ -452,7 +452,7 @@ bool QDeclarativeSpringFollow::inSync() const } /*! - \qmlproperty qreal SpringFollow::value + \qmlproperty real SpringFollow::value The current value. */ qreal QDeclarativeSpringFollow::value() const diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 7f8b962..55e768e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -667,7 +667,7 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati } /*! - \qmlproperty enum XmlListModel::status + \qmlproperty enumeration XmlListModel::status Specifies the model loading status, which can be one of the following: \list -- cgit v0.12
" - << "default