diff options
79 files changed, 349 insertions, 127 deletions
diff --git a/examples/declarative/toys/velocity/velocity.qmlproject b/demos/declarative/rssnews/rssnews.qmlproject index d4909f8..d4909f8 100644 --- a/examples/declarative/toys/velocity/velocity.qmlproject +++ b/demos/declarative/rssnews/rssnews.qmlproject diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 1e3a69c..41fe9d2 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -233,7 +233,16 @@ Qt for Windows CE - Designer - + - [QTBUG-9351] Fixed a bug that caused modified headerview-properties + of item views to be duplicated in the UI-file. + - [QTBUG-8347] Fixed a layout problem caused by embedded images in the rich + text of a QLabel. + - [QTBUG-8041], [QTBUG-8213] Fixed a crash related to undo while moving + widgets by arrow keys. + - [QTBUG-7822] Added support for the 'windowOpacity'-property. + - [QTBUG-7764] Fixed the emission of the propertyChanged()-signal of + QDesignerPropertyEditorInterface. + - [QTBUG-5492] Made widgetbox-filter match on class names, too. - Linguist - Linguist GUI @@ -251,9 +260,10 @@ Qt for Windows CE - uic - - uic3 + - [QTBUG-9207] Fixed export of image files of type XPM, added + compatibility option -limit-xpm-linelength. - qmake diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 94f27e9..5d3b8e4 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -122,7 +122,6 @@ For example, from your build directory, run: \section2 XML \list -\o \l{declarative/xml/xmldata}{XML data} \o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest} \endlist @@ -140,20 +139,20 @@ For example, from your build directory, run: \list \o \l{declarative/cppextensions/referenceexamples}{Reference examples} (discussed in \l {Extending QML in C++}) \o \l{declarative/cppextensions/plugins}{Plugins} -\o \l{declarative/cppextensions/proxywidgets}{QtWidgets} \o \l{declarative/cppextensions/qgraphicslayouts}{QGraphicsLayouts} +\o \l{declarative/cppextensions/qwidgets}{QWidgets} \o \l{declarative/cppextensions/imageprovider}{Image provider} -\o \l{declarative/cppextensions/proxyviewer}{Network access manager factory} +\o \l{declarative/cppextensions/networkaccessmanagerfactory}{Network access manager factory} \endlist \section2 Toys \list \o \l{declarative/toys/clocks}{Clocks} +\o \l{declarative/toys/corkboards}{Corkboards} \o \l{declarative/toys/dial}{Dial} -\o \l{declarative/toys/dynamic}{Dynamic} +\o \l{declarative/toys/dynamicscene}{Dynamic Scene} \o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} \o \l{declarative/toys/tvtennis}{TV Tennis} -\o \l{declarative/toys/velocity}{Velocity} \endlist @@ -161,9 +160,10 @@ For example, from your build directory, run: \list \o \l{demos/declarative/calculator}{Calculator} +\o \l{demos/declarative/flickr}{Flickr Mobile} \o \l{demos/declarative/minehunt}{Minehunt} \o \l{demos/declarative/photoviewer}{Photo Viewer} -\o \l{demos/declarative/flickr}{Flickr Mobile} +\o \l{demos/declarative/rssnews}{RSS News Reader} \o \l{demos/declarative/samegame}{Same Game} \o \l{demos/declarative/snake}{Snake} \endlist diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 2a83e30..c29a796 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -219,8 +219,9 @@ Binary to ASCII - this function returns a base64 encoding of \c data. ASCII to binary - this function returns a base64 decoding of \c data. \section3 Qt.quit() -This function causes the QML engine to emit the quit signal, which in -\l {Qt Declarative UI Runtime}{qml} causes the runtime to quit. +This function causes the QDeclarativeEngine::quit() signal to be emitted. +Within the \l {Qt Declarative UI Runtime}{qml} application this causes the +launcher application to exit. \section3 Qt.resolvedUrl(url) This function returns \c url resolved relative to the URL of the diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index b105df4..a03b9c2 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -42,17 +42,17 @@ /*! \page qmlruntime.html \title Qt Declarative UI Runtime - \keyword qml runtime + \keyword QML Viewer (qml) \ingroup qttools This page documents the \e{Declarative UI Runtime} for the Qt GUI - toolkit, and the \QQL which can be used to run apps - written for the runtime. The \QQL reads a declarative + toolkit, and the \QQV which can be used to run apps + written for the runtime. The \QQV reads a declarative user interface definition (\c .qml) file and displays the user interface it describes. QML is a runtime, as you can run plain QML files which pull in their required modules. To run apps with the QML runtime, you can either start the runtime - from your own application (using a QDeclarativeView) or with the simple \QQL. + from your own application (using a QDeclarativeView) or with the simple \QQV. The launcher can be installed in a production environment, assuming that it is not already present in the system. It is generally packaged alongside Qt. @@ -61,16 +61,16 @@ \list \o Write your own Qt application including a QDeclarative view and deploy it the same as any other Qt application (not discussed further on this page), or - \o Write a main QML file for your application, and run your application using the included \QQL. + \o Write a main QML file for your application, and run your application using the included \QQV. \endlist - To run an application with the \QQL, pass the filename as an argument: + To run an application with the \QQV, pass the filename as an argument: \code qml myQmlFile.qml \endcode - Deploying a QML application via the \QQL allows for QML only deployments, but can also + Deploying a QML application via the \QQV allows for QML only deployments, but can also include custom C++ modules just as easily. Below is an example of how you might structure a complex application deployed via the QML runtime, it is a listing of the files that would be included in the deployment package. @@ -92,8 +92,8 @@ as the appropriate module file is chosen based on platform naming conventions. The C++ modules must contain a QDeclarativeExtentionPlugin subclass. - The application would be executed either with your own application, the command 'qml MyApp.qml' or by - opening the file if your system has the \QQL registered as the handler for QML files. The MyApp.qml file would have access + The application would be executed either with your own application, the command 'qml MyApp.qml' or by + opening the file if your system has the \QQV registered as the handler for QML files. The MyApp.qml file would have access to all of the deployed types using the import statements such as the following: \code @@ -101,8 +101,8 @@ import "OtherModule" 1.0 as Other \endcode - \section1 Qt QML Launcher functionality - The \QQL implements some additional functionality to help it supporting + \section1 Qt QML Viewer functionality + The \QQV implements some additional functionality to help it supporting myriad applications. If you implement your own application, you may also wish to reimplement some or all of this functionality. However, much of this functionality is intended to aid the prototyping of QML applications and may not be necessary for a deployed application. diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index 7d56ea1..afc6361 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -359,7 +359,7 @@ The \menu{Options} page lets you specify the homepage \QA will display when you click the \gui{Home} button in \QA's main user interface. You can specify - the hompage by typing it here or clicking on one of the buttons below the + the homepage by typing it here or clicking on one of the buttons below the textbox. \gui{Current Page} sets the currently displayed page as your home page while \gui{Restore to default} will reset your home page to the default home page. diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 22113ee..2973d8c 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -88,13 +88,13 @@ */ /*! - \title QtWidgets - \example declarative/cppextensions/proxywidgets + \title QGraphicsLayouts + \example declarative/cppextensions/qgraphicslayouts */ /*! - \title QGraphicsLayouts - \example declarative/cppextensions/qgraphicslayouts + \title QWidgets + \example declarative/cppextensions/qwidgets */ /*! @@ -104,7 +104,7 @@ /*! \title Network access manager - \example declarative/cppextensions/proxyviewer + \example declarative/cppextensions/networkaccessmanagerfactory */ /*! @@ -175,7 +175,7 @@ */ /*! - \title Threaded ListModel + \title Threaded ListModel \example declarative/threading/threadedlistmodel */ @@ -192,6 +192,11 @@ */ /*! + \title Corkboards + \example declarative/toys/corkboards +*/ + +/*! \title Dial \example declarative/toys/dial @@ -199,8 +204,8 @@ */ /*! - \title Dynamic - \example declarative/toys/dynamic + \title Dynamic Scene + \example declarative/toys/dynamicscene This example shows how to create dynamic objects QML. */ @@ -216,11 +221,6 @@ */ /*! - \title Velocity - \example declarative/toys/velocity -*/ - -/*! \title Gestures \example declarative/touchinteraction/gestures */ @@ -268,11 +268,6 @@ */ /*! - \title XML Data - \example declarative/xml/xmldata -*/ - -/*! \title XMLHttpRequest \example declarative/xml/xmlhttprequest */ diff --git a/doc/src/examples/qml-rssnews.qdoc b/doc/src/examples/qml-rssnews.qdoc new file mode 100644 index 0000000..0e7bdef --- /dev/null +++ b/doc/src/examples/qml-rssnews.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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 documentation 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$ +** +****************************************************************************/ + +/*! + \title RSS News + \example demos/declarative/rssnews + + This demo shows how to write a RSS news reader in QML. + + \image qml-rssnews-example.png +*/ diff --git a/doc/src/images/qml-rssnews-example.png b/doc/src/images/qml-rssnews-example.png Binary files differnew file mode 100644 index 0000000..948ef4d --- /dev/null +++ b/doc/src/images/qml-rssnews-example.png diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index cf345aa..1d3df97 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -4,7 +4,7 @@ import Qt 4.7 Rectangle { width: 240; height: 180; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The launcher automatically loads files in dummydata/* to assist + // The viewer automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index 1282f8d..794b3f2 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -4,7 +4,7 @@ Rectangle { width: 180; height: 200; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The launcher automatically loads files in dummydata/* to assist + // The viewer automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index 44f0540..61bf126 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -5,7 +5,7 @@ Rectangle { width: 180; height: 200; color: "white" // ContactModel model is defined in dummydata/ContactModel.qml - // The launcher automatically loads files in dummydata/* to assist + // The viewer automatically loads files in dummydata/* to assist // development without a real data source. // Define a delegate component. A component will be diff --git a/examples/declarative/cppextensions/cppextensions.pro b/examples/declarative/cppextensions/cppextensions.pro index caa6092..33762fe 100644 --- a/examples/declarative/cppextensions/cppextensions.pro +++ b/examples/declarative/cppextensions/cppextensions.pro @@ -3,8 +3,8 @@ TEMPLATE = subdirs SUBDIRS += \ imageprovider \ plugins \ - proxyviewer \ - proxywidgets \ + networkaccessmanagerfactory \ + qwidgets \ qgraphicslayouts \ referenceexamples diff --git a/examples/declarative/cppextensions/proxyviewer/main.cpp b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp index b82d2c9..4ecbb5c 100644 --- a/examples/declarative/cppextensions/proxyviewer/main.cpp +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp @@ -53,7 +53,7 @@ create a QNetworkAccessManager with a proxy. Usage: - proxyviewer [-host <proxy> -port <port>] [file] + networkaccessmanagerfactory [-host <proxy> -port <port>] [file] */ static QString proxyHost; @@ -93,7 +93,7 @@ int main(int argc, char ** argv) } else if (arg[0] != '-') { source = QUrl::fromLocalFile(arg); } else { - qWarning() << "Usage: proxyviewer [-host <proxy> -port <port>] [file]"; + qWarning() << "Usage: networkaccessmanagerfactory [-host <proxy> -port <port>] [file]"; exit(1); } } diff --git a/examples/declarative/cppextensions/proxyviewer/proxyviewer.pro b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro index b6bfa7f..74d8db3 100644 --- a/examples/declarative/cppextensions/proxyviewer/proxyviewer.pro +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.pro @@ -1,9 +1,9 @@ TEMPLATE = app -TARGET = proxyviewer +TARGET = networkaccessmanagerfactory DEPENDPATH += . INCLUDEPATH += . QT += declarative network # Input SOURCES += main.cpp -RESOURCES += proxyviewer.qrc +RESOURCES += networkaccessmanagerfactory.qrc diff --git a/examples/declarative/cppextensions/proxyviewer/proxyviewer.qrc b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc index 17e9301..17e9301 100644 --- a/examples/declarative/cppextensions/proxyviewer/proxyviewer.qrc +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/networkaccessmanagerfactory.qrc diff --git a/examples/declarative/cppextensions/proxyviewer/view.qml b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml index 7f1bdef..7f1bdef 100644 --- a/examples/declarative/cppextensions/proxyviewer/view.qml +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml diff --git a/examples/declarative/cppextensions/proxywidgets/README b/examples/declarative/cppextensions/proxywidgets/README deleted file mode 100644 index f50fa22..0000000 --- a/examples/declarative/cppextensions/proxywidgets/README +++ /dev/null @@ -1,4 +0,0 @@ -To run: - - make install - qml proxywidgets.qml diff --git a/examples/declarative/cppextensions/qgraphicslayouts/graphicsLayouts/graphicslayouts.pro b/examples/declarative/cppextensions/qgraphicslayouts/graphicsLayouts/graphicsLayouts.pro index e5d91b2..e5d91b2 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/graphicsLayouts/graphicslayouts.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/graphicsLayouts/graphicsLayouts.pro diff --git a/examples/declarative/cppextensions/proxywidgets/ProxyWidgets/qmldir b/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir index e55267c..e55267c 100644 --- a/examples/declarative/cppextensions/proxywidgets/ProxyWidgets/qmldir +++ b/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir diff --git a/examples/declarative/cppextensions/qwidgets/README b/examples/declarative/cppextensions/qwidgets/README new file mode 100644 index 0000000..e2f1b2b --- /dev/null +++ b/examples/declarative/cppextensions/qwidgets/README @@ -0,0 +1,6 @@ +This example shows how to embed QWidget-based objects into QML. + +To run: + + make install + qml qwidgets.qml diff --git a/examples/declarative/cppextensions/proxywidgets/proxywidgets.cpp b/examples/declarative/cppextensions/qwidgets/qwidgets.cpp index 067eb2c..228f9f1 100644 --- a/examples/declarative/cppextensions/proxywidgets/proxywidgets.cpp +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.cpp @@ -82,7 +82,7 @@ private: QPushButton *widget; }; -class ProxyWidgetsPlugin : public QDeclarativeExtensionPlugin +class QWidgetsPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT public: @@ -92,6 +92,6 @@ public: } }; -#include "proxywidgets.moc" +#include "qwidgets.moc" -Q_EXPORT_PLUGIN2(proxywidgetsplugin, ProxyWidgetsPlugin); +Q_EXPORT_PLUGIN2(qwidgetsplugin, QWidgetsPlugin); diff --git a/examples/declarative/cppextensions/proxywidgets/proxywidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index cb07d80..37f313d 100644 --- a/examples/declarative/cppextensions/proxywidgets/proxywidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -1,12 +1,12 @@ TEMPLATE = lib -DESTDIR = ProxyWidgets -TARGET = proxywidgetsplugin +DESTDIR = QWidgets +TARGET = qwidgetsplugin CONFIG += qt plugin QT += declarative -SOURCES += proxywidgets.cpp +SOURCES += qwidgets.cpp -sources.files += proxywidgets.pro proxywidgets.cpp proxywidgets.qml +sources.files += qwidgets.pro qwidgets.cpp qwidgets.qml sources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins @@ -18,4 +18,4 @@ symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) symbian:{ TARGET.EPOCALLOWDLLDATA = 1 -}
\ No newline at end of file +} diff --git a/examples/declarative/cppextensions/proxywidgets/proxywidgets.qml b/examples/declarative/cppextensions/qwidgets/qwidgets.qml index 88de37f..47f9573 100644 --- a/examples/declarative/cppextensions/proxywidgets/proxywidgets.qml +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import "ProxyWidgets" 1.0 +import "QWidgets" 1.0 Rectangle { id: window diff --git a/examples/declarative/toys/dynamic/dynamic.qmlproject b/examples/declarative/cppextensions/qwidgets/qwidgets.qmlproject index d4909f8..d4909f8 100644 --- a/examples/declarative/toys/dynamic/dynamic.qmlproject +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.qmlproject diff --git a/examples/declarative/toys/velocity/Day.qml b/examples/declarative/toys/corkboards/Day.qml index 350c1c4..350c1c4 100644 --- a/examples/declarative/toys/velocity/Day.qml +++ b/examples/declarative/toys/corkboards/Day.qml diff --git a/examples/declarative/toys/velocity/cork.jpg b/examples/declarative/toys/corkboards/cork.jpg Binary files differindex 160bc00..160bc00 100644 --- a/examples/declarative/toys/velocity/cork.jpg +++ b/examples/declarative/toys/corkboards/cork.jpg diff --git a/examples/declarative/toys/velocity/velocity.qml b/examples/declarative/toys/corkboards/corkboards.qml index 871bafc..871bafc 100644 --- a/examples/declarative/toys/velocity/velocity.qml +++ b/examples/declarative/toys/corkboards/corkboards.qml diff --git a/examples/declarative/cppextensions/proxywidgets/proxywidgets.qmlproject b/examples/declarative/toys/corkboards/corkboards.qmlproject index d4909f8..d4909f8 100644 --- a/examples/declarative/cppextensions/proxywidgets/proxywidgets.qmlproject +++ b/examples/declarative/toys/corkboards/corkboards.qmlproject diff --git a/examples/declarative/toys/velocity/note-yellow.png b/examples/declarative/toys/corkboards/note-yellow.png Binary files differindex 8ddecc8..8ddecc8 100644 --- a/examples/declarative/toys/velocity/note-yellow.png +++ b/examples/declarative/toys/corkboards/note-yellow.png diff --git a/examples/declarative/toys/velocity/tack.png b/examples/declarative/toys/corkboards/tack.png Binary files differindex cef2d1c..cef2d1c 100644 --- a/examples/declarative/toys/velocity/tack.png +++ b/examples/declarative/toys/corkboards/tack.png diff --git a/examples/declarative/toys/dynamic/dynamic.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml index 52c7c1e..52c7c1e 100644 --- a/examples/declarative/toys/dynamic/dynamic.qml +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qmlproject b/examples/declarative/toys/dynamicscene/dynamicscene.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/toys/dynamic/images/NOTE b/examples/declarative/toys/dynamicscene/images/NOTE index fcd87f9..fcd87f9 100644 --- a/examples/declarative/toys/dynamic/images/NOTE +++ b/examples/declarative/toys/dynamicscene/images/NOTE diff --git a/examples/declarative/toys/dynamic/images/face-smile.png b/examples/declarative/toys/dynamicscene/images/face-smile.png Binary files differindex 3d66d72..3d66d72 100644 --- a/examples/declarative/toys/dynamic/images/face-smile.png +++ b/examples/declarative/toys/dynamicscene/images/face-smile.png diff --git a/examples/declarative/toys/dynamic/images/moon.png b/examples/declarative/toys/dynamicscene/images/moon.png Binary files differindex 1c0d606..1c0d606 100644 --- a/examples/declarative/toys/dynamic/images/moon.png +++ b/examples/declarative/toys/dynamicscene/images/moon.png diff --git a/examples/declarative/toys/dynamic/images/rabbit_brown.png b/examples/declarative/toys/dynamicscene/images/rabbit_brown.png Binary files differindex ebfdeed..ebfdeed 100644 --- a/examples/declarative/toys/dynamic/images/rabbit_brown.png +++ b/examples/declarative/toys/dynamicscene/images/rabbit_brown.png diff --git a/examples/declarative/toys/dynamic/images/rabbit_bw.png b/examples/declarative/toys/dynamicscene/images/rabbit_bw.png Binary files differindex 7bff9b9..7bff9b9 100644 --- a/examples/declarative/toys/dynamic/images/rabbit_bw.png +++ b/examples/declarative/toys/dynamicscene/images/rabbit_bw.png diff --git a/examples/declarative/toys/dynamic/images/star.png b/examples/declarative/toys/dynamicscene/images/star.png Binary files differindex 27ef924..27ef924 100644 --- a/examples/declarative/toys/dynamic/images/star.png +++ b/examples/declarative/toys/dynamicscene/images/star.png diff --git a/examples/declarative/toys/dynamic/images/sun.png b/examples/declarative/toys/dynamicscene/images/sun.png Binary files differindex 7713ca5..7713ca5 100644 --- a/examples/declarative/toys/dynamic/images/sun.png +++ b/examples/declarative/toys/dynamicscene/images/sun.png diff --git a/examples/declarative/toys/dynamic/images/tree_s.png b/examples/declarative/toys/dynamicscene/images/tree_s.png Binary files differindex 6eac35a..6eac35a 100644 --- a/examples/declarative/toys/dynamic/images/tree_s.png +++ b/examples/declarative/toys/dynamicscene/images/tree_s.png diff --git a/examples/declarative/toys/dynamic/qml/Button.qml b/examples/declarative/toys/dynamicscene/qml/Button.qml index 963a850..963a850 100644 --- a/examples/declarative/toys/dynamic/qml/Button.qml +++ b/examples/declarative/toys/dynamicscene/qml/Button.qml diff --git a/examples/declarative/toys/dynamic/qml/PaletteItem.qml b/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml index dcb5cc3..dcb5cc3 100644 --- a/examples/declarative/toys/dynamic/qml/PaletteItem.qml +++ b/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml diff --git a/examples/declarative/toys/dynamic/qml/PerspectiveItem.qml b/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml index c04d3dc..c04d3dc 100644 --- a/examples/declarative/toys/dynamic/qml/PerspectiveItem.qml +++ b/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml diff --git a/examples/declarative/toys/dynamic/qml/Sun.qml b/examples/declarative/toys/dynamicscene/qml/Sun.qml index 43dcb9a..43dcb9a 100644 --- a/examples/declarative/toys/dynamic/qml/Sun.qml +++ b/examples/declarative/toys/dynamicscene/qml/Sun.qml diff --git a/examples/declarative/toys/dynamic/qml/itemCreation.js b/examples/declarative/toys/dynamicscene/qml/itemCreation.js index 59750f3..59750f3 100644 --- a/examples/declarative/toys/dynamic/qml/itemCreation.js +++ b/examples/declarative/toys/dynamicscene/qml/itemCreation.js diff --git a/examples/graphicsview/padnavigator/padnavigator.h b/examples/graphicsview/padnavigator/padnavigator.h index 03a1ea2..d9298ae 100644 --- a/examples/graphicsview/padnavigator/padnavigator.h +++ b/examples/graphicsview/padnavigator/padnavigator.h @@ -45,10 +45,14 @@ #include <QGraphicsView> #include "ui_form.h" +QT_BEGIN_NAMESPACE + class QState; class QStateMachine; class Ui_Form; +QT_END_NAMESPACE + //! [0] class PadNavigator : public QGraphicsView { diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index b1f4f1b..c121a2d 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -23,9 +23,9 @@ The QDeclarativeExpression constructor has changed from to QDeclarativeExpression(context, scope, expression, parent = 0) -QML Launcher +QML Viewer ------------ -The standalone executable has been renamed to qml launcher. Runtime warnings +The standalone qml executable has been renamed back to Qml Viewer. Runtime warnings can be now accessed via the menu (Debugging->Show Warnings). ============================================================================= diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index cbdfd87..4995baf 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -81,8 +81,12 @@ void QDeclarativeLoaderPrivate::clear() // We can't delete immediately because our item may have triggered // the Loader to load a different item. - item->setVisible(false); - item->setParentItem(0); + if (item->scene()) { + item->scene()->removeItem(item); + } else { + item->setParentItem(0); + item->setVisible(false); + } item->deleteLater(); item = 0; } @@ -366,6 +370,7 @@ QDeclarativeLoader::Status QDeclarativeLoader::status() const void QDeclarativeLoader::componentComplete() { + QDeclarativeItem::componentComplete(); if (status() == Ready) emit loaded(); } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 19c12ff..b5bf972 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -180,7 +180,7 @@ bool QDeclarativeCompiler::isSignalPropertyName(const QByteArray &name) bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, QDeclarativeParser::Value *v) { - QString string = v->value.asScript(); + QString string = v->value.asString(); if (!prop.isWritable()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); @@ -207,31 +207,31 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, break; case QVariant::UInt: { - bool ok; - string.toUInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected")); + bool ok = v->value.isNumber(); + if (ok) { + double n = v->value.asNumber(); + if (double(uint(n)) != n) + ok = false; + } + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected")); } break; case QVariant::Int: { - bool ok; - string.toInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected")); + bool ok = v->value.isNumber(); + if (ok) { + double n = v->value.asNumber(); + if (double(int(n)) != n) + ok = false; + } + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected")); } break; case QMetaType::Float: - { - bool ok; - string.toFloat(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected")); - } + if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected")); break; case QVariant::Double: - { - bool ok; - string.toDouble(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected")); - } + if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected")); break; case QVariant::Color: { @@ -319,7 +319,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, QDeclarativeParser::Value *v) { - QString string = v->value.asScript(); + QString string = v->value.asString(); QDeclarativeInstruction instr; instr.line = v->location.start.line; @@ -382,28 +382,28 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, { instr.type = QDeclarativeInstruction::StoreInteger; instr.storeInteger.propertyIndex = prop.propertyIndex(); - instr.storeInteger.value = string.toUInt(); + instr.storeInteger.value = uint(v->value.asNumber()); } break; case QVariant::Int: { instr.type = QDeclarativeInstruction::StoreInteger; instr.storeInteger.propertyIndex = prop.propertyIndex(); - instr.storeInteger.value = string.toInt(); + instr.storeInteger.value = int(v->value.asNumber()); } break; case QMetaType::Float: { instr.type = QDeclarativeInstruction::StoreFloat; instr.storeFloat.propertyIndex = prop.propertyIndex(); - instr.storeFloat.value = string.toFloat(); + instr.storeFloat.value = float(v->value.asNumber()); } break; case QVariant::Double: { instr.type = QDeclarativeInstruction::StoreDouble; instr.storeDouble.propertyIndex = prop.propertyIndex(); - instr.storeDouble.value = string.toDouble(); + instr.storeDouble.value = v->value.asNumber(); } break; case QVariant::Color: @@ -1187,7 +1187,7 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, if (idProp) { if (idProp->value || idProp->values.count() > 1 || idProp->values.at(0)->object) COMPILE_EXCEPTION(idProp, tr("Invalid component id specification")); - COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive())); + COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive())) QString idVal = idProp->values.first()->primitive(); @@ -1316,6 +1316,9 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl } else { prop->values.at(0)->type = Value::SignalExpression; + if (!prop->values.at(0)->value.isScript()) + COMPILE_EXCEPTION(prop, tr("Cannot assign a value to a signal (expecting a script to be run)")); + QString script = prop->values.at(0)->value.asScript().trimmed(); if (script.isEmpty()) COMPILE_EXCEPTION(prop, tr("Empty signal assignment")); diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 531ac97..0b1c17d 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -91,6 +91,7 @@ class QDeclarativeEngine; class QDeclarativeContextPrivate; class QDeclarativeExpression; class QDeclarativeContextScriptClass; +class QDeclarativeImportDatabase; class QDeclarativeObjectScriptClass; class QDeclarativeTypeNameScriptClass; class QDeclarativeValueTypeScriptClass; diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 619264a..e37b68b 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -140,6 +140,7 @@ void QDeclarativeInclude::finished() scriptContext->pushScope(m_scope[1]); scriptContext->setActivationObject(m_scope[1]); + QDeclarativeScriptParser::extractPragmas(code); m_scriptEngine->evaluate(code, urlString, 1); @@ -230,6 +231,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -5); scriptContext->pushScope(scope); scriptContext->setActivationObject(scope); + QDeclarativeScriptParser::extractPragmas(code); engine->evaluate(code, urlString, 1); @@ -291,6 +293,7 @@ QScriptValue QDeclarativeInclude::worker_include(QScriptContext *ctxt, QScriptEn QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -4); scriptContext->pushScope(scope); scriptContext->setActivationObject(scope); + QDeclarativeScriptParser::extractPragmas(code); engine->evaluate(code, urlString, 1); diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index b38bd76..8d00ef8 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -57,6 +57,7 @@ #include <QPointF> #include <QSizeF> #include <QRectF> +#include <QStringBuilder> #include <QtDebug> QT_BEGIN_NAMESPACE @@ -310,6 +311,49 @@ double QDeclarativeParser::Variant::asNumber() const return d; } +//reverse of Lexer::singleEscape() +QString escapedString(const QString &string) +{ + QString tmp = QLatin1String("\""); + for (int i = 0; i < string.length(); ++i) { + const QChar &c = string.at(i); + switch(c.unicode()) { + case 0x08: + tmp += QLatin1String("\\b"); + break; + case 0x09: + tmp += QLatin1String("\\t"); + break; + case 0x0A: + tmp += QLatin1String("\\n"); + break; + case 0x0B: + tmp += QLatin1String("\\v"); + break; + case 0x0C: + tmp += QLatin1String("\\f"); + break; + case 0x0D: + tmp += QLatin1String("\\r"); + break; + case 0x22: + tmp += QLatin1String("\\\""); + break; + case 0x27: + tmp += QLatin1String("\\\'"); + break; + case 0x5C: + tmp += QLatin1String("\\\\"); + break; + default: + tmp += c; + break; + } + } + tmp += QLatin1Char('\"'); + return tmp; +} + QString QDeclarativeParser::Variant::asScript() const { switch(type()) { @@ -324,6 +368,7 @@ QString QDeclarativeParser::Variant::asScript() const else return s; case String: + return escapedString(s); case Script: return s; } diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index 25777f5..d192f3a 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -307,8 +307,8 @@ namespace QDeclarativeParser }; Type type; - // ### Temporary - QString primitive() const { return value.asScript(); } + // ### Temporary (for id only) + QString primitive() const { return value.isString() ? value.asString() : value.asScript(); } // Primitive value Variant value; diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 4b687a9..8182998 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -527,7 +527,7 @@ void QDeclarativeWorkerScriptEngine::run() \snippet doc/src/snippets/declarative/workerscript.qml 0 The above worker script specifies a javascript file, "script.js", that handles - the operations to be performed in the new thread: + the operations to be performed in the new thread. Here is \c script.js: \qml WorkerScript.onMessage = function(message) { @@ -538,7 +538,7 @@ void QDeclarativeWorkerScriptEngine::run() When the user clicks anywhere within the rectangle, \c sendMessage() is called, triggering the \tt WorkerScript.onMessage() handler in - \tt source.js. This in turn sends a reply message that is then received + \tt script.js. This in turn sends a reply message that is then received by the \tt onMessage() handler of \tt myWorker. */ QDeclarativeWorkerScript::QDeclarativeWorkerScript(QObject *parent) diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 0a75edf..6a7383a 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -45,6 +45,8 @@ #include <QDebug> #include <qdeclarativecontext.h> +QT_BEGIN_NAMESPACE + class QDeclarativeFolderListModelPrivate { public: @@ -396,3 +398,4 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on) } //![code] +QT_END_NAMESPACE diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h index 87141c5..ea7d701 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h @@ -47,6 +47,12 @@ #include <QUrl> #include <QAbstractListModel> +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + class QDeclarativeContext; class QModelIndex; @@ -138,8 +144,12 @@ private: }; //![class end] +QT_END_NAMESPACE + //![qml decl] QML_DECLARE_TYPE(QDeclarativeFolderListModel) //![qml decl] +QT_END_HEADER + #endif // QDECLARATIVEFOLDERLISTMODEL_H diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml new file mode 100644 index 0000000..67b8cfd --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml @@ -0,0 +1,11 @@ +import Qt 4.7 +import "include_pragma_outer.js" as Script + +Item { + property int test1 + + Component.onCompleted: { + test1 = Script.callFunction() + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js new file mode 100644 index 0000000..a0380a2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js @@ -0,0 +1,5 @@ +.pragma library + +function getValue() { + return 100; +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js new file mode 100644 index 0000000..d87bafc --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js @@ -0,0 +1,6 @@ +Qt.include("include_pragma_inner.js") + +function callFunction() { + return getValue(); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 0710e15..9a88237 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2424,6 +2424,17 @@ void tst_qdeclarativeecmascript::include() delete o; } + // Including file with ".pragma library" + { + QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml")); + qDebug() << "errors:" << component.errorsString(); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").toInt(), 100); + + delete o; + } + // Remote - success { TestHTTPServer server(8111); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt new file mode 100644 index 0000000..eb1430a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign a value to a signal (expecting a script to be run) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml index c84fea3..6fa1259 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml @@ -1,7 +1,6 @@ import Test 1.0 MyQmlObject { - onBasicSignal { - } + onBasicSignal: "hello world" } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt deleted file mode 100644 index 8b20434..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt +++ /dev/null @@ -1 +0,0 @@ -4:5:Incorrectly specified signal assignment diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt index 353bbf5..8b20434 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt @@ -1 +1 @@ -4:5:Empty signal assignment +4:5:Incorrectly specified signal assignment diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml index 4c5a122..c84fea3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml @@ -1,6 +1,7 @@ import Test 1.0 MyQmlObject { - onBasicSignal: " " + onBasicSignal { + } } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml index 0de3667..c42da2b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - scriptProperty: "hello world" + scriptProperty: "hello\n\"world\"" } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index b72c75f..200f016 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -351,8 +351,8 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAttachedProperty.12") << "invalidAttachedProperty.12.qml" << "invalidAttachedProperty.12.errors.txt" << false; QTest::newRow("invalidAttachedProperty.13") << "invalidAttachedProperty.13.qml" << "invalidAttachedProperty.13.errors.txt" << false; + QTest::newRow("assignValueToSignal") << "assignValueToSignal.qml" << "assignValueToSignal.errors.txt" << false; QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false; - QTest::newRow("emptySignal.2") << "emptySignal.2.qml" << "emptySignal.2.errors.txt" << false; QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false; QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; @@ -1127,8 +1127,7 @@ void tst_qdeclarativelanguage::scriptString() MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); QVERIFY(object != 0); - QEXPECT_FAIL("", "Variant.asScript() returns incorrect value for string (bug pending)", Continue); - QCOMPARE(object->scriptProperty().script(), QString("\"hello world\"")); + QCOMPARE(object->scriptProperty().script(), QString("\"hello\\n\\\"world\\\"\"")); } { diff --git a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml new file mode 100644 index 0000000..5d02dae --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Rectangle { + width: 300 + height: 200 + color: "blue" + Loader { + objectName: "loader" + anchors.fill: parent + sourceComponent: Component { + Rectangle { color: "red"; objectName: "sourceElement" } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 59580ea..11cc61b 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -78,6 +78,7 @@ private slots: void clear(); void urlToComponent(); void componentToUrl(); + void anchoredLoader(); void sizeLoaderToItem(); void sizeItemToLoader(); void noResize(); @@ -266,6 +267,27 @@ void tst_QDeclarativeLoader::componentToUrl() delete item; } +void tst_QDeclarativeLoader::anchoredLoader() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/AnchoredLoader.qml")); + QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(rootItem != 0); + QDeclarativeItem *loader = rootItem->findChild<QDeclarativeItem*>("loader"); + QDeclarativeItem *sourceElement = rootItem->findChild<QDeclarativeItem*>("sourceElement"); + + QVERIFY(loader != 0); + QVERIFY(sourceElement != 0); + + QCOMPARE(rootItem->width(), 300.0); + QCOMPARE(rootItem->height(), 200.0); + + QCOMPARE(loader->width(), 300.0); + QCOMPARE(loader->height(), 200.0); + + QCOMPARE(sourceElement->width(), 300.0); + QCOMPARE(sourceElement->height(), 200.0); +} + void tst_QDeclarativeLoader::sizeLoaderToItem() { QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml")); diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 2359479..131fb85 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -565,6 +565,7 @@ void CentralWidget::connectSignals() SIGNAL(highlighted(QString))); connect(viewer, SIGNAL(sourceChanged(QUrl)), this, SLOT(setTabTitle(QUrl))); + connect(viewer, SIGNAL(printRequested()), this, SLOT(print())); } } diff --git a/tools/assistant/tools/assistant/contentwindow.cpp b/tools/assistant/tools/assistant/contentwindow.cpp index e0347c8..8afa1df 100644 --- a/tools/assistant/tools/assistant/contentwindow.cpp +++ b/tools/assistant/tools/assistant/contentwindow.cpp @@ -133,11 +133,13 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e) if (m_contentWidget && o == m_contentWidget->viewport() && e->type() == QEvent::MouseButtonRelease) { QMouseEvent *me = static_cast<QMouseEvent*>(e); - QModelIndex index = m_contentWidget->indexAt(me->pos()); - QItemSelectionModel *sm = m_contentWidget->selectionModel(); + const QModelIndex &index = m_contentWidget->indexAt(me->pos()); + if (!index.isValid()) + return QWidget::eventFilter(o, e); - Qt::MouseButtons button = me->button(); - if (index.isValid() && (sm && sm->isSelected(index))) { + const Qt::MouseButtons button = me->button(); + QItemSelectionModel *sm = m_contentWidget->selectionModel(); + if (sm->isSelected(index)) { if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier)) || (button == Qt::MidButton)) { QHelpContentModel *contentModel = @@ -189,9 +191,11 @@ void ContentWindow::itemClicked(const QModelIndex &index) qobject_cast<QHelpContentModel*>(m_contentWidget->model()); if (contentModel) { - QHelpContentItem *itm = contentModel->contentItemAt(index); - if (itm) - emit linkActivated(itm->url()); + if (QHelpContentItem *itm = contentModel->contentItemAt(index)) { + const QUrl &url = itm->url(); + if (url != CentralWidget::instance()->currentSource()) + emit linkActivated(url); + } } } diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index adaa45b..244d091 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -269,6 +269,7 @@ HelpViewer::HelpViewer(CentralWidget *parent, qreal zoom) SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); + connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); setFont(viewerFont()); setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index a2c0389..2577828 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -100,6 +100,7 @@ Q_SIGNALS: void backwardAvailable(bool enabled); void highlighted(const QString &); void sourceChanged(const QUrl &); + void printRequested(); protected: virtual void wheelEvent(QWheelEvent *); diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index e7a1dbc..510a8b3 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -18,7 +18,7 @@ macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" macro.QD = "\\e{Qt Designer}" macro.QL = "\\e{Qt Linguist}" -macro.QQL = "\\e{Qt QML Launcher}" +macro.QQV = "\\e{Qt QML Viewer}" macro.param = "\\e" macro.raisedaster.HTML = "<sup>*</sup>" macro.rarrow.HTML = "→" diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index fe7ad9c..7238203 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -13,12 +13,12 @@ Rectangle { FolderListModel { id: folders1 nameFilters: [ "*.qml" ] - folder: qmlLauncherFolder + folder: qmlViewerFolder } FolderListModel { id: folders2 nameFilters: [ "*.qml" ] - folder: qmlLauncherFolder + folder: qmlViewerFolder } SystemPalette { id: palette } @@ -63,7 +63,7 @@ Rectangle { if (folders.isFolder(index)) { down(filePath); } else { - qmlLauncher.launch(filePath); + qmlViewer.launch(filePath); } } width: root.width diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 18e2531..22fc5ca 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -85,7 +85,7 @@ QString warnings; void showWarnings() { if (!warnings.isEmpty()) { - QMessageBox::warning(0, QApplication::tr("Qt QML Launcher"), warnings); + QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); } } @@ -117,7 +117,7 @@ void usage() qWarning(" -frameless ............................... run with no window frame"); qWarning(" -maximized................................ run maximized"); qWarning(" -fullscreen............................... run fullscreen"); - qWarning(" -stayontop................................ keep launcher window on top"); + qWarning(" -stayontop................................ keep viewer window on top"); 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"); @@ -156,9 +156,9 @@ void scriptOptsUsage() qWarning(" testerror ................................ test 'error' property of root item on playback"); qWarning(" snapshot ................................. file being recorded is static,"); qWarning(" only one frame will be recorded or tested"); - qWarning(" exitoncomplete ........................... cleanly exit the launcher on script completion"); - qWarning(" exitonfailure ............................ immediately exit the launcher on script failure"); - qWarning(" saveonexit ............................... save recording on launcher exit"); + qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion"); + qWarning(" exitonfailure ............................ immediately exit the viewer on script failure"); + qWarning(" saveonexit ............................... save recording on viewer exit"); qWarning(" "); qWarning(" One of record, play or both must be specified."); exit(1); @@ -196,7 +196,7 @@ int main(int argc, char ** argv) #endif QApplication app(argc, argv); - app.setApplicationName("QtQmlLauncher"); + app.setApplicationName("QtQmlViewer"); app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); @@ -277,7 +277,7 @@ int main(int argc, char ** argv) if (lastArg) usage(); app.setStartDragDistance(QString(argv[++i]).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { - qWarning("Qt QML Launcher version %s", QT_VERSION_STR); + qWarning("Qt QML Viewer version %s", QT_VERSION_STR); exit(0); } else if (arg == "-translation") { if (lastArg) usage(); diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 6129639..886f0d9 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -37,6 +37,6 @@ symbian { } mac { QMAKE_INFO_PLIST=Info_mac.plist - TARGET="QML Launcher" + TARGET=QMLViewer ICON=qml.icns } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 490fa34..8df250f 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -350,7 +350,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) setupProxy(manager); if (cacheSize > 0) { QNetworkDiskCache *cache = new QNetworkDiskCache; - cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-launcher-network-cache")); + cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); cache->setMaximumCacheSize(cacheSize); manager->setCache(cache); } else { @@ -388,7 +388,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) , translator(0) { QDeclarativeViewer::registerTypes(); - setWindowTitle(tr("Qt QML Launcher")); + setWindowTitle(tr("Qt QML Viewer")); devicemode = false; canvas = 0; @@ -887,7 +887,7 @@ bool QDeclarativeViewer::open(const QString& file_or_url) url = QUrl::fromLocalFile(fi.absoluteFilePath()); else url = QUrl(file_or_url); - setWindowTitle(tr("%1 - Qt QML Launcher").arg(file_or_url)); + setWindowTitle(tr("%1 - Qt QML Viewer").arg(file_or_url)); if (!m_script.isEmpty()) tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); @@ -895,11 +895,11 @@ bool QDeclarativeViewer::open(const QString& file_or_url) delete canvas->rootObject(); canvas->engine()->clearComponentCache(); QDeclarativeContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("qmlLauncher", this); + ctxt->setContextProperty("qmlViewer", this); #ifdef Q_OS_SYMBIAN - ctxt->setContextProperty("qmlLauncherFolder", "E:\\"); // Documents on your S60 phone + ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone #else - ctxt->setContextProperty("qmlLauncherFolder", QDir::currentPath()); + ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); #endif ctxt->setContextProperty("runtime", Runtime::instance()); |