Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	src/quick/doc/src/appdevguide/porting.qdoc
	sync.profile

Change-Id: Iec5516c596c3eca60a3e6ceb1d45f2a7a1595c12
This commit is contained in:
Frederik Gladhorn 2013-05-28 15:24:18 +02:00
commit ba0899542c
378 changed files with 5304 additions and 6615 deletions

9
dist/changes-5.1.0 vendored
View File

@ -35,10 +35,19 @@ Third party components
- A Window declared nested inside another Item or Window automatically
becomes transient for (centered upon) its parent's window, if x and y
were not explicitly specified
- The resources property of Item is now its own property independent
of QObject. It no longer returns all QObject children, or explicitly
sets QObject parent. The resources property now behaves as documented.
- As part of a fix for QTBUG-30555, ListView and GridView properties, such
as count, which are based off of the data model will no longer update
immediately if queried. Updates are batched to happen once per frame (or
when properties are being set).
****************************************************************************
* Library *
****************************************************************************
- QTBUG-30837: The Flickable type no longer fixes up the content area on
startup to move it inside the viewport.
****************************************************************************

View File

@ -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

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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();
}
}
}

View File

@ -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();
}
}

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -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.
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -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
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -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
*/

View File

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -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
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -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
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -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
*/

View File

@ -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
}
}

View File

@ -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)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -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
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -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
*/

View File

@ -46,8 +46,8 @@ Rectangle {
width: 320
height: 200
color: palette.window
SystemPalette { id: palette }
clip: true
ColorDialog {
id: colorDialog
@ -62,7 +62,7 @@ Rectangle {
Column {
anchors.fill: parent
anchors.margins: 8
anchors.margins: 12
spacing: 8
Text {
font.bold: true
@ -106,4 +106,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"
}
}
}
}

View File

@ -43,43 +43,11 @@ import QtQuick.Dialogs 1.0
import "../shared"
Rectangle {
width: 580
height: 360
height: 400
color: palette.window
SystemPalette { id: palette }
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"
}
}
}
clip: true
FileDialog {
id: fileDialog
@ -97,10 +65,8 @@ Rectangle {
}
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 +129,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"
}
}
}
}

View File

@ -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

View File

@ -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
}
MouseArea{
TabSet {
width: 580
height: 440
FileDialogs {
property string title: "File Dialog"
anchors.fill: parent
onClicked: self.createObject();
color: "#e3e3e3" // to match tab.png
}
ColorDialogs {
property string title: "Color Dialog"
anchors.fill: parent
color: "#e3e3e3" // to match tab.png
}
}

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/dialogs">
<file>dialogs.qml</file>
<file>FileDialogs.qml</file>
<file>ColorDialogs.qml</file>
</qresource>
</RCC>

View File

@ -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)

View File

@ -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
*/

View File

@ -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.
*/

View File

@ -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
*/

View File

@ -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
@ -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

View File

@ -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.
*/

View File

@ -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.
*/

View File

@ -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
*/

View File

@ -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.

View File

@ -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,14 +43,14 @@
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 \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.

View File

@ -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
*/

View File

@ -20,6 +20,7 @@ SUBDIRS = accessibility \
customitems \
imageprovider \
window \
dialogs \
particles \
demos

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example quick/scenegraph/textureinsgnode
\example scenegraph/textureinsgnode
\title Scene Graph - Rendering FBOs
\ingroup qtquickexamples

View File

@ -26,7 +26,7 @@
****************************************************************************/
/*!
\example quick/scenegraph/textureinthread
\example scenegraph/textureinthread
\title Scene Graph - Rendering FBOs in a thread
\ingroup qtquickexamples

View File

@ -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]

View File

@ -42,6 +42,9 @@
#include <QGuiApplication>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
#include <QtQuick/QQuickView>
#include "threadrenderer.h"
@ -50,6 +53,13 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) {
QQuickView view;
view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml"));
view.show();
return app.exec();
}
qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer");
int execReturn = 0;
@ -63,7 +73,7 @@ int main(int argc, char **argv)
view.setPersistentSceneGraph(true);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml"));
view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml"));
view.show();
execReturn = app.exec();

View File

@ -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

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/scenegraph/textureinsgnode">
<qresource prefix="/scenegraph/textureinthread">
<file>main.qml</file>
<file>error.qml</file>
</qresource>
</RCC>

View File

@ -25,7 +25,7 @@
**
****************************************************************************/
/*!
\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
@ -35,17 +35,17 @@
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
*/

View File

@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

View File

@ -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

View File

@ -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();\

View File

@ -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>

View File

@ -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
*/

Some files were not shown because too many files have changed in this diff Show More