Source

Target

Commits (52)
Showing with 86 additions and 53 deletions
......@@ -35,10 +35,19 @@ Third party components
- A Window declared nested inside another Item or Window automatically
becomes transient for (centered upon) its parent's window, if x and y
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 *
****************************************************************************
- 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
QList<Person *> member.
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
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
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.
\section2 Define the BirthdayParty
......
......@@ -40,13 +40,12 @@
import QtQuick 2.0
Row {
Item {
id: button
property alias text: txt.text
property bool buttonEnabled: true
width: 140
height: 25
spacing: 5
x: 5
MouseArea {
id: mouse
......@@ -75,14 +74,14 @@ Row {
radius: 1
color: mouse.pressed || buttonEnabled ? "#76644A" : "transparent"
}
Text {
id: txt
anchors.left: checkbox.right
anchors.leftMargin: 4
anchors.verticalCenter: parent.verticalCenter
text: "Close "
color: "#ecc089"
font.pixelSize: 18
}
}
Text {
id: txt
anchors.left: checkbox.right
anchors.leftMargin: 4
anchors.verticalCenter: parent.verticalCenter
text: "Close "
color: "#ecc089"
font.pixelSize: 18
}
}
......@@ -88,7 +88,6 @@ Rectangle {
anchors.leftMargin: 30
anchors.top: startDateText.bottom
anchors.topMargin: 8
date: new Date(1995, 3, 25)
}
Text {
......@@ -212,4 +211,6 @@ Rectangle {
onClicked: root.chartType = "all"
}
}
Component.onCompleted: startDatePicker.date = new Date(1995, 3, 25)
}
......@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** 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$
** You may use this file under the terms of the BSD license as follows:
......@@ -38,24 +38,12 @@
**
****************************************************************************/
//![0]
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
Text {
width: 400
height: 100
text: 'Platform does not support threaded OpenGL needed by this example.'
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
//![0]
......@@ -42,6 +42,9 @@
#include <QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtQuick/QQuickView>
#include "threadrenderer.h"
......@@ -50,6 +53,13 @@ int main(int argc, char **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");
int execReturn = 0;
......@@ -63,7 +73,7 @@ int main(int argc, char **argv)
view.setPersistentSceneGraph(true);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml"));
view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml"));
view.show();
execReturn = app.exec();
......
QT += quick
# To make threaded gl check...
QT += core-private gui-private
HEADERS += threadrenderer.h
SOURCES += threadrenderer.cpp main.cpp
......@@ -13,4 +16,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread
INSTALLS += target
OTHER_FILES += \
main.qml
main.qml \
error.qml
<RCC>
<qresource prefix="/scenegraph/textureinsgnode">
<qresource prefix="/scenegraph/textureinthread">
<file>main.qml</file>
<file>error.qml</file>
</qresource>
</RCC>
CONFIG += tests_need_tools
load(qt_parts)
......@@ -279,7 +279,27 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
The following example shows a FolderListModel being used to provide a list
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
......
......@@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE
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
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.
Dynamic object instantiation and dynamic expression evaluation are both core
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
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
can be calculated in C++ via the QQmlExpression class, and such expressions
can interact directly the QML context.
......
......@@ -74,7 +74,7 @@ QML code invokes a method on the object instance:
\endtable
(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
\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}
module is included.
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
to the QSize type) and can be specified by a string value formatted as
"width\c{x}height", or by the Qt.size() function:
......
......@@ -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
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.
\section1 Creating Objects Dynamically
There are two ways to create objects dynamically from JavaScript. You can
either call \l {QML:Qt::createComponent()}{Qt.createComponent()} to
dynamically create a \l Component object, or use \l{QML:Qt::createQmlObject()}
either call \l {QtQml2::Qt::createComponent()}{Qt.createComponent()} to
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
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,
......@@ -54,7 +54,7 @@ generated at runtime.
\section2 Creating a Component Dynamically
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}.
This function takes the URL of the QML file as its only argument and creates
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
child of the \c appWindow object in \c main.qml, and appear in the scene.
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.
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
\section2 Creating an Object from a String of QML
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:
\snippet qml/createQmlObject.qml 0
......@@ -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:
\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
\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
\li If a \c {Component{}} object is defined and \l {Component::createObject()}
{createObject()} or \l {Component::incubateObject()}{incubateObject()} is
......@@ -221,7 +221,7 @@ Item {
This would result in an error, since objects can only be dynamically
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():
\snippet qml/createQmlObject.qml 0
......
......@@ -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
qualifier (that is, as \tt{Qualifier.functionName(params)}). Sometimes it is
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.
This copies all functions from the other file into the current file's
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,
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
\row
......@@ -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
\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
component can also access \c factorial() directly as \c MyScript.factorial().
......