diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-13 00:50:44 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-13 00:50:44 (GMT) |
commit | 50711dd7aa22052eff58431d9f4e95e1a688047e (patch) | |
tree | 748ba00ade4cb880739dd88990b5c827b312296a /doc/src | |
parent | 47760d59d57f548d5816ae43e456c86e01146491 (diff) | |
parent | d45c45432ccd0a74c67e70ce5fc3a09f35923c26 (diff) | |
download | Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.zip Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.tar.gz Qt-50711dd7aa22052eff58431d9f4e95e1a688047e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (34 commits)
Fix TextEdit and TextInput input panel support for mode RSIP_OnMouseClickAndAlreadyFocused
Fix for graphics widget in the background stealing declarative item's focus
Fix broken benchmarks.
Possibly fix autotest
Correctly assign bool to variant properties
Improve Image docs. Move all fillMode image examples to fillMode
Flickable small API changes.
Reset the dragDropItem to 0 when the item dies while dragging on top it.
Avoid warning (and possible future crash) upon reload.
Don't pass sequential (QNetworkReply) to image reader, it doesn't work well enough.
Stop GIF handler claiming it can report Size for sequential devices,
Use raster graphicssystem for qml.app on OS X.
Add missing test, qdeclarativelayoutitem, to declarative.pro
Sorted the tests list in declarative.pro
Bail out early if the same target value is reassigned to a Behavior.
Correctly position any input method popups for TextInput.
Correctly resize TextInput in the presence of preedit text.
Apply signal handler changes immediately.
Remove unused image
Qt.widgets was removed, point to graphics layouts example
...
Diffstat (limited to 'doc/src')
27 files changed, 36 insertions, 270 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 8f95190..47504ae 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -105,7 +105,7 @@ is the \l SystemPalette item. This provides access to the Qt system palette and is used to give the button a more native look-and-feel. Notice the anchors for the \c Item, \c Button and \c Text elements are set using -\l {codingconventions.html#Grouped-properties}{group notation} for readability. +\l {qdeclarativeintroduction.html#dot-properties}{group notation} for readability. \section2 Adding \c Button and \c Block components diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index d0f873d..4fa7d0c 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -72,7 +72,6 @@ For example, a hypothetical \e photo QML object would look like this: \snippet doc/src/snippets/declarative/codingconventions/photo.qml 0 -\target Grouped properties \section1 Grouped properties If using multiple properties from a group of properties, diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc index 307162e..611dac1 100644 --- a/doc/src/declarative/extending-examples.qdoc +++ b/doc/src/declarative/extending-examples.qdoc @@ -64,8 +64,8 @@ element, the C++ class can be named differently, or appear in a namespace. The Person class implementation is quite basic. The property accessors simply return members of the object instance. -The implementation must also be registered using the QML_REGISTER_TYPE() macro. This macro -registers the Person class with QML as a type in the People library version 1.0, +The \c main.cpp file also calls the \c qmlRegisterType() function to +register the \c Person type with QML as a type in the People library version 1.0, and defines the mapping between the C++ and QML class names. \section1 Running the example @@ -159,9 +159,7 @@ directly - an explicit Boy or Girl should be instantiated instead. While we want to disallow instantiating Person from within QML, it still needs to be registered with the QML engine, so that it can be used as a property type -and other types can be coerced to it. To register a type, without defining a -named mapping into QML, we call the QML_REGISTER_NOCREATE_TYPE() macro instead of -the QML_REGISTER_TYPE() macro used previously. +and other types can be coerced to it. \section2 Define Boy and Girl diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 1c07f8e..972976f 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -110,51 +110,11 @@ of QML UIs: \section2 Loading QGraphicsWidget objects in QML An alternative approach is to expose your existing QGraphicsWidget objects to -QML and construct your scene in QML instead. To do this, you need to register -any custom C++ types and create a plugin that registers the custom types -so that they can be used from your QML file. +QML and construct your scene in QML instead. See the \l {declarative/layouts/graphicsLayouts}{graphics layouts example} +which shows how to expose Qt's graphics layout classes to QML in order +to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. -Here is an example. Suppose you have two classes, \c RedSquare and \c BlueCircle, -that both inherit from QGraphicsWidget: - -\c [graphicswidgets/redsquare.h] -\snippet doc/src/snippets/declarative/graphicswidgets/redsquare.h 0 - -\c [graphicswidgets/bluecircle.h] -\snippet doc/src/snippets/declarative/graphicswidgets/bluecircle.h 0 - -Then, create a plugin by subclassing QDeclarativeExtensionPlugin, and register the -types by calling qmlRegisterType(). Also export the plugin with Q_EXPORT_PLUGIN2. - -\c [graphicswidgets/shapesplugin.cpp] -\snippet doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp 0 - -Now write a project file that creates the plugin: - -\c [graphicswidgets/graphicswidgets.pro] -\quotefile doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro - -And add a \c qmldir file that includes the \c graphicswidgets plugin from the \c lib -subdirectory (as defined in the project file): - -\c [graphicswidgets/qmldir] -\quotefile doc/src/snippets/declarative/graphicswidgets/qmldir - -Now, we can write a QML file that uses the \c RedSquare and \c BlueCircle widgets. -(As an example, we can also create \c QGraphicsWidget items if we import the \c Qt.widgets -module.) - -\c [main.qml] -\quotefile doc/src/snippets/declarative/graphicswidgets/main.qml - -Here is a screenshot of the result: - -\image declarative-integrating-graphicswidgets.png - - -Note this approach of creating your graphics objects from QML does not work -with QGraphicsItems that are not QGraphicsObject-based, since they are not QObjects. - -See \l{Extending QML in C++} for further information on using C++ types. +To expose your existing QGraphicsWidget classes to QML, use \l {qmlRegisterType()}. +See \l{Extending QML in C++} for further information on using C++ types in QML. */ diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index a98c9e1..acf4ec9 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -60,10 +60,13 @@ technologies like HTML and CSS, but it's not required. QML looks like this: \code +import Qt 4.7 + Rectangle { width: 200 height: 200 - color: "white" + color: "blue" + Image { source: "pics/logo.png" anchors.centerIn: parent diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 9b706a1..788d417 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -143,6 +143,28 @@ ListView { } \endcode +It is also possible to manipulate the ListModel directly via JavaScript. +In this case, the first item inserted will determine the roles available +to any views using the model. For example, if an empty ListModel is +created and populated via JavaScript the roles provided by the first +insertion are the only roles that will be shown in the view: + +\code +Item { + ListModel { + id: fruitModel + } + MouseArea { + anchors.fill: parent + onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) + } +} +\endcode + +When the MouseArea is clicked fruitModel will have two roles, "cost" and "name". +Even if subsequent roles are added, only the first two will be handled by views +using the model. + \section2 XmlListModel diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 23c5c32..10aeac0 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -123,7 +123,7 @@ Such files can be created using \l{Qt Linguist}. - See \l{scripting.html#internationalization} for information about how to make + See the \l{scripting.html#internationalization}{Qt Internationalization} documentation for information about how to make the JavaScript in QML files use translatable strings. Additionally, the QML runtime will load translation files specified on the diff --git a/doc/src/images/declarative-image_fillMode.gif b/doc/src/images/declarative-image_fillMode.gif Binary files differdeleted file mode 100644 index eb0a9af..0000000 --- a/doc/src/images/declarative-image_fillMode.gif +++ /dev/null diff --git a/doc/src/images/declarative-integrating-graphicswidgets.png b/doc/src/images/declarative-integrating-graphicswidgets.png Binary files differdeleted file mode 100644 index d57f4b9..0000000 --- a/doc/src/images/declarative-integrating-graphicswidgets.png +++ /dev/null diff --git a/doc/src/images/declarative-qtlogo-preserveaspectcrop.png b/doc/src/images/declarative-qtlogo-preserveaspectcrop.png Binary files differnew file mode 100644 index 0000000..64fb086 --- /dev/null +++ b/doc/src/images/declarative-qtlogo-preserveaspectcrop.png diff --git a/doc/src/images/declarative-qtlogo-preserveaspectfit.png b/doc/src/images/declarative-qtlogo-preserveaspectfit.png Binary files differnew file mode 100644 index 0000000..2585fa5 --- /dev/null +++ b/doc/src/images/declarative-qtlogo-preserveaspectfit.png diff --git a/doc/src/images/declarative-qtlogo-stretch.png b/doc/src/images/declarative-qtlogo-stretch.png Binary files differnew file mode 100644 index 0000000..32a0114 --- /dev/null +++ b/doc/src/images/declarative-qtlogo-stretch.png diff --git a/doc/src/images/declarative-qtlogo-tile.png b/doc/src/images/declarative-qtlogo-tile.png Binary files differnew file mode 100644 index 0000000..7d1b9d0 --- /dev/null +++ b/doc/src/images/declarative-qtlogo-tile.png diff --git a/doc/src/images/declarative-qtlogo-tilehorizontally.png b/doc/src/images/declarative-qtlogo-tilehorizontally.png Binary files differnew file mode 100644 index 0000000..367a8c7 --- /dev/null +++ b/doc/src/images/declarative-qtlogo-tilehorizontally.png diff --git a/doc/src/images/declarative-qtlogo-tilevertically.png b/doc/src/images/declarative-qtlogo-tilevertically.png Binary files differnew file mode 100644 index 0000000..68afafa --- /dev/null +++ b/doc/src/images/declarative-qtlogo-tilevertically.png diff --git a/doc/src/images/declarative-qtlogo1.png b/doc/src/images/declarative-qtlogo.png Binary files differindex 940d159..940d159 100644 --- a/doc/src/images/declarative-qtlogo1.png +++ b/doc/src/images/declarative-qtlogo.png diff --git a/doc/src/images/declarative-qtlogo2.png b/doc/src/images/declarative-qtlogo2.png Binary files differdeleted file mode 100644 index b1d128a..0000000 --- a/doc/src/images/declarative-qtlogo2.png +++ /dev/null diff --git a/doc/src/images/declarative-qtlogo3.png b/doc/src/images/declarative-qtlogo3.png Binary files differdeleted file mode 100644 index d516524..0000000 --- a/doc/src/images/declarative-qtlogo3.png +++ /dev/null diff --git a/doc/src/images/declarative-qtlogo4.png b/doc/src/images/declarative-qtlogo4.png Binary files differdeleted file mode 100644 index 7c8aa64..0000000 --- a/doc/src/images/declarative-qtlogo4.png +++ /dev/null diff --git a/doc/src/images/declarative-qtlogo5.png b/doc/src/images/declarative-qtlogo5.png Binary files differdeleted file mode 100644 index b7b3513..0000000 --- a/doc/src/images/declarative-qtlogo5.png +++ /dev/null diff --git a/doc/src/images/declarative-qtlogo6.png b/doc/src/images/declarative-qtlogo6.png Binary files differdeleted file mode 100644 index 07a078f..0000000 --- a/doc/src/images/declarative-qtlogo6.png +++ /dev/null diff --git a/doc/src/snippets/declarative/graphicswidgets/bluecircle.h b/doc/src/snippets/declarative/graphicswidgets/bluecircle.h deleted file mode 100644 index 73d66b7..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/bluecircle.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -//![0] -#include <QGraphicsWidget> -#include <QPainter> - -class BlueCircle : public QGraphicsWidget -{ - Q_OBJECT -public: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) - { - painter->setPen(QColor(Qt::blue)); - painter->drawEllipse(0, 0, size().width(), size().height()); - } -}; -//![0] diff --git a/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro b/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro deleted file mode 100644 index 21c8a37..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -HEADERS += redsquare.h \ - bluecircle.h - -SOURCES += shapesplugin.cpp - -DESTDIR = lib -OBJECTS_DIR = tmp -MOC_DIR = tmp - diff --git a/doc/src/snippets/declarative/graphicswidgets/main.qml b/doc/src/snippets/declarative/graphicswidgets/main.qml deleted file mode 100644 index ffcf79d..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/main.qml +++ /dev/null @@ -1,32 +0,0 @@ -import Qt 4.7 -import Qt.widgets 4.7 - -Rectangle { - width: 200 - height: 200 - - RedSquare { - id: square - width: 80 - height: 80 - } - - BlueCircle { - anchors.left: square.right - width: 80 - height: 80 - } - - QGraphicsWidget { - anchors.top: square.bottom - size.width: 80 - size.height: 80 - layout: QGraphicsLinearLayout { - LayoutItem { - preferredSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - } - } -} - diff --git a/doc/src/snippets/declarative/graphicswidgets/qmldir b/doc/src/snippets/declarative/graphicswidgets/qmldir deleted file mode 100644 index f94dad2..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin graphicswidgets lib diff --git a/doc/src/snippets/declarative/graphicswidgets/redsquare.h b/doc/src/snippets/declarative/graphicswidgets/redsquare.h deleted file mode 100644 index 3050662..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/redsquare.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -//![0] -#include <QGraphicsWidget> -#include <QPainter> - -class RedSquare : public QGraphicsWidget -{ - Q_OBJECT -public: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) - { - painter->fillRect(0, 0, size().width(), size().height(), QColor(Qt::red)); - } -}; -//![0] diff --git a/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp b/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp deleted file mode 100644 index 4c18ef3..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ -//![0] -#include "redsquare.h" -#include "bluecircle.h" - -#include <QtDeclarative/QDeclarativeExtensionPlugin> -#include <QtDeclarative/qdeclarative.h> - -class ShapesPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - void registerTypes(const char *uri) { - qmlRegisterType<RedSquare>(uri, 1, 0, "RedSquare"); - qmlRegisterType<BlueCircle>(uri, 1, 0, "BlueCircle"); - } -}; - -#include "shapesplugin.moc" - -Q_EXPORT_PLUGIN2(shapesplugin, ShapesPlugin); -//![0] |