diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
625 files changed, 11041 insertions, 7904 deletions
diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index cee8d4b382..eaf6d05094 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -32,10 +32,32 @@ Third party components * Important Behavior Changes * **************************************************************************** + - 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). + + - tryCompare now correctly fails when it only gets two parameters + + - If a QObject has a property and a slot (or invokable method) with the same + name, in QML the previous behavior was to let the property obscure the + method; from Qt 5.1 things work in the opposite way, that is a property can + never obscure a method having the same name. This is especially important + for objects having dynamic properties, such as QQmlPropertyMap. This change + was a consequence of the fix for QTBUG-29836. **************************************************************************** * Library * **************************************************************************** + - QTBUG-30837: The Flickable type no longer fixes up the content area on + startup to move it inside the viewport. **************************************************************************** diff --git a/examples/HACKING b/examples/HACKING index 9539d2d129..7d2a61a481 100644 --- a/examples/HACKING +++ b/examples/HACKING @@ -1,4 +1,4 @@ -Some guidelines for QtQml examples +Some guidelines for Qt QML examples Snippets --- diff --git a/examples/quick/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc index ee2dd06623..7dbd147cc1 100644 --- a/examples/quick/doc/src/qml-extending.qdoc +++ b/examples/qml/doc/src/qml-extending.qdoc @@ -34,7 +34,7 @@ The Adding Types Example shows how to add a new object type, \c Person, to QML. The \c Person type can be used from QML like this: -\snippet qml/referenceexamples/adding/example.qml 0 +\snippet referenceexamples/adding/example.qml 0 \section1 Declare the Person class @@ -43,11 +43,11 @@ with the two properties we want accessible on the QML type - name and shoeSize. Although in this example we use the same name for the C++ class as the QML type, the C++ class can be named differently, or appear in a namespace. -\snippet qml/referenceexamples/adding/person.h 0 +\snippet referenceexamples/adding/person.h 0 \section1 Define the Person class -\snippet qml/referenceexamples/adding/person.cpp 0 +\snippet referenceexamples/adding/person.cpp 0 The Person class implementation is quite basic. The property accessors simply return members of the object instance. @@ -78,33 +78,33 @@ properties in QML. This example adds a BirthdayParty type that specifies a birthday party, consisting of a celebrant and a list of guests. People are specified using the People QML type built in the previous example. -\snippet qml/referenceexamples/properties/example.qml 0 +\snippet referenceexamples/properties/example.qml 0 \section1 Declare the BirthdayParty The BirthdayParty class is declared like this: -\snippet qml/referenceexamples/properties/birthdayparty.h 0 -\snippet qml/referenceexamples/properties/birthdayparty.h 1 -\snippet qml/referenceexamples/properties/birthdayparty.h 2 -\snippet qml/referenceexamples/properties/birthdayparty.h 3 +\snippet referenceexamples/properties/birthdayparty.h 0 +\snippet referenceexamples/properties/birthdayparty.h 1 +\snippet referenceexamples/properties/birthdayparty.h 2 +\snippet referenceexamples/properties/birthdayparty.h 3 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 The implementation of BirthdayParty property accessors is straight forward. -\snippet qml/referenceexamples/properties/birthdayparty.cpp 0 +\snippet referenceexamples/properties/birthdayparty.cpp 0 \section1 Running the example @@ -128,11 +128,11 @@ The Inheritance and Coercion Example shows how to use base classes to assign types of more than one type to a property. It specializes the Person type developed in the previous examples into two types - a \c Boy and a \c Girl. -\snippet qml/referenceexamples/coercion/example.qml 0 +\snippet referenceexamples/coercion/example.qml 0 \section1 Declare Boy and Girl -\snippet qml/referenceexamples/coercion/person.h 0 +\snippet referenceexamples/coercion/person.h 0 The Person class remains unaltered in this example and the Boy and Girl C++ classes are trivial extensions of it. As an example, the inheritance used here @@ -147,7 +147,7 @@ previous example. However, as we have repurposed the People class as a common base for Boy and Girl, we want to prevent it from being instantiated from QML directly - an explicit Boy or Girl should be instantiated instead. -\snippet qml/referenceexamples/coercion/main.cpp 0 +\snippet referenceexamples/coercion/main.cpp 0 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 @@ -157,7 +157,7 @@ and other types can be coerced to it. The implementation of Boy and Girl are trivial. -\snippet qml/referenceexamples/coercion/person.cpp 1 +\snippet referenceexamples/coercion/person.cpp 1 All that is necessary is to implement the constructor, and to register the types and their QML name with the QML engine. @@ -167,7 +167,7 @@ and their QML name with the QML engine. The BirthdayParty type has not changed since the previous example. The celebrant and guests property still use the People type. -\snippet qml/referenceexamples/coercion/birthdayparty.h 0 +\snippet referenceexamples/coercion/birthdayparty.h 0 However, as all three types, Person, Boy and Girl, have been registered with the QML system, on assignment QML automatically (and type-safely) converts the Boy @@ -194,14 +194,14 @@ The Default Property Example is a minor modification of the \l {Extending QML - Inheritance and Coercion Example} that simplifies the specification of a BirthdayParty through the use of a default property. -\snippet qml/referenceexamples/default/example.qml 0 +\snippet referenceexamples/default/example.qml 0 \section1 Declaring the BirthdayParty class The only difference between this example and the last, is the addition of the \c DefaultProperty class info annotation. -\snippet qml/referenceexamples/default/birthdayparty.h 0 +\snippet referenceexamples/default/birthdayparty.h 0 The default property specifies the property to assign to whenever an explicit property is not specified, in the case of the BirthdayParty type the guest diff --git a/examples/quick/tutorials/extending/chapter1-basics/app.qml b/examples/qml/tutorials/extending/chapter1-basics/app.qml index d2f03daf83..d2f03daf83 100644 --- a/examples/quick/tutorials/extending/chapter1-basics/app.qml +++ b/examples/qml/tutorials/extending/chapter1-basics/app.qml diff --git a/examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro index 8ed66f8b66..8ed66f8b66 100644 --- a/examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro +++ b/examples/qml/tutorials/extending/chapter1-basics/chapter1-basics.pro diff --git a/examples/quick/tutorials/extending/chapter1-basics/main.cpp b/examples/qml/tutorials/extending/chapter1-basics/main.cpp index d30628fd5a..d30628fd5a 100644 --- a/examples/quick/tutorials/extending/chapter1-basics/main.cpp +++ b/examples/qml/tutorials/extending/chapter1-basics/main.cpp diff --git a/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp b/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp index fa005781d8..fa005781d8 100644 --- a/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter1-basics/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter1-basics/piechart.h b/examples/qml/tutorials/extending/chapter1-basics/piechart.h index a6272453ce..a6272453ce 100644 --- a/examples/quick/tutorials/extending/chapter1-basics/piechart.h +++ b/examples/qml/tutorials/extending/chapter1-basics/piechart.h diff --git a/examples/quick/tutorials/extending/chapter2-methods/app.qml b/examples/qml/tutorials/extending/chapter2-methods/app.qml index 06ecb3a09d..06ecb3a09d 100644 --- a/examples/quick/tutorials/extending/chapter2-methods/app.qml +++ b/examples/qml/tutorials/extending/chapter2-methods/app.qml diff --git a/examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro index 8ed66f8b66..8ed66f8b66 100644 --- a/examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro +++ b/examples/qml/tutorials/extending/chapter2-methods/chapter2-methods.pro diff --git a/examples/quick/tutorials/extending/chapter2-methods/main.cpp b/examples/qml/tutorials/extending/chapter2-methods/main.cpp index d30628fd5a..d30628fd5a 100644 --- a/examples/quick/tutorials/extending/chapter2-methods/main.cpp +++ b/examples/qml/tutorials/extending/chapter2-methods/main.cpp diff --git a/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp b/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp index ddcb1b3efd..ddcb1b3efd 100644 --- a/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter2-methods/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter2-methods/piechart.h b/examples/qml/tutorials/extending/chapter2-methods/piechart.h index 86750197d2..86750197d2 100644 --- a/examples/quick/tutorials/extending/chapter2-methods/piechart.h +++ b/examples/qml/tutorials/extending/chapter2-methods/piechart.h diff --git a/examples/quick/tutorials/extending/chapter3-bindings/app.qml b/examples/qml/tutorials/extending/chapter3-bindings/app.qml index afb9e25c51..afb9e25c51 100644 --- a/examples/quick/tutorials/extending/chapter3-bindings/app.qml +++ b/examples/qml/tutorials/extending/chapter3-bindings/app.qml diff --git a/examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro index 8ed66f8b66..8ed66f8b66 100644 --- a/examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro +++ b/examples/qml/tutorials/extending/chapter3-bindings/chapter3-bindings.pro diff --git a/examples/quick/tutorials/extending/chapter3-bindings/main.cpp b/examples/qml/tutorials/extending/chapter3-bindings/main.cpp index d30628fd5a..d30628fd5a 100644 --- a/examples/quick/tutorials/extending/chapter3-bindings/main.cpp +++ b/examples/qml/tutorials/extending/chapter3-bindings/main.cpp diff --git a/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp index a63035033f..a63035033f 100644 --- a/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter3-bindings/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending/chapter3-bindings/piechart.h index 25e82d66cc..25e82d66cc 100644 --- a/examples/quick/tutorials/extending/chapter3-bindings/piechart.h +++ b/examples/qml/tutorials/extending/chapter3-bindings/piechart.h diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml index 441b7f9b82..441b7f9b82 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/app.qml diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro index 23eb222ea3..23eb222ea3 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp index 5b6e1cf451..5b6e1cf451 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/main.cpp diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp index c1e2996e83..c1e2996e83 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h index 9f0ea47eb9..9f0ea47eb9 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/piechart.h diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp index 2afe82048f..2afe82048f 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp diff --git a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h index 4eef9bb6d1..4eef9bb6d1 100644 --- a/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h +++ b/examples/qml/tutorials/extending/chapter4-customPropertyTypes/pieslice.h diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/app.qml b/examples/qml/tutorials/extending/chapter5-listproperties/app.qml index a57d1b833f..a57d1b833f 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/app.qml +++ b/examples/qml/tutorials/extending/chapter5-listproperties/app.qml diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro index 23eb222ea3..23eb222ea3 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro +++ b/examples/qml/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp index f8826f6c31..f8826f6c31 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp +++ b/examples/qml/tutorials/extending/chapter5-listproperties/main.cpp diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp index 9fb61d9cd8..9fb61d9cd8 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h index 55488f4900..55488f4900 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h +++ b/examples/qml/tutorials/extending/chapter5-listproperties/piechart.h diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp index 52b409aa22..52b409aa22 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp +++ b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.cpp diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h index f324179481..f324179481 100644 --- a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h +++ b/examples/qml/tutorials/extending/chapter5-listproperties/pieslice.h diff --git a/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir b/examples/qml/tutorials/extending/chapter6-plugins/Charts/qmldir index d9e8471b3c..d9e8471b3c 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir +++ b/examples/qml/tutorials/extending/chapter6-plugins/Charts/qmldir diff --git a/examples/quick/tutorials/extending/chapter6-plugins/app.qml b/examples/qml/tutorials/extending/chapter6-plugins/app.qml index 417fc6651a..417fc6651a 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/app.qml +++ b/examples/qml/tutorials/extending/chapter6-plugins/app.qml diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro index 6bf44b4d15..6bf44b4d15 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +++ b/examples/qml/tutorials/extending/chapter6-plugins/chapter6-plugins.pro diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp index fea4c1aa85..fea4c1aa85 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp +++ b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.cpp diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h index d768306967..d768306967 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h +++ b/examples/qml/tutorials/extending/chapter6-plugins/chartsplugin.h diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp index 295bb8961d..295bb8961d 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp +++ b/examples/qml/tutorials/extending/chapter6-plugins/piechart.cpp diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.h b/examples/qml/tutorials/extending/chapter6-plugins/piechart.h index b37bcdd411..b37bcdd411 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/piechart.h +++ b/examples/qml/tutorials/extending/chapter6-plugins/piechart.h diff --git a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp index 52b409aa22..52b409aa22 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp +++ b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.cpp diff --git a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h index 0b488b4835..0b488b4835 100644 --- a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h +++ b/examples/qml/tutorials/extending/chapter6-plugins/pieslice.h diff --git a/examples/quick/tutorials/extending/extending.pro b/examples/qml/tutorials/extending/extending.pro index 967473fda0..967473fda0 100644 --- a/examples/quick/tutorials/extending/extending.pro +++ b/examples/qml/tutorials/extending/extending.pro diff --git a/examples/quick/accessibility/doc/src/accessibility.qdoc b/examples/quick/accessibility/doc/src/accessibility.qdoc index a637383324..0281ffff4e 100644 --- a/examples/quick/accessibility/doc/src/accessibility.qdoc +++ b/examples/quick/accessibility/doc/src/accessibility.qdoc @@ -33,8 +33,8 @@ Types in this example are augmented with meta-data for accessiblity systems. For example, the button identifies itself and its functionality to the accessibility system: - \snippet quick/accessibility/content/Button.qml button + \snippet accessibility/content/Button.qml button As do Text types inside the example: - \snippet quick/accessibility/accessibility.qml text + \snippet accessibility/accessibility.qml text */ diff --git a/examples/quick/animation/doc/src/animation.qdoc b/examples/quick/animation/doc/src/animation.qdoc index 064717835d..734b1af118 100644 --- a/examples/quick/animation/doc/src/animation.qdoc +++ b/examples/quick/animation/doc/src/animation.qdoc @@ -36,37 +36,37 @@ a small QML file emphasizing a particular type or feature. ColorAnimation demonstrates using a color animation to fade a sky from day to night. - \snippet quick/animation/basics/color-animation.qml 0 + \snippet animation/basics/color-animation.qml 0 PropertyAnimation demonstrates using a number animation to bounce a circle up and down. - \snippet quick/animation/basics/property-animation.qml 0 + \snippet animation/basics/property-animation.qml 0 Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click. - \snippet quick/animation/behaviors/behavior-example.qml 0 + \snippet animation/behaviors/behavior-example.qml 0 Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it. It does this by assigning a complex binding to each letter: - \snippet quick/animation/behaviors/wigglytext.qml 0 + \snippet animation/behaviors/wigglytext.qml 0 Then, it uses behaviors to animate the movement on each letter: - \snippet quick/animation/behaviors/wigglytext.qml 1 + \snippet animation/behaviors/wigglytext.qml 1 Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game. Again a binding which depends on other values is applied to the position and a behavior provided the animation. - \snippet quick/animation/behaviors/tvtennis.qml 0 + \snippet animation/behaviors/tvtennis.qml 0 Easing Curves shows off all the easing curves available in Qt Quick animations. States demonstrates how the properties of an item can vary between states. It defines several states: - \snippet quick/animation/states/states.qml 0 + \snippet animation/states/states.qml 0 Note that there is also the implicit 'base state' from properties set directly on objects. Transitions takes the States example and animates the property changes by setting transitions: - \snippet quick/animation/states/transitions.qml 0 + \snippet animation/states/transitions.qml 0 PathAnimation animates an image along a beizer curve using a PathAnimation. - \snippet quick/animation/pathanimation/pathanimation.qml 0 + \snippet animation/pathanimation/pathanimation.qml 0 PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead. - \snippet quick/animation/pathinterpolator/pathinterpolator.qml 0 + \snippet animation/pathinterpolator/pathinterpolator.qml 0 */ diff --git a/examples/quick/canvas/doc/src/canvas.qdoc b/examples/quick/canvas/doc/src/canvas.qdoc index 638d25d83f..f3eb78e1d1 100644 --- a/examples/quick/canvas/doc/src/canvas.qdoc +++ b/examples/quick/canvas/doc/src/canvas.qdoc @@ -36,12 +36,12 @@ a small QML file emphasizing a particular type or feature. Red heart demonstrates using a bezierCurve API to stroke and fill a red heart. - \snippet quick/canvas/bezierCurve/bezierCurve.qml 0 + \snippet canvas/bezierCurve/bezierCurve.qml 0 Talk bubble demonstrates using a quadraticCurveTo API to stroke and fill a customized talk bubble: - \snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 0 + \snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 0 This example also demonstrates the fillText API: - \snippet quick/canvas/quadraticCurveTo/quadraticCurveTo.qml 1 + \snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 1 Squircle demonstrates using a collection of simple moveTo/lineTo path APIs to draw a smooth squircle. @@ -50,9 +50,9 @@ Smile face demonstrates using several complex path APIs to draw an fill a smile face. Clip demonstrates using clip API to clip a given image. - \snippet quick/canvas/clip/clip.qml 0 + \snippet canvas/clip/clip.qml 0 Tiger demonstrates using SVG path API to draw a tiger with a collection of SVG path strings. - \snippet quick/canvas/tiger/tiger.qml 0 + \snippet canvas/tiger/tiger.qml 0 */ diff --git a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml index 0756d339ff..69e703cca7 100644 --- a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml +++ b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml @@ -116,13 +116,12 @@ Item { if (canvas.stroke) ctx.stroke(); - ctx.restore(); - // ![1] ctx.fillStyle = "white"; ctx.font = "Bold 17px"; - ctx.fillText("Qt Quick", 110, 140); + ctx.fillText("Qt Quick", 40, 70); // ![1] + ctx.restore(); } } } diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp index be37a5936d..4f0818ac71 100644 --- a/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp +++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.cpp @@ -42,7 +42,7 @@ #include <QStyleHints> #include <QGuiApplication> - +#include <qqmlfile.h> MaskedMouseArea::MaskedMouseArea(QQuickItem *parent) : QQuickItem(parent), @@ -74,7 +74,7 @@ void MaskedMouseArea::setMaskSource(const QUrl &source) { if (m_maskSource != source) { m_maskSource = source; - m_maskImage = QImage(source.toLocalFile()); + m_maskImage = QImage(QQmlFile::urlToLocalFileOrQrc(source)); emit maskSourceChanged(); } } diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index 77e4d146e1..3ec6420abf 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -18,3 +18,6 @@ qmldir.files = TextBalloonPlugin/qmldir qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin INSTALLS += qmldir target + +OTHER_FILES += \ + textballoons.qml diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro index 1b002a5f27..91d52a293e 100644 --- a/examples/quick/demos/calqlatr/calqlatr.pro +++ b/examples/quick/demos/calqlatr/calqlatr.pro @@ -6,5 +6,24 @@ SOURCES += main.cpp RESOURCES += calqlatr.qrc \ ../../shared/shared.qrc +OTHER_FILES = calqlatr.qml \ + content/Button.qml \ + content/Display.qml \ + content/NumberPad.qml \ + content/StyleLabel.qml \ + content/audio/touch.wav \ + content/calculator.js \ + content/images/icon-back.png \ + content/images/icon-close.png \ + content/images/icon-settings.png \ + content/images/logo.png \ + content/images/paper-edge-left.png \ + content/images/paper-edge-right.png \ + content/images/paper-grip.png \ + content/images/settings-selected-a.png \ + content/images/settings-selected-b.png \ + content/images/touch-green.png \ + content/images/touch-white.png + target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr INSTALLS += target diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml index 16b2e19724..0a092c25da 100644 --- a/examples/quick/demos/calqlatr/calqlatr.qml +++ b/examples/quick/demos/calqlatr/calqlatr.qml @@ -57,7 +57,7 @@ Rectangle { Item { id: pad - width: window.width * 0.58 + width: 180 NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } } @@ -77,7 +77,7 @@ Rectangle { Display { id: display x: -16 - width: window.width * 0.42 + width: window.width - pad.width height: parent.height MouseArea { @@ -85,7 +85,12 @@ Rectangle { property real oldP: 0 property bool rewind: false - anchors.fill: parent + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + } + height: 50 onPositionChanged: { var reverse = startX > window.width / 2 var mx = mapToItem(window, mouse.x).x diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml index 4a78a3ebcd..ec8edfea66 100644 --- a/examples/quick/demos/calqlatr/content/Display.qml +++ b/examples/quick/demos/calqlatr/content/Display.qml @@ -42,23 +42,38 @@ import QtQuick 2.0 Item { id: display + property bool enteringDigits: false function displayOperator(operator) { listView.model.append({ "operator": operator, "operand": "" }) + enteringDigits = true } function newLine(operator, operand) { listView.model.append({ "operator": operator, "operand": operand }) + enteringDigits = false + listView.positionViewAtEnd() } function appendDigit(digit) { - if (!listView.model.count) + if (!enteringDigits) listView.model.append({ "operator": "", "operand": "" }) var i = listView.model.count - 1; listView.model.get(i).operand = listView.model.get(i).operand + digit; + enteringDigits = true + } + + function clear() + { + if (enteringDigits) { + var i = listView.model.count - 1 + if (i >= 0) + listView.model.remove(i) + enteringDigits = false + } } Item { @@ -87,6 +102,7 @@ Item { } Image { + id: grip source: "images/paper-grip.png" anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom @@ -97,7 +113,7 @@ Item { id: listView x: 16; y: 30 width: display.width - height: display.height + height: display.height - 50 - y delegate: Item { height: 20 width: parent.width diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml index 3203e18431..c7f2680651 100644 --- a/examples/quick/demos/calqlatr/content/NumberPad.qml +++ b/examples/quick/demos/calqlatr/content/NumberPad.qml @@ -60,7 +60,7 @@ Grid { Button { text: "±"; color: "#6da43d"; operator: true } Button { text: "−"; color: "#6da43d"; operator: true } Button { text: "+"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } + Button { text: "√"; color: "#6da43d"; operator: true } Button { text: "÷"; color: "#6da43d"; operator: true } Button { text: "×"; color: "#6da43d"; operator: true } Button { text: "C"; color: "#6da43d"; operator: true } diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js index d86fecbf39..da8e940b16 100644 --- a/examples/quick/demos/calqlatr/content/calculator.js +++ b/examples/quick/demos/calqlatr/content/calculator.js @@ -84,7 +84,7 @@ function operatorPressed(op) } else if (previousOperator == "×") { digits = Number(curVal) * Number(digits.valueOf()) } else if (previousOperator == "÷") { - digits = Number(Number(curVal) / Number(digits.valueOf())).toString() + digits = Number(curVal) / Number(digits.valueOf()) } else if (previousOperator == "=") { } @@ -110,9 +110,9 @@ function operatorPressed(op) digits = (Math.abs(digits.valueOf())).toString() } else if (op == "Int") { digits = (Math.floor(digits.valueOf())).toString() - } else if (op == window.plusminus) { + } else if (op == "±") { digits = (digits.valueOf() * -1).toString() - } else if (op == window.squareRoot) { + } else if (op == "√") { digits = (Math.sqrt(digits.valueOf())).toString() } else if (op == "mc") { memory = 0; @@ -130,7 +130,7 @@ function operatorPressed(op) } else if (op == "Off") { Qt.quit(); } else if (op == "C") { - digits = "0" + display.clear() } else if (op == "AC") { curVal = 0 memory = 0 diff --git a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png b/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png Binary files differindex af67f63dd1..af67f63dd1 100644 --- a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png +++ b/examples/quick/demos/calqlatr/doc/images/qtquick-demo-calqlatr.png diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc index 60a9725e53..7217c7d806 100644 --- a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc +++ b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc @@ -26,13 +26,11 @@ ****************************************************************************/ /*! - \title QML Demo - Calqlatr + \title Qt Quick Demo - Calqlatr + \ingroup qtquickdemos \example demos/calqlatr - \brief This is an example calculator written in QML. - \image qml-calqlatr-demo-small.png - \ingroup qmldemos - - This demo implements a simple calculator app, designed for portrait devices. + \brief A simple calculator app, designed for portrait devices. + \image qtquick-demo-calqlatr.png This app has the logic implemented in Javascipt and the appearance implemented in QML. */ diff --git a/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png b/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png Binary files differnew file mode 100644 index 0000000000..94b641d891 --- /dev/null +++ b/examples/quick/demos/clocks/doc/images/qtquick-demo-clocks-small.png diff --git a/examples/quick/demos/clocks/doc/src/clocks.qdoc b/examples/quick/demos/clocks/doc/src/clocks.qdoc new file mode 100644 index 0000000000..b34f844cc6 --- /dev/null +++ b/examples/quick/demos/clocks/doc/src/clocks.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - Clocks + \ingroup qtquickdemos + \example demos/clocks + \brief An app that shows the current time in different cities. + \image qtquick-demo-clocks-small.png +*/ + diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png Binary files differnew file mode 100644 index 0000000000..6d41179c23 --- /dev/null +++ b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png Binary files differnew file mode 100644 index 0000000000..c8f37486f6 --- /dev/null +++ b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png diff --git a/examples/quick/demos/maroon/doc/src/maroon.qdoc b/examples/quick/demos/maroon/doc/src/maroon.qdoc new file mode 100644 index 0000000000..c18b6bc874 --- /dev/null +++ b/examples/quick/demos/maroon/doc/src/maroon.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - Maroon in Trouble + \ingroup qtquickdemos + \example demos/maroon + \brief A cute game designed for touchscreens. + \image qtquick-demo-maroon-med-1.png + \image qtquick-demo-maroon-med-2.png +*/ + diff --git a/examples/quick/demos/photosurface/doc/images/qml-photosurface-example-small.png b/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png Binary files differindex a0cd823999..a0cd823999 100644 --- a/examples/quick/demos/photosurface/doc/images/qml-photosurface-example-small.png +++ b/examples/quick/demos/photosurface/doc/images/qtquick-demo-photosurface-small.png diff --git a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc index 343acce14a..48f8e8a14b 100644 --- a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc +++ b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc @@ -26,11 +26,11 @@ ****************************************************************************/ /*! - \title QML Demo - Photo Surface + \title Qt Quick Demo - Photo Surface + \ingroup qtquickdemos \example demos/photosurface - \brief This is the typical touch photo-shuffling example written in QML. - \image qml-photosurface-example-small.png - \ingroup qtquickexamples + \brief A touch-based app for shuffling photos around a virtual surface. + \image qtquick-demo-photosurface-small.png This example demonstrates how to handle dragging, rotation and pinch zooming within the same item using a PinchArea containing a MouseArea. diff --git a/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png b/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png Binary files differnew file mode 100644 index 0000000000..d872310a3e --- /dev/null +++ b/examples/quick/demos/photoviewer/doc/images/qtquick-demo-photoviewer-small.png diff --git a/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc new file mode 100644 index 0000000000..b0f1368a1c --- /dev/null +++ b/examples/quick/demos/photoviewer/doc/src/photoviewer.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - Photo Viewer + \ingroup qtquickdemos + \example demos/photoviewer + \brief An online photo viewer that displays Flickr feeds. + \image qtquick-demo-photoviewer-small.png +*/ + diff --git a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png Binary files differnew file mode 100644 index 0000000000..0ad6c02251 --- /dev/null +++ b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png diff --git a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc new file mode 100644 index 0000000000..019b54d609 --- /dev/null +++ b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - RSS News + \ingroup qtquickdemos + \example demos/rssnews + \brief An RSS news reader. + \image qtquick-demo-rssnews-small.png +*/ + diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png Binary files differnew file mode 100644 index 0000000000..cce9f11017 --- /dev/null +++ b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-1.png diff --git a/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png Binary files differnew file mode 100644 index 0000000000..ca9e8368b1 --- /dev/null +++ b/examples/quick/demos/samegame/doc/images/qtquick-demo-samegame-med-2.png diff --git a/examples/quick/demos/samegame/doc/src/samegame.qdoc b/examples/quick/demos/samegame/doc/src/samegame.qdoc new file mode 100644 index 0000000000..70042d73f0 --- /dev/null +++ b/examples/quick/demos/samegame/doc/src/samegame.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - Same Game + \ingroup qtquickdemos + \example demos/samegame + \brief A QML implementation of the popular puzzle game by Kuniaki Moribe. + \image qtquick-demo-samegame-med-1.png + \image qtquick-demo-samegame-med-2.png +*/ + diff --git a/examples/quick/demos/stocqt/content/CheckBox.qml b/examples/quick/demos/stocqt/content/CheckBox.qml index 9c429d65dc..1e7dcf7c74 100644 --- a/examples/quick/demos/stocqt/content/CheckBox.qml +++ b/examples/quick/demos/stocqt/content/CheckBox.qml @@ -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 } } diff --git a/examples/quick/demos/stocqt/content/StockSettings.qml b/examples/quick/demos/stocqt/content/StockSettings.qml index 5978a3b6a0..07152410fa 100644 --- a/examples/quick/demos/stocqt/content/StockSettings.qml +++ b/examples/quick/demos/stocqt/content/StockSettings.qml @@ -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) } diff --git a/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png b/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png Binary files differnew file mode 100644 index 0000000000..1783881e1f --- /dev/null +++ b/examples/quick/demos/stocqt/doc/images/qtquick-demo-stocqt.png diff --git a/examples/quick/demos/stocqt/doc/src/stocqt.qdoc b/examples/quick/demos/stocqt/doc/src/stocqt.qdoc new file mode 100644 index 0000000000..7001bfb395 --- /dev/null +++ b/examples/quick/demos/stocqt/doc/src/stocqt.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - StocQt + \ingroup qtquickdemos + \example demos/stocqt + \brief A configurable stock chart for the NASDAQ-100. + \image qtquick-demo-stocqt.png +*/ + diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png Binary files differnew file mode 100644 index 0000000000..930ee39929 --- /dev/null +++ b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-1.png diff --git a/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png Binary files differnew file mode 100644 index 0000000000..9eff191a47 --- /dev/null +++ b/examples/quick/demos/tweetsearch/doc/images/qtquick-demo-tweetsearch-med-2.png diff --git a/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc b/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc new file mode 100644 index 0000000000..9ba252fcb5 --- /dev/null +++ b/examples/quick/demos/tweetsearch/doc/src/tweetsearch.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick Demo - Tweet Search + \ingroup qtquickdemos + \example demos/tweetsearch + \brief A Twitter search client with 3D effects. + \image qtquick-demo-tweetsearch-med-1.png + \image qtquick-demo-tweetsearch-med-2.png +*/ + diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml index 7817c8edf8..6a0af7f730 100644 --- a/examples/quick/dialogs/ColorDialogs.qml +++ b/examples/quick/dialogs/ColorDialogs.qml @@ -46,9 +46,10 @@ Rectangle { width: 320 height: 200 color: palette.window - SystemPalette { id: palette } + clip: true + //! [colordialog] ColorDialog { id: colorDialog visible: colorDialogVisible.checked @@ -59,10 +60,11 @@ Rectangle { onAccepted: { console.log("Accepted: " + color) } onRejected: { console.log("Rejected") } } + //! [colordialog] Column { anchors.fill: parent - anchors.margins: 8 + anchors.margins: 12 spacing: 8 Text { font.bold: true @@ -106,4 +108,38 @@ Rectangle { } } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } } diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml index a6df29bb37..d1278609f9 100644 --- a/examples/quick/dialogs/FileDialogs.qml +++ b/examples/quick/dialogs/FileDialogs.qml @@ -43,44 +43,13 @@ import QtQuick.Dialogs 1.0 import "../shared" Rectangle { - width: 580 - height: 360 + height: 400 color: palette.window SystemPalette { id: palette } + clip: true - Rectangle { - id: toolbar - width: parent.width - height: 40 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 8 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "/tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } - + //! [filedialog] FileDialog { id: fileDialog visible: fileDialogVisible.checked @@ -95,12 +64,11 @@ Rectangle { onAccepted: { console.log("Accepted: " + fileUrls) } onRejected: { console.log("Rejected") } } + //! [filedialog] Column { - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolbar.bottom - anchors.margins: 8 + anchors.fill: parent + anchors.margins: 12 spacing: 8 Text { color: palette.windowText @@ -163,4 +131,39 @@ Rectangle { wrapMode: Text.Wrap } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } } diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro new file mode 100644 index 0000000000..b76f396e9d --- /dev/null +++ b/examples/quick/dialogs/dialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += dialogs.qrc ../shared/shared.qrc + +OTHER_FILES += \ + dialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/window/window/Window.qml b/examples/quick/dialogs/dialogs.qml index 07900930d3..b5f9841a3f 100644 --- a/examples/quick/window/window/Window.qml +++ b/examples/quick/dialogs/dialogs.qml @@ -39,20 +39,21 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Window 2.0 +import "../shared" -Window { - width: 640 - height: 480 - visible: true //It's false by default - property Component self - Component.onCompleted: self = Qt.createComponent("Window.qml") - Text{ - text: "Hello World!" - anchors.centerIn: parent +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png } - MouseArea{ + + ColorDialogs { + property string title: "Color Dialog" anchors.fill: parent - onClicked: self.createObject(); + color: "#e3e3e3" // to match tab.png } } diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc new file mode 100644 index 0000000000..efebfe4845 --- /dev/null +++ b/examples/quick/dialogs/dialogs.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/dialogs"> + <file>dialogs.qml</file> + <file>FileDialogs.qml</file> + <file>ColorDialogs.qml</file> + </qresource> +</RCC> diff --git a/examples/quick/dialogs/doc/images/dialogs-example.jpg b/examples/quick/dialogs/doc/images/dialogs-example.jpg Binary files differnew file mode 100644 index 0000000000..4517a39308 --- /dev/null +++ b/examples/quick/dialogs/doc/images/dialogs-example.jpg diff --git a/examples/quick/dialogs/doc/src/dialogs.qdoc b/examples/quick/dialogs/doc/src/dialogs.qdoc new file mode 100644 index 0000000000..daac914c60 --- /dev/null +++ b/examples/quick/dialogs/doc/src/dialogs.qdoc @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Dialog Examples + \example dialogs + \brief This example demonstrates the dialog types in QML + \image dialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet dialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet dialogs/ColorDialogs.qml colordialog +*/ diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml b/examples/quick/dialogs/main.cpp index 410b3f68d1..bbf0c48104 100644 --- a/src/qml/doc/snippets/qml/qtbinding/resources/main.qml +++ b/examples/quick/dialogs/main.cpp @@ -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: @@ -37,10 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -//![0] -// main.qml -import QtQuick 2.0 - -Image { source: "images/background.png" } -//![0] +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/draganddrop/doc/src/draganddrop.qdoc b/examples/quick/draganddrop/doc/src/draganddrop.qdoc index 381fdd1299..2c62e271e6 100644 --- a/examples/quick/draganddrop/doc/src/draganddrop.qdoc +++ b/examples/quick/draganddrop/doc/src/draganddrop.qdoc @@ -37,12 +37,12 @@ It has a DragTile component which uses a MouseArea to move an item when dragged: - \snippet quick/draganddrop/tiles/DragTile.qml 0 - \snippet quick/draganddrop/tiles/DragTile.qml 1 + \snippet draganddrop/tiles/DragTile.qml 0 + \snippet draganddrop/tiles/DragTile.qml 1 And a DropTile component which the dragged tiles can be dropped onto: - \snippet quick/draganddrop/tiles/DropTile.qml 0 + \snippet draganddrop/tiles/DropTile.qml 0 The keys property of the DropArea will only allow an item with matching key in it's Drag.keys property to be dropped on it. @@ -52,7 +52,7 @@ It uses a DelegateModel to move a delegate item to the position of another item it is dragged over. - \snippet quick/draganddrop/views/gridview.qml 0 - \snippet quick/draganddrop/views/gridview.qml 1 + \snippet draganddrop/views/gridview.qml 0 + \snippet draganddrop/views/gridview.qml 1 */ diff --git a/examples/quick/imageelements/doc/src/imageelements.qdoc b/examples/quick/imageelements/doc/src/imageelements.qdoc index 5abcece4fc..d88201faf9 100644 --- a/examples/quick/imageelements/doc/src/imageelements.qdoc +++ b/examples/quick/imageelements/doc/src/imageelements.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ /*! - \title QML Examples - Image Elements + \title Qt Quick Examples - Image Elements \example imageelements \brief This is a collection of QML examples relating to image types. \image qml-imageelements-example.png @@ -40,20 +40,20 @@ 'Shadows' shows how to create a drop shadow effect for a rectangular item using a BorderImage: - \snippet quick/imageelements/content/ShadowRectangle.qml shadow + \snippet imageelements/content/ShadowRectangle.qml shadow 'AnimatedSprite' shows how to display a simple animation using an AnimatedSprite object: - \snippet quick/imageelements/animatedsprite.qml sprite + \snippet imageelements/animatedsprite.qml sprite The sprite animation will loop 3 times. 'SpriteSequence' demonstrates using a sprite sequence to draw an animated and interactive bear. The SpriteSequence defines 5 different sprites. The bear is initially in a 'still' state: - \snippet quick/imageelements/spritesequence.qml still + \snippet imageelements/spritesequence.qml still When the scene is clicked, an animation sets the sprite sequence to the 'falling' states and animates the bear's y property. - \snippet quick/imageelements/spritesequence.qml animation + \snippet imageelements/spritesequence.qml animation At the end of the animation the bear is set back to its initial state. */ diff --git a/examples/quick/mousearea/doc/src/mousearea.qdoc b/examples/quick/mousearea/doc/src/mousearea.qdoc index b0d9abce8f..091be69e5d 100644 --- a/examples/quick/mousearea/doc/src/mousearea.qdoc +++ b/examples/quick/mousearea/doc/src/mousearea.qdoc @@ -37,10 +37,10 @@ of that click which are available to QML. Signals are emitted by the MouseArea when clicks or other discrete operations occur within it - \snippet quick/mousearea/mousearea.qml clicks + \snippet mousearea/mousearea.qml clicks The MouseArea can also be used to drag items around. By setting the parameters of the drag property, the target item will be dragged around if the user starts to drag within the MouseArea. - \snippet quick/mousearea/mousearea.qml drag + \snippet mousearea/mousearea.qml drag */ diff --git a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc index d4aabc01d8..7869383ca2 100644 --- a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc +++ b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc @@ -27,7 +27,7 @@ /*! - \title Scenegraph Painted Item Example + \title Scene Graph - Painted Item \brief Shows how to implement QPainter-based custom scenegraph items. \example customitems/painteditem \ingroup qtquickexamples @@ -43,12 +43,12 @@ The example consists of an item class, a plugin class and a QML file to use this plugin. The \c TextBalloon class represents the individual text balloons extending QQuickPaintedItem, the \c TextBalloonPlugin class - represents the skeleton code for a QtQuick plugin and the + represents the skeleton code for a \l {Qt Quick} plugin and the \c textballoons.qml file is used to load the plugin and display the text balloons. We will focus on the \c TextBalloon class first and continue with the - \c textballoons.qml file. For an example on how to implement a QtQuick + \c textballoons.qml file. For an example on how to implement a \l {Qt Quick} plugin please look at \l{declarative/tutorials/extending/chapter6-plugins} {Writing an Extension Plugin} @@ -58,7 +58,7 @@ is the base class for all QPainter based items in the QML Scene Graph framework. - \snippet quick/customitems/painteditem/textballoon.h 0 + \snippet customitems/painteditem/textballoon.h 0 To implement a QQuickPaintedItem you must implement QQuickPaintedIem's pure virtual function \l {QQuickPaintedItem::}{paint()} which implements the @@ -69,13 +69,13 @@ We have to be sure to initialize the rightAligned property for a TextBalloon item. - \snippet quick/customitems/painteditem/textballoon.cpp 0 + \snippet customitems/painteditem/textballoon.cpp 0 Then we implement the \c paint() function which is automatically called by - the Scenegraph framework to paint the contents of the item. The function + the Scene Graph framework to paint the contents of the item. The function paints the item in local coordinates. - \snippet quick/customitems/painteditem/textballoon.cpp 1 + \snippet customitems/painteditem/textballoon.cpp 1 We start with setting the pen and brush on the item to define the look of the item. After that we start drawing. Note that the \l {QQuickPaintedItem::}{boundingRect()} @@ -90,7 +90,7 @@ \section2 BalloonView - \snippet quick/customitems/painteditem/textballoons.qml 0 + \snippet customitems/painteditem/textballoons.qml 0 The balloonModel contains two types at application start which will be displayed by the balloonView. The balloonView alernates the TextBalloon @@ -98,7 +98,7 @@ \section2 Controls - \snippet quick/customitems/painteditem/textballoons.qml 1 + \snippet customitems/painteditem/textballoons.qml 1 The controls part of the UI contains a rectangle with a MouseArea which changes color when the mouse hovers over it. This control 'button' adds diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/content/attractor.qml index fd7fd65b9c..349132e61a 100644 --- a/examples/quick/particles/affectors/content/attractor.qml +++ b/examples/quick/particles/affectors/content/attractor.qml @@ -77,7 +77,7 @@ Rectangle { ImageParticle { id: stars groups: ["stars"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "white" colorVariation: 0.1 alpha: 0 @@ -96,7 +96,7 @@ Rectangle { ImageParticle { id: shot groups: ["shot"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "#0FF06600" colorVariation: 0.3 @@ -104,7 +104,7 @@ Rectangle { ImageParticle { id: engine groups: ["engine"] - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" color: "orange" SequentialAnimation on color { diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/content/groupgoal.qml index 19fa041288..cf4361eb94 100644 --- a/examples/quick/particles/affectors/content/groupgoal.qml +++ b/examples/quick/particles/affectors/content/groupgoal.qml @@ -124,7 +124,7 @@ Rectangle { id: smoke anchors.fill: parent groups: ["smoke"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0 color: "#00111111" } @@ -132,7 +132,7 @@ Rectangle { id: pilot anchors.fill: parent groups: ["pilot"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" redVariation: 0.01 blueVariation: 0.4 color: "#0010004f" diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/content/move.qml index b4d83318b0..e90f8c685c 100644 --- a/examples/quick/particles/affectors/content/move.qml +++ b/examples/quick/particles/affectors/content/move.qml @@ -50,7 +50,7 @@ Rectangle { ImageParticle { groups: ["A"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#FF1010" redVariation: 0.8 } @@ -80,7 +80,7 @@ Rectangle { ImageParticle { groups: ["B"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#10FF10" greenVariation: 0.8 } @@ -112,7 +112,7 @@ Rectangle { ImageParticle { groups: ["C"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#1010FF" blueVariation: 0.8 } diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/content/spritegoal.qml index 78b161f25b..ab108bb065 100644 --- a/examples/quick/particles/affectors/content/spritegoal.qml +++ b/examples/quick/particles/affectors/content/spritegoal.qml @@ -66,7 +66,7 @@ Item { ImageParticle { system: sys groups: ["starfield"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" colorVariation: 0.3 color: "white" } @@ -170,7 +170,7 @@ Item { z:0 system: sys groups: ["exhaust"] - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" color: "orange" SequentialAnimation on color { diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/content/turbulence.qml index d7a86039b4..eacedbe153 100644 --- a/examples/quick/particles/affectors/content/turbulence.qml +++ b/examples/quick/particles/affectors/content/turbulence.qml @@ -75,13 +75,13 @@ Rectangle { ImageParticle { groups: ["smoke"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "#11111111" colorVariation: 0 } ImageParticle { groups: ["flame"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "#11ff400f" colorVariation: 0.1 } diff --git a/examples/quick/particles/affectors/doc/src/affectors.qdoc b/examples/quick/particles/affectors/doc/src/affectors.qdoc index 58661d5b70..a1407abda2 100644 --- a/examples/quick/particles/affectors/doc/src/affectors.qdoc +++ b/examples/quick/particles/affectors/doc/src/affectors.qdoc @@ -35,7 +35,7 @@ Each example is a small QML file emphasizing a particular type or feature. Age demonstrates using an Age affector to prematurely end the lives of particles. - \snippet quick/particles/affectors/content/age.qml 0 + \snippet particles/affectors/content/age.qml 0 As you move the affector around the screen, the particles inside it (which haven't already been affected) jump to a period near the end @@ -44,7 +44,7 @@ the end of their life instantly. Attractor demonstrates using an Attractor affector to simulate a black hole - \snippet quick/particles/affectors/content/attractor.qml 0 + \snippet particles/affectors/content/attractor.qml 0 All particles in the scene, including the rocket ship's exhaust and pellets, are pulled towards the black hole. This effect is stronger closer to the black hole, so the @@ -55,58 +55,58 @@ Custom Affector manipulates the properties of the particles directly in javascript. One Affector is used to make the leaves rock back and forth as they fall, looking more leaf-like than just spinning in circles: - \snippet quick/particles/affectors/content/customaffector.qml 0 + \snippet particles/affectors/content/customaffector.qml 0 Another is used to provide a slightly varying friction to the leaves as they 'land', to look more natural: - \snippet quick/particles/affectors/content/customaffector.qml 1 + \snippet particles/affectors/content/customaffector.qml 1 Friction is similar to the falling leaves in the custom affector, except that it uses a flat friction the whole way down instead of custom affectors. - \snippet quick/particles/affectors/content/friction.qml 0 + \snippet particles/affectors/content/friction.qml 0 Gravity is a convenience affector for applying a constant acceleration to particles inside it - \snippet quick/particles/affectors/content/gravity.qml 0 + \snippet particles/affectors/content/gravity.qml 0 GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various ways to transition between them. - \snippet quick/particles/affectors/content/groupgoal.qml unlit + \snippet particles/affectors/content/groupgoal.qml unlit The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding with particles in the lit group, and cause them to move to the lighting group. - \snippet quick/particles/affectors/content/groupgoal.qml lighting + \snippet particles/affectors/content/groupgoal.qml lighting lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically moves into the lit group after 100ms. - \snippet quick/particles/affectors/content/groupgoal.qml lit + \snippet particles/affectors/content/groupgoal.qml lit The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere. There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group (and then to the lit group). - \snippet quick/particles/affectors/content/groupgoal.qml groupgoal-pilot + \snippet particles/affectors/content/groupgoal.qml groupgoal-pilot The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame, they go straight to lit because the pilot flame is so hot. - \snippet quick/particles/affectors/content/groupgoal.qml groupgoal-ma + \snippet particles/affectors/content/groupgoal.qml groupgoal-ma The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which is hard due to their constant movement) causes them to move to the lighting group. Move shows some simple effects you can get by altering trajectory midway. The red particles have an affector that affects their position, jumping them forwards by 120px. - \snippet quick/particles/affectors/content/move.qml A + \snippet particles/affectors/content/move.qml A The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction velocity to their existing forwards velocity, they begin to spray off in a cone. - \snippet quick/particles/affectors/content/move.qml B + \snippet particles/affectors/content/move.qml B The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases. - \snippet quick/particles/affectors/content/move.qml C + \snippet particles/affectors/content/move.qml C SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle. - \snippet quick/particles/affectors/content/spritegoal.qml 0 + \snippet particles/affectors/content/spritegoal.qml 0 The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites, it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces. Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect. - \snippet quick/particles/affectors/content/turbulence.qml 0 + \snippet particles/affectors/content/turbulence.qml 0 To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source). Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down. - \snippet quick/particles/affectors/content/wander.qml 0 + \snippet particles/affectors/content/wander.qml 0 There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference. */ diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml index 130518a6f9..3fb4c9f378 100644 --- a/examples/quick/particles/customparticle/content/imagecolors.qml +++ b/examples/quick/particles/customparticle/content/imagecolors.qml @@ -71,7 +71,7 @@ Rectangle { } Image { id: particle - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" } //! [vertex] vertexShader:" diff --git a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc index ccef82c922..fb53a67831 100644 --- a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc +++ b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc @@ -36,19 +36,19 @@ Blur Particles adds a blur effect to the particles, which increases over the particle's life time. It uses a custom vertex shader: - \snippet quick/particles/customparticle/content/blurparticles.qml vertex + \snippet particles/customparticle/content/blurparticles.qml vertex to propagate life time simulation to a custom fragement shader: - \snippet quick/particles/customparticle/content/blurparticles.qml fragment + \snippet particles/customparticle/content/blurparticles.qml fragment which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect. Fragment Shader just uses the particle system as a vertex delivery system. - \snippet quick/particles/customparticle/content/fragmentshader.qml 0 + \snippet particles/customparticle/content/fragmentshader.qml 0 Image Colors uses CustomParticle to assign colors to particles based on their location in a picture. The vertex shader, - \snippet quick/particles/customparticle/content/imagecolors.qml vertex + \snippet particles/customparticle/content/imagecolors.qml vertex passes along the starting position for each vertex to the fragment shader, - \snippet quick/particles/customparticle/content/imagecolors.qml fragment + \snippet particles/customparticle/content/imagecolors.qml fragment which uses it to determine the color for that particle. */ diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/content/burstandpulse.qml index 18d1c43933..28c56b326d 100644 --- a/examples/quick/particles/emitters/content/burstandpulse.qml +++ b/examples/quick/particles/emitters/content/burstandpulse.qml @@ -67,7 +67,7 @@ Rectangle { id: particles anchors.fill: parent ImageParticle { - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" alpha: 0 colorVariation: 0.6 } diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/content/customemitter.qml index 966c78e70f..9ad504ebc8 100644 --- a/examples/quick/particles/emitters/content/customemitter.qml +++ b/examples/quick/particles/emitters/content/customemitter.qml @@ -90,7 +90,7 @@ ParticleSystem { } ImageParticle { - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" alpha: 0.0 } } diff --git a/examples/quick/particles/emitters/content/emitmask.qml b/examples/quick/particles/emitters/content/emitmask.qml index 08c04f6e5f..1c2e7b458f 100644 --- a/examples/quick/particles/emitters/content/emitmask.qml +++ b/examples/quick/particles/emitters/content/emitmask.qml @@ -51,7 +51,7 @@ Rectangle { anchors.centerIn: parent ImageParticle { - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" z: 2 anchors.fill: parent color: "#336666CC" diff --git a/examples/quick/particles/emitters/content/maximumemitted.qml b/examples/quick/particles/emitters/content/maximumemitted.qml index df92f05f4b..4bd9079770 100644 --- a/examples/quick/particles/emitters/content/maximumemitted.qml +++ b/examples/quick/particles/emitters/content/maximumemitted.qml @@ -53,7 +53,7 @@ Rectangle { ImageParticle { system: sys id: cp - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.4 color: "#000000FF" } diff --git a/examples/quick/particles/emitters/content/shapeanddirection.qml b/examples/quick/particles/emitters/content/shapeanddirection.qml index 1dec5b2fa7..0ca433cfba 100644 --- a/examples/quick/particles/emitters/content/shapeanddirection.qml +++ b/examples/quick/particles/emitters/content/shapeanddirection.qml @@ -58,7 +58,7 @@ Rectangle { ImageParticle { groups: ["center","edge"] anchors.fill: parent - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.1 color: "#009999FF" } diff --git a/examples/quick/particles/emitters/content/trailemitter.qml b/examples/quick/particles/emitters/content/trailemitter.qml index a4972b7b73..3186b511ef 100644 --- a/examples/quick/particles/emitters/content/trailemitter.qml +++ b/examples/quick/particles/emitters/content/trailemitter.qml @@ -56,7 +56,7 @@ Rectangle { system: particles anchors.fill: parent groups: ["A", "B"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0 color: "#00111111" } @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent system: particles groups: ["C", "D"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.1 color: "#00ff400f" } diff --git a/examples/quick/particles/emitters/content/velocityfrommotion.qml b/examples/quick/particles/emitters/content/velocityfrommotion.qml index 1f1d6607d0..d325f9b7e1 100644 --- a/examples/quick/particles/emitters/content/velocityfrommotion.qml +++ b/examples/quick/particles/emitters/content/velocityfrommotion.qml @@ -61,7 +61,7 @@ Rectangle { ParticleSystem { id: sys1 } ImageParticle { system: sys1 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "cyan" alpha: 0 SequentialAnimation on color { @@ -127,7 +127,7 @@ Rectangle { } } colorVariation: 0.5 - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" } Emitter { id: trailsStars @@ -149,7 +149,7 @@ Rectangle { } ParticleSystem { id: sys3; } ImageParticle { - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" system: sys3 color: "orange" alpha: 0 @@ -191,7 +191,7 @@ Rectangle { ParticleSystem { id: sys4; } ImageParticle { system: sys4 - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "green" alpha: 0 SequentialAnimation on color { diff --git a/examples/quick/particles/emitters/doc/src/emitters.qdoc b/examples/quick/particles/emitters/doc/src/emitters.qdoc index 8eb7919000..acf8ce41c4 100644 --- a/examples/quick/particles/emitters/doc/src/emitters.qdoc +++ b/examples/quick/particles/emitters/doc/src/emitters.qdoc @@ -34,27 +34,27 @@ Each example is a small QML file emphasizing a particular type or feature. Velocity from motion gives the effect of strong particle motion through primarily moving the emitters: - \snippet quick/particles/emitters/content/velocityfrommotion.qml 0 + \snippet particles/emitters/content/velocityfrommotion.qml 0 Burst and pulse calls the burst and pulse methods on two idential emitters. - \snippet quick/particles/emitters/content/burstandpulse.qml 0 + \snippet particles/emitters/content/burstandpulse.qml 0 Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for. This gives a slightly different behaviour, which is easy to see in this example. Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted; - \snippet quick/particles/emitters/content/customemitter.qml 0 + \snippet particles/emitters/content/customemitter.qml 0 This is used to emit curving particles in six rotating spokes. Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape. - \snippet quick/particles/emitters/content/emitmask.qml 0 + \snippet particles/emitters/content/emitmask.qml 0 Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached. Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection - \snippet quick/particles/emitters/content/shapeanddirection.qml 0 + \snippet particles/emitters/content/shapeanddirection.qml 0 This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center. TrailEmitter uses that type to add smoke particles to trail the fire particles in the scene. - \snippet quick/particles/emitters/content/customemitter.qml 0 + \snippet particles/emitters/content/customemitter.qml 0 */ diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/content/colored.qml index 939ec7e437..236cc0f372 100644 --- a/examples/quick/particles/imageparticle/content/colored.qml +++ b/examples/quick/particles/imageparticle/content/colored.qml @@ -50,7 +50,7 @@ Rectangle { ImageParticle { groups: ["stars"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" } Emitter { group: "stars" @@ -64,7 +64,7 @@ Rectangle { // ![0] ImageParticle { anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" alpha: 0 alphaVariation: 0.2 colorVariation: 1.0 diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/content/colortable.qml index 4090163872..87b5ae2678 100644 --- a/examples/quick/particles/imageparticle/content/colortable.qml +++ b/examples/quick/particles/imageparticle/content/colortable.qml @@ -55,7 +55,7 @@ Rectangle { alpha: 0 //! [0] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorTable: "../../images/colortable.png" sizeTable: "../../images/colortable.png" //! [0] diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc index c8f2dc988b..4fda13746a 100644 --- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -35,25 +35,25 @@ Each example is a small QML file emphasizing a particular type or feature. All at once shows off several of the features of ImageParticle at the same time. - \snippet quick/particles/imageparticle/content/allatonce.qml 0 + \snippet particles/imageparticle/content/allatonce.qml 0 Colored shows a simple ImageParticle with some color variation. - \snippet quick/particles/imageparticle/content/colored.qml 0 + \snippet particles/imageparticle/content/colored.qml 0 Color Table sets the color over life on the particles to provide a fixed rainbow effect. - \snippet quick/particles/imageparticle/content/colortable.qml 0 + \snippet particles/imageparticle/content/colortable.qml 0 Deformation spins and squishes a starfish particle. - \snippet quick/particles/imageparticle/content/deformation.qml spin - \snippet quick/particles/imageparticle/content/deformation.qml deform + \snippet particles/imageparticle/content/deformation.qml spin + \snippet particles/imageparticle/content/deformation.qml deform Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel. Sharing demonstrates what happens when multiple ImageParticles try to render the same particle. The following ImageParticle renders the particles inside the ListView: - \snippet quick/particles/imageparticle/content/sharing.qml 0 + \snippet particles/imageparticle/content/sharing.qml 0 The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle. - \snippet quick/particles/imageparticle/content/sharing.qml 1 + \snippet particles/imageparticle/content/sharing.qml 1 Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color. Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both. Note that you can undo rotation in another ImageParticle, you just need to explicity set rotationVariation to 0. diff --git a/examples/quick/particles/images.qrc b/examples/quick/particles/images.qrc index 9f284a087d..1f754838a8 100644 --- a/examples/quick/particles/images.qrc +++ b/examples/quick/particles/images.qrc @@ -12,10 +12,8 @@ <file>images/meteor.png</file> <file>images/meteors.png</file> <file>images/nullRock.png</file> - <file>images/particle.png</file> <file>images/particle2.png</file> <file>images/particle3.png</file> - <file>images/particle4.png</file> <file>images/particleA.png</file> <file>images/portal_bg.png</file> <file>images/realLeaf1.png</file> @@ -27,7 +25,6 @@ <file>images/sizeInOut.png</file> <file>images/snowflake.png</file> <file>images/sparkleSize.png</file> - <file>images/star.png</file> <file>images/starfish_0.png</file> <file>images/starfish_1.png</file> <file>images/starfish_2.png</file> diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/content/dynamiccomparison.qml index 247a25a17d..9db7c0a1ec 100644 --- a/examples/quick/particles/system/content/dynamiccomparison.qml +++ b/examples/quick/particles/system/content/dynamiccomparison.qml @@ -52,7 +52,7 @@ Rectangle { ImageParticle { system: sys - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "white" colorVariation: 1.0 alpha: 0.1 @@ -90,7 +90,7 @@ Rectangle { property int lifeSpan: 10000 width: 32 height: 32 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" y: 0 PropertyAnimation on y {from: -16; to: root.height-16; duration: container.lifeSpan; running: true} SequentialAnimation on opacity { diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml index 10ac33bd76..72ec1ffc23 100644 --- a/examples/quick/particles/system/content/dynamicemitters.qml +++ b/examples/quick/particles/system/content/dynamicemitters.qml @@ -51,7 +51,7 @@ Rectangle { } ImageParticle { system: sys - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "white" colorVariation: 1.0 alpha: 0.1 diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/content/multiplepainters.qml index 8a38874533..e0a1288588 100644 --- a/examples/quick/particles/system/content/multiplepainters.qml +++ b/examples/quick/particles/system/content/multiplepainters.qml @@ -91,6 +91,6 @@ Rectangle { height: 240 width: root.width z: 1 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" } } diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml index 5ce8729a43..e787919b05 100644 --- a/examples/quick/particles/system/content/startstop.qml +++ b/examples/quick/particles/system/content/startstop.qml @@ -69,7 +69,7 @@ Rectangle { ImageParticle { anchors.fill: parent system: particles - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" sizeTable: "../../images/sparkleSize.png" alpha: 0 colorVariation: 0.6 diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml index 6443878a36..7131633769 100644 --- a/examples/quick/particles/system/content/timedgroupchanges.qml +++ b/examples/quick/particles/system/content/timedgroupchanges.qml @@ -119,7 +119,7 @@ Rectangle { ImageParticle { groups: ["works", "fire", "splode"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" entryEffect: ImageParticle.Scale } } diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc index 04dc1727d2..99be23d9d1 100644 --- a/examples/quick/particles/system/doc/src/system.qdoc +++ b/examples/quick/particles/system/doc/src/system.qdoc @@ -35,7 +35,7 @@ Each example is a small QML file emphasizing a particular type or feature. Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image types. - \snippet quick/particles/system/content/dynamiccomparison.qml fake + \snippet particles/system/content/dynamiccomparison.qml fake Note how the Image objects are not able to be randomly colorized. Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was. @@ -43,16 +43,16 @@ Timed group changes is an example that highlights the ParticleGroup type. While normally referring to groups with a string name is sufficient, additional effects can be done by setting properties on groups. The first group has a variable duration on it, but always transitions to the second group. - \snippet quick/particles/system/content/timedgroupchanges.qml 0 + \snippet particles/system/content/timedgroupchanges.qml 0 The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow. - \snippet quick/particles/system/content/timedgroupchanges.qml 1 + \snippet particles/system/content/timedgroupchanges.qml 1 The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle. - \snippet quick/particles/system/content/timedgroupchanges.qml 2 + \snippet particles/system/content/timedgroupchanges.qml 2 If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle - \snippet quick/particles/system/content/dynamicemitters.qml 0 + \snippet particles/system/content/dynamicemitters.qml 0 Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply. - Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for QtQuick items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle. + Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for \l {Qt Quick} items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle. */ diff --git a/examples/quick/positioners/doc/src/positioners.qdoc b/examples/quick/positioners/doc/src/positioners.qdoc index 3a20b145ef..794b3b25f9 100644 --- a/examples/quick/positioners/doc/src/positioners.qdoc +++ b/examples/quick/positioners/doc/src/positioners.qdoc @@ -38,15 +38,15 @@ It consists of a scene populated with items in a variety of positioners: Column, Row, Grid and Flow. Each positioner has animations described as Transitions. - \snippet quick/positioners/positioners-transitions.qml move + \snippet positioners/positioners-transitions.qml move The move transition specifies how items inside a positioner will animate when they are displaced by the appearance or disappearance of other items. - \snippet quick/positioners/positioners-transitions.qml add + \snippet positioners/positioners-transitions.qml add The add transition specifies how items will appear when they are added to a positioner. - \snippet quick/positioners/positioners-transitions.qml populate + \snippet positioners/positioners-transitions.qml populate The populate transition specifies how items will appear when their parent positioner is first created. Attached Properties shows how the Positioner attached property can be used to determine where an item is within a positioner. - \snippet quick/positioners/positioners-attachedproperties.qml 0 + \snippet positioners/positioners-attachedproperties.qml 0 */ diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index 2d8acb3345..311e264af1 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -20,6 +20,7 @@ SUBDIRS = accessibility \ customitems \ imageprovider \ window \ + dialogs \ particles \ demos diff --git a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc index d98407b6c1..e3cef52bf7 100644 --- a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc +++ b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc @@ -41,7 +41,7 @@ \section1 BezierCurve Declaration - \snippet quick/scenegraph/customgeometry/beziercurve.h 1 + \snippet scenegraph/customgeometry/beziercurve.h 1 The item declaration subclasses the QQuickItem class and adds five properties. One for each of the four control points in the bezier @@ -52,7 +52,7 @@ signals for each of them so changes will be picked up the QML engine and used accordingly. - \snippet quick/scenegraph/customgeometry/beziercurve.h 2 + \snippet scenegraph/customgeometry/beziercurve.h 2 The synchronization point between the QML scene and the rendering scene graph is the virtual function \l @@ -67,7 +67,7 @@ \section1 BezierCurve Implementation - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 1 + \snippet scenegraph/customgeometry/beziercurve.cpp 1 The BezierCurve constructor sets up default values for the control points and the number of segments. The bezier curve @@ -80,7 +80,7 @@ QQuickItem::updatePaintNode() when it is time for the QML scene to be synchronized with the rendering scene graph. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 2 + \snippet scenegraph/customgeometry/beziercurve.cpp 2 The BezierCurve class has no data members that need to be cleaned up so the destructor does nothing. It is worth mentioning that the @@ -89,7 +89,7 @@ QSGNode references in the QQuickItem class nor try to clean them up explicitly. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 3 + \snippet scenegraph/customgeometry/beziercurve.cpp 3 The setter function for the p1 property checks if the value is unchanged and exits early if this is the case. Then it updates the @@ -103,7 +103,7 @@ The other property setters are equivalent, and are omitted from this example. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 4 + \snippet scenegraph/customgeometry/beziercurve.cpp 4 The updatePaintNode() function is the primary integration point for synchronizing the state of the QML scene with the rendering @@ -113,7 +113,7 @@ our QSGGeometryNode which we will fill with geometry and a material. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 5 + \snippet scenegraph/customgeometry/beziercurve.cpp 5 We then create the geometry and add it to the node. The first argument to the QSGGeometry constructor is a definition of the @@ -135,7 +135,7 @@ geometry a member of a QSGGeometryNode subclass, in which case, we would not have set the QSGGeometryNode::OwnsGeometry flag. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 6 + \snippet scenegraph/customgeometry/beziercurve.cpp 6 The scene graph API provides a few commonly used used material implementations. In this example we use the QSGFlatColorMaterial @@ -143,7 +143,7 @@ color. Again we pass the ownership of the material to the node, so it can be cleaned up by the scene graph. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 7 + \snippet scenegraph/customgeometry/beziercurve.cpp 7 In the case where the QML item has changed and we only want to modify the existing node's geometry, we cast the \c oldNode to a @@ -151,7 +151,7 @@ segment count has changed, we call QSGGeometry::allocate() to make sure it has the right number of vertices. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 8 + \snippet scenegraph/customgeometry/beziercurve.cpp 8 To fill the geometry, we first extract the vertex array from it. Since we are using one of the default attribute sets, we can @@ -159,14 +159,14 @@ Then we go through each segment and calculate its position and write that value to the vertex. - \snippet quick/scenegraph/customgeometry/beziercurve.cpp 9 + \snippet scenegraph/customgeometry/beziercurve.cpp 9 In the end of the function, we return the node so the scene graph can render it. \section1 Application Entry-Point - \snippet quick/scenegraph/customgeometry/main.cpp 1 + \snippet scenegraph/customgeometry/main.cpp 1 The application is a straightforward QML application, with a QGuiApplication and a QQuickView that we pass a .qml file. To make @@ -183,24 +183,24 @@ \section1 Using the Item - \snippet quick/scenegraph/customgeometry/main.qml 1 + \snippet scenegraph/customgeometry/main.qml 1 Our .qml file imports the \c {QtQuick 2.0} module to get the standard types and also our own \c {CustomGeometry 1.0} module which contains our newly created BezierCurve objects. - \snippet quick/scenegraph/customgeometry/main.qml 2 + \snippet scenegraph/customgeometry/main.qml 2 Then we create the our root item and an instance of the BezierCurve which we anchor to fill the root. - \snippet quick/scenegraph/customgeometry/main.qml 3 + \snippet scenegraph/customgeometry/main.qml 3 To make the example a bit more interesting we add an animation to change the two control points in the curve. The end points stay unchanged. - \snippet quick/scenegraph/customgeometry/main.qml 4 + \snippet scenegraph/customgeometry/main.qml 4 Finally we overlay a short text outlining what the example shows. diff --git a/examples/quick/scenegraph/graph/doc/images/graph-example.jpg b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg Binary files differnew file mode 100644 index 0000000000..74975ee7c4 --- /dev/null +++ b/examples/quick/scenegraph/graph/doc/images/graph-example.jpg diff --git a/examples/quick/scenegraph/graph/doc/src/graph.qdoc b/examples/quick/scenegraph/graph/doc/src/graph.qdoc new file mode 100644 index 0000000000..d5a07cdc48 --- /dev/null +++ b/examples/quick/scenegraph/graph/doc/src/graph.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example scenegraph/graph + \title Scene Graph - Graph + \ingroup qtquickexamples + + \brief Demonstrates how one can combine custom materials and geometries + under a single QQuickItem. + + \image graph-example.jpg + + */ diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp new file mode 100644 index 0000000000..ad75307e57 --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "graph.h" + +#include "noisynode.h" +#include "gridnode.h" +#include "linenode.h" + +Graph::Graph() + : m_samplesChanged(false) + , m_geometryChanged(false) +{ + setFlag(ItemHasContents, true); +} + + +void Graph::appendSample(qreal value) +{ + m_samples << value; + m_samplesChanged = true; + update(); +} + + +void Graph::removeFirstSample() +{ + m_samples.removeFirst(); + m_samplesChanged = true; + update(); +} + +void Graph::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + m_geometryChanged = true; + update(); + QQuickItem::geometryChanged(newGeometry, oldGeometry); +} + + +class GraphNode : public QSGNode +{ +public: + NoisyNode *background; + GridNode *grid; + LineNode *line; + LineNode *shadow; +}; + + +QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) +{ + GraphNode *n= static_cast<GraphNode *>(oldNode); + + QRectF rect = boundingRect(); + + if (rect.isEmpty()) { + delete n; + return 0; + } + + if (!n) { + n = new GraphNode(); + + n->background = new NoisyNode(window()); + n->grid = new GridNode(); + n->line = new LineNode(10, 0.5, QColor("steelblue")); + n->shadow = new LineNode(20, 0.2, QColor::fromRgbF(0.2, 0.2, 0.2, 0.4)); + + n->appendChildNode(n->background); + n->appendChildNode(n->grid); + n->appendChildNode(n->shadow); + n->appendChildNode(n->line); + } + + if (m_geometryChanged) { + n->background->setRect(rect); + n->grid->setRect(rect); + } + + if (m_geometryChanged || m_samplesChanged) { + n->line->updateGeometry(rect, m_samples); + // We don't need to calculate the geometry twice, so just steal it from the other one... + n->shadow->setGeometry(n->line->geometry()); + } + + m_geometryChanged = false; + m_samplesChanged = false; + + return n; +} diff --git a/examples/quick/scenegraph/graph/graph.h b/examples/quick/scenegraph/graph/graph.h new file mode 100644 index 0000000000..28d14f166a --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRAPH_H +#define GRAPH_H + +#include <QQuickItem> + +class Graph : public QQuickItem +{ + Q_OBJECT +public: + Graph(); + +protected: + QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + +public slots: + void appendSample(qreal value); + void removeFirstSample(); + +private: + QList<qreal> m_samples; + + bool m_samplesChanged; + bool m_geometryChanged; +}; + +#endif // GRAPH_H diff --git a/examples/quick/scenegraph/graph/graph.pro b/examples/quick/scenegraph/graph/graph.pro new file mode 100644 index 0000000000..5991f799dc --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.pro @@ -0,0 +1,34 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-06-11T13:13:18 +# +#------------------------------------------------- + +QT += core gui quick + +TARGET = graph + +TEMPLATE = app + +SOURCES += main.cpp \ + graph.cpp \ + noisynode.cpp \ + gridnode.cpp \ + linenode.cpp + +HEADERS += \ + graph.h \ + noisynode.h \ + gridnode.h \ + linenode.h + +RESOURCES += \ + graph.qrc + +OTHER_FILES += \ + main.qml \ + shaders/noisy.vsh \ + shaders/noisy.fsh \ + shaders/line.fsh \ + shaders/line.vsh + diff --git a/examples/quick/scenegraph/graph/graph.qrc b/examples/quick/scenegraph/graph/graph.qrc new file mode 100644 index 0000000000..2adaeac751 --- /dev/null +++ b/examples/quick/scenegraph/graph/graph.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/scenegraph/graph"> + <file>main.qml</file> + <file>shaders/noisy.vsh</file> + <file>shaders/noisy.fsh</file> + <file>shaders/line.vsh</file> + <file>shaders/line.fsh</file> + </qresource> +</RCC> diff --git a/examples/quick/scenegraph/graph/gridnode.cpp b/examples/quick/scenegraph/graph/gridnode.cpp new file mode 100644 index 0000000000..2b5e8cac16 --- /dev/null +++ b/examples/quick/scenegraph/graph/gridnode.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "gridnode.h" + +#include "qmath.h" + +#define GRID_SIZE 32 + +GridNode::GridNode() + : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 0) +{ + setGeometry(&m_geometry); + m_geometry.setDrawingMode(GL_LINES); + + setMaterial(&m_material); + m_material.setColor(Qt::gray); +} + +/* + * The function hardcodes a fixed set of grid lines and scales + * those to the bounding rect. + */ +void GridNode::setRect(const QRectF &rect) +{ + int vCount = int((rect.width() - 1) / GRID_SIZE); + int hCount = int((rect.height() - 1) / GRID_SIZE); + + int lineCount = vCount + hCount; + + QSGGeometry *g = geometry(); + + g->allocate(lineCount * 2); + + float x = rect.x(); + float y = rect.y(); + float w = rect.width(); + float h = rect.height(); + + QSGGeometry::Point2D *v = g->vertexDataAsPoint2D(); + + // Then write the vertical lines + for (int i=0; i<vCount; ++i) { + float dx = (i + 1) * GRID_SIZE; + v[i*2].set(dx, y); + v[i*2+1].set(dx, y + h); + } + v += vCount * 2; + // Then write the horizontal lines + for (int i=0; i<hCount; ++i) { + float dy = (i + 1) * GRID_SIZE; + v[i*2].set(x, dy); + v[i*2+1].set(x + w, dy); + } + + // Tell the scenegraph we updated the geometry.. + markDirty(QSGNode::DirtyGeometry); +} diff --git a/examples/quick/scenegraph/graph/gridnode.h b/examples/quick/scenegraph/graph/gridnode.h new file mode 100644 index 0000000000..8581a993ae --- /dev/null +++ b/examples/quick/scenegraph/graph/gridnode.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GRIDNODE_H +#define GRIDNODE_H + +#include <QtQuick/QSGGeometryNode> +#include <QtQuick/QSGFlatColorMaterial> + +class GridNode : public QSGGeometryNode +{ +public: + GridNode(); + + void setRect(const QRectF &rect); + +private: + QSGFlatColorMaterial m_material; + QSGGeometry m_geometry; +}; + +#endif // GRIDNODE_H diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp new file mode 100644 index 0000000000..0d1229cf1d --- /dev/null +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "linenode.h" + +#include <QtCore/QResource> + +#include <QtGui/QColor> + +#include <QtQuick/QSGSimpleMaterial> + +struct LineMaterial +{ + QColor color; + float spread; + float size; +}; + +class LineShader : public QSGSimpleMaterialShader<LineMaterial> +{ + QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) + +public: + const char *vertexShader() const { + QResource r(":/scenegraph/graph/shaders/line.vsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + const char *fragmentShader() const { + QResource r(":/scenegraph/graph/shaders/line.fsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + QList<QByteArray> attributes() const { return QList<QByteArray>() << "pos" << "t"; } + + void updateState(const LineMaterial *m, const LineMaterial *) { + program()->setUniformValue(id_color, m->color); + program()->setUniformValue(id_spread, m->spread); + program()->setUniformValue(id_size, m->size); + } + + void resolveUniforms() { + id_spread = program()->uniformLocation("spread"); + id_size = program()->uniformLocation("size"); + id_color = program()->uniformLocation("color"); + } + +private: + int id_color; + int id_spread; + int id_size; +}; + +struct LineVertex { + float x; + float y; + float t; + inline void set(float xx, float yy, float tt) { x = xx; y = yy; t = tt; } +}; + +static const QSGGeometry::AttributeSet &attributes() +{ + static QSGGeometry::Attribute attr[] = { + QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true), + QSGGeometry::Attribute::create(1, 1, GL_FLOAT) + }; + static QSGGeometry::AttributeSet set = { 2, 3 * sizeof(float), attr }; + return set; +} + +LineNode::LineNode(float size, float spread, const QColor &color) + : m_geometry(attributes(), 0) +{ + setGeometry(&m_geometry); + m_geometry.setDrawingMode(GL_TRIANGLE_STRIP); + + QSGSimpleMaterial<LineMaterial> *m = LineShader::createMaterial(); + m->state()->color = color; + m->state()->size = size; + m->state()->spread = spread; + m->setFlag(QSGMaterial::Blending); + setMaterial(m); + setFlag(OwnsMaterial); +} + +/* + * Assumes that samples have values in the range of 0 to 1 and scales them to + * the height of bounds. The samples are stretched out horizontally along the + * width of the bounds. + * + * The position of each pair of points is identical, but we use the third value + * "t" to shift the point up or down and to add antialiasing. + */ +void LineNode::updateGeometry(const QRectF &bounds, const QList<qreal> &samples) +{ + m_geometry.allocate(samples.size() * 2); + + float x = bounds.x(); + float y = bounds.y(); + float w = bounds.width(); + float h = bounds.height(); + + float dx = w / (samples.size() - 1); + + LineVertex *v = (LineVertex *) m_geometry.vertexData(); + for (int i=0; i<samples.size(); ++i) { + v[i*2+0].set(x + dx * i, y + samples.at(i) * h, 0); + v[i*2+1].set(x + dx * i, y + samples.at(i) * h, 1); + } + + markDirty(QSGNode::DirtyGeometry); +} diff --git a/examples/quick/scenegraph/graph/linenode.h b/examples/quick/scenegraph/graph/linenode.h new file mode 100644 index 0000000000..192bedbefc --- /dev/null +++ b/examples/quick/scenegraph/graph/linenode.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LINENODE_H +#define LINENODE_H + +#include <QSGGeometryNode> + +class LineNode : public QSGGeometryNode +{ +public: + LineNode(float size, float spread, const QColor &color); + + void updateGeometry(const QRectF &bounds, const QList<qreal> &samples); + +private: + QSGGeometry m_geometry; + +}; + +#endif // LINENODE_H diff --git a/examples/quick/scenegraph/graph/main.cpp b/examples/quick/scenegraph/graph/main.cpp new file mode 100644 index 0000000000..ed54ae59b1 --- /dev/null +++ b/examples/quick/scenegraph/graph/main.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQuickView> + +#include "graph.h" +#include <QtQml/QQmlContext> + +int main(int argc, char *argv[]) +{ + QGuiApplication a(argc, argv); + + qmlRegisterType<Graph>("Graph", 1, 0, "Graph"); + + QQuickView view; + view.resize(800, 400); + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl("qrc:///scenegraph/graph/main.qml")); + view.show(); + + return a.exec(); +} diff --git a/examples/quick/scenegraph/graph/main.qml b/examples/quick/scenegraph/graph/main.qml new file mode 100644 index 0000000000..ad952bcf1a --- /dev/null +++ b/examples/quick/scenegraph/graph/main.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +import Graph 1.0 + +Item { + width: 800 + height: 400 + + Graph { + id: graph + anchors.fill: parent + anchors.margins: 100 + + function newSample(i) { + return (Math.sin(i / 100.0 * Math.PI * 2) + 1) * 0.4 + Math.random() * 0.05; + } + + Component.onCompleted: { + for (var i=0; i<100; ++i) + appendSample(newSample(i)); + } + + property int offset: 100; + } + + Timer { + id: timer + interval: 500 + repeat: true + running: true + onTriggered: { + graph.removeFirstSample(); + graph.appendSample(graph.newSample(++graph.offset)); + } + + } + + Rectangle { + anchors.fill: graph + color: "transparent" + border.color: "black" + border.width: 2 + } + +} diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp new file mode 100644 index 0000000000..1fc87a2b97 --- /dev/null +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "noisynode.h" + +#include <QtCore/QResource> + +#include <QtQuick/QSGSimpleMaterialShader> +#include <QtQuick/QSGTexture> +#include <QtQuick/QQuickWindow> + +#define NOISE_SIZE 64 + +struct NoisyMaterial +{ + ~NoisyMaterial() { + delete texture; + } + + QColor color; + QSGTexture *texture; +}; + +class NoisyShader : public QSGSimpleMaterialShader<NoisyMaterial> +{ + QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial) + +public: + const char *vertexShader() const { + QResource r(":/scenegraph/graph/shaders/noisy.vsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + const char *fragmentShader() const { + QResource r(":/scenegraph/graph/shaders/noisy.fsh"); + Q_ASSERT(r.isValid()); + return (const char *) r.data(); + } + + QList<QByteArray> attributes() const { return QList<QByteArray>() << "aVertex" << "aTexCoord"; } + + void updateState(const NoisyMaterial *m, const NoisyMaterial *) { + + // Set the color + program()->setUniformValue(id_color, m->color); + + // Bind the texture and set program to use texture unit 0 (the default) + m->texture->bind(); + + // Then set the texture size so we can adjust the texture coordinates accordingly in the + // vertex shader.. + QSize s = m->texture->textureSize(); + program()->setUniformValue(id_textureSize, QSizeF(1.0 / s.width(), 1.0 / s.height())); + } + + void resolveUniforms() { + id_texture = program()->uniformLocation("texture"); + id_textureSize = program()->uniformLocation("textureSize"); + id_color = program()->uniformLocation("color"); + + // We will only use texture unit 0, so set it only once. + program()->setUniformValue(id_texture, 0); + } + +private: + int id_color; + int id_texture; + int id_textureSize; +}; + +NoisyNode::NoisyNode(QQuickWindow *window) +{ + // Make some noise... + QImage image(NOISE_SIZE, NOISE_SIZE, QImage::Format_RGB32); + uint *data = (uint *) image.bits(); + for (int i=0; i<NOISE_SIZE * NOISE_SIZE; ++i) { + uint g = rand() & 0xff; + data[i] = 0xff000000 | (g << 16) | (g << 8) | g; + } + + QSGTexture *t = window->createTextureFromImage(image); + t->setFiltering(QSGTexture::Nearest); + t->setHorizontalWrapMode(QSGTexture::Repeat); + t->setVerticalWrapMode(QSGTexture::Repeat); + + QSGSimpleMaterial<NoisyMaterial> *m = NoisyShader::createMaterial(); + m->state()->texture = t; + m->state()->color = QColor::fromRgbF(0.95, 0.95, 0.97); + m->setFlag(QSGMaterial::Blending); + + setMaterial(m); + setFlag(OwnsMaterial, true); + + QSGGeometry *g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4); + QSGGeometry::updateTexturedRectGeometry(g, QRect(), QRect()); + setGeometry(g); + setFlag(OwnsGeometry, true); +} + +void NoisyNode::setRect(const QRectF &bounds) +{ + QSGGeometry::updateTexturedRectGeometry(geometry(), bounds, QRectF(0, 0, 1, 1)); + markDirty(QSGNode::DirtyGeometry); +} diff --git a/examples/quick/scenegraph/graph/noisynode.h b/examples/quick/scenegraph/graph/noisynode.h new file mode 100644 index 0000000000..b5a291330f --- /dev/null +++ b/examples/quick/scenegraph/graph/noisynode.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NOISYNODE_H +#define NOISYNODE_H + +#include <QSGGeometryNode> + +class QQuickWindow; + +class NoisyNode : public QSGGeometryNode +{ +public: + NoisyNode(QQuickWindow *window); + + void setRect(const QRectF &bounds); +}; + +#endif // NOISYNODE_H diff --git a/examples/quick/window/window/nogui.qml b/examples/quick/scenegraph/graph/shaders/line.fsh index 2a5734c773..b07558c2ab 100644 --- a/examples/quick/window/window/nogui.qml +++ b/examples/quick/scenegraph/graph/shaders/line.fsh @@ -38,13 +38,17 @@ ** ****************************************************************************/ -import QtQml 2.0 +uniform lowp vec4 color; +uniform lowp float qt_Opacity; +uniform lowp float spread; -/* - This object's only functionality is to exist as a root object and - display nothing, proving that qmlscene can run without windows. - (A QtObject can't even have Component.onCompleted) -*/ -QtObject { - property string philosophy: "hello bleak windowless world" +varying lowp float vT; + +#define PI 3.14159265359 + +void main(void) +{ + lowp float tt = smoothstep(spread, 1.0, sin(vT * PI)); + + gl_FragColor = color * qt_Opacity * tt; } diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp b/examples/quick/scenegraph/graph/shaders/line.vsh index 844c850366..84353b852c 100644 --- a/src/qml/doc/snippets/qml/qtbinding/resources/main.cpp +++ b/examples/quick/scenegraph/graph/shaders/line.vsh @@ -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,20 +38,19 @@ ** ****************************************************************************/ -#include <QApplication> -#include <QQuickView> -#include <QQmlContext> +attribute highp vec4 pos; +attribute highp float t; -//![0] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); +uniform lowp float size; +uniform highp mat4 qt_Matrix; - QQuickView view; - view.setSource(QUrl("qrc:/main.qml")); - view.show(); +varying lowp float vT; - return app.exec(); -} -//![0] +void main(void) +{ + vec4 adjustedPos = pos; + adjustedPos.y += (t * size); + gl_Position = qt_Matrix * adjustedPos; + vT = t; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.fsh b/examples/quick/scenegraph/graph/shaders/noisy.fsh new file mode 100644 index 0000000000..227c2b5974 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.fsh @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +uniform sampler2D texture; +uniform lowp float qt_Opacity; +uniform lowp vec4 color; + +varying highp vec2 vTexCoord; +varying lowp vec2 vShadeCoord; + +#define PI 3.14159265359 + +void main() +{ + lowp float shade = texture2D(texture, vTexCoord).r * 0.05 - length(vec2(0.5, 0.4) - vShadeCoord) * 0.3; + lowp vec4 c = vec4(color.xyz + shade, color.w); + gl_FragColor = c * qt_Opacity; +} diff --git a/examples/quick/scenegraph/graph/shaders/noisy.vsh b/examples/quick/scenegraph/graph/shaders/noisy.vsh new file mode 100644 index 0000000000..ce648e51b9 --- /dev/null +++ b/examples/quick/scenegraph/graph/shaders/noisy.vsh @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +attribute highp vec4 aVertex; +attribute highp vec2 aTexCoord; + +uniform highp mat4 qt_Matrix; +uniform highp vec2 textureSize; + +varying highp vec2 vTexCoord; +varying lowp vec2 vShadeCoord; + +void main() { + gl_Position = qt_Matrix * aVertex; + vTexCoord = aVertex.xy * textureSize; + vShadeCoord = aTexCoord; +} diff --git a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc index 4bf5444d79..1f87412aa4 100644 --- a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc +++ b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc @@ -50,7 +50,7 @@ in the QML file and this value is used by the OpenGL shader program that draws the squircles. - \snippet quick/scenegraph/openglunderqml/squircle.h 1 + \snippet scenegraph/openglunderqml/squircle.h 1 First of all, we need a QObject with a slot to connect the signals to. We subclass QQuickItem in order to use the \l @@ -73,13 +73,13 @@ Lets move on to the implementation. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 7 + \snippet scenegraph/openglunderqml/squircle.cpp 7 The constructor of the \c Squircle class simply initializes the values. The shader program will be initialized during rendering later. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 8 + \snippet scenegraph/openglunderqml/squircle.cpp 8 The property setter checks that the value has indeed changed before updating its internal variable. It then calls \l @@ -88,13 +88,13 @@ initialization, before the object has been entered into the scene and before it has a window. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 1 - \snippet quick/scenegraph/openglunderqml/squircle.cpp 2 + \snippet scenegraph/openglunderqml/squircle.cpp 1 + \snippet scenegraph/openglunderqml/squircle.cpp 2 For our paint function to be called, we need to connect to the window's signals. When Squircle object is populated into the - scene, the itemChange function is called with the change type \c - ItemSceneChange. We connect \l QQuickWindow::beforeRendering() to + scene, the windowChanged signal is emitted. In our handler, + we connect \l QQuickWindow::beforeRendering() to \c paint() to do the rendering, and \l QQuickWindow::beforeSynchronizing() to \c sync() to copy the state of the \c t property for the upcoming frame. @@ -106,14 +106,14 @@ slots are invoked on the wrong thread with no OpenGL context present. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 3 + \snippet scenegraph/openglunderqml/squircle.cpp 3 The default behavior of the scene graph is to clear the framebuffer before rendering. Since we render before the scene graph, we need to turn this clearing off. This means that we need to clear ourselves in the \c paint() function. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 4 + \snippet scenegraph/openglunderqml/squircle.cpp 4 The first thing we do in the \c paint() function is to initialize the shader program. By initializing the shader program @@ -126,18 +126,18 @@ all rendering related operations must happen on the rendering thread. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 5 + \snippet scenegraph/openglunderqml/squircle.cpp 5 We use the shader program to draw the squircle. At the end of the \c paint function we release the program and disable the attributes we used so that the OpenGL context is in a "clean" state for the scene graph to pick it up. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 6 + \snippet scenegraph/openglunderqml/squircle.cpp 6 In the \c cleanup() function we delete the program. - \snippet quick/scenegraph/openglunderqml/squircle.cpp 9 + \snippet scenegraph/openglunderqml/squircle.cpp 9 We use the \c sync() function to copy the state of the object in the GUI thread into the rendering thread. @@ -146,20 +146,20 @@ thread is blocked, so it is safe to simply copy the value without any additional protection. - \snippet quick/scenegraph/openglunderqml/main.cpp 1 + \snippet scenegraph/openglunderqml/main.cpp 1 The application's \c main() function instantiates a QQuickView and launches the \c main.qml file. The only thing worth noting is that we export the \c Squircle class to QML using the \l qmlRegisterType() macro. - \snippet quick/scenegraph/openglunderqml/main.qml 1 + \snippet scenegraph/openglunderqml/main.qml 1 We import the Squircle QML type with the name we registered in the \c main() function. We then instantiate it and create a running - NumberAnimation on the its \c t property. + NumberAnimation on its \c t property. - \snippet quick/scenegraph/openglunderqml/main.qml 2 + \snippet scenegraph/openglunderqml/main.qml 2 Then we overlay a short descriptive text, so that it is clearly visible that we are in fact rendering OpenGL under our Qt Quick diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 84509fb615..8ceb9c5f9e 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -51,6 +51,7 @@ Squircle::Squircle() , m_t(0) , m_thread_t(0) { + connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*))); } //! [7] @@ -66,17 +67,11 @@ void Squircle::setT(qreal t) } //! [8] - //! [1] -void Squircle::itemChange(ItemChange change, const ItemChangeData &) +void Squircle::handleWindowChanged(QQuickWindow *win) { - // The ItemSceneChange event is sent when we are first attached to a window. - if (change == ItemSceneChange) { - QQuickWindow *win = window(); - if (!win) - return; + if (win) { //! [1] - // Connect the beforeRendering signal to our paint function. // Since this call is executed on the rendering thread it must be // a Qt::DirectConnection diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h index e292ca325f..449e02bbf1 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.h +++ b/examples/quick/scenegraph/openglunderqml/squircle.h @@ -61,14 +61,14 @@ public: signals: void tChanged(); -protected: - void itemChange(ItemChange change, const ItemChangeData &); - public slots: void paint(); void cleanup(); void sync(); +private slots: + void handleWindowChanged(QQuickWindow *win); + private: QOpenGLShaderProgram *m_program; diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc index 1529649798..5d83b9fa5f 100644 --- a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc +++ b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc @@ -47,7 +47,7 @@ material state is what we assign to each individual node, in this case to give them different colors. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 1 + \snippet scenegraph/simplematerial/simplematerial.cpp 1 The first thing we do when creating custom materials with the simplified scheme is to create a state class. In this case the @@ -55,7 +55,7 @@ compare function which the scene graph can use to reorder the node rendering. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 2 + \snippet scenegraph/simplematerial/simplematerial.cpp 2 Next we define the material shader, by subclassing a template instantiation of \l QSGSimpleMaterialShader with our \c State. @@ -74,21 +74,21 @@ classes. Using the same \c State class in multiple shaders will will lead to undefined behavior. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 3 + \snippet scenegraph/simplematerial/simplematerial.cpp 3 Next comes the declaration of the shader source code, where we define a vertex and fragment shader. The simple material assumes the presence of \c qt_Matrix in the vertex shader and \c qt_Opacity in the fragment shader. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 4 + \snippet scenegraph/simplematerial/simplematerial.cpp 4 We reimplement the \c attributes function to return the name of the \c aVertex and \c aTexCoord attribute names. These attributes will be mapped to attribute indices 0 and 1 in the node's geometry. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 6 + \snippet scenegraph/simplematerial/simplematerial.cpp 6 Uniforms can be accessed either by name or by index, where index is faster than name, so we reimplement the \c resolveUniforms() @@ -96,7 +96,7 @@ to worry about resolving \c qt_Opacity or \c qt_Matrix as these are handled by the baseclass. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 5 + \snippet scenegraph/simplematerial/simplematerial.cpp 5 The \c updateState() function is called once for every unique state and we use it to update the shader program with the current @@ -105,7 +105,7 @@ usecase, where all the colors are different, the updateState will be called once for every node. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 7 + \snippet scenegraph/simplematerial/simplematerial.cpp 7 The \c ColorNode class is supposed to draw something, so it needs to be a subclass of \l QSGGeometryNode. @@ -129,12 +129,12 @@ Finally, we tell the node to take ownership of the material, so we do not have to explicitly memorymanage it. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 8 + \snippet scenegraph/simplematerial/simplematerial.cpp 8 Since the Item is providing its own graphics to the scene graph, we set the flag \l QQuickItem::ItemHasContents. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 9 + \snippet scenegraph/simplematerial/simplematerial.cpp 9 Whenever the Item has changed graphically, the \l QQuickItem::updatePaintNode() function is called. @@ -157,23 +157,23 @@ state. Finally, we notify the scene graph that the node has undergone changes to its geometry and material. - \snippet quick/scenegraph/simplematerial/simplematerial.cpp 11 + \snippet scenegraph/simplematerial/simplematerial.cpp 11 The \c main() function of the application adds the custom QML type using \l qmlRegisterType() and opens up a \l QQuickView with our QML file. - \snippet quick/scenegraph/simplematerial/main.qml 1 + \snippet scenegraph/simplematerial/main.qml 1 In the QML file, we import our custom type so we can instantiate it. - \snippet quick/scenegraph/simplematerial/main.qml 2 + \snippet scenegraph/simplematerial/main.qml 2 Then we create a column of three instances of our custom item, each with a different color. - \snippet quick/scenegraph/simplematerial/main.qml 3 + \snippet scenegraph/simplematerial/main.qml 3 And finally we overlay a short descriptive text. diff --git a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc b/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc index b24b0bd97b..0917604a35 100644 --- a/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc +++ b/examples/quick/scenegraph/textureinsgnode/doc/src/textureinsgnode.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example quick/scenegraph/textureinsgnode + \example scenegraph/textureinsgnode \title Scene Graph - Rendering FBOs \ingroup qtquickexamples diff --git a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc b/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc index 476605b268..6f4a2514f0 100644 --- a/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc +++ b/examples/quick/scenegraph/textureinthread/doc/src/textureinthread.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example quick/scenegraph/textureinthread + \example scenegraph/textureinthread \title Scene Graph - Rendering FBOs in a thread \ingroup qtquickexamples diff --git a/src/quick/doc/snippets/qml/usecases/MyText.qml b/examples/quick/scenegraph/textureinthread/error.qml index d58a4036bb..1dbd576ef7 100644 --- a/src/quick/doc/snippets/qml/usecases/MyText.qml +++ b/examples/quick/scenegraph/textureinthread/error.qml @@ -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,11 +38,12 @@ ** ****************************************************************************/ -//![0] import QtQuick 2.0 Text { - color: "lightsteelblue" - font { family: 'Courier'; pixelSize: 20; bold: true; capitalization: Font.SmallCaps } + width: 400 + height: 100 + text: 'Platform does not support threaded OpenGL needed by this example.' + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter } -//![0] diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp index e415d254a1..801f1891b9 100644 --- a/examples/quick/scenegraph/textureinthread/main.cpp +++ b/examples/quick/scenegraph/textureinthread/main.cpp @@ -38,8 +38,13 @@ ** ****************************************************************************/ +#include <QtCore/QThread> + #include <QGuiApplication> +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/qpa/qplatformintegration.h> + #include <QtQuick/QQuickView> #include "threadrenderer.h" @@ -48,12 +53,39 @@ 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; + + { + QQuickView view; + + // Rendering in a thread introduces a slightly more complicated cleanup + // so we ensure that no cleanup of graphics resources happen until the + // application is shutting down. + view.setPersistentOpenGLContext(true); + view.setPersistentSceneGraph(true); + + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml")); + view.show(); + + execReturn = app.exec(); + } - QQuickView view; - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml")); - view.show(); + // As the render threads make use of our QGuiApplication object + // to clean up gracefully, wait for them to finish before + // QGuiApp is taken off the heap. + foreach (QThread *t, ThreadRenderer::threads) { + t->wait(); + delete t; + } - return app.exec(); + return execReturn; } diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.pro b/examples/quick/scenegraph/textureinthread/textureinthread.pro index b48c2a1863..7f5fbb76e9 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.pro +++ b/examples/quick/scenegraph/textureinthread/textureinthread.pro @@ -1,5 +1,8 @@ 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 diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.qrc b/examples/quick/scenegraph/textureinthread/textureinthread.qrc index 9ecf0ada1c..66eb53b736 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.qrc +++ b/examples/quick/scenegraph/textureinthread/textureinthread.qrc @@ -1,5 +1,6 @@ <RCC> - <qresource prefix="/scenegraph/textureinsgnode"> + <qresource prefix="/scenegraph/textureinthread"> <file>main.qml</file> + <file>error.qml</file> </qresource> </RCC> diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp index 90b6b49880..7de1d294ba 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp @@ -46,10 +46,13 @@ #include <QtGui/QOpenGLContext> #include <QtGui/QOpenGLFramebufferObject> +#include <QtGui/QGuiApplication> +#include <QtGui/QOffscreenSurface> #include <QtQuick/QQuickWindow> #include <qsgsimpletexturenode.h> +QList<QThread *> ThreadRenderer::threads; /* * The render thread shares a context with the scene graph and will @@ -60,37 +63,39 @@ class RenderThread : public QThread { Q_OBJECT public: - RenderThread(const QSize &size) + RenderThread(const QSize &size, QOpenGLContext *context) : m_renderFbo(0) , m_displayFbo(0) , m_logoRenderer(0) + , m_fakeSurface(0) , m_size(size) { - // Since we're using queued connections, we need affinity to the rendering thread. - moveToThread(this); + ThreadRenderer::threads << this; // Set up the QOpenGLContext to use for rendering in this thread. It is sharing // memory space with the GL context of the scene graph. This constructor is called // during updatePaintNode, so we are currently on the scene graph thread with the // scene graph's OpenGL context current. - QOpenGLContext *current = QOpenGLContext::currentContext(); m_context = new QOpenGLContext(); - m_context->setShareContext(current); - m_context->setFormat(current->format()); - m_context->create(); + m_context->setShareContext(context); + m_context->setFormat(context->format()); m_context->moveToThread(this); - // We need a non-visible surface to make current... - m_fakeSurface = new QWindow(); - m_fakeSurface->setGeometry(0, 0, 64, 64); - m_fakeSurface->setSurfaceType(QWindow::OpenGLSurface); - m_fakeSurface->setFormat(current->format()); + // We need a non-visible surface to make current in the other thread + // and QWindows must be created and managed on the GUI thread. + m_fakeSurface = new QOffscreenSurface(); + m_fakeSurface->setFormat(context->format()); m_fakeSurface->create(); } + void setSurface(QOffscreenSurface *surface) { m_fakeSurface = surface; } + public slots: void renderNext() { + if (!m_context->isValid()) + m_context->create(); + m_context->makeCurrent(m_fakeSurface); if (!m_renderFbo) { @@ -119,6 +124,23 @@ public slots: emit textureReady(m_displayFbo->texture(), m_size); } + void shutDown() + { + m_context->makeCurrent(m_fakeSurface); + delete m_renderFbo; + delete m_displayFbo; + delete m_logoRenderer; + m_context->doneCurrent(); + delete m_context; + + // schedule this to be deleted only after we're done cleaning up + m_fakeSurface->deleteLater(); + + // Stop event processing, move the thread to GUI and make sure it is deleted. + exit(); + moveToThread(QGuiApplication::instance()->thread()); + } + signals: void textureReady(int id, const QSize &size); @@ -128,7 +150,7 @@ private: LogoRenderer *m_logoRenderer; - QWindow *m_fakeSurface; + QOffscreenSurface *m_fakeSurface; QOpenGLContext *m_context; QSize m_size; }; @@ -209,19 +231,35 @@ private: ThreadRenderer::ThreadRenderer() + : m_renderThread(0) { setFlag(ItemHasContents, true); + polish(); } +void ThreadRenderer::updatePolish() +{ + if (!window() || !window()->openglContext()) + return; + m_renderThread = new RenderThread(QSize(512, 512), window()->openglContext()); + m_renderThread->moveToThread(m_renderThread); + m_renderThread->start(); + connect(window(), SIGNAL(sceneGraphInvalidated()), m_renderThread, SLOT(shutDown()), Qt::QueuedConnection); +} QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { + if (!m_renderThread) { + polish(); + update(); + return 0; + } + TextureNode *node = static_cast<TextureNode *>(oldNode); if (!node) { node = new TextureNode(window()); - m_renderThread = new RenderThread(QSize(512, 512)); /* Set up connections to get the production of FBO textures in sync with vsync on the * rendering thread. @@ -242,9 +280,6 @@ QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * connect(window(), SIGNAL(beforeRendering()), node, SLOT(prepareNode()), Qt::DirectConnection); connect(node, SIGNAL(textureInUse()), m_renderThread, SLOT(renderNext()), Qt::QueuedConnection); - // Start the render thread and enter let it process events. - m_renderThread->start(); - // Get the production of FBO textures started.. QMetaObject::invokeMethod(m_renderThread, "renderNext", Qt::QueuedConnection); } diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.h b/examples/quick/scenegraph/textureinthread/threadrenderer.h index f12e6404e5..8c68e27d92 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.h +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.h @@ -52,9 +52,15 @@ class ThreadRenderer : public QQuickItem public: ThreadRenderer(); + static QList<QThread *> threads; + +public slots: + void updatePolish(); + protected: QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); + private: RenderThread *m_renderThread; }; diff --git a/examples/quick/shadereffects/doc/src/shadereffects.qdoc b/examples/quick/shadereffects/doc/src/shadereffects.qdoc index 5d1547a1fe..3d5f42eacc 100644 --- a/examples/quick/shadereffects/doc/src/shadereffects.qdoc +++ b/examples/quick/shadereffects/doc/src/shadereffects.qdoc @@ -25,27 +25,27 @@ ** ****************************************************************************/ /*! - \title QML Examples - Shader Effects + \title Qt Quick Examples - Shader Effects \example shadereffects \image qml-shadereffects-example.png \brief This is a shader effects example \ingroup qtquickexamples This example demonstrates a couple of visual effects that you can perform - with shaders in QtQuick 2.0 + with shaders in \l {Qt Quick}. ShaderEffects typically operate on other types, using a ShaderEffectSource - \snippet quick/shadereffects/shadereffects.qml source + \snippet shadereffects/shadereffects.qml source In the above snippet, theItem is the id of a complex QML object in the file. ShaderEffects can use this ShaderEffectSource as a texture in their fragment shader. - \snippet quick/shadereffects/shadereffects.qml fragment + \snippet shadereffects/shadereffects.qml fragment You can use any custom property on the ShaderEffect in your shader. This makes animated shader code very easy. - \snippet quick/shadereffects/shadereffects.qml properties + \snippet shadereffects/shadereffects.qml properties ShaderEffects can also have a custom vertext shader. Setting the mesh property on ShaderEffect provides more vertices for you to manipulate, enabling many effects. - \snippet quick/shadereffects/shadereffects.qml vertex + \snippet shadereffects/shadereffects.qml vertex */ diff --git a/examples/quick/window/screen/screenInfo.qml b/examples/quick/shared/TabSet.qml index 8f60d83933..10263a70ac 100644 --- a/examples/quick/window/screen/screenInfo.qml +++ b/examples/quick/shared/TabSet.qml @@ -39,52 +39,63 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Window 2.0 as Window Item { - id: root - width: 400 - height: 200 - Item { - id: main - state: "orientation " + Window.Screen.orientation + id: tabWidget - property bool landscapeWindow: Window.Screen.primaryOrientation == Qt.LandscapeOrientation - property real baseWidth: landscapeWindow ? root.height : root.width - property real baseHeight: landscapeWindow ? root.width : root.height - property real rotationDelta: landscapeWindow ? -90 : 0 + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Property Binding" + // documentation for details on default properties. + default property alias content: stack.children - rotation: rotationDelta - width: main.baseWidth - height: main.baseHeight - anchors.centerIn: parent + property int current: 0 - Text { - text: "Screen is " + Window.Screen.width + "x" + Window.Screen.height + " and primarily orientation " + Window.Screen.primaryOrientation - anchors.centerIn:parent - } + onCurrentChanged: setZOrders() + Component.onCompleted: setZOrders() + function setZOrders() { + for (var i = 0; i < stack.children.length; ++i) + stack.children[i].z = (i == current ? 1 : 0) + } - states: [ - State { - name: "orientation " + Qt.LandscapeOrientation - PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth } - }, - State { - name: "orientation " + Qt.InvertedPortraitOrientation - PropertyChanges { target: main; rotation: 180 + rotationDelta; } - }, - State { - name: "orientation " + Qt.InvertedLandscapeOrientation - PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth } - } - ] + Row { + id: header - transitions: Transition { - SequentialAnimation { - RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } - NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length; height: 36 + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "images/tab.png" + visible: tabWidget.current == index + } + Text { + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } } } } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } } diff --git a/examples/quick/shared/images/qt-logo.png b/examples/quick/shared/images/qt-logo.png Binary files differnew file mode 100644 index 0000000000..7d3e97eb36 --- /dev/null +++ b/examples/quick/shared/images/qt-logo.png diff --git a/examples/quick/shared/images/tab.png b/examples/quick/shared/images/tab.png Binary files differnew file mode 100644 index 0000000000..ad8021605f --- /dev/null +++ b/examples/quick/shared/images/tab.png diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir index cc4eb3c793..4f7c50540d 100644 --- a/examples/quick/shared/qmldir +++ b/examples/quick/shared/qmldir @@ -3,3 +3,4 @@ CheckBox 2.1 CheckBox.qml LauncherList 2.0 LauncherList.qml SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml Slider 2.0 Slider.qml +TabSet 2.1 TabSet.qml diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index eab15f3e0a..c59e858d47 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -47,9 +47,9 @@ QQuickView view;\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ - view.setResizeMode(QQuickView::SizeRootObjectToView);\ view.showFullScreen();\ } else {\ view.show();\ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 0b574ac879..6aaeca5211 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -6,7 +6,11 @@ <file>Slider.qml</file> <file>images/slider_handle.png</file> <file>CheckBox.qml</file> + <file>TabSet.qml</file> <file>images/back.png</file> <file>images/next.png</file> + <file>images/qt-logo.png</file> + <file>images/checkmark.png</file> + <file>images/tab.png</file> </qresource> </RCC> diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc index 1f173ac843..c93d2db8aa 100644 --- a/examples/quick/text/doc/src/text.qdoc +++ b/examples/quick/text/doc/src/text.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ /*! - \title QML Examples - Text + \title Qt Quick Examples - Text \example text \brief This is a collection of QML examples relating to text \image qml-text-example.png @@ -38,24 +38,24 @@ 'Hello' shows how to change and animate the letter spacing of a Text type. It uses a sequential animation to first animate the font.letterSpacing property from 0 to 50 over 3 seconds and then move the text to a random position on screen: - \snippet quick/text/fonts/hello.qml letterspacing + \snippet text/fonts/hello.qml letterspacing 'Fonts' shows different ways of using fonts with the Text type. Simply by name, using the font.family property directly: - \snippet quick/text/fonts/fonts.qml name + \snippet text/fonts/fonts.qml name or using a FontLoader type: - \snippet quick/text/fonts/fonts.qml fontloader + \snippet text/fonts/fonts.qml fontloader or using a FontLoader and specifying a local font file: - \snippet quick/text/fonts/fonts.qml fontloaderlocal + \snippet text/fonts/fonts.qml fontloaderlocal or finally using a FontLoader and specifying a remote font file: - \snippet quick/text/fonts/fonts.qml fontloaderremote + \snippet text/fonts/fonts.qml fontloaderremote 'Available Fonts' shows how to use the QML global Qt object and a list view to display all the fonts available on the system. The ListView type uses the list of fonts available as its model: - \snippet quick/text/fonts/availableFonts.qml model + \snippet text/fonts/availableFonts.qml model Inside the delegate, the font family is set with the modelData: - \snippet quick/text/fonts/availableFonts.qml delegate + \snippet text/fonts/availableFonts.qml delegate 'Banner' is a simple example showing how to create a banner using a row of text types and a NumberAnimation. @@ -66,5 +66,5 @@ 'Text Layout' shows how to create a more complex layout for a text item. This example lays out the text in two columns using the onLineLaidOut handler that allows you to position and resize each line: - \snippet quick/text/styledtext-layout.qml layout + \snippet text/styledtext-layout.qml layout */ diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp index 52c2c17cfe..04545fe830 100644 --- a/examples/quick/textureprovider/etcprovider.cpp +++ b/examples/quick/textureprovider/etcprovider.cpp @@ -121,6 +121,10 @@ void EtcTexture::bind() "paddedWidth: " << m_paddedSize.width() << "paddedHeight: " << m_paddedSize.height(); #endif +#ifndef QT_NO_DEBUG + while (glGetError() != GL_NO_ERROR) { } +#endif + QOpenGLContext *ctx = QOpenGLContext::currentContext(); Q_ASSERT(ctx != 0); ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES, @@ -128,6 +132,7 @@ void EtcTexture::bind() (m_paddedSize.width() * m_paddedSize.height()) >> 1, m_data.data() + 16); +#ifndef QT_NO_DEBUG // Gracefully fail in case of an error... GLuint error = glGetError(); if (error != GL_NO_ERROR) { @@ -137,6 +142,7 @@ void EtcTexture::bind() m_texture_id = 0; return; } +#endif m_uploaded = true; updateBindOptions(true); diff --git a/examples/quick/threading/doc/src/threading.qdoc b/examples/quick/threading/doc/src/threading.qdoc index 71fcdf820b..1cced3b9d3 100644 --- a/examples/quick/threading/doc/src/threading.qdoc +++ b/examples/quick/threading/doc/src/threading.qdoc @@ -33,17 +33,17 @@ Threaded ListModel contains a ListView and a ListModel. The ListModel is updated asynchronusly in another thread, and the results propagate back to the main thread. A timer requests updates from the worker thread periodically: - \snippet quick/threading/threadedlistmodel/timedisplay.qml 0 + \snippet threading/threadedlistmodel/timedisplay.qml 0 Inside the worker thread, the ListModel is synchronized once the data is finished loading: - \snippet quick/threading/threadedlistmodel/dataloader.js 0 + \snippet threading/threadedlistmodel/dataloader.js 0 WorkerScript contains an example of using a WorkerScript to offload expensive calculations into another thread. This keeps the UI from being blocked. This example calculates numbers in Pascal's Triangle, and not in a very optimal way, so it will often take several seconds to complete the calculation. By doing this in a WorkerScript in another thread, the UI is not blocked during this time. When the UI needs another value, a request is sent to the WorkerScript: - \snippet quick/threading/workerscript/workerscript.qml 0 + \snippet threading/workerscript/workerscript.qml 0 The workerscript then is free to take a really long time to calculate it: - \snippet quick/threading/workerscript/workerscript.js 0 + \snippet threading/workerscript/workerscript.js 0 When it's done, the result returns to the main scene via the WorkerScript type: - \snippet quick/threading/workerscript/workerscript.qml 1 + \snippet threading/workerscript/workerscript.qml 1 */ diff --git a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc index 164409076c..09a5f51105 100644 --- a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc +++ b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc @@ -34,21 +34,21 @@ Multipoint Flames demonstrates distinguishing different fingers in a MultiPointTouchArea, by assigning a different colored flame to each touch point. The MultipointTouchArea sets up multiple touch points: - \snippet quick/touchinteraction/multipointtouch/multiflame.qml 0 + \snippet touchinteraction/multipointtouch/multiflame.qml 0 The flames are then simply bound to the coordiates of the touch point, and whether it is currently pressed, like so: - \snippet quick/touchinteraction/multipointtouch/multiflame.qml 1 + \snippet touchinteraction/multipointtouch/multiflame.qml 1 Bear-Whack demonstrates using a MultiPointTouchArea to add multiple finger support to a simple game. The interaction with the game is done through a SpriteGoal that follows the TouchPoint. The TouchPoints added to the MultiPointTouchArea are a component with all this logic embedded into it: - \snippet quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0 + \snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0 Flick Resize uses a PinchArea to allow Pinch-to-Resize behavior. This is easily achieved just by listening to the PinchArea signals and responding to user input. - \snippet quick/touchinteraction/pincharea/flickresize.qml 0 + \snippet touchinteraction/pincharea/flickresize.qml 0 Flickable is a simple example demonstrating the Flickable type. The object inside the flickable is very big, but the flickable itself is very small: - \snippet quick/touchinteraction/flickable/basic-flickable.qml 0 + \snippet touchinteraction/flickable/basic-flickable.qml 0 Corkboards shows a more complex Flickable usecase, with types on the flickable that respond to mouse and keyboard interaction. This doesn't require special code, the Qt Quick types automatically cooperate with Flickable for accepting the touch events. diff --git a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc index 1ebe7eb9f5..3a14dd465a 100644 --- a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc +++ b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc @@ -28,7 +28,7 @@ /*! \page qmlexampletoggleswitch.html tutorial -\title QML Example - Toggle Switch +\title Qt Quick Examples - Toggle Switch \brief A reusable switch component made in QML \ingroup qtquickexamples @@ -48,12 +48,12 @@ The objects that compose the switch are: \endlist \section1 Switch.qml -\snippet quick/ui-components/slideswitch/content/Switch.qml 0 +\snippet ui-components/slideswitch/content/Switch.qml 0 \section1 Walkthrough \section2 Interface -\snippet quick/ui-components/slideswitch/content/Switch.qml 1 +\snippet ui-components/slideswitch/content/Switch.qml 1 This property is the interface of the switch. By default, the switch is off and this property is \c false. It can be used to activate/disactivate the switch or to query its current state. @@ -76,14 +76,14 @@ Item { the text will only be visible when the switch is on. \section2 Images and user interaction -\snippet quick/ui-components/slideswitch/content/Switch.qml 4 +\snippet ui-components/slideswitch/content/Switch.qml 4 First, we create the background image of the switch. In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image. A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a \c toggle() function. We will see what this function does in a moment. -\snippet quick/ui-components/slideswitch/content/Switch.qml 5 +\snippet ui-components/slideswitch/content/Switch.qml 5 Then, we place the image of the knob on top of the background. The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag @@ -91,7 +91,7 @@ property of the \c MouseArea is for. We also want to toggle the switch if the kn in the \c dorelease() function that is called in the \c onReleased property. \section2 States -\snippet quick/ui-components/slideswitch/content/Switch.qml 6 +\snippet ui-components/slideswitch/content/Switch.qml 6 We define the two states of the switch: \list @@ -105,13 +105,13 @@ For more information on states see \l{Qt Quick States}. We add two JavaScript functions to our switch: -\snippet quick/ui-components/slideswitch/content/Switch.qml 2 +\snippet ui-components/slideswitch/content/Switch.qml 2 This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two states (\e on and \e off). -\snippet quick/ui-components/slideswitch/content/Switch.qml 3 +\snippet ui-components/slideswitch/content/Switch.qml 3 This second function is called when the knob is released and we want to make sure that the knob does not end up between states (neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing. @@ -119,7 +119,7 @@ This second function is called when the knob is released and we want to make sur For more information on scripts see \l{Using JavaScript Expressions in QML}. \section2 Transition -\snippet quick/ui-components/slideswitch/content/Switch.qml 7 +\snippet ui-components/slideswitch/content/Switch.qml 7 At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78. In order for the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms. @@ -128,5 +128,5 @@ For more information on transitions see \l{Animation and Transitions in Qt Quick \section1 Usage The switch can be used in a QML file, like this: -\snippet quick/ui-components/slideswitch/slideswitch.qml 0 +\snippet ui-components/slideswitch/slideswitch.qml 0 */ diff --git a/examples/quick/views/doc/src/views.qdoc b/examples/quick/views/doc/src/views.qdoc index cc8112f4dd..2d664c9bd9 100644 --- a/examples/quick/views/doc/src/views.qdoc +++ b/examples/quick/views/doc/src/views.qdoc @@ -32,51 +32,51 @@ \image qml-modelviews-example.png \ingroup qtquickexamples - This is a collection of small QML examples relating to model and view functionality. They demonstrate how to show data from a model using the QtQuick view types. + This is a collection of small QML examples relating to model and view functionality. They demonstrate how to show data from a model using the \l {Qt Quick} view types. \section2 GridView and PathView demonstrate usage of these types to display views. - \snippet quick/views/gridview/gridview-example.qml 0 + \snippet views/gridview/gridview-example.qml 0 \section2 Dynamic List demonstrates animation of runtime additions and removals to a ListView. The ListView.onAdd signal handler runs an animation when new items are added to the view, and the ListView.onRemove another when they are removed. - \snippet quick/views/listview/dynamiclist.qml 0 - \snippet quick/views/listview/dynamiclist.qml 1 + \snippet views/listview/dynamiclist.qml 0 + \snippet views/listview/dynamiclist.qml 1 \section2 Expanding Delegates demonstrates delegates that expand when activated. It has a complex delegate the size and appearance of which can change, displacing other items in the view. - \snippet quick/views/listview/expandingdelegates.qml 0 - \snippet quick/views/listview/expandingdelegates.qml 1 - \snippet quick/views/listview/expandingdelegates.qml 2 - \snippet quick/views/listview/expandingdelegates.qml 3 + \snippet views/listview/expandingdelegates.qml 0 + \snippet views/listview/expandingdelegates.qml 1 + \snippet views/listview/expandingdelegates.qml 2 + \snippet views/listview/expandingdelegates.qml 3 \section2 Highlight demonstrates adding a custom highlight to a ListView. - \snippet quick/views/listview/highlight.qml 0 + \snippet views/listview/highlight.qml 0 \section2 Highlight Ranges shows the three different highlight range modes of ListView. - \snippet quick/views/listview/highlightranges.qml 0 - \snippet quick/views/listview/highlightranges.qml 1 - \snippet quick/views/listview/highlightranges.qml 2 + \snippet views/listview/highlightranges.qml 0 + \snippet views/listview/highlightranges.qml 1 + \snippet views/listview/highlightranges.qml 2 \section2 Sections demonstrates the various section headers and footers available to ListView. - \snippet quick/views/listview/sections.qml 0 + \snippet views/listview/sections.qml 0 \section2 Packages demonstrates using Packages to transition delegates between two views. It has a Package which defines delegate items for each view and an item that can be transferred between delegates. - \snippet quick/views/package/Delegate.qml 0 + \snippet views/package/Delegate.qml 0 A DelegateModel allows the individual views to access their specific items from the shared package delegate. - \snippet quick/views/package/view.qml 0 + \snippet views/package/view.qml 0 \section2 ObjectModel uses an ObjectModel for the model instead of a ListModel. - \snippet quick/views/visualitemmodel/visualitemmodel.qml 0 + \snippet views/objectmodel/objectmodel.qml 0 */ diff --git a/examples/quick/window/window/twowindows.qml b/examples/quick/window/ScreenInfo.qml index 4a8d2f4f1b..e4abc8d69d 100644 --- a/examples/quick/window/window/twowindows.qml +++ b/examples/quick/window/ScreenInfo.qml @@ -38,52 +38,58 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Window 2.0 +import QtQuick 2.1 +import QtQuick.Window 2.1 -QtObject { - property var win1: Window { - width: 320 - height: 240 - x: 0 - y: 0 - visible: true - color: "#ccffff" - title: "First Window" - Text { - anchors.centerIn: parent - text: "First Window" - Text { - id: statusText - anchors.top: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: win2.visible = !win2.visible +Item { + id: root + width: 400 + height: propertyGrid.implicitHeight + 16 + + function orientationToString(o) { + switch (o) { + case Qt.PrimaryOrientation: + return "primary"; + case Qt.PortraitOrientation: + return "portrait"; + case Qt.LandscapeOrientation: + return "landscape"; + case Qt.InvertedPortraitOrientation: + return "inverted portrait"; + case Qt.InvertedLandscapeOrientation: + return "inverted landscape"; } + return "unknown"; } - property var win2: Window { - width: 320 - height: 240 - x: 220 - y: 120 - visible: true - color: "green" - title: "Second Window: " + color - Rectangle { - anchors.fill: parent - anchors.margins: 10 - Text { - anchors.centerIn: parent - text: "Second Window" - } - MouseArea { - anchors.fill: parent - onClicked: win2.color = "#ffffcc" - } + + Grid { + id: propertyGrid + columns: 2 + spacing: 8 + x: spacing + y: spacing + + //! [screen] + Text { + text: "Screen \"" + Screen.name + "\":" + font.bold: true } - onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible") + Item { width: 1; height: 1 } // spacer + + Text { text: "dimensions" } + Text { text: Screen.width + "x" + Screen.height } + + Text { text: "logical pixel density" } + Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm" } + + Text { text: "available virtual desktop" } + Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight } + + Text { text: "orientation" } + Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" } + + Text { text: "primary orientation" } + Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" } + //! [screen] } } diff --git a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml b/examples/quick/window/Splash.qml index d5a1e6f91f..c981bd2585 100644 --- a/src/quick/doc/snippets/qml/usecases/visual-opacity.qml +++ b/examples/quick/window/Splash.qml @@ -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,46 +38,42 @@ ** ****************************************************************************/ -//![0] import QtQuick 2.0 +import QtQuick.Window 2.1 -Item { +//! [splash-properties] +Window { + id: splash + visible: true + width: splashImage.width + height: splashImage.height + color: "transparent" + title: "Splash Window" + modality: Qt.ApplicationModal + flags: Qt.SplashScreen + property int timeoutInterval: 2000 + signal timeout +//! [splash-properties] +//! [screen-properties] + x: (Screen.width - splashImage.width) / 2 + y: (Screen.height - splashImage.height) / 2 +//! [screen-properties] - width: 320 - height: 480 - - Rectangle { - color: "#272822" - width: 320 - height: 480 - } - - Item { - x: 20 - y: 270 - width: 200 - height: 200 + Image { + id: splashImage + source: "../../shared/images/qt-logo.png" MouseArea { anchors.fill: parent - onClicked: topRect.visible = !topRect.visible + onClicked: Qt.quit() } - Rectangle { - x: 20 - y: 20 - width: 100 - height: 100 - color: "red" - } - Rectangle { - id: topRect - opacity: 0.5 - - x: 100 - y: 100 - width: 100 - height: 100 - color: "blue" + } + //! [timer] + Timer { + interval: timeoutInterval; running: true; repeat: false + onTriggered: { + visible = false + splash.timeout() } } + //! [timer] } -//![0] diff --git a/examples/quick/window/doc/images/qml-window-example.png b/examples/quick/window/doc/images/qml-window-example.png Binary files differnew file mode 100644 index 0000000000..72487b4d93 --- /dev/null +++ b/examples/quick/window/doc/images/qml-window-example.png diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc new file mode 100644 index 0000000000..07d2f115c1 --- /dev/null +++ b/examples/quick/window/doc/src/window.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Examples - Window and Screen + \example window + \brief This example demonstrates the Window and Screen types in QML + \image qml-window-example.png + \ingroup qtquickexamples + + This example shows you how to create a Window in QML, how to control its + \l {QQuickWindow::visibility} {visibility}, how to present a splash screen + during application startup, and how to access the properties of the + \l Screen. It also demonstrates how to package QML into + \l {The Qt Resource System} {resources} and provide an + \l {Setting the Application Icon} {icon} to create a standalone QML desktop application. + + A splash screen can be created with the \l {Qt::SplashScreen} {Qt.SplashScreen} flag, + and should be \l {Qt::ApplicationModal} {ApplicationModal} to prevent interaction + with the main window. If the splash window is also transparent, and showing a + partially transparent image, then it will look like a shaped window. + \snippet window/Splash.qml splash-properties + + In this example a \l Timer will automatically dismiss the splash screen, + but in a real application you might want to connect to a signal from the + application logic to hide the splash when initialization is complete. + \snippet window/Splash.qml timer + + The main window in this example is the control window, with some buttons + and checkboxes to control and provide feedback on the state of a secondary + window. Each checkbox has a binding to the property whose state it is + displaying, and also an onClicked handler to change the state. This is the + typical pattern to create a two-way binding while avoiding binding loops. + \snippet window/window.qml windowedCheckbox + + The \l Screen has several properties which are generally useful to applications + which need to rotate some content when the screen orientation changes, to position + windows on the screen or to convert real units to logical pixel units. ScreenInfo.qml + (which is displayed inline in window.qml, or can be run by itself with qmlscene) + simply displays the property values, while the splash screen uses them to + center the window on the screen. + \snippet window/Splash.qml screen-properties + + If a Window is nested inside an \l Item or another Window, the inner window + becomes "transient for" the outer one (see \l Window for more explanation). + But if you want to create multiple top-level windows as unrelated peers, you + can create them inside a non-visual \l QtObject root item, as this example does. +*/ diff --git a/examples/quick/window/window/window.cpp b/examples/quick/window/main.cpp index 277effc20c..7872c7183c 100644 --- a/examples/quick/window/window/window.cpp +++ b/examples/quick/window/main.cpp @@ -41,6 +41,7 @@ #include <QtGui/QGuiApplication> #include <QtQml/QQmlEngine> #include <QtQml/QQmlComponent> +#include <QtQuick/QQuickWindow> #include <QtCore/QUrl> #include <QDebug> @@ -49,7 +50,8 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine); - component.loadUrl(QUrl("qrc:///window/window/Window.qml")); + QQuickWindow::setDefaultAlphaBuffer(true); + component.loadUrl(QUrl("qrc:///window/window.qml")); if ( component.isReady() ) component.create(); else diff --git a/examples/quick/window/resources/icon.icns b/examples/quick/window/resources/icon.icns Binary files differnew file mode 100644 index 0000000000..88b4b24449 --- /dev/null +++ b/examples/quick/window/resources/icon.icns diff --git a/examples/quick/window/resources/icon.ico b/examples/quick/window/resources/icon.ico Binary files differnew file mode 100644 index 0000000000..52af30a6ca --- /dev/null +++ b/examples/quick/window/resources/icon.ico diff --git a/examples/quick/window/resources/icon.svg b/examples/quick/window/resources/icon.svg new file mode 100644 index 0000000000..0b6153206d --- /dev/null +++ b/examples/quick/window/resources/icon.svg @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="128" + height="128" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="icon.svg" + inkscape:export-filename="/Users/rutledge/dev/qt5-stable/qtdeclarative/examples/quick/window/window/icon80.png" + inkscape:export-xdpi="61.509998" + inkscape:export-ydpi="61.509998" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <linearGradient + id="linearGradient4009"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4011" /> + <stop + id="stop4019" + offset="0.875" + style="stop-color:#ffffff;stop-opacity:0.49803922;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4013" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 186.64798 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="559.62469 : 186.64798 : 1" + inkscape:persp3d-origin="279.81235 : 124.43199 : 1" + id="perspective4876" /> + <inkscape:perspective + id="perspective2836" + inkscape:persp3d-origin="22 : 14.666667 : 1" + inkscape:vp_z="44 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 22 : 1" + sodipodi:type="inkscape:persp3d" /> + <filter + inkscape:collect="always" + id="filter4063" + x="-0.195491" + width="1.390982" + y="-0.16235915" + height="1.3247183"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="3.3077485" + id="feGaussianBlur4065" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10" + guidetolerance="10" + objecttolerance="10000" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="2.9775825" + inkscape:cx="62.656189" + inkscape:cy="42.423381" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1280" + inkscape:window-height="744" + inkscape:window-x="2003" + inkscape:window-y="156" + showgrid="true" + borderlayer="true" + showguides="true" + inkscape:guide-bbox="true" + inkscape:snap-global="false" + inkscape:window-maximized="0"> + <inkscape:grid + type="xygrid" + id="grid7194" + visible="true" + enabled="true" + spacingx="8px" + spacingy="8px" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-66.38047,-391.3222)"> + <path + id="path7304" + d="M 95.556318,434.65407 L 165.25811,434.65407 L 165.25811,490.10429 L 95.556318,490.10429 L 95.556318,434.65407 z" + style="fill:#01afaf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + <path + style="fill:#a7c706;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 96.869177,465.30846 c 27.677903,3.04574 41.155393,12.11589 48.000003,24 l -48.000003,0 0,-24 z" + id="path7300" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" /> + <path + sodipodi:nodetypes="cccc" + id="path7302" + d="M 165.46767,465.22201 C 137.78977,468.26775 124.31228,477.33791 117.46767,489.22201 L 165.46767,489.22201 L 165.46767,465.22201 z" + style="fill:#966406;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1;fill-opacity:1" + d="M 95.532809,434.35736 L 74.567964,420.38079 L 74.567964,497.25189 L 95.532809,490.26361 L 95.532809,434.35736 z" + id="path7270" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#00ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 74.567964,455.3222 L 95.532809,462.31048" + id="path7272" + sodipodi:nodetypes="cc" /> + <g + style="fill:#80ffff;fill-opacity:1" + id="g7278" + transform="matrix(-0.8735352,0,0,0.8735352,244.36615,64.570513)"> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 24,32 L 0,16 L 0,104 L 24,96 L 24,32 z" + id="path7280" + transform="translate(66.38047,391.3222)" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 0,56 L 24,64" + id="path7282" + transform="translate(66.38047,391.3222)" + sodipodi:nodetypes="cc" /> + </g> + <path + style="fill:#ffffff;fill-opacity:1;filter:url(#filter4063)" + d="m 119.74679,437.94232 c -0.0487,0.003 -0.0932,0.0315 -0.14149,0.0354 -0.1659,0.0132 -0.33372,0.008 -0.49523,0.0354 -0.96156,0.0643 -1.9037,0.14607 -2.86523,0.21224 -2.94807,0.23566 -5.19987,2.66253 -5.19987,6.01345 l 0,39.51194 3.32508,3.07747 0,-0.0354 33.2155,-5.58898 c 2.28673,-0.39587 4.06792,-3.06727 4.06792,-5.97808 l 0,-32.18967 -30.5625,-5.023 c -0.45263,-0.0748 -0.91269,-0.0942 -1.34418,-0.0708 z" + id="path3987" + inkscape:connector-curvature="0" /> + <g + id="g3" + transform="matrix(0.20572087,0,0,0.20572087,113.4162,440.80626)"> + <path + sodipodi:nodetypes="cccccccc" + id="path5" + style="fill:#006225" + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + inkscape:connector-curvature="0" /> + <path + id="path7" + style="fill:#80c342" + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + inkscape:connector-curvature="0" /> + <path + id="path11" + style="fill:#006225" + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + inkscape:connector-curvature="0" /> + <path + id="path13" + style="fill:#006225" + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + inkscape:connector-curvature="0" /> + <path + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" + style="fill:#ffffff" + id="path17" + inkscape:connector-curvature="0" /> + <path + id="path19" + style="fill:#006225" + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + inkscape:connector-curvature="0" /> + <path + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" + style="fill:#006225" + id="path21" + inkscape:connector-curvature="0" /> + </g> + <path + style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 96.506224,434.65407 L 166.20801,434.65407 L 166.20801,490.10429 L 96.506224,490.10429 L 96.506224,434.65407 z" + id="rect7265" /> + </g> +</svg> diff --git a/examples/quick/window/resources/icon64.png b/examples/quick/window/resources/icon64.png Binary files differnew file mode 100644 index 0000000000..0fa324401f --- /dev/null +++ b/examples/quick/window/resources/icon64.png diff --git a/examples/quick/window/resources/window.rc b/examples/quick/window/resources/window.rc new file mode 100644 index 0000000000..4de84d297e --- /dev/null +++ b/examples/quick/window/resources/window.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON DISCARDABLE "icon.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)" + VALUE "FileDescription", "QtQuick Window Example" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)." + VALUE "InternalName", "window" + VALUE "OriginalFilename", "window.exe" + VALUE "ProductName", "QtQuick Window Example" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/examples/quick/window/window.pro b/examples/quick/window/window.pro index 93e43fcd65..be35b24325 100644 --- a/examples/quick/window/window.pro +++ b/examples/quick/window/window.pro @@ -1,6 +1,16 @@ -TEMPLATE = subdirs -SUBDIRS += \ - window +TEMPLATE = app +QT += quick qml +SOURCES += main.cpp +RESOURCES += \ + window.qrc \ + ../shared/shared.qrc EXAMPLE_FILES = \ - screen + window.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/window +INSTALLS += target + +ICON = resources/icon64.png +macx: ICON = resources/icon.icns +win32: RC_FILE = resources/window.rc diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml new file mode 100644 index 0000000000..67e2ba40ff --- /dev/null +++ b/examples/quick/window/window.qml @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.1 +import "../shared" as Shared + +QtObject { + property real defaultSpacing: 10 + property SystemPalette palette: SystemPalette { } + + property var controlWindow: Window { + width: 400 + height: col.implicitHeight + defaultSpacing * 2 + color: palette.window + title: "Control Window" + Column { + id: col + anchors.fill: parent + anchors.margins: defaultSpacing + spacing: defaultSpacing + property real cellWidth: col.width / 3 - spacing + Text { text: "Control the second window:" } + Grid { + id: grid + columns: 3 + spacing: defaultSpacing + width: parent.width + Shared.Button { + id: showButton + width: col.cellWidth + text: testWindow.visible ? "Hide" : "Show" + onClicked: testWindow.visible = !testWindow.visible + } + //! [windowedCheckbox] + Shared.CheckBox { + text: "Windowed" + height: showButton.height + width: col.cellWidth + Binding on checked { value: testWindow.visibility === Window.Windowed } + onClicked: testWindow.visibility = Window.Windowed + } + //! [windowedCheckbox] + Shared.CheckBox { + height: showButton.height + width: col.cellWidth + text: "Full Screen" + Binding on checked { value: testWindow.visibility === Window.FullScreen } + onClicked: testWindow.visibility = Window.FullScreen + } + Shared.Button { + id: autoButton + width: col.cellWidth + text: "Automatic" + onClicked: testWindow.visibility = Window.AutomaticVisibility + } + Shared.CheckBox { + height: autoButton.height + text: "Minimized" + Binding on checked { value: testWindow.visibility === Window.Minimized } + onClicked: testWindow.visibility = Window.Minimized + } + Shared.CheckBox { + height: autoButton.height + text: "Maximized" + Binding on checked { value: testWindow.visibility === Window.Maximized } + onClicked: testWindow.visibility = Window.Maximized + } + } + function visibilityToString(v) { + switch (v) { + case Window.Windowed: + return "windowed"; + case Window.Minimized: + return "minimized"; + case Window.Maximized: + return "maximized"; + case Window.FullScreen: + return "fullscreen"; + case Window.AutomaticVisibility: + return "automatic"; + case Window.Hidden: + return "hidden"; + } + return "unknown"; + } + Text { + text: "second window is " + (testWindow.visible ? "visible" : "invisible") + + " and has visibility " + parent.visibilityToString(testWindow.visibility) + } + Rectangle { + id: horizontalRule + color: "black" + width: parent.width + height: 1 + } + ScreenInfo { } + } + } + + property var testWindow: Window { + width: 320 + height: 240 + color: "#215400" + title: "Test Window with color " + color + Rectangle { + anchors.fill: parent + anchors.margins: defaultSpacing + Text { + anchors.centerIn: parent + text: "Second Window" + } + MouseArea { + anchors.fill: parent + onClicked: testWindow.color = "#e0c31e" + } + Shared.Button { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: defaultSpacing + text: testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen" + width: 150 + onClicked: { + if (testWindow.visibility === Window.FullScreen) + testWindow.visibility = Window.AutomaticVisibility + else + testWindow.visibility = Window.FullScreen + } + } + Shared.Button { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: defaultSpacing + text: "X" + width: 30 + onClicked: testWindow.visible = false + } + } + } + + property var splashWindow: Splash { + onTimeout: controlWindow.visible = true + } +} diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc new file mode 100644 index 0000000000..dc211bdaaf --- /dev/null +++ b/examples/quick/window/window.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/window"> + <file>window.qml</file> + <file>Splash.qml</file> + <file>ScreenInfo.qml</file> + </qresource> +</RCC> diff --git a/examples/quick/window/window/standalone.qml b/examples/quick/window/window/standalone.qml deleted file mode 100644 index db73bf66eb..0000000000 --- a/examples/quick/window/window/standalone.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Item { - width: 320 - height: 240 - // It's not possible to set an Item's windowTitle. If you want to modify - // window properties, you need to explicitly create a Window. - Text { - id: text1 - anchors.centerIn: parent - text: "First Window\n" + (Qt.application.supportsMultipleWindows ? - "click the button to open a second window" : "only one window is allowed") - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text1.bottom - anchors.horizontalCenter: text1.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti1 - focus: true // but the modal popup will prevent input while it is open - anchors.centerIn: parent - } - } - Rectangle { - border.color: "black" - color: childWindow.visible ? "goldenrod" : "beige" - radius: height / 4 - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 10 - width: text.implicitWidth + 20 - height: text.implicitHeight + 20 - visible: Qt.application.supportsMultipleWindows - Text { - id: text - text: "Pop up window" - anchors.centerIn: parent - } - MouseArea { - anchors.fill: parent - onClicked: childWindow.visible = !childWindow.visible - } - } - - Window { - id: childWindow - width: 320 - height: 240 - x: 220 - y: 120 - color: "beige" - title: "Second Window" - modality: Qt.ApplicationModal - flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint - Text { - id: text2 - anchors.centerIn: parent - text: "Modal Frameless Stay-on-Top Window" - } - Text { - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 10 - text: "X" - MouseArea{ - anchors.fill: parent - onClicked: childWindow.visible = false - } - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text2.bottom - anchors.horizontalCenter: text2.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti2 - focus: true - anchors.centerIn: parent - } - } - } -} diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro deleted file mode 100644 index 3525a893fa..0000000000 --- a/examples/quick/window/window/window.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app -QT += qml - -SOURCES += window.cpp -RESOURCES += window.qrc - -EXAMPLE_FILES = \ - nogui.qml \ - standalone.qml \ - twowindows.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window -INSTALLS = target diff --git a/examples/quick/window/window/window.qrc b/examples/quick/window/window/window.qrc deleted file mode 100644 index c203c140fc..0000000000 --- a/examples/quick/window/window/window.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/window/window"> - <file>Window.qml</file> - </qresource> -</RCC> diff --git a/qtdeclarative.pro b/qtdeclarative.pro index 58c33f27ca..8bc15a5662 100644 --- a/qtdeclarative.pro +++ b/qtdeclarative.pro @@ -1 +1,2 @@ +CONFIG += tests_need_tools load(qt_parts) diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index b7704dadda..53cad30cee 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -3,6 +3,8 @@ TARGET = dialogplugin TARGETPATH = QtQuick/Dialogs IMPORT_VERSION = 1.0 +QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf + SOURCES += \ qquickabstractfiledialog.cpp \ qquickplatformfiledialog.cpp \ diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf new file mode 100644 index 0000000000..34f19b5ff3 --- /dev/null +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -0,0 +1,36 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickDialogs +description = Qt Quick Dialogs Reference Documentation +url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/ +version = $QT_VERSION + +qhp.projects = QtQuickDialogs + +qhp.QtQuickDialogs.file = qtquickdialogs.qhp +qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG +qhp.QtQuickDialogs.virtualFolder = qtquickdialogs +qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.indexRoot = + +qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc +qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION +qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION + +qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true + +depends = qtqml qtquick qtgui qtwidgets qtdoc + +exampledirs += ../../../../examples/quick/dialogs + +examplesinstallpath = quick/dialogs + +headerdirs += .. + +sourcedirs += .. + +imagedirs += images diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc new file mode 100644 index 0000000000..ee277f48dc --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtquickdialog_examples + \ingroup qtquickexamples + \title Qt Quick Examples - Dialogs + \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML. + + These examples show how to use the \l{Qt Quick Dialogs}. +*/ + diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc new file mode 100644 index 0000000000..5a1223b04d --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group dialogs + \title Dialogs +*/ + +/*! + \page qtquickdialogs-index.html + \title Qt Quick Dialogs + + \brief Qt Quick Dialogs submodule + + The module is new in Qt 5.1. + + \section1 Dialogs + + \annotatedlist dialogs + + \section1 Related information + + \section2 Examples + \list + \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples} + \endlist + + \section2 Reference + \list + \li \l{Qt Quick Dialogs QML Types}{QML Types} + \endlist + +*/ + diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index 67653e5965..5502a65310 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmodule QtQuick.Dialogs 1 - \title Qt Quick Dialog QML Types + \title Qt Quick Dialogs QML Types \ingroup qmlmodules \brief Provides QML types for standard file, color picker and message dialogs diff --git a/src/imports/dialogs/plugins.qmltypes b/src/imports/dialogs/plugins.qmltypes index faf68de909..80eb8bd291 100644 --- a/src/imports/dialogs/plugins.qmltypes +++ b/src/imports/dialogs/plugins.qmltypes @@ -3,39 +3,72 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.Dialogs 1.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.Dialogs 1.0'. Module { Component { - name: "QQuickAbstractFileDialog" + name: "QQuickAbstractColorDialog" + prototype: "QQuickAbstractDialog" + Property { name: "showAlphaChannel"; type: "bool" } + Property { name: "color"; type: "QColor" } + Signal { name: "selectionAccepted" } + Method { + name: "setVisible" + Parameter { name: "v"; type: "bool" } + } + Method { + name: "setModality" + Parameter { name: "m"; type: "Qt::WindowModality" } + } + Method { + name: "setTitle" + Parameter { name: "t"; type: "string" } + } + Method { + name: "setColor" + Parameter { name: "arg"; type: "QColor" } + } + Method { + name: "setShowAlphaChannel" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickAbstractDialog" prototype: "QObject" Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Signal { name: "visibilityChanged" } + Signal { name: "geometryChanged" } + Signal { name: "accepted" } + Signal { name: "rejected" } + Method { name: "open" } + Method { name: "close" } + } + Component { + name: "QQuickAbstractFileDialog" + prototype: "QQuickAbstractDialog" Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } Property { name: "folder"; type: "string" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } - Property { name: "filePath"; type: "string"; isReadonly: true } - Property { name: "filePaths"; type: "QStringList"; isReadonly: true } - Signal { name: "visibilityChanged" } + Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } + Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true } Signal { name: "filterSelected" } Signal { name: "fileModeChanged" } - Signal { name: "accepted" } - Signal { name: "rejected" } - Method { name: "open" } - Method { name: "close" } + Signal { name: "selectionAccepted" } Method { name: "setVisible" Parameter { name: "v"; type: "bool" } } Method { - name: "setModality" - Parameter { name: "m"; type: "Qt::WindowModality" } - } - Method { name: "setTitle" Parameter { name: "t"; type: "string" } } @@ -65,8 +98,25 @@ Module { } } Component { - name: "QQuickQFileDialog" + name: "QQuickColorDialog" + defaultProperty: "implementation" + prototype: "QQuickAbstractColorDialog" + exports: ["QtQuick.Dialogs/AbstractColorDialog 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "implementation"; type: "QObject"; isPointer: true } + } + Component { + name: "QQuickFileDialog" + defaultProperty: "implementation" prototype: "QQuickAbstractFileDialog" - exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"] + exports: ["QtQuick.Dialogs/AbstractFileDialog 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "implementation"; type: "QObject"; isPointer: true } + Method { name: "clearSelection" } + Method { + name: "addSelection" + type: "bool" + Parameter { name: "path"; type: "string" } + } } } diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp index 491a2e687c..ea3114c86e 100644 --- a/src/imports/dialogs/qquickplatformcolordialog.cpp +++ b/src/imports/dialogs/qquickplatformcolordialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype ColorDialog \instantiates QQuickPlatformColorDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing a color. \since Qt 5.1 diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp index d767f65499..5ae7fd0067 100644 --- a/src/imports/dialogs/qquickplatformfiledialog.cpp +++ b/src/imports/dialogs/qquickplatformfiledialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype FileDialog \instantiates QQuickPlatformFileDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing files from a local filesystem. \since Qt 5.1 diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index 64a4b02e91..ad09f54381 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -57,7 +57,7 @@ FileInfoThread::FileInfoThread(QObject *parent) sortUpdate(false), showDirs(true), showDirsFirst(false), - showDotDot(false), + showDotAndDotDot(false), showOnlyReadable(false) { #ifndef QT_NO_FILESYSTEMWATCHER @@ -158,11 +158,12 @@ void FileInfoThread::setShowDirsFirst(bool show) condition.wakeAll(); } -void FileInfoThread::setShowDotDot(bool on) +void FileInfoThread::setShowDotAndDotDot(bool on) { QMutexLocker locker(&mutex); - showDotDot = on; + showDotAndDotDot = on; folderUpdate = true; + needUpdate = true; condition.wakeAll(); } @@ -212,10 +213,12 @@ void FileInfoThread::run() void FileInfoThread::getFileInfos(const QString &path) { QDir::Filters filter; - filter = QDir::Files | QDir::NoDot | QDir::CaseSensitive; + filter = QDir::Files | QDir::CaseSensitive; if (showDirs) filter = filter | QDir::AllDirs | QDir::Drives; - if ((path == rootPath) || !showDotDot) + if (!showDotAndDotDot) + filter = filter | QDir::NoDot | QDir::NoDotDot; + else if (path == rootPath) filter = filter | QDir::NoDotDot; if (showOnlyReadable) filter = filter | QDir::Readable; diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h index f9340ca75d..cf6572a279 100644 --- a/src/imports/folderlistmodel/fileinfothread_p.h +++ b/src/imports/folderlistmodel/fileinfothread_p.h @@ -72,7 +72,7 @@ public: void setNameFilters(const QStringList & nameFilters); void setShowDirs(bool showFolders); void setShowDirsFirst(bool show); - void setShowDotDot(bool on); + void setShowDotAndDotDot(bool on); void setShowOnlyReadable(bool on); public Q_SLOTS: @@ -104,7 +104,7 @@ private: bool sortUpdate; bool showDirs; bool showDirsFirst; - bool showDotDot; + bool showDotAndDotDot; bool showOnlyReadable; }; diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes index fabeb9e4b1..20914f4108 100644 --- a/src/imports/folderlistmodel/plugins.qmltypes +++ b/src/imports/folderlistmodel/plugins.qmltypes @@ -3,13 +3,17 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump Qt.labs.folderlistmodel 2.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable Qt.labs.folderlistmodel 2.0'. Module { Component { name: "QQuickFolderListModel" prototype: "QAbstractListModel" - exports: ["FolderListModel 1.0", "FolderListModel 2.0"] + exports: [ + "Qt.labs.folderlistmodel/FolderListModel 1.0", + "Qt.labs.folderlistmodel/FolderListModel 2.0" + ] + exportMetaObjectRevisions: [0, 0] Enum { name: "SortField" values: { diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 421e215066..85b59e9c73 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -55,7 +55,7 @@ class QQuickFolderListModelPrivate public: QQuickFolderListModelPrivate(QQuickFolderListModel *q) : q_ptr(q), - sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDots(false), showOnlyReadable(false) + sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false) { nameFilters << QLatin1String("*"); } @@ -72,7 +72,7 @@ public: bool sortReversed; bool showDirs; bool showDirsFirst; - bool showDots; + bool showDotAndDotDot; bool showOnlyReadable; ~QQuickFolderListModelPrivate() {} @@ -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 @@ -661,15 +681,15 @@ void QQuickFolderListModel::setShowDirsFirst(bool on) bool QQuickFolderListModel::showDotAndDotDot() const { Q_D(const QQuickFolderListModel); - return d->showDots; + return d->showDotAndDotDot; } void QQuickFolderListModel::setShowDotAndDotDot(bool on) { Q_D(QQuickFolderListModel); - if (on != d->showDots) { - d->fileInfoThread.setShowDotDot(on); + if (on != d->showDotAndDotDot) { + d->fileInfoThread.setShowDotAndDotDot(on); } } diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 733c7c47bd..7a922a832e 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -16,4 +16,4 @@ qtHaveModule(quick) { qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel -qtHaveModule(widgets) : SUBDIRS += widgets +qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += widgets diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 9357b5a43c..5bb8099b2e 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -502,7 +502,7 @@ Database connections are automatically closed during Javascript garbage collecti The API can be used from JavaScript functions in your QML: -\snippet quick/localstorage/localstorage/hello.qml 0 +\snippet localstorage/localstorage/hello.qml 0 The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. diff --git a/src/imports/localstorage/plugins.qmltypes b/src/imports/localstorage/plugins.qmltypes index 107781d6be..bcd516c25e 100644 --- a/src/imports/localstorage/plugins.qmltypes +++ b/src/imports/localstorage/plugins.qmltypes @@ -3,13 +3,14 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.LocalStorage 2.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.LocalStorage 2.0'. Module { Component { name: "QQuickLocalStorage" prototype: "QObject" - exports: ["LocalStorage 2.0"] + exports: ["QtQuick.LocalStorage/LocalStorage 2.0"] + exportMetaObjectRevisions: [0] Method { name: "openDatabaseSync" Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro index e96d4b9a44..98b0bd617a 100644 --- a/src/imports/models/models.pro +++ b/src/imports/models/models.pro @@ -6,6 +6,6 @@ IMPORT_VERSION = 2.1 SOURCES += \ plugin.cpp -QT += qml-private +QT = qml-private load(qml_plugin) diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp index 2181562098..90e8a56399 100644 --- a/src/imports/models/plugin.cpp +++ b/src/imports/models/plugin.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmodule QtQml.Models 2 - \title Qt QML Model QML Types + \title Qt QML Models QML Types \ingroup qmlmodules \brief Provides QML types for data models \since 5.1 @@ -60,7 +60,8 @@ QT_BEGIN_NAMESPACE import QtQml.Models 2.1 \endcode - Note that QtQml.Models module started at version 2.1 to match the version of the parent module. + Note that QtQml.Models module started at version 2.1 to match the version + of the parent module, \l{Qt QML}. */ diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes index f8acb168b8..495c072a41 100644 --- a/src/imports/particles/plugins.qmltypes +++ b/src/imports/particles/plugins.qmltypes @@ -3,14 +3,15 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.Particles 2.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.Particles 2.0'. Module { Component { name: "QQuickAgeAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Age 2.0"] + exports: ["QtQuick.Particles/Age 2.0"] + exportMetaObjectRevisions: [0] Property { name: "lifeLeft"; type: "int" } Property { name: "advancePosition"; type: "bool" } Signal { @@ -33,7 +34,8 @@ Module { Component { name: "QQuickAngleDirection" prototype: "QQuickDirection" - exports: ["AngleDirection 2.0"] + exports: ["QtQuick.Particles/AngleDirection 2.0"] + exportMetaObjectRevisions: [0] Property { name: "angle"; type: "double" } Property { name: "magnitude"; type: "double" } Property { name: "angleVariation"; type: "double" } @@ -75,7 +77,8 @@ Module { name: "QQuickAttractorAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Attractor 2.0"] + exports: ["QtQuick.Particles/Attractor 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Proportion" values: { @@ -144,14 +147,16 @@ Module { name: "QQuickCumulativeDirection" defaultProperty: "directions" prototype: "QQuickDirection" - exports: ["CumulativeDirection 2.0"] + exports: ["QtQuick.Particles/CumulativeDirection 2.0"] + exportMetaObjectRevisions: [0] Property { name: "directions"; type: "QQuickDirection"; isList: true; isReadonly: true } } Component { name: "QQuickCustomAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Affector 2.0"] + exports: ["QtQuick.Particles/Affector 2.0"] + exportMetaObjectRevisions: [0] Property { name: "relative"; type: "bool" } Property { name: "position"; type: "QQuickDirection"; isPointer: true } Property { name: "velocity"; type: "QQuickDirection"; isPointer: true } @@ -198,19 +203,22 @@ Module { name: "QQuickCustomParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["CustomParticle 2.0"] + exports: ["QtQuick.Particles/CustomParticle 2.0"] + exportMetaObjectRevisions: [0] Property { name: "fragmentShader"; type: "QByteArray" } Property { name: "vertexShader"; type: "QByteArray" } } Component { name: "QQuickDirection" prototype: "QObject" - exports: ["NullVector 2.0"] + exports: ["QtQuick.Particles/NullVector 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickEllipseExtruder" prototype: "QQuickParticleExtruder" - exports: ["EllipseShape 2.0"] + exports: ["QtQuick.Particles/EllipseShape 2.0"] + exportMetaObjectRevisions: [0] Property { name: "fill"; type: "bool" } Signal { name: "fillChanged" @@ -225,7 +233,8 @@ Module { name: "QQuickFrictionAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Friction 2.0"] + exports: ["QtQuick.Particles/Friction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "factor"; type: "double" } Property { name: "threshold"; type: "double" } Signal { @@ -249,7 +258,8 @@ Module { name: "QQuickGravityAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Gravity 2.0"] + exports: ["QtQuick.Particles/Gravity 2.0"] + exportMetaObjectRevisions: [0] Property { name: "magnitude"; type: "double" } Property { name: "acceleration"; type: "double" } Property { name: "angle"; type: "double" } @@ -278,7 +288,8 @@ Module { name: "QQuickGroupGoalAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["GroupGoal 2.0"] + exports: ["QtQuick.Particles/GroupGoal 2.0"] + exportMetaObjectRevisions: [0] Property { name: "goalState"; type: "string" } Property { name: "jump"; type: "bool" } Signal { @@ -302,7 +313,8 @@ Module { name: "QQuickImageParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["ImageParticle 2.0"] + exports: ["QtQuick.Particles/ImageParticle 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -480,7 +492,8 @@ Module { name: "QQuickItemParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["ItemParticle 2.0"] + exports: ["QtQuick.Particles/ItemParticle 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickItemParticleAttached" Property { name: "fade"; type: "bool" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } @@ -528,7 +541,8 @@ Module { Component { name: "QQuickLineExtruder" prototype: "QQuickParticleExtruder" - exports: ["LineShape 2.0"] + exports: ["QtQuick.Particles/LineShape 2.0"] + exportMetaObjectRevisions: [0] Property { name: "mirrored"; type: "bool" } Signal { name: "mirroredChanged" @@ -542,7 +556,8 @@ Module { Component { name: "QQuickMaskExtruder" prototype: "QQuickParticleExtruder" - exports: ["MaskShape 2.0"] + exports: ["QtQuick.Particles/MaskShape 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Signal { name: "sourceChanged" @@ -557,7 +572,8 @@ Module { name: "QQuickParticleAffector" defaultProperty: "data" prototype: "QQuickItem" - exports: ["ParticleAffector 2.0"] + exports: ["QtQuick.Particles/ParticleAffector 2.0"] + exportMetaObjectRevisions: [0] Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true } Property { name: "groups"; type: "QStringList" } Property { name: "whenCollidingWith"; type: "QStringList" } @@ -623,7 +639,8 @@ Module { name: "QQuickParticleEmitter" defaultProperty: "data" prototype: "QQuickItem" - exports: ["Emitter 2.0"] + exports: ["QtQuick.Particles/Emitter 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Lifetime" values: { @@ -781,13 +798,15 @@ Module { Component { name: "QQuickParticleExtruder" prototype: "QObject" - exports: ["ParticleExtruder 2.0"] + exports: ["QtQuick.Particles/ParticleExtruder 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickParticleGroup" defaultProperty: "particleChildren" prototype: "QQuickStochasticState" - exports: ["ParticleGroup 2.0"] + exports: ["QtQuick.Particles/ParticleGroup 2.0"] + exportMetaObjectRevisions: [0] Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true } Property { name: "particleChildren"; type: "QObject"; isList: true; isReadonly: true } Signal { @@ -815,7 +834,8 @@ Module { name: "QQuickParticlePainter" defaultProperty: "data" prototype: "QQuickItem" - exports: ["ParticlePainter 2.0"] + exports: ["QtQuick.Particles/ParticlePainter 2.0"] + exportMetaObjectRevisions: [0] Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true } Property { name: "groups"; type: "QStringList" } Signal { name: "countChanged" } @@ -845,7 +865,8 @@ Module { name: "QQuickParticleSystem" defaultProperty: "data" prototype: "QQuickItem" - exports: ["ParticleSystem 2.0"] + exports: ["QtQuick.Particles/ParticleSystem 2.0"] + exportMetaObjectRevisions: [0] Property { name: "running"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "empty"; type: "bool"; isReadonly: true } @@ -881,7 +902,8 @@ Module { Component { name: "QQuickPointDirection" prototype: "QQuickDirection" - exports: ["PointDirection 2.0"] + exports: ["QtQuick.Particles/PointDirection 2.0"] + exportMetaObjectRevisions: [0] Property { name: "x"; type: "double" } Property { name: "y"; type: "double" } Property { name: "xVariation"; type: "double" } @@ -922,7 +944,8 @@ Module { Component { name: "QQuickRectangleExtruder" prototype: "QQuickParticleExtruder" - exports: ["RectangleShape 2.0"] + exports: ["QtQuick.Particles/RectangleShape 2.0"] + exportMetaObjectRevisions: [0] Property { name: "fill"; type: "bool" } Signal { name: "fillChanged" @@ -937,7 +960,8 @@ Module { name: "QQuickSpriteGoalAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["SpriteGoal 2.0"] + exports: ["QtQuick.Particles/SpriteGoal 2.0"] + exportMetaObjectRevisions: [0] Property { name: "goalState"; type: "string" } Property { name: "jump"; type: "bool" } Property { name: "systemStates"; type: "bool" } @@ -969,7 +993,8 @@ Module { Component { name: "QQuickTargetDirection" prototype: "QQuickDirection" - exports: ["TargetDirection 2.0"] + exports: ["QtQuick.Particles/TargetDirection 2.0"] + exportMetaObjectRevisions: [0] Property { name: "targetX"; type: "double" } Property { name: "targetY"; type: "double" } Property { name: "targetItem"; type: "QQuickItem"; isPointer: true } @@ -1038,7 +1063,8 @@ Module { name: "QQuickTrailEmitter" defaultProperty: "data" prototype: "QQuickParticleEmitter" - exports: ["TrailEmitter 2.0"] + exports: ["QtQuick.Particles/TrailEmitter 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "EmitSize" values: { @@ -1100,7 +1126,8 @@ Module { name: "QQuickTurbulenceAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Turbulence 2.0"] + exports: ["QtQuick.Particles/Turbulence 2.0"] + exportMetaObjectRevisions: [0] Property { name: "strength"; type: "double" } Property { name: "noiseSource"; type: "QUrl" } Signal { @@ -1124,7 +1151,8 @@ Module { name: "QQuickWanderAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["Wander 2.0"] + exports: ["QtQuick.Particles/Wander 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "AffectableParameters" values: { diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index aa24e39f85..02c7d61536 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -3,12 +3,20 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump -builtins'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable -builtins'. Module { Component { name: "QAbstractItemModel" prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } Signal { name: "dataChanged" Parameter { name: "topLeft"; type: "QModelIndex" } @@ -167,6 +175,7 @@ Module { name: "QInputMethod" prototype: "QObject" exports: ["QtQuick/InputMethod 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Action" values: { @@ -215,6 +224,7 @@ Module { Component { name: "QObject" exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "objectName"; type: "string" } Signal { name: "objectNameChanged" @@ -228,9 +238,26 @@ Module { } } Component { + name: "QQmlApplication" + prototype: "QObject" + Property { name: "arguments"; type: "QStringList"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "version"; type: "string" } + Signal { name: "aboutToQuit" } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setVersion" + Parameter { name: "arg"; type: "string" } + } + } + Component { name: "QQmlBind" prototype: "QObject" exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "value"; type: "QVariant" } @@ -244,6 +271,7 @@ Module { "QtQml/Component 2.0", "QtQuick/Component 2.0" ] + exportMetaObjectRevisions: [0, 0, 0] attachedType: "QQmlComponentAttached" Enum { name: "CompilationMode" @@ -298,13 +326,105 @@ Module { name: "QQmlConnections" prototype: "QObject" exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "ignoreUnknownSignals"; type: "bool" } } Component { + name: "QQmlDelegateModel" + defaultProperty: "delegate" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualDataModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlDelegateModelAttached" + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "filterOnGroup"; type: "string" } + Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true } + Property { + name: "persistedItems" + type: "QQmlDelegateModelGroup" + isReadonly: true + isPointer: true + } + Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true } + Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "rootIndex"; type: "QVariant" } + Signal { name: "filterGroupChanged" } + Signal { name: "defaultGroupsChanged" } + Method { + name: "modelIndex" + type: "QVariant" + Parameter { name: "idx"; type: "int" } + } + Method { name: "parentModelIndex"; type: "QVariant" } + } + Component { + name: "QQmlDelegateModelAttached" + prototype: "QObject" + Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true } + Property { name: "groups"; type: "QStringList" } + Property { name: "isUnresolved"; type: "bool"; isReadonly: true } + Signal { name: "unresolvedChanged" } + } + Component { + name: "QQmlDelegateModelGroup" + prototype: "QObject" + exports: ["QtQuick/VisualDataGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "includeByDefault"; type: "bool" } + Signal { name: "defaultIncludeChanged" } + Signal { + name: "changed" + Parameter { name: "removed"; type: "QQmlV8Handle" } + Parameter { name: "inserted"; type: "QQmlV8Handle" } + } + Method { + name: "insert" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "create" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "resolve" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "remove" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "addGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "removeGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "setGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "move" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + } + Component { name: "QQmlDelegateModelParts"; prototype: "QObject" } + Component { name: "QQmlEasingValueType" prototype: "QQmlValueType" exports: ["QtQuick/Easing 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Type" values: { @@ -363,8 +483,111 @@ Module { Property { name: "bezierCurve"; type: "QVariantList" } } Component { + name: "QQmlInstanceModel" + prototype: "QObject" + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "modelUpdated" + Parameter { name: "changeSet"; type: "QQmlChangeSet" } + Parameter { name: "reset"; type: "bool" } + } + Signal { + name: "createdItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "initItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "destroyingItem" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQmlInstantiator" + defaultProperty: "delegate" + prototype: "QObject" + exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"] + exportMetaObjectRevisions: [0, 0] + Property { name: "active"; type: "bool" } + Property { name: "asynchronous"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { + name: "objectAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "objectRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Method { + name: "objectAt" + type: "QObject*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQmlListElement" + prototype: "QObject" + exports: ["QtQuick/ListElement 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQmlListModel" + prototype: "QAbstractListModel" + exports: ["QtQuick/ListModel 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "dynamicRoles"; type: "bool" } + Method { name: "clear" } + Method { + name: "remove" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "append" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "insert" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + Method { + name: "set" + Parameter { name: "index"; type: "int" } + Parameter { type: "QQmlV8Handle" } + } + Method { + name: "setProperty" + Parameter { name: "index"; type: "int" } + Parameter { name: "property"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "move" + Parameter { name: "from"; type: "int" } + Parameter { name: "to"; type: "int" } + Parameter { name: "count"; type: "int" } + } + Method { name: "sync" } + } + Component { name: "QQmlLocale" exports: ["QtQuick/Locale 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "MeasurementSystem" values: { @@ -404,9 +627,24 @@ Module { } } Component { + name: "QQmlObjectModel" + defaultProperty: "children" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualItemModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlObjectModelAttached" + Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQmlObjectModelAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + } + Component { name: "QQmlTimer" prototype: "QObject" exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "interval"; type: "int" } Property { name: "running"; type: "bool" } Property { name: "repeat"; type: "bool" } @@ -422,6 +660,7 @@ Module { name: "QQuickAbstractAnimation" prototype: "QObject" exports: ["QtQuick/Animation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Loops" values: { @@ -461,14 +700,18 @@ Module { name: "QQuickAccessibleAttached" prototype: "QObject" exports: ["QtQuick/Accessible 2.0"] + exportMetaObjectRevisions: [0] Property { name: "role"; type: "QAccessible::Role" } Property { name: "name"; type: "string" } Property { name: "description"; type: "string" } + Method { name: "valueChanged" } + Method { name: "cursorPositionChanged" } } Component { name: "QQuickAnchorAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/AnchorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } Property { name: "duration"; type: "int" } Property { name: "easing"; type: "QEasingCurve" } @@ -485,6 +728,7 @@ Module { name: "QQuickAnchorChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/AnchorChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true } } @@ -527,6 +771,7 @@ Module { defaultProperty: "data" prototype: "QQuickImage" exports: ["QtQuick/AnimatedImage 2.0"] + exportMetaObjectRevisions: [0] Property { name: "playing"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "currentFrame"; type: "int" } @@ -539,6 +784,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/AnimatedSprite 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "LoopParameters" values: { @@ -698,6 +944,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/AnimationController 2.0"] + exportMetaObjectRevisions: [0] Property { name: "progress"; type: "double" } Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Method { name: "reload" } @@ -712,8 +959,9 @@ Module { } Component { name: "QQuickApplication" - prototype: "QObject" + prototype: "QQmlApplication" exports: ["QtQuick/Application 2.0"] + exportMetaObjectRevisions: [0] Property { name: "active"; type: "bool"; isReadonly: true } Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true } @@ -723,6 +971,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Positioner 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPositionerAttached" Property { name: "spacing"; type: "double" } Property { name: "populate"; type: "QQuickTransition"; isPointer: true } @@ -734,6 +983,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/Behavior 2.0"] + exportMetaObjectRevisions: [0] Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Property { name: "enabled"; type: "bool" } } @@ -742,6 +992,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/BorderImage 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "TileMode" values: { @@ -760,6 +1011,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Canvas 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -846,6 +1098,7 @@ Module { name: "QQuickColorAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/ColorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QColor" } Property { name: "to"; type: "QColor" } } @@ -854,6 +1107,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Column 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickCurve" @@ -867,6 +1121,7 @@ Module { name: "QQuickDoubleValidator" prototype: "QDoubleValidator" exports: ["QtQuick/DoubleValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -874,13 +1129,15 @@ Module { name: "QQuickDrag" prototype: "QObject" exports: ["QtQuick/Drag 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickDragAttached" Enum { name: "Axis" values: { "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -914,6 +1171,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/DropArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "containsDrag"; type: "bool"; isReadonly: true } Property { name: "keys"; type: "QStringList" } Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } @@ -945,6 +1203,7 @@ Module { defaultProperty: "flickableData" prototype: "QQuickItem" exports: ["QtQuick/Flickable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "BoundsBehavior" values: { @@ -1054,6 +1313,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Flipable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Side" values: { @@ -1070,6 +1330,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Flow 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Flow" values: { @@ -1086,11 +1347,13 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/FocusScope 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickFontLoader" prototype: "QObject" exports: ["QtQuick/FontLoader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1108,6 +1371,7 @@ Module { name: "QQuickFontValueType" prototype: "QQmlValueType" exports: ["QtQuick/Font 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "FontWeight" values: { @@ -1146,6 +1410,7 @@ Module { defaultProperty: "stops" prototype: "QObject" exports: ["QtQuick/Gradient 2.0"] + exportMetaObjectRevisions: [0] Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true } Signal { name: "updated" } } @@ -1153,6 +1418,7 @@ Module { name: "QQuickGradientStop" prototype: "QObject" exports: ["QtQuick/GradientStop 2.0"] + exportMetaObjectRevisions: [0] Property { name: "position"; type: "double" } Property { name: "color"; type: "QColor" } } @@ -1160,7 +1426,8 @@ Module { name: "QQuickGrid" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Grid 2.0"] + exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "Flow" values: { @@ -1168,6 +1435,22 @@ Module { "TopToBottom": 1 } } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } Property { name: "rows"; type: "int" } Property { name: "columns"; type: "int" } Property { name: "rowSpacing"; type: "double" } @@ -1175,18 +1458,43 @@ Module { Property { name: "flow"; type: "Flow" } Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" } + Property { + name: "effectiveHorizontalItemAlignment" + revision: 1 + type: "HAlignment" + isReadonly: true + } + Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" } + Signal { + name: "horizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "effectiveHorizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "VAlignment" } + } } Component { name: "QQuickGridMesh" prototype: "QQuickShaderEffectMesh" exports: ["QtQuick/GridMesh 2.0"] + exportMetaObjectRevisions: [0] Property { name: "resolution"; type: "QSize" } } Component { name: "QQuickGridView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/GridView 2.0"] + exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickGridViewAttached" Enum { name: "Flow" @@ -1223,6 +1531,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/Image 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -1305,11 +1614,14 @@ Module { prototype: "QQuickItem" Property { name: "implicitWidth"; type: "double"; isReadonly: true } Property { name: "implicitHeight"; type: "double"; isReadonly: true } + Signal { name: "implicitWidthChanged2"; revision: 1 } + Signal { name: "implicitHeightChanged2"; revision: 1 } } Component { name: "QQuickIntValidator" prototype: "QIntValidator" exports: ["QtQuick/IntValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -1317,7 +1629,8 @@ Module { name: "QQuickItem" defaultProperty: "data" prototype: "QObject" - exports: ["QtQuick/Item 2.0"] + exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "TransformOrigin" values: { @@ -1361,6 +1674,7 @@ Module { Property { name: "clip"; type: "bool" } Property { name: "focus"; type: "bool" } Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } Property { name: "rotation"; type: "double" } Property { name: "scale"; type: "double" } Property { name: "transformOrigin"; type: "TransformOrigin" } @@ -1392,6 +1706,11 @@ Module { Parameter { type: "bool" } } Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { name: "parentChanged" Parameter { type: "QQuickItem"; isPointer: true } } @@ -1411,6 +1730,11 @@ Module { name: "clipChanged" Parameter { type: "bool" } } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } Method { name: "update" } Method { name: "contains" @@ -1427,6 +1751,16 @@ Module { } Method { name: "forceActiveFocus" } Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; type: "QQuickItem*" } + Method { name: "childAt" type: "QQuickItem*" Parameter { name: "x"; type: "double" } @@ -1486,6 +1820,8 @@ Module { name: "QQuickItemView" defaultProperty: "flickableData" prototype: "QQuickFlickable" + exports: ["QtQuick/ItemView 2.1"] + exportMetaObjectRevisions: [1] Enum { name: "LayoutDirection" values: { @@ -1577,6 +1913,7 @@ Module { } Method { name: "positionViewAtBeginning" } Method { name: "positionViewAtEnd" } + Method { name: "forceLayout"; revision: 1 } } Component { name: "QQuickItemViewAttached" @@ -1595,6 +1932,7 @@ Module { name: "QQuickKeyNavigationAttached" prototype: "QObject" exports: ["QtQuick/KeyNavigation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1614,6 +1952,7 @@ Module { name: "QQuickKeysAttached" prototype: "QObject" exports: ["QtQuick/Keys 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1789,62 +2128,16 @@ Module { name: "QQuickLayoutMirroringAttached" prototype: "QObject" exports: ["QtQuick/LayoutMirroring 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "childrenInherit"; type: "bool" } } Component { - name: "QQuickListElement" - prototype: "QObject" - exports: ["QtQuick/ListElement 2.0"] - } - Component { - name: "QQuickListModel" - prototype: "QAbstractListModel" - exports: ["QtQuick/ListModel 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "dynamicRoles"; type: "bool" } - Method { name: "clear" } - Method { - name: "remove" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "append" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "insert" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV4Handle" - Parameter { name: "index"; type: "int" } - } - Method { - name: "set" - Parameter { name: "index"; type: "int" } - Parameter { type: "QQmlV4Handle" } - } - Method { - name: "setProperty" - Parameter { name: "index"; type: "int" } - Parameter { name: "property"; type: "string" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "move" - Parameter { name: "from"; type: "int" } - Parameter { name: "to"; type: "int" } - Parameter { name: "count"; type: "int" } - } - Method { name: "sync" } - } - Component { name: "QQuickListView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/ListView 2.0"] + exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickListViewAttached" Enum { name: "Orientation" @@ -1882,6 +2175,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Loader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1909,6 +2203,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MouseArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "mouseX"; type: "double"; isReadonly: true } Property { name: "mouseY"; type: "double"; isReadonly: true } Property { name: "containsMouse"; type: "bool"; isReadonly: true } @@ -1979,6 +2274,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MultiPointTouchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } Property { name: "minimumTouchPoints"; type: "int" } Property { name: "maximumTouchPoints"; type: "int" } @@ -2011,6 +2307,7 @@ Module { name: "QQuickNumberAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/NumberAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } } @@ -2019,6 +2316,7 @@ Module { defaultProperty: "data" prototype: "QObject" exports: ["QtQuick/Package 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPackageAttached" Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } @@ -2032,6 +2330,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PaintedItem 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -2050,12 +2349,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParallelAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickParentAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParentAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "newParent"; type: "QQuickItem"; isPointer: true } Property { name: "via"; type: "QQuickItem"; isPointer: true } @@ -2064,6 +2365,7 @@ Module { name: "QQuickParentChange" prototype: "QQuickStateOperation" exports: ["QtQuick/ParentChange 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "parent"; type: "QQuickItem"; isPointer: true } Property { name: "x"; type: "QQmlScriptString" } @@ -2078,6 +2380,7 @@ Module { defaultProperty: "pathElements" prototype: "QObject" exports: ["QtQuick/Path 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true } Property { name: "startX"; type: "double" } Property { name: "startY"; type: "double" } @@ -2088,6 +2391,7 @@ Module { name: "QQuickPathAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PathAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Orientation" values: { @@ -2140,6 +2444,7 @@ Module { name: "QQuickPathArc" prototype: "QQuickCurve" exports: ["QtQuick/PathArc 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ArcDirection" values: { @@ -2156,6 +2461,7 @@ Module { name: "QQuickPathAttribute" prototype: "QQuickPathElement" exports: ["QtQuick/PathAttribute 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "value"; type: "double" } } @@ -2163,11 +2469,13 @@ Module { name: "QQuickPathCatmullRomCurve" prototype: "QQuickCurve" exports: ["QtQuick/PathCurve 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathCubic" prototype: "QQuickCurve" exports: ["QtQuick/PathCubic 2.0"] + exportMetaObjectRevisions: [0] Property { name: "control1X"; type: "double" } Property { name: "control1Y"; type: "double" } Property { name: "control2X"; type: "double" } @@ -2186,6 +2494,7 @@ Module { name: "QQuickPathInterpolator" prototype: "QObject" exports: ["QtQuick/PathInterpolator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "QQuickPath"; isPointer: true } Property { name: "progress"; type: "double" } Property { name: "x"; type: "double"; isReadonly: true } @@ -2196,17 +2505,20 @@ Module { name: "QQuickPathLine" prototype: "QQuickCurve" exports: ["QtQuick/PathLine 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathPercent" prototype: "QQuickPathElement" exports: ["QtQuick/PathPercent 2.0"] + exportMetaObjectRevisions: [0] Property { name: "value"; type: "double" } } Component { name: "QQuickPathQuad" prototype: "QQuickCurve" exports: ["QtQuick/PathQuad 2.0"] + exportMetaObjectRevisions: [0] Property { name: "controlX"; type: "double" } Property { name: "controlY"; type: "double" } Property { name: "relativeControlX"; type: "double" } @@ -2216,6 +2528,7 @@ Module { name: "QQuickPathSvg" prototype: "QQuickCurve" exports: ["QtQuick/PathSvg 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "string" } } Component { @@ -2223,6 +2536,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PathView 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPathViewAttached" Enum { name: "HighlightRangeMode" @@ -2313,6 +2627,7 @@ Module { name: "QQuickPauseAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PauseAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Signal { name: "durationChanged" @@ -2331,13 +2646,15 @@ Module { name: "QQuickPinch" prototype: "QObject" exports: ["QtQuick/Pinch 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Axis" values: { "NoDrag": 0, "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -2357,6 +2674,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PinchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } Signal { @@ -2383,6 +2701,7 @@ Module { name: "QQuickPropertyAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "properties"; type: "string" } @@ -2402,6 +2721,7 @@ Module { name: "QQuickPropertyAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Property { name: "from"; type: "QVariant" } Property { name: "to"; type: "QVariant" } @@ -2436,6 +2756,7 @@ Module { name: "QQuickPropertyChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/PropertyChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "restoreEntryValues"; type: "bool" } Property { name: "explicit"; type: "bool" } @@ -2445,6 +2766,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Rectangle 2.0"] + exportMetaObjectRevisions: [0] Property { name: "color"; type: "QColor" } Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } @@ -2455,6 +2777,7 @@ Module { defaultProperty: "delegate" prototype: "QQuickItem" exports: ["QtQuick/Repeater 2.0"] + exportMetaObjectRevisions: [0] Property { name: "model"; type: "QVariant" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "count"; type: "int"; isReadonly: true } @@ -2478,6 +2801,7 @@ Module { name: "QQuickRotation" prototype: "QQuickTransform" exports: ["QtQuick/Rotation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "angle"; type: "double" } Property { name: "axis"; type: "QVector3D" } @@ -2486,6 +2810,7 @@ Module { name: "QQuickRotationAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/RotationAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RotationDirection" values: { @@ -2504,6 +2829,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Row 2.0"] + exportMetaObjectRevisions: [0] Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } } @@ -2511,6 +2837,7 @@ Module { name: "QQuickScale" prototype: "QQuickTransform" exports: ["QtQuick/Scale 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "xScale"; type: "double" } Property { name: "yScale"; type: "double" } @@ -2530,6 +2857,7 @@ Module { name: "QQuickScriptAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/ScriptAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "scriptName"; type: "string" } } @@ -2538,12 +2866,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/SequentialAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickShaderEffect" defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffect 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "CullMode" values: { @@ -2572,6 +2902,7 @@ Module { name: "QQuickShaderEffectMesh" prototype: "QObject" exports: ["QtQuick/ShaderEffectMesh 2.0"] + exportMetaObjectRevisions: [0] Signal { name: "geometryChanged" } } Component { @@ -2579,6 +2910,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffectSource 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "WrapMode" values: { @@ -2612,6 +2944,7 @@ Module { name: "QQuickSmoothedAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SmoothedAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ReversingMode" values: { @@ -2628,6 +2961,7 @@ Module { name: "QQuickSpringAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SpringAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "velocity"; type: "double" } Property { name: "spring"; type: "double" } Property { name: "damping"; type: "double" } @@ -2640,6 +2974,7 @@ Module { name: "QQuickSprite" prototype: "QQuickStochasticState" exports: ["QtQuick/Sprite 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Property { name: "reverse"; type: "bool" } Property { name: "frameSync"; type: "bool" } @@ -2759,6 +3094,7 @@ Module { defaultProperty: "sprites" prototype: "QQuickItem" exports: ["QtQuick/SpriteSequence 2.0"] + exportMetaObjectRevisions: [0] Property { name: "running"; type: "bool" } Property { name: "interpolate"; type: "bool" } Property { name: "goalSprite"; type: "string" } @@ -2802,6 +3138,7 @@ Module { defaultProperty: "changes" prototype: "QObject" exports: ["QtQuick/State 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "when"; type: "QQmlBinding"; isPointer: true } Property { name: "extend"; type: "string" } @@ -2812,6 +3149,7 @@ Module { name: "QQuickStateChangeScript" prototype: "QQuickStateOperation" exports: ["QtQuick/StateChangeScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "name"; type: "string" } } @@ -2819,6 +3157,7 @@ Module { name: "QQuickStateGroup" prototype: "QObject" exports: ["QtQuick/StateGroup 2.0"] + exportMetaObjectRevisions: [0] Property { name: "state"; type: "string" } Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } @@ -2882,6 +3221,7 @@ Module { name: "QQuickSystemPalette" prototype: "QObject" exports: ["QtQuick/SystemPalette 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ColorGroup" values: { @@ -2912,6 +3252,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -3062,11 +3403,13 @@ Module { } Method { name: "doLayout" } } + Component { name: "QQuickTextDocument"; prototype: "QObject" } Component { name: "QQuickTextEdit" defaultProperty: "data" prototype: "QQuickImplicitSizeItem" - exports: ["QtQuick/TextEdit 2.0"] + exports: ["QtQuick/TextEdit 2.0", "QtQuick/TextEdit 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "HAlignment" values: { @@ -3144,6 +3487,7 @@ Module { Property { name: "persistentSelection"; type: "bool" } Property { name: "textMargin"; type: "double" } Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } Property { name: "selectByMouse"; type: "bool" } Property { name: "mouseSelectionMode"; type: "SelectionMode" } Property { name: "canPaste"; type: "bool"; isReadonly: true } @@ -3152,6 +3496,13 @@ Module { Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } Property { name: "baseUrl"; type: "QUrl" } Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } Signal { name: "contentSizeChanged" } Signal { name: "colorChanged" @@ -3202,6 +3553,11 @@ Module { Parameter { name: "textMargin"; type: "double" } } Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } + Signal { name: "selectByMouseChanged" Parameter { name: "selectByMouse"; type: "bool" } } @@ -3280,6 +3636,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/TextInput 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "EchoMode" values: { @@ -3482,6 +3839,7 @@ Module { name: "QQuickTouchPoint" prototype: "QObject" exports: ["QtQuick/TouchPoint 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pointId"; type: "int"; isReadonly: true } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "x"; type: "double"; isReadonly: true } @@ -3502,6 +3860,7 @@ Module { defaultProperty: "animations" prototype: "QObject" exports: ["QtQuick/Transition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "string" } Property { name: "to"; type: "string" } Property { name: "reversible"; type: "bool" } @@ -3513,6 +3872,7 @@ Module { name: "QQuickTranslate" prototype: "QQuickTransform" exports: ["QtQuick/Translate 2.0"] + exportMetaObjectRevisions: [0] Property { name: "x"; type: "double" } Property { name: "y"; type: "double" } } @@ -3520,6 +3880,7 @@ Module { name: "QQuickVector3dAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/Vector3dAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QVector3D" } Property { name: "to"; type: "QVector3D" } } @@ -3527,6 +3888,7 @@ Module { name: "QQuickViewSection" prototype: "QObject" exports: ["QtQuick/ViewSection 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "SectionCriteria" values: { @@ -3552,6 +3914,7 @@ Module { name: "QQuickViewTransitionAttached" prototype: "QObject" exports: ["QtQuick/ViewTransition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "index"; type: "int"; isReadonly: true } Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "destination"; type: "QPointF"; isReadonly: true } @@ -3559,134 +3922,10 @@ Module { Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true } } Component { - name: "QQuickVisualDataGroup" - prototype: "QObject" - exports: ["QtQuick/VisualDataGroup 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "name"; type: "string" } - Property { name: "includeByDefault"; type: "bool" } - Signal { name: "defaultIncludeChanged" } - Signal { - name: "changed" - Parameter { name: "removed"; type: "QQmlV4Handle" } - Parameter { name: "inserted"; type: "QQmlV4Handle" } - } - Method { - name: "insert" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "create" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "resolve" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "remove" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "addGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "removeGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "setGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "move" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV4Handle" - Parameter { name: "index"; type: "int" } - } - } - Component { - name: "QQuickVisualDataModel" - defaultProperty: "delegate" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualDataModel 2.0"] - attachedType: "QQuickVisualDataModelAttached" - Property { name: "model"; type: "QVariant" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "filterOnGroup"; type: "string" } - Property { name: "items"; type: "QQuickVisualDataGroup"; isReadonly: true; isPointer: true } - Property { - name: "persistedItems" - type: "QQuickVisualDataGroup" - isReadonly: true - isPointer: true - } - Property { name: "groups"; type: "QQuickVisualDataGroup"; isList: true; isReadonly: true } - Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } - Property { name: "rootIndex"; type: "QVariant" } - Signal { name: "filterGroupChanged" } - Signal { name: "defaultGroupsChanged" } - Method { - name: "modelIndex" - type: "QVariant" - Parameter { name: "idx"; type: "int" } - } - Method { name: "parentModelIndex"; type: "QVariant" } - } - Component { - name: "QQuickVisualDataModelAttached" - prototype: "QObject" - Property { name: "model"; type: "QQuickVisualDataModel"; isReadonly: true; isPointer: true } - Property { name: "groups"; type: "QStringList" } - Property { name: "isUnresolved"; type: "bool"; isReadonly: true } - Signal { name: "unresolvedChanged" } - } - Component { name: "QQuickVisualDataModelParts"; prototype: "QObject" } - Component { - name: "QQuickVisualItemModel" - defaultProperty: "children" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualItemModel 2.0"] - attachedType: "QQuickVisualItemModelAttached" - Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } - } - Component { - name: "QQuickVisualItemModelAttached" - prototype: "QObject" - Property { name: "index"; type: "int"; isReadonly: true } - } - Component { - name: "QQuickVisualModel" - prototype: "QObject" - Property { name: "count"; type: "int"; isReadonly: true } - Signal { - name: "modelUpdated" - Parameter { name: "changeSet"; type: "QQuickChangeSet" } - Parameter { name: "reset"; type: "bool" } - } - Signal { - name: "createdItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "initItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "destroyingItem" - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - } - Component { name: "QQuickWorkerScript" prototype: "QObject" exports: ["QtQuick/WorkerScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Signal { name: "message" @@ -3701,6 +3940,7 @@ Module { name: "QRegExpValidator" prototype: "QValidator" exports: ["QtQuick/RegExpValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "regExp"; type: "QRegExp" } Signal { name: "regExpChanged" @@ -3866,9 +4106,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -3907,9 +4149,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -4105,7 +4349,8 @@ Module { "AA_X11InitThreads": 10, "AA_SynthesizeTouchForUnhandledMouseEvents": 11, "AA_SynthesizeMouseForUnhandledTouchEvents": 12, - "AA_AttributeCount": 13 + "AA_UseHighDpiPixmaps": 13, + "AA_AttributeCount": 14 } } Enum { @@ -4790,6 +5035,15 @@ Module { } } Enum { + name: "Edge" + values: { + "TopEdge": 1, + "LeftEdge": 2, + "RightEdge": 4, + "BottomEdge": 8 + } + } + Enum { name: "ConnectionType" values: { "AutoConnection": 0, @@ -4916,6 +5170,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -4941,6 +5196,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -5010,7 +5266,8 @@ Module { "ItemIsDropEnabled": 8, "ItemIsUserCheckable": 16, "ItemIsEnabled": 32, - "ItemIsTristate": 64 + "ItemIsTristate": 64, + "ItemNeverHasChildren": 128 } } Enum { diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index fbfad28209..0bec4cddf2 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -143,7 +143,7 @@ Item { if ("mapFromItem" in o && "mapToItem" in o) { return "declarativeitem"; // @todo improve detection of declarative items } else if ("x" in o && "y" in o && "z" in o) { - return "vector3d"; // Qt3D vector + return "vector3d"; // Qt 3D vector } return "object"; } else if (o instanceof Function) { @@ -291,6 +291,11 @@ Item { } function tryCompare(obj, prop, value, timeout) { + if (arguments.length == 2) { + qtest_results.fail("A value is required for tryCompare", + util.callerFile(), util.callerLine()) + throw new Error("QtQuickTest::fail") + } if (!timeout) timeout = 5000 if (!qtest_compareInternal(obj[prop], value)) @@ -682,6 +687,9 @@ Item { qtest_runFunction(prop, null, isBenchmark) } qtest_results.finishTestFunction() + // wait(0) will call processEvents() so objects marked for deletion + // in the test function will be deleted. + wait(0) qtest_results.skipped = false } diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes index 5ad3f891f9..2865812eb2 100644 --- a/src/imports/testlib/plugins.qmltypes +++ b/src/imports/testlib/plugins.qmltypes @@ -3,13 +3,14 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtTest 1.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtTest 1.0'. Module { Component { name: "QuickTestEvent" prototype: "QObject" - exports: ["TestEvent 1.0"] + exports: ["QtTest/TestEvent 1.0"] + exportMetaObjectRevisions: [0] Method { name: "keyPress" type: "bool" @@ -32,6 +33,27 @@ Module { Parameter { name: "delay"; type: "int" } } Method { + name: "keyPressChar" + type: "bool" + Parameter { name: "character"; type: "string" } + Parameter { name: "modifiers"; type: "int" } + Parameter { name: "delay"; type: "int" } + } + Method { + name: "keyReleaseChar" + type: "bool" + Parameter { name: "character"; type: "string" } + Parameter { name: "modifiers"; type: "int" } + Parameter { name: "delay"; type: "int" } + } + Method { + name: "keyClickChar" + type: "bool" + Parameter { name: "character"; type: "string" } + Parameter { name: "modifiers"; type: "int" } + Parameter { name: "delay"; type: "int" } + } + Method { name: "mousePress" type: "bool" Parameter { name: "item"; type: "QObject"; isPointer: true } @@ -96,7 +118,8 @@ Module { Component { name: "QuickTestResult" prototype: "QObject" - exports: ["TestResult 1.0"] + exports: ["QtTest/TestResult 1.0"] + exportMetaObjectRevisions: [0] Enum { name: "RunMode" values: { @@ -230,7 +253,8 @@ Module { Component { name: "QuickTestUtil" prototype: "QObject" - exports: ["TestUtil 1.0"] + exports: ["QtTest/TestUtil 1.0"] + exportMetaObjectRevisions: [0] Property { name: "printAvailableFunctions"; type: "bool"; isReadonly: true } Property { name: "dragThreshold"; type: "int"; isReadonly: true } Method { diff --git a/src/imports/widgets/plugins.qmltypes b/src/imports/widgets/plugins.qmltypes index f9fe1f722c..583a36a357 100644 --- a/src/imports/widgets/plugins.qmltypes +++ b/src/imports/widgets/plugins.qmltypes @@ -3,39 +3,72 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.PrivateWidgets 1.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.PrivateWidgets 1.0'. Module { Component { - name: "QQuickAbstractFileDialog" + name: "QQuickAbstractColorDialog" + prototype: "QQuickAbstractDialog" + Property { name: "showAlphaChannel"; type: "bool" } + Property { name: "color"; type: "QColor" } + Signal { name: "selectionAccepted" } + Method { + name: "setVisible" + Parameter { name: "v"; type: "bool" } + } + Method { + name: "setModality" + Parameter { name: "m"; type: "Qt::WindowModality" } + } + Method { + name: "setTitle" + Parameter { name: "t"; type: "string" } + } + Method { + name: "setColor" + Parameter { name: "arg"; type: "QColor" } + } + Method { + name: "setShowAlphaChannel" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickAbstractDialog" prototype: "QObject" Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Signal { name: "visibilityChanged" } + Signal { name: "geometryChanged" } + Signal { name: "accepted" } + Signal { name: "rejected" } + Method { name: "open" } + Method { name: "close" } + } + Component { + name: "QQuickAbstractFileDialog" + prototype: "QQuickAbstractDialog" Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } Property { name: "folder"; type: "string" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } - Property { name: "filePath"; type: "string"; isReadonly: true } - Property { name: "filePaths"; type: "QStringList"; isReadonly: true } - Signal { name: "visibilityChanged" } + Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } + Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true } Signal { name: "filterSelected" } Signal { name: "fileModeChanged" } - Signal { name: "accepted" } - Signal { name: "rejected" } - Method { name: "open" } - Method { name: "close" } + Signal { name: "selectionAccepted" } Method { name: "setVisible" Parameter { name: "v"; type: "bool" } } Method { - name: "setModality" - Parameter { name: "m"; type: "Qt::WindowModality" } - } - Method { name: "setTitle" Parameter { name: "t"; type: "string" } } @@ -65,8 +98,15 @@ Module { } } Component { + name: "QQuickQColorDialog" + prototype: "QQuickAbstractColorDialog" + exports: ["QtQuick.PrivateWidgets/QtColorDialog 1.0"] + exportMetaObjectRevisions: [0] + } + Component { name: "QQuickQFileDialog" prototype: "QQuickAbstractFileDialog" - exports: ["QtFileDialog 1.0"] + exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"] + exportMetaObjectRevisions: [0] } } diff --git a/src/imports/widgets/widgetsplugin.cpp b/src/imports/widgets/widgetsplugin.cpp index a29c9b3609..be9d59f346 100644 --- a/src/imports/widgets/widgetsplugin.cpp +++ b/src/imports/widgets/widgetsplugin.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \brief Provides QML types for certain QWidgets \internal - This QML module contains types which should not be depended upon in QtQuick + This QML module contains types which should not be depended upon in Qt Quick applications, but are available if the Widgets module is linked. It is recommended to load components from this module conditionally, if at all, and to provide fallback implementations in case they fail to load. diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes index ff29466670..59e69114e1 100644 --- a/src/imports/window/plugins.qmltypes +++ b/src/imports/window/plugins.qmltypes @@ -3,7 +3,7 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.0'. +// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.1 -notrelocatable'. Module { Component { @@ -22,16 +22,24 @@ Module { Component { name: "QQuickScreen" prototype: "QObject" - exports: ["Screen 2.0"] + exports: ["QtQuick.Window/Screen 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickScreenAttached" } Component { name: "QQuickScreenAttached" prototype: "QObject" + Property { name: "name"; revision: 1; type: "string"; isReadonly: true } Property { name: "width"; type: "int"; isReadonly: true } Property { name: "height"; type: "int"; isReadonly: true } + Property { name: "desktopAvailableWidth"; revision: 1; type: "int"; isReadonly: true } + Property { name: "desktopAvailableHeight"; revision: 1; type: "int"; isReadonly: true } + Property { name: "logicalPixelDensity"; revision: 1; type: "double"; isReadonly: true } Property { name: "primaryOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true } Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true } + Signal { name: "nameChanged"; revision: 1 } + Signal { name: "desktopGeometryChanged"; revision: 1 } + Signal { name: "logicalPixelDensityChanged"; revision: 1 } Method { name: "angleBetween" type: "int" @@ -43,10 +51,18 @@ Module { name: "QQuickWindow" defaultProperty: "data" prototype: "QWindow" - exports: ["Window 2.0"] + exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"] + exportMetaObjectRevisions: [0, 1] Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "color"; type: "QColor" } Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } Signal { name: "frameSwapped" } Signal { name: "sceneGraphInitialized" } Signal { name: "sceneGraphInvalidated" } @@ -54,15 +70,32 @@ Module { Signal { name: "beforeRendering" } Signal { name: "afterRendering" } Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { name: "colorChanged" Parameter { type: "QColor" } } + Signal { name: "activeFocusItemChanged"; revision: 1 } Method { name: "update" } Method { name: "releaseResources" } } Component { name: "QWindow" prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } Property { name: "title"; type: "string" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "flags"; type: "Qt::WindowFlags" } @@ -70,20 +103,15 @@ Module { Property { name: "y"; type: "int" } Property { name: "width"; type: "int" } Property { name: "height"; type: "int" } - Property { name: "minimumWidth"; type: "int" } - Property { name: "minimumHeight"; type: "int" } - Property { name: "maximumWidth"; type: "int" } - Property { name: "maximumHeight"; type: "int" } + Property { name: "minimumWidth"; revision: 1; type: "int" } + Property { name: "minimumHeight"; revision: 1; type: "int" } + Property { name: "maximumWidth"; revision: 1; type: "int" } + Property { name: "maximumHeight"; revision: 1; type: "int" } Property { name: "visible"; type: "bool" } - Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } - Property { name: "windowTitle"; type: "string" } - Property { name: "windowFilePath"; type: "string" } - Property { name: "windowIcon"; type: "QIcon" } - Property { name: "windowModality"; type: "Qt::WindowModality" } - Signal { - name: "windowModalityChanged" - Parameter { name: "windowModality"; type: "Qt::WindowModality" } - } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } Signal { name: "screenChanged" Parameter { name: "screen"; type: "QScreen"; isPointer: true } @@ -114,18 +142,22 @@ Module { } Signal { name: "minimumWidthChanged" + revision: 1 Parameter { name: "arg"; type: "int" } } Signal { name: "minimumHeightChanged" + revision: 1 Parameter { name: "arg"; type: "int" } } Signal { name: "maximumWidthChanged" + revision: 1 Parameter { name: "arg"; type: "int" } } Signal { name: "maximumHeightChanged" + revision: 1 Parameter { name: "arg"; type: "int" } } Signal { @@ -133,13 +165,26 @@ Module { Parameter { name: "arg"; type: "bool" } } Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { name: "contentOrientationChanged" + revision: 1 Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } } Signal { name: "focusObjectChanged" Parameter { name: "object"; type: "QObject"; isPointer: true } } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } Method { name: "setVisible" Parameter { name: "visible"; type: "bool" } @@ -175,19 +220,27 @@ Module { } Method { name: "setMinimumWidth" + revision: 1 Parameter { name: "w"; type: "int" } } Method { name: "setMinimumHeight" + revision: 1 Parameter { name: "h"; type: "int" } } Method { name: "setMaximumWidth" + revision: 1 Parameter { name: "w"; type: "int" } } Method { name: "setMaximumHeight" + revision: 1 Parameter { name: "h"; type: "int" } } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } } } diff --git a/src/imports/xmllistmodel/plugins.qmltypes b/src/imports/xmllistmodel/plugins.qmltypes index c71899776f..d951d07719 100644 --- a/src/imports/xmllistmodel/plugins.qmltypes +++ b/src/imports/xmllistmodel/plugins.qmltypes @@ -3,14 +3,15 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump QtQuick.XmlListModel 2.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.XmlListModel 2.0'. Module { Component { name: "QQuickXmlListModel" defaultProperty: "roles" prototype: "QAbstractListModel" - exports: ["XmlListModel 2.0"] + exports: ["QtQuick.XmlListModel/XmlListModel 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -47,7 +48,8 @@ Module { Component { name: "QQuickXmlListModelRole" prototype: "QObject" - exports: ["XmlRole 2.0"] + exports: ["QtQuick.XmlListModel/XmlRole 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "query"; type: "string" } Property { name: "isKey"; type: "bool" } diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index e814eda04b..f3f78c8eae 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -95,7 +95,7 @@ typedef QPair<int, int> QQuickXmlListRange; \brief For specifying a role to an XmlListModel \ingroup qtquick-models - \sa {QtQml} + \sa {Qt QML} */ /*! diff --git a/examples/quick/particles/images/particle4.png b/src/particles/particleresources/fuzzydot.png Binary files differindex bc95b703c1..bc95b703c1 100644 --- a/examples/quick/particles/images/particle4.png +++ b/src/particles/particleresources/fuzzydot.png diff --git a/examples/quick/particles/images/particle.png b/src/particles/particleresources/glowdot.png Binary files differindex 5c83896d22..5c83896d22 100644 --- a/examples/quick/particles/images/particle.png +++ b/src/particles/particleresources/glowdot.png diff --git a/examples/quick/particles/images/star.png b/src/particles/particleresources/star.png Binary files differindex 0d592cfa87..0d592cfa87 100644 --- a/examples/quick/particles/images/star.png +++ b/src/particles/particleresources/star.png diff --git a/src/particles/particles.qrc b/src/particles/particles.qrc index 344f9489a4..582520405f 100644 --- a/src/particles/particles.qrc +++ b/src/particles/particles.qrc @@ -1,5 +1,8 @@ <RCC> <qresource prefix="/"> <file>particleresources/noise.png</file> + <file>particleresources/fuzzydot.png</file> + <file>particleresources/glowdot.png</file> + <file>particleresources/star.png</file> </qresource> </RCC> diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index e0572ef424..0145ce4edb 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -623,6 +623,22 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) The source image to be used. If the image is a sprite animation, use the sprite property instead. + + Since Qt 5.2, some default images are provided as resources to aid prototyping: + \table + \row + \li qrc:///particleresources/star.png + \li \inlineimage particles/star.png + \row + \li qrc:///particleresources/glowdot.png + \li \inlineimage particles/glowdot.png + \row + \li qrc:///particleresources/fuzzydot.png + \li \inlineimage particles/fuzzydot.png + \endtable + + Note that the images are white and semi-transparent, to allow colorization + and alpha levels to have maximum effect. */ /*! \qmlproperty list<Sprite> QtQuick.Particles2::ImageParticle::sprites @@ -1363,6 +1379,15 @@ void QQuickImageParticle::finishBuildParticleNodes() perfLevel = Deformable; #endif +#ifdef Q_OS_MAC + // Mac OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros, + // causing point sprites who read gl_PointCoord in the frag shader to come out as + // green-red blobs. + if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) { + perfLevel = Deformable; + } +#endif + if (perfLevel >= Colored && !m_color.isValid()) m_color = QColor(Qt::white);//Hidden default, but different from unset diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp index 3153e2b7d0..d59902bf3a 100644 --- a/src/particles/qquickmaskextruder.cpp +++ b/src/particles/qquickmaskextruder.cpp @@ -114,12 +114,18 @@ bool QQuickMaskExtruder::contains(const QRectF &bounds, const QPointF &point) ensureInitialized(bounds);//###Current usage patterns WILL lead to different bounds/r calls. Separate list? if (m_img.isNull()) return false; - QPoint p = point.toPoint() - bounds.topLeft().toPoint(); - return m_img.rect().contains(p) && (bool)m_img.pixelIndex(p); + + QPointF pt = point - bounds.topLeft(); + QPoint p(pt.x() * m_img.width() / bounds.width(), + pt.y() * m_img.height() / bounds.height()); + return m_img.rect().contains(p) && (m_img.pixel(p) & 0xff000000); } -void QQuickMaskExtruder::ensureInitialized(const QRectF &r) +void QQuickMaskExtruder::ensureInitialized(const QRectF &rf) { + // Convert to integer coords to avoid comparing floats and ints which would + // often result in rounding errors. + QRect r = rf.toRect(); if (m_lastWidth == r.width() && m_lastHeight == r.height()) return;//Same as before if (!m_pix.isReady()) @@ -129,13 +135,22 @@ void QQuickMaskExtruder::ensureInitialized(const QRectF &r) m_mask.clear(); - m_img = m_pix.image().createAlphaMask(); - m_img = m_img.convertToFormat(QImage::Format_Mono);//Else LSB, but I think that's easier - m_img = m_img.scaled(r.size().toSize());//TODO: Do they need aspect ratio stuff? Or tiling? - for (int i=0; i<r.width(); i++){ - for (int j=0; j<r.height(); j++){ - if (m_img.pixelIndex(i,j))//Direct bit manipulation is presumably more efficient - m_mask << QPointF(i,j); + m_img = m_pix.image(); + // Image will in all likelyhood be in this format already, so + // no extra memory or conversion takes place + if (m_img.format() != QImage::Format_ARGB32 && m_img.format() != QImage::Format_ARGB32_Premultiplied) + m_img = m_img.convertToFormat(QImage::Format_ARGB32_Premultiplied); + + // resample on the fly using 16-bit + int sx = (m_img.width() << 16) / r.width(); + int sy = (m_img.height() << 16) / r.height(); + int w = r.width(); + int h = r.height(); + for (int y=0; y<h; ++y) { + const uint *sl = (const uint *) m_img.constScanLine((y * sy) >> 16); + for (int x=0; x<w; ++x) { + if (sl[(x * sx) >> 16] & 0xff000000) + m_mask << QPointF(x, y); } } } diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp index cc410fbfbe..6627291c55 100644 --- a/src/particles/qquickparticleemitter.cpp +++ b/src/particles/qquickparticleemitter.cpp @@ -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. @@ -357,7 +357,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp) m_last_timestamp = timeStamp/1000.; m_last_emission = m_last_timestamp; m_reset_last = false; - m_emitCap = particleCount(); + m_emitCap = -1; } if (m_pulseLeft){ @@ -424,6 +424,8 @@ void QQuickParticleEmitter::emitWindow(int timeStamp) if (datum->lifeSpan >= m_system->maxLife){ datum->lifeSpan = m_system->maxLife; + if (m_emitCap == -1) + m_emitCap = particleCount(); m_emitCap--;//emitCap keeps us from reemitting 'infinite' particles after their life. Unless you reset the emitter. } diff --git a/src/particles/qquickparticlepainter.cpp b/src/particles/qquickparticlepainter.cpp index a84f4a66f4..694391a701 100644 --- a/src/particles/qquickparticlepainter.cpp +++ b/src/particles/qquickparticlepainter.cpp @@ -80,8 +80,8 @@ void QQuickParticlePainter::itemChange(ItemChange change, const ItemChangeData & m_window = data.window; if (m_window) connect(m_window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()), Qt::DirectConnection); - } + QQuickItem::itemChange(change, data); } void QQuickParticlePainter::componentComplete() diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp index da70fe0424..12884ffa4f 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp @@ -40,16 +40,20 @@ ****************************************************************************/ #include "qaccessiblequickitem.h" + +#include <QtGui/qtextdocument.h> + #include "QtQuick/private/qquickitem_p.h" #include "QtQuick/private/qquicktext_p.h" #include "QtQuick/private/qquickaccessibleattached_p.h" +#include "QtQuick/qquicktextdocument.h" QT_BEGIN_NAMESPACE #ifndef QT_NO_ACCESSIBILITY QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item) - : QQmlAccessible(item) + : QQmlAccessible(item), m_doc(textDocument()) { } @@ -86,7 +90,6 @@ bool QAccessibleQuickItem::clipsChildren() const return static_cast<QQuickItem *>(item())->clip(); } - QAccessibleInterface *QAccessibleQuickItem::parent() const { QQuickItem *parent = item()->parentItem(); @@ -231,10 +234,11 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const // the following block handles item-specific behavior if (role() == QAccessible::EditableText) { if (textType == QAccessible::Value) { + if (QTextDocument *doc = textDocument()) { + return doc->toPlainText(); + } QVariant text = object()->property("text"); return text.toString(); - } else if (textType == QAccessible::Name) { - return object()->objectName(); } } @@ -310,6 +314,143 @@ QRect itemScreenRect(QQuickItem *item) return QRect(screenPos, itemSize); } +QTextDocument *QAccessibleQuickItem::textDocument() const +{ + QVariant docVariant = item()->property("textDocument"); + if (docVariant.canConvert<QQuickTextDocument*>()) { + QQuickTextDocument *qqdoc = docVariant.value<QQuickTextDocument*>(); + return qqdoc->textDocument(); + } + return 0; +} + +int QAccessibleQuickItem::characterCount() const +{ + if (m_doc) { + QTextCursor cursor = QTextCursor(m_doc); + cursor.movePosition(QTextCursor::End); + return cursor.position(); + } + return text(QAccessible::Value).size(); +} + +int QAccessibleQuickItem::cursorPosition() const +{ + QVariant pos = item()->property("cursorPosition"); + return pos.toInt(); +} + +void QAccessibleQuickItem::setCursorPosition(int position) +{ + item()->setProperty("cursorPosition", position); +} + +QString QAccessibleQuickItem::text(int startOffset, int endOffset) const +{ + if (m_doc) { + QTextCursor cursor = QTextCursor(m_doc); + cursor.setPosition(startOffset); + cursor.setPosition(endOffset, QTextCursor::KeepAnchor); + return cursor.selectedText(); + } + return text(QAccessible::Value).mid(startOffset, endOffset - startOffset); +} + +QString QAccessibleQuickItem::textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + Q_ASSERT(startOffset); + Q_ASSERT(endOffset); + + if (m_doc) { + QTextCursor cursor = QTextCursor(m_doc); + cursor.setPosition(offset); + QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType); + cursor.setPosition(boundaries.first - 1); + boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType); + + *startOffset = boundaries.first; + *endOffset = boundaries.second; + + return text(boundaries.first, boundaries.second); + } else { + return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset); + } +} + +QString QAccessibleQuickItem::textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + Q_ASSERT(startOffset); + Q_ASSERT(endOffset); + + if (m_doc) { + QTextCursor cursor = QTextCursor(m_doc); + cursor.setPosition(offset); + QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType); + cursor.setPosition(boundaries.second); + boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType); + + *startOffset = boundaries.first; + *endOffset = boundaries.second; + + return text(boundaries.first, boundaries.second); + } else { + return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset); + } +} + +QString QAccessibleQuickItem::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + Q_ASSERT(startOffset); + Q_ASSERT(endOffset); + + if (m_doc) { + QTextCursor cursor = QTextCursor(m_doc); + cursor.setPosition(offset); + QPair<int, int> boundaries = QAccessible::qAccessibleTextBoundaryHelper(cursor, boundaryType); + + *startOffset = boundaries.first; + *endOffset = boundaries.second; + return text(boundaries.first, boundaries.second); + } else { + return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset); + } +} + +void QAccessibleQuickItem::selection(int selectionIndex, int *startOffset, int *endOffset) const +{ + if (selectionIndex == 0) { + *startOffset = item()->property("selectionStart").toInt(); + *endOffset = item()->property("selectionEnd").toInt(); + } else { + *startOffset = 0; + *endOffset = 0; + } +} + +int QAccessibleQuickItem::selectionCount() const +{ + if (item()->property("selectionStart").toInt() != item()->property("selectionEnd").toInt()) + return 1; + return 0; +} + +void QAccessibleQuickItem::addSelection(int /* startOffset */, int /* endOffset */) +{ + +} +void QAccessibleQuickItem::removeSelection(int /* selectionIndex */) +{ + +} +void QAccessibleQuickItem::setSelection(int /* selectionIndex */, int /* startOffset */, int /* endOffset */) +{ + +} + + #endif // QT_NO_ACCESSIBILITY QT_END_NAMESPACE diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.h b/src/plugins/accessible/quick/qaccessiblequickitem.h index e82b2f84d2..d9eb652030 100644 --- a/src/plugins/accessible/quick/qaccessiblequickitem.h +++ b/src/plugins/accessible/quick/qaccessiblequickitem.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_ACCESSIBILITY +class QTextDocument; + class QAccessibleQuickItem : public QQmlAccessible, public QAccessibleValueInterface, public QAccessibleTextInterface { public: @@ -81,37 +83,41 @@ public: // Text Interface - // selection (ignored for now) - void selection(int /* selectionIndex */, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; } - int selectionCount() const { return 0; } - void addSelection(int /* startOffset */, int /* endOffset */) {} - void removeSelection(int /* selectionIndex */) {} - void setSelection(int /* selectionIndex */, int /* startOffset */, int /* endOffset */) {} + void selection(int selectionIndex, int *startOffset, int *endOffset) const; + int selectionCount() const; + void addSelection(int startOffset, int endOffset); + void removeSelection(int selectionIndex); + void setSelection(int selectionIndex, int startOffset, int endOffset); // cursor - int cursorPosition() const { return 0; } - void setCursorPosition(int /* position */) {} + int cursorPosition() const; + void setCursorPosition(int position); // text - QString text(int startOffset, int endOffset) const { return text(QAccessible::Name).mid(startOffset, endOffset - startOffset); } -// QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, -// int *startOffset, int *endOffset) const; -// QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, -// int *startOffset, int *endOffset) const; -// QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, -// int *startOffset, int *endOffset) const; - int characterCount() const { return text(QAccessible::Name).count(); } + QString text(int startOffset, int endOffset) const; + QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const; + QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const; + QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int *startOffset, int *endOffset) const; + int characterCount() const; // character <-> geometry QRect characterRect(int /* offset */) const { return QRect(); } int offsetAtPoint(const QPoint & /* point */) const { return -1; } void scrollToSubstring(int /* startIndex */, int /* endIndex */) {} - QString attributes(int /* offset */, int * /* startOffset */, int * /* endOffset */) const { return QString(); } + QString attributes(int /* offset */, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; return QString(); } + + QTextDocument *textDocument() const; protected: QQuickItem *item() const { return static_cast<QQuickItem*>(object()); } void *interface_cast(QAccessible::InterfaceType t); + +private: + QTextDocument *m_doc; }; QRect itemScreenRect(QQuickItem *item); diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index 4251a80b33..1240b2ef4c 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -60,8 +60,11 @@ QAccessibleQuickWindow::QAccessibleQuickWindow(QQuickWindow *object) QQuickItem *QAccessibleQuickWindow::rootItem() const { - if (window()->contentItem()) - return window()->contentItem()->childItems().first(); + if (QQuickItem *ci = window()->contentItem()) { + const QList<QQuickItem *> &childItems = ci->childItems(); + if (!childItems.isEmpty()) + return childItems.first(); + } return 0; } @@ -78,10 +81,8 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const QAccessibleInterface *QAccessibleQuickWindow::child(int index) const { - if (index == 0) { - if (QQuickItem *declarativeRoot = rootItem()) - return new QAccessibleQuickItem(declarativeRoot); - } + if (index == 0) + return QAccessible::queryAccessibleInterface(rootItem()); return 0; } diff --git a/src/plugins/accessible/shared/qqmlaccessible.cpp b/src/plugins/accessible/shared/qqmlaccessible.cpp index c4daa3e014..d08f9bdb2c 100644 --- a/src/plugins/accessible/shared/qqmlaccessible.cpp +++ b/src/plugins/accessible/shared/qqmlaccessible.cpp @@ -129,7 +129,8 @@ QStringList QQmlAccessible::actionNames() const break; case QAccessible::RadioButton: case QAccessible::CheckBox: - actions << QAccessibleActionInterface::toggleAction(); + actions << QAccessibleActionInterface::toggleAction() + << QAccessibleActionInterface::pressAction(); break; case QAccessible::Slider: case QAccessible::SpinBox: @@ -153,7 +154,7 @@ void QQmlAccessible::doAction(const QString &actionName) return; } - // Role-specific default action handling follows. Items are excepted to provide + // Role-specific default action handling follows. Items are expected to provide // properties according to role conventions. These will then be read and/or updated // by the accessibility system. // Checkable roles : checked @@ -163,7 +164,9 @@ void QQmlAccessible::doAction(const QString &actionName) case QAccessible::CheckBox: { QVariant checked = object()->property("checked"); if (checked.isValid()) { - if (actionName == QAccessibleActionInterface::toggleAction()) { + if (actionName == QAccessibleActionInterface::toggleAction() || + actionName == QAccessibleActionInterface::pressAction()) { + object()->setProperty("checked", QVariant(!checked.toBool())); } } diff --git a/src/plugins/accessible/shared/qqmlaccessible.h b/src/plugins/accessible/shared/qqmlaccessible.h index c6ac4e49dd..5280c78485 100644 --- a/src/plugins/accessible/shared/qqmlaccessible.h +++ b/src/plugins/accessible/shared/qqmlaccessible.h @@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE -- Declarative Accessibility Overview. -- * Item interface classes: - QAccessibleDeclarativeItem for QtQuick1 - QAccessibleQuickItem for for QtQuick2 + QAccessibleDeclarativeItem for Qt Quick 1 + QAccessibleQuickItem for for Qt Quick 2 Common base class: QQmlAccessible * View interface classes. diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index c649370680..b82e1850f7 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) if (atEnd()) { //we make sure that we don't exceed the duration here m_currentTime += m_currentAnimation->currentTime() - newCurrentTime; - stop(); + RETURN_IF_DELETED(stop()); } } else { //the only case where currentAnimation could be null //is when all animations have been removed Q_ASSERT(!firstChild()); m_currentTime = 0; - stop(); + RETURN_IF_DELETED(stop()); } m_previousLoop = m_currentLoop; diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp index 27e3d226cd..53ad15775c 100644 --- a/src/qml/debugger/qqmldebugserver.cpp +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -102,9 +102,8 @@ public: bool gotHello; bool blockingMode; - QMutex messageArrivedMutex; - QWaitCondition messageArrivedCondition; - QStringList waitingForMessageNames; + QMutex helloMutex; + QWaitCondition helloCondition; QQmlDebugServerThread *thread; QPluginLoader loader; QAtomicInt changeServiceStateCalls; @@ -298,6 +297,7 @@ QQmlDebugServer *QQmlDebugServer::instance() for (; argsIt != argsItEnd; ++argsIt) { const QString strArgument = *argsIt; if (strArgument.startsWith(QLatin1String("port:"))) { + pluginName = QLatin1String("qmldbg_tcp"); portFrom = strArgument.mid(5).toInt(&ok); portTo = portFrom; QStringList::const_iterator argsNext = argsIt + 1; @@ -308,7 +308,6 @@ QQmlDebugServer *QQmlDebugServer::instance() portTo = nextArgument.toInt(&ok); ++argsIt; } - pluginName = QLatin1String("qmldbg_tcp"); } else if (strArgument.startsWith(QLatin1String("host:"))) { hostAddress = strArgument.mid(5); } else if (strArgument == QLatin1String("block")) { @@ -331,11 +330,11 @@ QQmlDebugServer *QQmlDebugServer::instance() QQmlDebugServerPrivate *d = qQmlDebugServer->d_func(); d->blockingMode = block; - QMutexLocker locker(&d->messageArrivedMutex); + QMutexLocker locker(&d->helloMutex); thread->start(); if (d->blockingMode) - d->messageArrivedCondition.wait(&d->messageArrivedMutex); + d->helloCondition.wait(&d->helloMutex); } else { qWarning() << QString(QLatin1String( @@ -418,10 +417,13 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message) if (s_dataStreamVersion > QDataStream().version()) s_dataStreamVersion = QDataStream().version(); } + // Send the hello answer immediately, since it needs to arrive before // the plugins below start sending messages. + QByteArray helloAnswer; { + QReadLocker readPluginsLock(&d->pluginsLock); QQmlDebugStream out(&helloAnswer, QIODevice::WriteOnly); QStringList pluginNames; QList<float> pluginVersions; @@ -447,7 +449,8 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message) d->_q_changeServiceState(iter.value()->name(), newState); } - d->messageArrivedCondition.wakeAll(); + QMutexLocker helloLock(&d->helloMutex); + d->helloCondition.wakeAll(); } else if (op == 1) { @@ -487,9 +490,6 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message) qWarning() << "QML Debugger: Message received for missing plugin" << name << '.'; } else { (*iter)->messageReceived(message); - - if (d->waitingForMessageNames.removeOne(name)) - d->messageArrivedCondition.wakeAll(); } } else { qWarning("QML Debugger: Invalid hello message."); diff --git a/src/qml/debugger/qqmldebugserver_p.h b/src/qml/debugger/qqmldebugserver_p.h index 27d54d6947..e285d7cfe7 100644 --- a/src/qml/debugger/qqmldebugserver_p.h +++ b/src/qml/debugger/qqmldebugserver_p.h @@ -71,8 +71,6 @@ public: static QQmlDebugServer *instance(); - void setConnection(QQmlDebugServerConnection *connection); - bool hasDebuggingClient() const; bool blockingMode() const; diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp index cb85fc0e1f..0ba939cdca 100644 --- a/src/qml/debugger/qqmlprofilerservice.cpp +++ b/src/qml/debugger/qqmlprofilerservice.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE // instance will be set, unset in constructor. Allows static methods to be inlined. QQmlProfilerService *QQmlProfilerService::instance = 0; Q_GLOBAL_STATIC(QQmlProfilerService, profilerInstance) - +bool QQmlProfilerService::enabled = false; // convert to a QByteArray that can be sent to the debug client // use of QDataStream can skew results @@ -76,12 +76,46 @@ QByteArray QQmlProfilerData::toByteArray() const if (messageType == (int)QQmlProfilerService::Event && detailType == (int)QQmlProfilerService::AnimationFrame) ds << framerate << animationcount; + if (messageType == (int)QQmlProfilerService::PixmapCacheEvent) { + ds << detailData; + switch (detailType) { + case QQmlProfilerService::PixmapSizeKnown: ds << line << column; break; + case QQmlProfilerService::PixmapReferenceCountChanged: ds << animationcount; break; + case QQmlProfilerService::PixmapCacheCountChanged: ds << animationcount; break; + default: break; + } + } + if (messageType == (int)QQmlProfilerService::SceneGraphFrame) { + switch (detailType) { + // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime + case QQmlProfilerService::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break; + // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime + case QQmlProfilerService::SceneGraphAdaptationLayerFrame: ds << (int)subtime_1 << subtime_2 << subtime_3; break; + // ContextFrame: compiling material time + case QQmlProfilerService::SceneGraphContextFrame: ds << subtime_1; break; + // RenderLoop: syncTime, renderTime, swapTime + case QQmlProfilerService::SceneGraphRenderLoopFrame: ds << subtime_1 << subtime_2 << subtime_3; break; + // TexturePrepare: bind, convert, swizzle, upload, mipmap + case QQmlProfilerService::SceneGraphTexturePrepare: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4 << subtime_5; break; + // TextureDeletion: deletionTime + case QQmlProfilerService::SceneGraphTextureDeletion: ds << subtime_1; break; + // PolishAndSync: polishTime, waitTime, syncTime, animationsTime, + case QQmlProfilerService::SceneGraphPolishAndSync: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break; + // WindowsRenderLoop: GL time, make current time, SceneGraph time + case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break; + // WindowsAnimations: update time + case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break; + // WindowsRenderWindow: polish time + case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break; + default:break; + } + } + return data; } QQmlProfilerService::QQmlProfilerService() - : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1), - m_enabled(false) + : QQmlDebugService(QStringLiteral("CanvasFrameRate"), 1) { m_timer.start(); @@ -131,6 +165,11 @@ void QQmlProfilerService::animationFrame(qint64 delta) profilerInstance()->animationFrameImpl(delta); } +void QQmlProfilerService::sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5) +{ + profilerInstance()->sceneGraphFrameImpl(frameType, value1, value2, value3, value4, value5); +} + void QQmlProfilerService::sendProfilingData() { profilerInstance()->sendMessages(); @@ -160,88 +199,136 @@ bool QQmlProfilerService::stopProfilingImpl() void QQmlProfilerService::sendStartedProfilingMessageImpl() { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)StartTrace, - QString(), -1, -1, 0, 0, 0}; + QString(), -1, -1, 0, 0, 0, + 0, 0, 0, 0, 0}; QQmlDebugService::sendMessage(ed.toByteArray()); } void QQmlProfilerService::addEventImpl(EventType event) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)event, - QString(), -1, -1, 0, 0, 0}; + QString(), -1, -1, 0, 0, 0, + 0, 0, 0, 0, 0}; processMessage(ed); } void QQmlProfilerService::startRange(RangeType range, BindingType bindingType) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeStart, (int)range, - QString(), -1, -1, 0, 0, (int)bindingType}; + QString(), -1, -1, 0, 0, (int)bindingType, + 0, 0, 0, 0, 0}; processMessage(rd); } void QQmlProfilerService::rangeData(RangeType range, const QString &rData) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range, - rData, -1, -1, 0, 0, 0}; + rData, -1, -1, 0, 0, 0, + 0, 0, 0, 0, 0}; processMessage(rd); } void QQmlProfilerService::rangeData(RangeType range, const QUrl &rData) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeData, (int)range, - rData.toString(), -1, -1, 0, 0, 0}; + rData.toString(), -1, -1, 0, 0, 0, + 0, 0, 0, 0, 0}; processMessage(rd); } void QQmlProfilerService::rangeLocation(RangeType range, const QString &fileName, int line, int column) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range, - fileName, line, column, 0, 0, 0}; + fileName, line, column, 0, 0, 0, + 0, 0, 0, 0, 0}; processMessage(rd); } void QQmlProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeLocation, (int)range, - fileName.toString(), line, column, 0, 0, 0}; + fileName.toString(), line, column, 0, 0, 0, + 0, 0, 0, 0, 0}; processMessage(rd); } void QQmlProfilerService::endRange(RangeType range) { - if (!QQmlDebugService::isDebuggingEnabled() || !m_enabled) + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) return; QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)RangeEnd, (int)range, - QString(), -1, -1, 0, 0, 0}; + QString(), -1, -1, 0, 0, 0, + 0, 0, 0, 0, 0}; + processMessage(rd); +} + +void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url) +{ + // assuming enabled checked by caller + QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType, + url.toString(), -1, -1, -1, -1, -1, + 0, 0, 0, 0, 0}; + processMessage(rd); +} + +void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height) +{ + // assuming enabled checked by caller + QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType, + url.toString(), width, height, -1, -1, -1, + 0, 0, 0, 0, 0}; + processMessage(rd); +} + +void QQmlProfilerService::pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count) +{ + // assuming enabled checked by caller + QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)PixmapCacheEvent, (int)eventType, + url.toString(), -1, -1, -1, count, -1, + 0, 0, 0, 0, 0}; + processMessage(rd); +} + +void QQmlProfilerService::sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5) +{ + if (!QQmlDebugService::isDebuggingEnabled() || !enabled) + return; + + // because I already have some space to store ints in the struct, I'll use it to store the frame data + // even though the field names do not match + QQmlProfilerData rd = {m_timer.nsecsElapsed(), (int)SceneGraphFrame, (int)frameType, QString(), + -1, -1, -1, -1, -1, + value1, value2, value3, value4, value5}; processMessage(rd); } void QQmlProfilerService::animationFrameImpl(qint64 delta) { Q_ASSERT(QQmlDebugService::isDebuggingEnabled()); - if (!m_enabled) + if (!enabled) return; int animCount = QUnifiedTimer::instance()->runningAnimationCount(); @@ -250,7 +337,8 @@ void QQmlProfilerService::animationFrameImpl(qint64 delta) // trim fps to integer int fps = 1000 / delta; QQmlProfilerData ed = {m_timer.nsecsElapsed(), (int)Event, (int)AnimationFrame, - QString(), -1, -1, fps, animCount, 0}; + QString(), -1, -1, fps, animCount, 0, + 0, 0, 0, 0, 0}; processMessage(ed); } } @@ -267,12 +355,12 @@ void QQmlProfilerService::processMessage(const QQmlProfilerData &message) bool QQmlProfilerService::profilingEnabled() { - return m_enabled; + return enabled; } void QQmlProfilerService::setProfilingEnabled(bool enable) { - m_enabled = enable; + enabled = enable; } /* @@ -281,6 +369,7 @@ void QQmlProfilerService::setProfilingEnabled(bool enable) void QQmlProfilerService::sendMessages() { QMutexLocker locker(&m_dataMutex); + QList<QByteArray> messages; for (int i = 0; i < m_data.count(); ++i) messages << m_data.at(i).toByteArray(); @@ -303,7 +392,7 @@ void QQmlProfilerService::stateAboutToBeChanged(QQmlDebugService::State newState return; if (state() == Enabled - && m_enabled) { + && enabled) { stopProfilingImpl(); sendMessages(); } diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index a50fb5ea08..fb08a30c6a 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -74,12 +74,18 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData //### QString detailData; //used by RangeData and RangeLocation - int line; //used by RangeLocation - int column; //used by RangeLocation + int line; //used by RangeLocation, also as "width" for pixmaps + int column; //used by RangeLocation, also as "height" for pixmaps int framerate; //used by animation events - int animationcount; //used by animation events + int animationcount; //used by animation events, also as "cache/reference count" for pixmaps int bindingType; + qint64 subtime_1; + qint64 subtime_2; + qint64 subtime_3; + qint64 subtime_4; + qint64 subtime_5; + QByteArray toByteArray() const; }; @@ -99,6 +105,8 @@ public: RangeLocation, RangeEnd, Complete, // end of transmission + PixmapCacheEvent, + SceneGraphFrame, MaximumMessage }; @@ -132,14 +140,43 @@ public: MaximumBindingType }; + enum PixmapEventType { + PixmapSizeKnown, + PixmapReferenceCountChanged, + PixmapCacheCountChanged, + PixmapLoadingStarted, + PixmapLoadingFinished, + PixmapLoadingError, + + MaximumPixmapEventType + }; + + enum SceneGraphFrameType { + SceneGraphRendererFrame, + SceneGraphAdaptationLayerFrame, + SceneGraphContextFrame, + SceneGraphRenderLoopFrame, + SceneGraphTexturePrepare, + SceneGraphTextureDeletion, + SceneGraphPolishAndSync, + SceneGraphWindowsRenderShow, + SceneGraphWindowsAnimations, + SceneGraphWindowsPolishFrame, + + MaximumSceneGraphFrameType + }; + static void initialize(); static bool startProfiling(); static bool stopProfiling(); static void sendStartedProfilingMessage(); + static bool profilingEnabled(); + static void addEvent(EventType); static void animationFrame(qint64); + static void sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2 = -1, qint64 value3 = -1, qint64 value4 = -1, qint64 value5 = -1); static void sendProfilingData(); QQmlProfilerService(); @@ -163,15 +200,22 @@ private: void rangeLocation(RangeType, const QUrl &, int, int); void endRange(RangeType); + // overloading depending on parameters + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count); + + void sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5); + - bool profilingEnabled(); void setProfilingEnabled(bool enable); void sendMessages(); void processMessage(const QQmlProfilerData &); +public: + static bool enabled; private: QElapsedTimer m_timer; - bool m_enabled; QVector<QQmlProfilerData> m_data; QMutex m_dataMutex; QMutex m_initializeMutex; @@ -183,6 +227,7 @@ private: friend struct QQmlHandlingSignalProfiler; friend struct QQmlObjectCreatingProfiler; friend struct QQmlCompilingProfiler; + friend struct QQmlPixmapProfiler; }; // @@ -288,6 +333,49 @@ struct QQmlCompilingProfiler { bool enabled; }; +struct QQmlPixmapProfiler { + QQmlPixmapProfiler() { + QQmlProfilerService *instance = QQmlProfilerService::instance; + enabled = instance ? + instance->profilingEnabled() : false; + } + + ~QQmlPixmapProfiler() {} + + void startLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl); + } + } + void finishLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl); + } + } + void errorLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl); + } + } + void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount); + } + } + void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount); + } + } + void setSize(const QUrl &pixmapUrl, int width, int height) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height); + } + } + + bool enabled; +}; + QT_END_NAMESPACE #endif // QQMLPROFILERSERVICE_P_H diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp index f0f7f7a28d..eeab21d6ab 100644 --- a/src/qml/debugger/qv8debugservice.cpp +++ b/src/qml/debugger/qv8debugservice.cpp @@ -186,9 +186,14 @@ void QV8DebugService::signalEmitted(const QString &signal) // executed in the gui thread void QV8DebugService::init() { -// ### FIXME: v4 -// v8::Debug::SetMessageHandler2(DebugMessageHandler); -// v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler); +#if 0 // ### FIXME: v4 + Q_D(QV8DebugService); + if (!d->debugIsolate) + d->debugIsolate = v8::Isolate::GetCurrent(); + v8::Debug::SetMessageHandler2(DebugMessageHandler); + v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler); + QV4Compiler::enableV4(false); +#endif } // executed in the gui thread @@ -268,7 +273,10 @@ void QV8DebugService::messageReceived(const QByteArray &message) void QV8DebugService::sendDebugMessage(const QString &message) { -// ### FIXME: v4 v8::Debug::SendCommand(message.utf16(), message.size()); +#if 0 // ### FIXME: v4 + Q_D(QV8DebugService); + v8::Debug::SendCommand(message.utf16(), message.size(), 0, d->debugIsolate); +#endif } void QV8DebugService::processDebugMessages() diff --git a/src/qml/debugger/qv8debugservice_p.h b/src/qml/debugger/qv8debugservice_p.h index 00ecf557c3..e6f05a2397 100644 --- a/src/qml/debugger/qv8debugservice_p.h +++ b/src/qml/debugger/qv8debugservice_p.h @@ -54,6 +54,11 @@ // #include "qqmldebugservice_p.h" +#ifdef Q_OS_WINCE +# ifdef DebugBreak +# undef DebugBreak +# endif +#endif #include <private/qv8debug_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 4ce44ba46e..2198428a38 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -18,7 +18,7 @@ qhp.QtQml.indexRoot = qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION -qhp.QtQml.subprojects = classes examples +qhp.QtQml.subprojects = qmltypes classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes qhp.QtQml.subprojects.classes.selectors = class fake:headerfile @@ -26,15 +26,21 @@ qhp.QtQml.subprojects.classes.sortPages = true qhp.QtQml.subprojects.examples.title = Examples qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples qhp.QtQml.subprojects.examples.selectors = fake:example +qhp.QtQml.subprojects.qmltypes.title = QML Types +qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types +qhp.QtQml.subprojects.qmltypes.selectors = fake:qmlclass +qhp.QtQml.subprojects.qmltypes.sortPages = true tagfile = ../../../doc/qtqml/qtqml.tags -depends += qtcore qtxmlpatterns qtgui qtquick +depends += qtcore qtxmlpatterns qtgui qtquick qtdoc -headerdirs += .. +headerdirs += .. \ + ../../imports/models -sourcedirs += .. +sourcedirs += .. \ + ../../imports/models exampledirs += ../../../examples/qml \ ../ \ diff --git a/src/quick/doc/snippets/qml/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml index 4254b50e63..4254b50e63 100644 --- a/src/quick/doc/snippets/qml/visualdatagroup.qml +++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml diff --git a/src/quick/doc/snippets/qml/visualdatamodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml index 0513c5b5f2..0513c5b5f2 100644 --- a/src/quick/doc/snippets/qml/visualdatamodel.qml +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp index da1086146c..da1086146c 100644 --- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/main.cpp +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp diff --git a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml index 1e8cfade96..1e8cfade96 100644 --- a/src/quick/doc/snippets/qml/visualdatamodel_rootindex/view.qml +++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml index c95d9e66eb..65e2bfd4ce 100644 --- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml +++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml @@ -39,9 +39,16 @@ ****************************************************************************/ //! [imports] -import QtQuick 2.0 as Nokia -import Ovi 1.0 as Nokia -//! [imports] +import QtQuick 2.0 as Project +import QtMultimedia 5.0 as Project + +Project.Rectangle { + width: 100; height: 50 -Item { + Project.Audio { + source: "music.wav" + autoPlay: true + } } +//! [imports] + diff --git a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc index fd8301cebe..c3b85ce15a 100644 --- a/src/quick/doc/snippets/qml/codingconventions/javascript-imports.qml +++ b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc @@ -38,10 +38,14 @@ ** ****************************************************************************/ -import QtQuick 2.0 - //![0] -import "myscript.js" as Script +<!DOCTYPE RCC> +<RCC version="1.0"> + +<qresource prefix="/"> + <file>main.qml</file> + <file>images/background.png</file> +</qresource> -Rectangle { color: "blue"; width: Script.calculateWidth(parent) } +</RCC> //![0] diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc deleted file mode 100644 index 5e4941512b..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/example.qrc +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE RCC> -<RCC version="1.0"> - -<qresource prefix="/"> - <file>main.qml</file> - <file>images/background.png</file> -</qresource> - -</RCC> - diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro b/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro deleted file mode 100644 index 5aee288a6e..0000000000 --- a/src/qml/doc/snippets/qml/qtbinding/resources/resources.pro +++ /dev/null @@ -1,4 +0,0 @@ -QT += qml - -SOURCES += main.cpp -RESOURCES += example.qrc diff --git a/src/qml/doc/src/cppclasses/topic.qdoc b/src/qml/doc/src/cppclasses/topic.qdoc index 8b97048c03..7c21793cfd 100644 --- a/src/qml/doc/src/cppclasses/topic.qdoc +++ b/src/qml/doc/src/cppclasses/topic.qdoc @@ -29,7 +29,7 @@ \title Important C++ Classes Provided By The Qt QML Module \brief Overview of the C++ classes provided by the Qt QML module -The Qt QML module provides C++ classes which implement the QML framework. +The \l{Qt QML} module provides C++ classes which implement the QML framework. Clients can use these classes to interact with the QML run-time (for example, by injecting data or invoking methods on objects), and to instantiate a hierarchy of objects from a QML document. The Qt QML module provides more @@ -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. @@ -113,4 +113,20 @@ engine. See the \l{QQmlExpression} class documentation for in depth information about how to use QQmlExpression in an application. +\section1 Usage of the Classes within QML Applications + +These pages describe how to create QML applications which interact with the +C++ classes: + +\list +\li \l{qtqml-cppintegration-topic.html}{Integrating QML and C++} + \list + \li \l{qtqml-cppintegration-exposecppattributes.html}{Exposing Attributes of C++ Classes to QML} + \li \l{qtqml-cppintegration-definetypes.html}{Defining QML Types from C++} + \li \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context Properties} + \li \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++} + \li \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++} + \endlist +\endlist + */ diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc index aaac43e470..1c2bced738 100644 --- a/src/qml/doc/src/cppintegration/contextproperties.qdoc +++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc @@ -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 diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index ba8ad47bab..74a93436f5 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -119,12 +119,12 @@ when passed from C++ to QML and vice-versa: \li \l enumeration \endtable -(Note that classes provided by the QtGui module, such as QColor, QFont, -QQuaternion and QMatrix4x4, are only available from QML when the \l QtQuick -module is imported.) +\note Classes provided by the \l {Qt GUI} module, such as QColor, QFont, +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: diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc index be5f26a865..995fb1bce8 100644 --- a/src/qml/doc/src/cppintegration/definetypes.qdoc +++ b/src/qml/doc/src/cppintegration/definetypes.qdoc @@ -40,7 +40,7 @@ as an instantiable \l{qtqml-typesystem-objecttypes.html}{QML object type} from QML, or enabling a singleton instance of the class to be imported and used from QML. -Additionally, the QtQml module provides mechanisms for implementing QML-specific +Additionally, the \l {Qt QML} module provides mechanisms for implementing QML-specific features such as \e{attached properties} and \e{default properties} in C++. (Note that a number of the important concepts covered in this document are @@ -133,7 +133,7 @@ not be instantiable should not be instantiable from QML \endlist -The QtQml module provides several methods for registering non-instantiable +The \l {Qt QML} module provides several methods for registering non-instantiable types: \list @@ -291,7 +291,7 @@ qmlRegisterRevision<BaseType,1>("MyTypes", 1, 1); \endcode This is useful when deriving from base classes provided by other authors, -e.g. when extending classes from the QtQuick library. +e.g. when extending classes from the Qt Quick module. \section1 Defining QML-Specific Types and Attributes @@ -675,19 +675,19 @@ to be declared for an item without explicitly assigning them to the \l{Item::}{children} property.) -\section2 Defining Visual Items with the QtQuick Module +\section2 Defining Visual Items with the Qt Quick Module -When building user interfaces with the QtQuick module, all QML objects that are +When building user interfaces with the \l {Qt Quick} module, all QML objects that are to be visually rendered must derive from the \l Item type, as it is the base -type for all visual objects in the QtQuick module. This \l Item type is -implemented by the QQuickItem C++ class, which is provided as part of the -QtQuick C++ module. Therefore, this class should be subclassed when it is +type for all visual objects in \l {Qt Quick}. This \l Item type is +implemented by the QQuickItem C++ class, which is provided by the +\l {Qt Quick} module. Therefore, this class should be subclassed when it is necessary to implement a visual type in C++ that can be integrated into a QML-based user interface. See the QQuickItem documentation for more information. Additionally, the \l{Writing QML Extensions with C++} tutorial demonstrates how a QQuickItem-based -visual item can be implemented in C++ and integrated into a QtQuick-based user +visual item can be implemented in C++ and integrated into a Qt Quick-based user interface. @@ -699,7 +699,7 @@ its properties have been set. For example, this may be the case if the initialization is costly, or if the initialization should not be performed until all property values have been initialized. -The QtQml module provides the QQmlParserStatus to be subclass for these +The \l {Qt QML} module provides the QQmlParserStatus to be subclass for these purposes. It defines a number of virtual methods that are invoked invoked at various stages during component instantiation. To receive these notifications, a C++ class should inherit QQmlParserStatus and also notify the Qt meta system diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc index 3253752e47..d0fb03a03c 100644 --- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc +++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc @@ -30,7 +30,7 @@ \title Writing QML Extensions with C++ \brief tutorial about extending QML with Qt C++ -The QtQml C++ module provides a set of APIs for extending QML through +The \l {Qt QML} module provides a set of APIs for extending QML through C++ extensions. You can write extensions to add your own QML types, extend existing Qt types, or call C/C++ functions that are not accessible from ordinary QML code. @@ -39,17 +39,17 @@ core QML features, including properties, signals and bindings. It also shows how extensions can be deployed through plugins. You can find the source code for this tutorial in \c Qt's -examples/quick/tutorials/extending directory. +examples/qml/tutorials/extending directory. Tutorial chapters: \list 1 -\li \l{quick/tutorials/extending/chapter1-basics}{Creating a New Type} -\li \l{quick/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} -\li \l{quick/tutorials/extending/chapter3-bindings}{Property Binding} -\li \l{quick/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} -\li \l{quick/tutorials/extending/chapter5-listproperties}{Using List Property Types} -\li \l{quick/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} +\li \l{tutorials/extending/chapter1-basics}{Creating a New Type} +\li \l{tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} +\li \l{tutorials/extending/chapter3-bindings}{Property Binding} +\li \l{tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} +\li \l{tutorials/extending/chapter5-listproperties}{Using List Property Types} +\li \l{tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} \li \l{qml-extending-tutorial7.html}{In Summary} \endlist @@ -104,7 +104,7 @@ this new class must: Here is our \c PieChart class, defined in \c piechart.h: -\snippet quick/tutorials/extending/chapter1-basics/piechart.h 0 +\snippet tutorials/extending/chapter1-basics/piechart.h 0 The class inherits from QQuickPaintedItem because we want to override QQuickPaintedItem::paint() in perform drawing operations with the QPainter API. @@ -120,15 +120,15 @@ simply sets and returns the \c m_name and \c m_color values as appropriate, and implements \c paint() to draw a simple pie chart. It also turns off the QGraphicsItem::ItemHasNoContents flag to enable painting: -\snippet quick/tutorials/extending/chapter1-basics/piechart.cpp 0 +\snippet tutorials/extending/chapter1-basics/piechart.cpp 0 \dots 0 -\snippet quick/tutorials/extending/chapter1-basics/piechart.cpp 1 +\snippet tutorials/extending/chapter1-basics/piechart.cpp 1 Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml file creates a \c PieChart item and display the pie chart's details using a standard QML \l Text item: -\snippet quick/tutorials/extending/chapter1-basics/app.qml 0 +\snippet tutorials/extending/chapter1-basics/app.qml 0 Notice that although the color is specified as a string in QML, it is automatically converted to a QColor object for the PieChart \c color property. Automatic conversions are @@ -142,20 +142,20 @@ you don't register the type, \c app.qml won't be able to create a \c PieChart. Here is the application \c main.cpp: -\snippet quick/tutorials/extending/chapter1-basics/main.cpp 0 +\snippet tutorials/extending/chapter1-basics/main.cpp 0 This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart", in a type namespace called "Charts", with a version of 1.0. Lastly, we write a \c .pro project file that includes the files and the \c declarative library: -\quotefile quick/tutorials/extending/chapter1-basics/chapter1-basics.pro +\quotefile tutorials/extending/chapter1-basics/chapter1-basics.pro Now we can build and run the application: \image extending-tutorial-chapter1.png -Try it yourself with the code in Qt's \c examples/quick/tutorials/extending/chapter1-basics directory. +Try it yourself with the code in Qt's \c examples/qml/tutorials/extending/chapter1-basics directory. */ @@ -168,20 +168,20 @@ Suppose we want \c PieChart to have a "clearChart()" method that erases the chart and then emits a "chartCleared" signal. Our \c app.qml would be able to call \c clearChart() and receive \c chartCleared() signals like this: -\snippet quick/tutorials/extending/chapter2-methods/app.qml 0 +\snippet tutorials/extending/chapter2-methods/app.qml 0 \image extending-tutorial-chapter2.png To do this, we add a \c clearChart() method and a \c chartCleared() signal to our C++ class: -\snippet quick/tutorials/extending/chapter2-methods/piechart.h 0 +\snippet tutorials/extending/chapter2-methods/piechart.h 0 \dots -\snippet quick/tutorials/extending/chapter2-methods/piechart.h 1 +\snippet tutorials/extending/chapter2-methods/piechart.h 1 \dots -\snippet quick/tutorials/extending/chapter2-methods/piechart.h 2 +\snippet tutorials/extending/chapter2-methods/piechart.h 2 \dots -\snippet quick/tutorials/extending/chapter2-methods/piechart.h 3 +\snippet tutorials/extending/chapter2-methods/piechart.h 3 The use of Q_INVOKABLE makes the \c clearChart() method available to the Qt Meta-Object system, and in turn, to QML. Note that it could have @@ -191,7 +191,7 @@ slots are also callable from QML. Both of these approaches are valid. The \c clearChart() method simply changes the color to Qt::transparent, repaints the chart, then emits the \c chartCleared() signal: -\snippet quick/tutorials/extending/chapter2-methods/piechart.cpp 0 +\snippet tutorials/extending/chapter2-methods/piechart.cpp 0 Now when we run the application and click the window, the pie chart disappears, and the application outputs: @@ -200,7 +200,7 @@ disappears, and the application outputs: The chart has been cleared \endcode -Try out the example yourself with the updated code in Qt's \c examples/quick/tutorials/extending/chapter2-methods directory. +Try out the example yourself with the updated code in Qt's \c examples/qml/tutorials/extending/chapter2-methods directory. */ @@ -216,7 +216,7 @@ other types' values when property values are changed. Let's enable property bindings for the \c color property. That means if we have code like this: -\snippet quick/tutorials/extending/chapter3-bindings/app.qml 0 +\snippet tutorials/extending/chapter3-bindings/app.qml 0 \image extending-tutorial-chapter3.png @@ -231,17 +231,17 @@ It's easy to enable property binding for the \c color property. We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal is emitted whenever the value changes. -\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 0 +\snippet tutorials/extending/chapter3-bindings/piechart.h 0 \dots -\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 1 +\snippet tutorials/extending/chapter3-bindings/piechart.h 1 \dots -\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 2 +\snippet tutorials/extending/chapter3-bindings/piechart.h 2 \dots -\snippet quick/tutorials/extending/chapter3-bindings/piechart.h 3 +\snippet tutorials/extending/chapter3-bindings/piechart.h 3 Then, we emit this signal in \c setPieSlice(): -\snippet quick/tutorials/extending/chapter3-bindings/piechart.cpp 0 +\snippet tutorials/extending/chapter3-bindings/piechart.cpp 0 It's important for \c setColor() to check that the color value has actually changed before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and @@ -299,43 +299,43 @@ For example, let's replace the use of the \c property with a type called "PieSlice" that has a \c color property. Instead of assigning a color, we assign an \c PieSlice value which itself contains a \c color: -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 +\snippet tutorials/extending/chapter4-customPropertyTypes/app.qml 0 Like \c PieChart, this new \c PieSlice type inherits from QQuickPaintedItem and declares its properties with Q_PROPERTY(): -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 +\snippet tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 To use it in \c PieChart, we modify the \c color property declaration and associated method signatures: -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 +\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 \dots -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 +\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 \dots -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 +\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 \dots -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 +\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice is a visual item, so it must be set as a child of the \c PieChart using QQuickItem::setParentItem() so that the \c PieChart knows to paint this child item when its contents are drawn: -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 +\snippet tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 Like the \c PieChart type, the \c PieSlice type has to be registered using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the type to the "Charts" type namespace, version 1.0: -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 +\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 \dots -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 +\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 \dots -\snippet quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 +\snippet tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 -Try it out with the code in Qt's \c examples/quick/tutorials/extending/chapter4-customPropertyTypes directory. +Try it out with the code in Qt's \c examples/qml/tutorials/extending/chapter4-customPropertyTypes directory. */ @@ -349,7 +349,7 @@ Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would have multiple slices, with different colors and sizes. To do this, we could have a \c slices property that accepts a list of \c PieSlice items: -\snippet quick/tutorials/extending/chapter5-listproperties/app.qml 0 +\snippet tutorials/extending/chapter5-listproperties/app.qml 0 \image extending-tutorial-chapter5.png @@ -360,11 +360,11 @@ function with a \c slices() function that returns a list of slices, and add an internal \c append_slice() function (discussed below). We also use a QList to store the internal list of slices as \c m_slices: -\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 0 +\snippet tutorials/extending/chapter5-listproperties/piechart.h 0 \dots -\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 1 +\snippet tutorials/extending/chapter5-listproperties/piechart.h 1 \dots -\snippet quick/tutorials/extending/chapter5-listproperties/piechart.h 2 +\snippet tutorials/extending/chapter5-listproperties/piechart.h 2 Although the \c slices property does not have an associated \c WRITE function, it is still modifiable because of the way QQmlListProperty works. @@ -373,7 +373,7 @@ return a QQmlListProperty value and indicate that the internal \c PieChart::append_slice() function is to be called whenever a request is made from QML to add items to the list: -\snippet quick/tutorials/extending/chapter5-listproperties/piechart.cpp 0 +\snippet tutorials/extending/chapter5-listproperties/piechart.cpp 0 The \c append_slice() function simply sets the parent item as before, and adds the new item to the \c m_slices list. As you can see, the append function for a @@ -384,7 +384,7 @@ The \c PieSlice class has also been modified to include \c fromAngle and \c angl properties and to draw the slice according to these values. This is a straightforward modification if you have read the previous pages in this tutorial, so the code is not shown here. -The complete code can be seen in the updated \c examples/quick/tutorials/extending/chapter5-listproperties directory. +The complete code can be seen in the updated \c examples/qml/tutorials/extending/chapter5-listproperties directory. */ @@ -407,22 +407,22 @@ and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerT Here is the \c ChartsPlugin definition in \c chartsplugin.h: -\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.h 0 +\snippet tutorials/extending/chapter6-plugins/chartsplugin.h 0 And its implementation in \c chartsplugin.cpp: -\snippet quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 +\snippet tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 Then, we write a \c .pro project file that defines the project as a plugin library and specifies with DESTDIR that library files should be built into a "lib" subdirectory: -\quotefile quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +\quotefile tutorials/extending/chapter6-plugins/chapter6-plugins.pro Finally, we add a \l{qtqml-modules-qmldir.html}{qmldir} file that is parsed by the QML engine. In this file, we specify that a plugin named "chapter6-plugin" (the name of the example project) can be found in the "lib" subdirectory: -\quotefile quick/tutorials/extending/chapter6-plugins/Charts/qmldir +\quotefile tutorials/extending/chapter6-plugins/Charts/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build the project and then load the QML file using the \l{Prototyping with qmlscene}{qmlscene tool}, diff --git a/src/qml/doc/src/cppintegration/topic.qdoc b/src/qml/doc/src/cppintegration/topic.qdoc index 48f430c919..4d12ab9d08 100644 --- a/src/qml/doc/src/cppintegration/topic.qdoc +++ b/src/qml/doc/src/cppintegration/topic.qdoc @@ -29,7 +29,7 @@ \title Integrating QML and C++ \brief Description of how to integrate QML and C++ code -QML is designed to be easily extensible through C++ code. The classes in the QtQml C++ module +QML is designed to be easily extensible through C++ code. The classes in the \l {Qt QML} module enables QML objects to be loaded and manipulated from C++, and the nature of QML engine's integration with Qt's \l{Meta Object System}{meta object system} enables C++ functionality to be invoked directly from QML. This allows the development of hybrid applications which are implemented @@ -43,7 +43,7 @@ with QML and JavaScript within \l{qtqml-documents-topic.html}{QML documents}, an C++ \li Use and invoke some C++ functionality from QML (for example, to invoke your application logic, use a data model implemented in C++, or call some functions in a third-party C++ library) -\li Access functionality in the QtQml or QtQuick C++ API (for example, to dynamically generate +\li Access functionality in the \l {Qt QML} or \l {Qt Quick} C++ API (for example, to dynamically generate images using QQuickImageProvider) \li Implement your own \l{qtqml-typesystem-objecttypes.html}{QML object types} from C++ \unicode{0x2014} whether for use within your own specific application, or for distribution to others @@ -71,7 +71,7 @@ methods and signals to be accessed from QML These are the most common methods of accessing C++ functionality from QML code; for more options and details, see the main documentation pages that are described in the sections further below. -Additionally, aside from the ability to access C++ functionality from QML, the Qt QML module also +Additionally, aside from the ability to access C++ functionality from QML, the \l {Qt QML} module also provides ways to do the reverse and manipulate QML objects from C++ code. See \l{qtqml-cppintegration-interactqmlfromcpp.html}{Interacting with QML Objects from C++} for more details. @@ -104,7 +104,7 @@ registered for other purposes: for example, it could be registered as a \e {Sing single class instance to be imported by QML code, or it could be registered to enable the enumeration values of a non-instantiable class to be accessible from QML. -Additionally, the QtQml module provides mechanisms to define QML types that integrate with QML +Additionally, the \l {Qt QML} module provides mechanisms to define QML types that integrate with QML concepts like attached properties and default properties. For more information on registering and creating custom QML types from C++, see the \l @@ -115,7 +115,7 @@ For more information on registering and creating custom QML types from C++, see C++ objects and values can be embedded directly into the context (or \e scope) of loaded QML objects using \e {context properties} and \e {context objects}. This is achieved through the QQmlContext -class provided by the QtQml module, which exposes data to the context of a QML component, allowing +class provided by the \l {Qt QML} module, which exposes data to the context of a QML component, allowing data to be injected from C++ into QML. See \l{qtqml-cppintegration-contextproperties.html}{Embedding C++ Objects into QML with Context diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc index 9f696930d2..7da24d4092 100644 --- a/src/qml/doc/src/javascript/date.qdoc +++ b/src/qml/doc/src/javascript/date.qdoc @@ -27,7 +27,7 @@ /*! \qmltype Date - \inqmlmodule QtQuick 2 + \inqmlmodule QtQml 2 \brief Provides date functions The QML Date object extends the JS Date object with @@ -223,4 +223,3 @@ } \endcode */ - diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc index 09faa61672..e54404d2fd 100644 --- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc +++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc @@ -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. @@ -66,7 +66,7 @@ can take one or two arguments: \li The first is the parent for the new object. The parent can be a graphical object (i.e. of the \l Item type) or non-graphical object (i.e. of the \l QtObject or C++ QObject type). Only graphical objects with graphical - parent objects will be rendered to the QtQuick visual canvas. If you wish + parent objects will be rendered to the \l {Qt Quick} visual canvas. If you wish to set the parent later you can safely pass \c null to this function. \li The second is optional and is a map of property-value pairs that define initial any property values for the object. Property values specified by @@ -109,11 +109,11 @@ the \c finishCreation() function and call \l {Component::createObject()} Notice in both instances, \l {Component::createObject()}{createObject()} is called with \c appWindow passed as the parent argument, since the dynamically -created object is a visual (QtQuick) object. The created object will become a +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 diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc index a63ef617c0..3bd64ac115 100644 --- a/src/qml/doc/src/javascript/hostenvironment.qdoc +++ b/src/qml/doc/src/javascript/hostenvironment.qdoc @@ -166,6 +166,15 @@ Item { } \endqml +\li The \c with statement is deprecated. Using the \c with statement will issue a warning +at loading time and we plan on removing support for it in Qt 5.2. It is generally considered +a language feature that is not recommended for use due reducing the readability of code and disabling +many optimizations in the engine. It is also forbidden in ECMAScript 5 strict mode. + +\li JavaScript binding expressions are executed in non-strict mode. However we +plan on changing the default for bindings in Qt 5.2 to execute always in +ECMAScript 5 strict mode. + \endlist diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc index 800091689c..809b74ed52 100644 --- a/src/qml/doc/src/javascript/imports.qdoc +++ b/src/qml/doc/src/javascript/imports.qdoc @@ -71,13 +71,13 @@ parameters and return values when calling such functions from QML. \section1 Imports Within JavaScript Resources -In QtQuick 2.0, support has been added to allow JavaScript resources to import +In \c {QtQuick 2.0}, support has been added to allow JavaScript resources to import other JavaScript resources and also QML type namespaces using a variation of the standard QML import syntax (where all of the previously described rules and qualifications apply). Due to the ability of a JavaScript resource to import another script or QML -module in this fashion in QtQuick 2.0, some extra semantics are defined: +module in this fashion in \c {QtQuick 2.0}, some extra semantics are defined: \list \li a script with imports will not inherit imports from the QML document which imported it (so accessing Component.errorString will fail, for example) \li a script without imports will inherit imports from the QML document which imported it (so accessing Component.errorString will succeed, for example) @@ -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(). diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc index 1e7894f3d1..20fe40c86f 100644 --- a/src/qml/doc/src/javascript/number.qdoc +++ b/src/qml/doc/src/javascript/number.qdoc @@ -27,7 +27,7 @@ /*! \qmltype Number - \inqmlmodule QtQuick 2 + \inqmlmodule QtQml 2 \brief The Number object provides represents a number value The QML Number object extends the JS Number object with @@ -102,4 +102,3 @@ d = Number.fromLocaleString(german, "1.234") // d == 1234.0 \endcode */ - diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc index cc3004d93f..ab7d7a4ebe 100644 --- a/src/qml/doc/src/javascript/string.qdoc +++ b/src/qml/doc/src/javascript/string.qdoc @@ -27,7 +27,7 @@ /*! \qmltype String - \inqmlmodule QtQuick 2 + \inqmlmodule QtQml 2 \brief The String object represents a string value The QML String object extends the JS String object with @@ -48,4 +48,3 @@ console.log(message.arg(count)) \endcode */ - diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index 4a4de0531c..386f9f49df 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -47,6 +47,20 @@ #include <QtQml> to use this macro. */ +/*! + \fn void qmlClearTypeRegistrations() + \relates QQmlEngine + + Clears all stored type registrations, such as those produced with \l qmlRegisterType. + + Do not call this function while a QQmlEngine exists or behavior will be undefined. + Any existing QQmlEngines must be deleted before calling this function. This function + only affects the application global cache. Delete the QQmlEngine to clear all cached + data relating to that engine. + + #include <QtQml> to use this method. +*/ + /*! \fn int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) @@ -222,7 +236,7 @@ Usage: \code - // first, define the singleton type provider function (callback). + // First, define the singleton type provider function (callback). static QJSValue *example_qjsvalue_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) @@ -233,7 +247,8 @@ return example; } - // second, register the singleton type provider with QML by calling this function in an initialization function. + // Second, register the singleton type provider with QML by calling this function in an initialization function. + #include <QtQml> ... qmlRegisterSingletonType("Qt.example.qjsvalueApi", 1, 0, "MyApi", example_qjsvalue_singletontype_provider); ... @@ -299,7 +314,7 @@ Usage: \code - // first, define your QObject which provides the functionality. + // First, define your QObject which provides the functionality. class SingletonTypeExample : public QObject { Q_OBJECT @@ -325,7 +340,7 @@ int m_someProperty; }; |