Source

Target

Commits (52)
Showing with 86 additions and 53 deletions
...@@ -35,10 +35,19 @@ Third party components ...@@ -35,10 +35,19 @@ Third party components
- A Window declared nested inside another Item or Window automatically - A Window declared nested inside another Item or Window automatically
becomes transient for (centered upon) its parent's window, if x and y becomes transient for (centered upon) its parent's window, if x and y
were not explicitly specified were not explicitly specified
- The resources property of Item is now its own property independent
of QObject. It no longer returns all QObject children, or explicitly
sets QObject parent. The resources property now behaves as documented.
- As part of a fix for QTBUG-30555, ListView and GridView properties, such
as count, which are based off of the data model will no longer update
immediately if queried. Updates are batched to happen once per frame (or
when properties are being set).
**************************************************************************** ****************************************************************************
* Library * * Library *
**************************************************************************** ****************************************************************************
- QTBUG-30837: The Flickable type no longer fixes up the content area on
startup to move it inside the viewport.
**************************************************************************** ****************************************************************************
......
...@@ -93,11 +93,11 @@ The class contains a member to store the celebrant object, and also a ...@@ -93,11 +93,11 @@ The class contains a member to store the celebrant object, and also a
QList<Person *> member. QList<Person *> member.
In QML, the type of a list properties - and the guests property is a list of In QML, the type of a list properties - and the guests property is a list of
people - are all of type QDeclarativeListProperty<T>. QDeclarativeListProperty is simple value people - are all of type QQmlListProperty<T>. QQmlListProperty is simple value
type that contains a set of function pointers. QML calls these function type that contains a set of function pointers. QML calls these function
pointers whenever it needs to read from, write to or otherwise interact with pointers whenever it needs to read from, write to or otherwise interact with
the list. In addition to concrete lists like the people list used in this the list. In addition to concrete lists like the people list used in this
example, the use of QDeclarativeListProperty allows for "virtual lists" and other advanced example, the use of QQmlListProperty allows for "virtual lists" and other advanced
scenarios. scenarios.
\section2 Define the BirthdayParty \section2 Define the BirthdayParty
......
...@@ -40,13 +40,12 @@ ...@@ -40,13 +40,12 @@
import QtQuick 2.0 import QtQuick 2.0
Row { Item {
id: button id: button
property alias text: txt.text property alias text: txt.text
property bool buttonEnabled: true property bool buttonEnabled: true
width: 140 width: 140
height: 25 height: 25
spacing: 5
x: 5 x: 5
MouseArea { MouseArea {
id: mouse id: mouse
...@@ -75,14 +74,14 @@ Row { ...@@ -75,14 +74,14 @@ Row {
radius: 1 radius: 1
color: mouse.pressed || buttonEnabled ? "#76644A" : "transparent" color: mouse.pressed || buttonEnabled ? "#76644A" : "transparent"
} }
Text { }
id: txt Text {
anchors.left: checkbox.right id: txt
anchors.leftMargin: 4 anchors.left: checkbox.right
anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: 4
text: "Close " anchors.verticalCenter: parent.verticalCenter
color: "#ecc089" text: "Close "
font.pixelSize: 18 color: "#ecc089"
} font.pixelSize: 18
} }
} }
...@@ -88,7 +88,6 @@ Rectangle { ...@@ -88,7 +88,6 @@ Rectangle {
anchors.leftMargin: 30 anchors.leftMargin: 30
anchors.top: startDateText.bottom anchors.top: startDateText.bottom
anchors.topMargin: 8 anchors.topMargin: 8
date: new Date(1995, 3, 25)
} }
Text { Text {
...@@ -212,4 +211,6 @@ Rectangle { ...@@ -212,4 +211,6 @@ Rectangle {
onClicked: root.chartType = "all" onClicked: root.chartType = "all"
} }
} }
Component.onCompleted: startDatePicker.date = new Date(1995, 3, 25)
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
** **
** This file is part of the documentation of the Qt Toolkit. ** This file is part of the examples of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows: ** You may use this file under the terms of the BSD license as follows:
...@@ -38,24 +38,12 @@ ...@@ -38,24 +38,12 @@
** **
****************************************************************************/ ****************************************************************************/
//![0]
import QtQuick 2.0 import QtQuick 2.0
import Qt.labs.folderlistmodel 1.0
ListView { Text {
width: 200; height: 400 width: 400
height: 100
FolderListModel { text: 'Platform does not support threaded OpenGL needed by this example.'
id: folderModel verticalAlignment: Text.AlignVCenter
nameFilters: ["*.qml"] horizontalAlignment: Text.AlignHCenter
}
Component {
id: fileDelegate
Text { text: fileName }
}
model: folderModel
delegate: fileDelegate
} }
//![0]
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtQuick/QQuickView> #include <QtQuick/QQuickView>
#include "threadrenderer.h" #include "threadrenderer.h"
...@@ -50,6 +53,13 @@ int main(int argc, char **argv) ...@@ -50,6 +53,13 @@ int main(int argc, char **argv)
{ {
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) {
QQuickView view;
view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml"));
view.show();
return app.exec();
}
qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer"); qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer");
int execReturn = 0; int execReturn = 0;
...@@ -63,7 +73,7 @@ int main(int argc, char **argv) ...@@ -63,7 +73,7 @@ int main(int argc, char **argv)
view.setPersistentSceneGraph(true); view.setPersistentSceneGraph(true);
view.setResizeMode(QQuickView::SizeRootObjectToView); view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml")); view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml"));
view.show(); view.show();
execReturn = app.exec(); execReturn = app.exec();
......
QT += quick QT += quick
# To make threaded gl check...
QT += core-private gui-private
HEADERS += threadrenderer.h HEADERS += threadrenderer.h
SOURCES += threadrenderer.cpp main.cpp SOURCES += threadrenderer.cpp main.cpp
...@@ -13,4 +16,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread ...@@ -13,4 +16,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread
INSTALLS += target INSTALLS += target
OTHER_FILES += \ OTHER_FILES += \
main.qml main.qml \
error.qml
<RCC> <RCC>
<qresource prefix="/scenegraph/textureinsgnode"> <qresource prefix="/scenegraph/textureinthread">
<file>main.qml</file> <file>main.qml</file>
<file>error.qml</file>
</qresource> </qresource>
</RCC> </RCC>
CONFIG += tests_need_tools
load(qt_parts) load(qt_parts)
...@@ -279,7 +279,27 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path) ...@@ -279,7 +279,27 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
The following example shows a FolderListModel being used to provide a list The following example shows a FolderListModel being used to provide a list
of QML files in a \l ListView: of QML files in a \l ListView:
\snippet qml/folderlistmodel.qml 0 \qml
import QtQuick 2.0
import Qt.labs.folderlistmodel 1.0
ListView {
width: 200; height: 400
FolderListModel {
id: folderModel
nameFilters: ["*.qml"]
}
Component {
id: fileDelegate
Text { text: fileName }
}
model: folderModel
delegate: fileDelegate
}
\endqml
\section1 Path Separators \section1 Path Separators
......
...@@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE ...@@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE
Emits count particles from this emitter immediately. Emits count particles from this emitter immediately.
*/ */
/*! \qmlmethod QtQuick.Particles2::Emitter::burst(int x, int y, int count) /*! \qmlmethod QtQuick.Particles2::Emitter::burst(int count, int x, int y)
Emits count particles from this emitter immediately. The particles are emitted Emits count particles from this emitter immediately. The particles are emitted
as if the Emitter was positioned at x,y but all other properties are the same. as if the Emitter was positioned at x,y but all other properties are the same.
......
...@@ -88,7 +88,7 @@ properties of a QQmlContext, and how to access the context for an object. ...@@ -88,7 +88,7 @@ properties of a QQmlContext, and how to access the context for an object.
Dynamic object instantiation and dynamic expression evaluation are both core Dynamic object instantiation and dynamic expression evaluation are both core
concepts in QML. QML documents define object types which can be instantiated concepts in QML. QML documents define object types which can be instantiated
at run-time using a QQmlComponent. An instance of the QQmlComponent class can at run-time using a QQmlComponent. An instance of the QQmlComponent class can
be created in C++ directly, or via the \l{QML:Qt::createComponent()} be created in C++ directly, or via the \l{QtQml2::Qt::createComponent()}
{Qt.createComponent()} function in imperative QML code. Arbitrary expressions {Qt.createComponent()} function in imperative QML code. Arbitrary expressions
can be calculated in C++ via the QQmlExpression class, and such expressions can be calculated in C++ via the QQmlExpression class, and such expressions
can interact directly the QML context. can interact directly the QML context.
......
...@@ -74,7 +74,7 @@ QML code invokes a method on the object instance: ...@@ -74,7 +74,7 @@ QML code invokes a method on the object instance:
\endtable \endtable
(Note that date/time values returned from C++ to QML can be formatted through (Note that date/time values returned from C++ to QML can be formatted through
\l{QML:Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.) \l{QtQml2::Qt::formatDateTime}{Qt.formatDateTime()} and associated functions.)
If the QML item needs to receive signals from the context property, it can connect to them using the If the QML item needs to receive signals from the context property, it can connect to them using the
\l Connections type. For example, if \c ApplicationData has a signal named \c \l Connections type. For example, if \c ApplicationData has a signal named \c
......
...@@ -124,7 +124,7 @@ QQuaternion and QMatrix4x4, are only available from QML when the \l {Qt Quick} ...@@ -124,7 +124,7 @@ QQuaternion and QMatrix4x4, are only available from QML when the \l {Qt Quick}
module is included. module is included.
As a convenience, many of these types can be specified in QML by string values, As a convenience, many of these types can be specified in QML by string values,
or by a related method provided by the \l {QML:Qt} object. For example, the \l or by a related method provided by the \l {QtQml2::Qt} object. For example, the \l
{Image::sourceSize} property is of type \l size (which automatically translates {Image::sourceSize} property is of type \l size (which automatically translates
to the QSize type) and can be specified by a string value formatted as to the QSize type) and can be specified by a string value formatted as
"width\c{x}height", or by the Qt.size() function: "width\c{x}height", or by the Qt.size() function:
......
...@@ -35,15 +35,15 @@ useful to delay instantiation of objects until necessary, thereby improving ...@@ -35,15 +35,15 @@ useful to delay instantiation of objects until necessary, thereby improving
application startup time. It also allows visual objects to be dynamically application startup time. It also allows visual objects to be dynamically
created and added to the scene in reaction to user input or other events. created and added to the scene in reaction to user input or other events.
See the \l {declarative/toys/dynamicscene}{Dynamic Scene example} for a See the \l {QML Example - Dynamic Scene}{Dynamic Scene example} for a
demonstration of the concepts discussed on this page. demonstration of the concepts discussed on this page.
\section1 Creating Objects Dynamically \section1 Creating Objects Dynamically
There are two ways to create objects dynamically from JavaScript. You can There are two ways to create objects dynamically from JavaScript. You can
either call \l {QML:Qt::createComponent()}{Qt.createComponent()} to either call \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} to
dynamically create a \l Component object, or use \l{QML:Qt::createQmlObject()} dynamically create a \l Component object, or use \l{QtQml2::Qt::createQmlObject()}
{Qt.createQmlObject()} to create an object from a string of QML. Creating a {Qt.createQmlObject()} to create an object from a string of QML. Creating a
component is better if you have an existing component defined in a QML document component is better if you have an existing component defined in a QML document
and you want to dynamically create instances of that component. Otherwise, and you want to dynamically create instances of that component. Otherwise,
...@@ -54,7 +54,7 @@ generated at runtime. ...@@ -54,7 +54,7 @@ generated at runtime.
\section2 Creating a Component Dynamically \section2 Creating a Component Dynamically
To dynamically load a component defined in a QML file, call the To dynamically load a component defined in a QML file, call the
\l {QML:Qt::createComponent()}{Qt.createComponent()} function in the \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} function in the
\l {QmlGlobalQtObject}{Qt object}. \l {QmlGlobalQtObject}{Qt object}.
This function takes the URL of the QML file as its only argument and creates This function takes the URL of the QML file as its only argument and creates
a \l Component object from this URL. a \l Component object from this URL.
...@@ -113,7 +113,7 @@ created object is a visual (Qt Quick) object. The created object will become a ...@@ -113,7 +113,7 @@ created object is a visual (Qt Quick) object. The created object will become a
child of the \c appWindow object in \c main.qml, and appear in the scene. child of the \c appWindow object in \c main.qml, and appear in the scene.
When using files with relative paths, the path should When using files with relative paths, the path should
be relative to the file where \l {QML:Qt::createComponent()} be relative to the file where \l {QtQml2::Qt::createComponent()}
{Qt.createComponent()} is executed. {Qt.createComponent()} is executed.
To connect signals to (or receive signals from) dynamically created objects, To connect signals to (or receive signals from) dynamically created objects,
...@@ -127,7 +127,7 @@ It is also possible to instantiate components without blocking via the ...@@ -127,7 +127,7 @@ It is also possible to instantiate components without blocking via the
\section2 Creating an Object from a String of QML \section2 Creating an Object from a String of QML
If the QML is not defined until runtime, you can create a QML object from If the QML is not defined until runtime, you can create a QML object from
a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} a string of QML using the \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
function, as in the following example: function, as in the following example:
\snippet qml/createQmlObject.qml 0 \snippet qml/createQmlObject.qml 0
...@@ -153,9 +153,9 @@ first, the bindings in the dynamic object will no longer work. ...@@ -153,9 +153,9 @@ first, the bindings in the dynamic object will no longer work.
The actual creation context depends on how an object is created: The actual creation context depends on how an object is created:
\list \list
\li If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the \li If \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} is used, the
creation context is the QQmlContext in which this method is called creation context is the QQmlContext in which this method is called
\li If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} is called, the \li If \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()} is called, the
creation context is the context of the parent object passed to this method creation context is the context of the parent object passed to this method
\li If a \c {Component{}} object is defined and \l {Component::createObject()} \li If a \c {Component{}} object is defined and \l {Component::createObject()}
{createObject()} or \l {Component::incubateObject()}{incubateObject()} is {createObject()} or \l {Component::incubateObject()}{incubateObject()} is
...@@ -221,7 +221,7 @@ Item { ...@@ -221,7 +221,7 @@ Item {
This would result in an error, since objects can only be dynamically This would result in an error, since objects can only be dynamically
destroyed if they were dynamically created. destroyed if they were dynamically created.
Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} Objects created with \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}
can similarly be destroyed using \c destroy(): can similarly be destroyed using \c destroy():
\snippet qml/createQmlObject.qml 0 \snippet qml/createQmlObject.qml 0
......
...@@ -125,14 +125,14 @@ When a JavaScript file is imported, it must be imported with a qualifier. The ...@@ -125,14 +125,14 @@ When a JavaScript file is imported, it must be imported with a qualifier. The
functions in that file are then accessible from the importing script via the functions in that file are then accessible from the importing script via the
qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is
desirable to have the functions made available in the importing context without desirable to have the functions made available in the importing context without
needing to qualify them, and in this circumstance the \l{QML:Qt::include()} needing to qualify them, and in this circumstance the \l{QtQml2::Qt::include()}
{Qt.include()} function may be used to include one JavaScript file from another. {Qt.include()} function may be used to include one JavaScript file from another.
This copies all functions from the other file into the current file's This copies all functions from the other file into the current file's
namespace, but ignores all pragmas and imports defined in that file. namespace, but ignores all pragmas and imports defined in that file.
For example, the QML code below left calls \c showCalculations() in \c script.js, For example, the QML code below left calls \c showCalculations() in \c script.js,
which in turn can call \c factorial() in \c factorial.js, as it has included which in turn can call \c factorial() in \c factorial.js, as it has included
\c factorial.js using \l {QML:Qt::include()}{Qt.include()}. \c factorial.js using \l {QtQml2::Qt::include()}{Qt.include()}.
\table \table
\row \row
...@@ -142,7 +142,7 @@ which in turn can call \c factorial() in \c factorial.js, as it has included ...@@ -142,7 +142,7 @@ which in turn can call \c factorial() in \c factorial.js, as it has included
\li \snippet qml/integrating-javascript/includejs/factorial.js 0 \li \snippet qml/integrating-javascript/includejs/factorial.js 0
\endtable \endtable
Notice that calling \l {QML:Qt::include()}{Qt.include()} copies all functions Notice that calling \l {QtQml2::Qt::include()}{Qt.include()} copies all functions
from \c factorial.js into the \c MyScript namespace, which means the QML from \c factorial.js into the \c MyScript namespace, which means the QML
component can also access \c factorial() directly as \c MyScript.factorial(). component can also access \c factorial() directly as \c MyScript.factorial().
......