diff options
Diffstat (limited to 'doc/src')
130 files changed, 3867 insertions, 1109 deletions
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 401cf16..7416341 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -29,134 +29,301 @@ \page qdeclarativeanimation.html \title QML Animation -Animation in QML is done by animating properties of objects. Properties of type -real, int, color, rect, point, size, and vector3d can all be animated. -QML supports three main forms of animation: basic property animation, -transitions, and property behaviors. +In QML, animations are created by applying animation objects to object property +values to gradually change them over time. Animation objects are created from +the built-in set of animation elements, which can be used to animate various +types of property values. In addition, animation objects can be applied in +different ways depending on the context in which they are required. + +To create an animation, use an appropriate animation element for the type of +the property that is to be animated, and apply the animation depending on the +type of behavior that is required. This page describes the \l {Types of +Animations} that can be created and the \l {Animation Elements} that are used +to create these animations. + + +\section1 Types of Animations + +An animation is created in different ways depending on the context in which it +is required. Suppose a \l Rectangle's movement - that is, changes in its \c x +or \c y property values - should be animated. The semantics of the animation +differ depending on whether you want to create: + +\list +\o An animation that moves the \l Rectangle as soon as it is created, to a +known position +\o An animation that only triggers when the \l Rectangle is moved by external +sources - for example, when the mouse is clicked, animate the movement to the +mouse position +\o An animation that triggers when a particular signal is received +\o A standalone animation that is not bound to the \l Rectangle's movement, but +instead can be started and stopped from script as required +\o An animation that only triggers during \l{QML States}{state changes} +\endlist + +To support these different types of animation methods, QML provides several +methods for defining an animation. These are: + +\list +\o Creating an \l{Animations as Property Value Sources}{animation using +property value sources}, to immediately animate a specific property +\o Using \l{Behavioral Animations}{behavioral animations}, which are triggered +when a property changes value +\o \l{Animations in a Signal Handler}{Within a signal handler}, to be triggered +when a signal is received +\o As a \l{Standalone Animation}{standalone animation}, that can be +started/stopped from script and can be rebound to different objects +\o Using \l{Transitions}{transitions}, to provide animations between \l{QML +States}{state changes} +\endlist + +These methods are demonstrated below. Notice these examples use +PropertyAnimation, which is one of several QML elements that can be used to +create an animation. See the \l {Animation Elements} section further below for +details. -\tableofcontents -\section1 Basic Property Animation -The simplest form of animation is a \l PropertyAnimation, which can animate all of the property -types listed above. If the property you are animating is a number or color, you can alternatively use -NumberAnimation or ColorAnimation. These elements don't add any additional functionality, -but will help enforce type correctness and are slightly more efficient. +\section2 Animations as Property Value Sources + +An animation is applied as a \l{QDeclarativePropertyValueSource}{property value +source} using the \e Animation \bold on \e Property syntax. Here is a \l +Rectangle whose movement is animated using this method: + +\snippet doc/src/snippets/declarative/animation-propertyvaluesource.qml 0 + +This applies a PropertyAnimation to the \l Rectangle's \c x and \c y properties +to animate from their current values (i.e. zero) to 50, over 1000 milliseconds. +The animation starts as soon as the \l Rectangle is loaded. To animate from +specific values rather than the current \c x and \c y values, set the +PropertyAnimation's \l {PropertyAnimation::}{from} property. + +Specifying an animation as a property value source is useful for animating a +property to a particular value as soon as the object is loaded. + + +\section2 Behavioral Animations + +Often an animation should be applied whenever a particular property value +changes. In these cases, a \l Behavior can be used to specify a default +animation for a property change. Here is an example: + +\snippet doc/src/snippets/declarative/animation-behavioral.qml 0 -A property animation can be specified as a value source using the \e Animation \bold on \e property syntax. This is especially useful -for repeating animations. +This \l Rectangle has \l Behavior objects applied to its \c x and \c y +properties. Whenever these properties change (in this case, when the mouse is +clicked within the parent \l Item), the PropertyAnimation objects defined +within the behaviors will be applied to these properties, thus animating the \l +Rectangle's movement to its new position. Unlike the method of \l {Animations +as Property Value Sources}{defining an animation as a property value source}, +which creates a one-time animation that animates a property to a known value, a +behavioral animation is an animation that is triggered \e {in response to} a +value change. -The following example creates a bouncing effect: -\snippet doc/src/snippets/declarative/animation.qml property-anim-1 +Any changes to these properties will trigger their animations. If \c x or \c y +were bound to other properties, and those properties changed, the animation +would be triggered. The \l{Behavior::}{enabled} property can be used to force a +\l Behavior to only apply under certain circumstances. -\image propanim.gif +Notice that unlike for property value source animations, the +PropertyAnimation's \l {PropertyAnimation::}{from} and \l +{PropertyAnimation::}{to} properties do not need to be defined because these +values are already provided, respectively, by the \l Rectangle's current values +and the new values set in the \c onClicked handler. If these properties were +defined anyway, they would override the default values. + +See the \l {declarative/animation/behaviors}{Behaviors example} for a +demonstration of behavioral animations. + + +\section2 Animations in a Signal Handler + +An animation can be created within a signal handler to be triggered when the +signal is received. For example: + +\snippet doc/src/snippets/declarative/animation-signalhandler.qml 0 + +The PropertyAnimation is triggered when the MouseArea is clicked, animating the +\c x and \c y properties to a value of 50 over 1000 milliseconds. Since the +animation is not bound to a particular object or property, it must define the +\l {PropertyAnimation::}{target} and \l {PropertyAnimation::}{property} (or \l +{PropertyAnimation::}{targets} and \l{PropertyAnimation::}{properties}) values. +The \l {PropertyAnimation::}{to} property is also required to specify the new +\c x and \c y values. + + +\section2 Standalone Animations + +Animations can also be created as ordinary QML objects that are not bound to +any particular objects and properties. An example: + +\snippet doc/src/snippets/declarative/animation-standalone.qml 0 + +A standalone animation is not running by default and must be started explicitly +using the \l {Animation::}{running} property or \l {Animation::}{start()} and +\l {Animation::}{stop()} methods. Since the animation is not bound to a +particular object or property, it must define the \l +{PropertyAnimation::}{target} and \l {PropertyAnimation::}{property} (or \l +{PropertyAnimation::}{targets} and \l{PropertyAnimation::}{properties}) values. +The \l {PropertyAnimation::}{to} property is also required to specify the new +\c x and \c y values. (The \l {PropertyAnimation::}{from} value can optionally +be provided.) + +Standalone animations are useful when an animation is not targeted towards a +single object property and the animation should be explicitly started and +stopped. + + +\section2 Transitions -When you assign an animation as a value source, you do not need to specify \c property -or \c target values; they are automatically selected for you. You do, however, need to specify a \c to value. -An animation specified as a value source will be \c running by default. +Transitions are used to describe the animations to be applied when a \l {QML +States}{state change} occurs. To create a transition, define a \l Transition +object and add it to an item's \l {Item::}{transitions} property. An example: -For example, here is a rectangle that uses a \l NumberAnimation value source to animate the movement -from its current position to an \c x value of 50. The animation starts immediately, and only the \c to -property is required: +\snippet doc/src/snippets/declarative/animation-transitions.qml 0 -\snippet doc/src/snippets/declarative/animation.qml property-anim-2 +When the \l Rectangle changes to the \e moved state, its \c x and \c y property +values are changed by the PropertyChanges object, and the PropertyAnimation +defined within the \l Transition is triggered on these properties. The +animation will not be applied at any time other than during the state change. -A property animation can also be specified as a resource that is manipulated from script. +Notice the example does not set any \l {PropertyAnimation::}{from} and \l +{PropertyAnimation::}{to} values for the PropertyAnimation. As a convenience, +these properties are automatically set to the values of \c x and \c y before +and after the state change, respectively. However, they can be explicitly set +if these values should be overrided. -\snippet doc/src/snippets/declarative/animation.qml property-anim-3 +Also notice the PropertyAnimation does not need to specify a \l +{PropertyAnimation::}{target} object; any \c x or \c y value of any object that +has changed during the state change will be animated. However, the target can +be set if the animation should be restricted to certain objects. -As can be seen, when an animation is used like this (as opposed to as a value source) you will need -to explicitly set the \c target and \c property to animate. This also the only case where -an animation needs to be started explictly by either setting the \c running property to -true or calling the \c start() method. +The top-level animations in a \l Transition are run in parallel. To run them +one after the other, use a SequentialAnimation, as shown below in \l {Grouping +Animations}. -Animations can be joined into a group using SequentialAnimation and ParallelAnimation. +See the \l Transition documentation for more information. -See the \l {declarative/animation/basics}{Animation basics example} for a demonstration of creating and combining multiple animations in QML. -\target state-transitions -\section1 Transitions +\section1 Animation Elements -\l Transition elements describe the animations to perform when \l{qmlstates}{state} changes occur. A transition -can only be triggered by a state change. +To create an animation, choose from one of the built-in QML animation elements. +While the above examples are demonstrated using PropertyAnimation, they could +have used other elements depending on the type of the property to be animated +and whether a single or multiple animations are required. -For example, a \l Transition could describe how an item moves from its initial position to its new position: +All animation elements inherit from the \l Animation element. It is not +possible to create \l Animation objects; instead, this element provides the +essential properties and methods for animation elements. For example, it allows +animations to be started and stopped through the \l {Animation::}{running} +property and the \l{Animation::}{start()} and \l{Animation::}{stop()} methods. +It can also define the number of \l {Animation::}{loops} for an animation. -\snippet doc/src/snippets/declarative/animation.qml transitions-1 -As can be seen, transitions make use of the same basic animation classes introduced above. -In the above example we have specified that we want to animate the \c x and \c y properties, but have not -specified the objects to animate or the \c to values. By default these values are supplied by the framework; -the animation will animate any \c targets whose \c x and \c y have changed, and the \c to values will be those -defined in the end state. You can always supply explicit values to override these implicit values when needed. +\section2 Property Animation Elements -\snippet doc/src/snippets/declarative/animation.qml transitions-2 +PropertyAnimation is the most basic animation element for animating a property. +It can be used to animate \c real, \c int, \c color, \c rect, \c point, \c size, and +\c vector3d properties. It is inherited by NumberAnimation, ColorAnimation, +RotationAnimation and Vector3dAnimation: NumberAnimation provides a more +efficient implementation for animating \c real and \c int properties, and +Vector3dAnimation does the same for \c vector3d properties. ColorAnimation +and RotationAnimation provide more specific attributes for animating color +and rotation changes. -QML transitions have selectors to determine which state changes a transition should apply to. -The following transition will only be triggered when we enter into the \c "details" state. -(The "*" value is a wildcard value that specifies the transition should be applied when changing -from \e any state to the "details" state.) +A ColorAnimation allows color values for the \l {ColorAnimation::}{from} +and \l {ColorAnimation::}{to} properties. The +following animates the rectangle's \l {Rectangle::color} property: -\code -Transition { - from: "*" - to: "details" - ... -} -\endcode +\snippet doc/src/snippets/declarative/animation-elements.qml color -Transitions can happen in parallel, in sequence, or in any combination of the two. By default, the top-level -animations in a transition will happen in parallel. The following example shows a rather complex transition -making use of both sequential and parallel animations: +RotationAnimation allows a rotation's direction to be specified. The following +animates the rectangle's \l {Item::rotation} property: -\snippet doc/src/snippets/declarative/animation.qml transitions-3 +\snippet doc/src/snippets/declarative/animation-elements.qml rotation +In addition, the following specialized animation elements are available: -See \l {declarative/animation/states}{States and Transitions example} for a simple example of how transitions can be applied. +\list +\o SmoothedAnimation: a specialized NumberAnimation that provides smooth +changes in animation when the target value changes +\o SpringAnimation: provides a spring-like animation with specialized +attributes such as \l {SpringAnimation::}{mass}, +\l{SpringAnimation::}{damping} and \l{SpringAnimation::}{epsilon} +\o ParentAnimation: used for animating a parent change (see ParentChange) +\o AnchorAnimation: used for animating an anchor change (see AnchorChanges) +\endlist +See their respective documentation pages for more details. -\section1 Property Behaviors -A property \l {Behavior}{behavior} specifies a default animation to run whenever the property's value changes, regardless -of what caused the change. The \c enabled property can be used to force a \l Behavior -to only apply under certain circumstances. +\section3 Easing + +Any PropertyAnimation-based animations can specify \l +{PropertyAnimation::easing.type}{easing attributes} to control the +easing curve applied when a property value is animated. These control the +effect of the animation on the property value, to provide visual effects like +bounce, acceleration and deceleration. + +For example, this modified version of an \l {Animations as Property Value +Sources}{earlier example} uses \c Easing.OutBounce to create a bouncing effect +when the animation reaches its target value: + +\snippet doc/src/snippets/declarative/animation-easing.qml 0 + +The \l{declarative/animation/easing}{easing example} visually demonstrates each +of the different easing types. + +\section2 Grouping Animations + +Multiple animations can be combined into a single animation using one of the +animation group elements: ParallelAnimation or SequentialAnimation. As their +names suggest, animations in a ParallelAnimation are run at the same time, +while animations in a SequentialAnimation are run one after the other. + +To run multiple animations, define the animations within an animation group. +The following example creates a SequentialAnimation that runs three animations +one after the other: a NumberAnimation, a PauseAnimation and another +NumberAnimation. The SequentialAnimation is applied as a \l{Animations as +Property Value Sources}{property value source animation} on the image's \c y +property, so that the animation starts as soon as the image is loaded, moving +the image up and down: + +\snippet doc/src/snippets/declarative/animation-groups.qml 0 +\image propanim.gif + +Since the SequentialAnimation is applied to the \c y property, the individual +animations within the group are automatically applied to the \c y property as +well; it is not required to set their \l{PropertyAnimation::}{properties} +values to a particular property. -In the following snippet, we specify that we want the \c x position of \c redRect to be animated -whenever it changes. The animation will last 300 milliseconds and use an \l{PropertyAnimation::easing.type}{Easing.InOutQuad} easing curve. +Animation groups can be nested. Here is a rather complex animation making use +of both sequential and parallel animations: -\snippet doc/src/snippets/declarative/animation.qml behavior +\snippet doc/src/snippets/declarative/animation-groups.qml 1 -Like using an animation as a value source, when used in a \l Behavior and animation does not need to specify -a \c target or \c property. +Once individual animations are placed into a SequentialAnimation or +ParallelAnimation, they can no longer be started and stopped independently. The +sequential or parallel animation must be started and stopped as a group. -To trigger this behavior, we could enter a state that changes \c x: +See the \l {declarative/animation/basics}{Animation basics example} for a +demonstration of creating and combining multiple animations in QML. -\qml -State { - name: "myState" - PropertyChanges { - target: redRect - x: 200 - ... - } -} -\endqml -Or, update \c x from a script: -\qml -MouseArea { - .... - onClicked: redRect.x = 24; -} -\endqml +\section2 Other Animation Elements -If \c x were bound to another property, triggering the binding would also trigger the behavior. +In addition, QML provides several other elements useful for animation: -If a state change has a transition animation matching a property with a \l Behavior, the transition animation -will override the \l Behavior for that state change. +\list +\o PauseAnimation: enables pauses during animations +\o ScriptAction: allows JavaScript to be executed during an animation, and can +be used together with StateChangeScript to reused existing scripts +\o PropertyAction: changes a property \e immediately during an animation, +without animating the property change +\endlist -The \l {declarative/animation/behaviors}{Behaviors example} shows how behaviors can be used to provide animations. +See their respective documentation pages for more details. */ diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 217e372..ce35f26 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -27,7 +27,7 @@ /*! \title Qt Quick -\page declarativeui.html +\page qtquick.html \brief Qt Quick provides a declarative framework for building highly dynamic, custom user interfaces. @@ -41,11 +41,10 @@ and netbooks. Qt Quick consists of the QtDeclarative C++ module, QML, and the integration of both of these into the Qt Creator IDE. Using the QtDeclarative C++ module, you can load and interact with QML files from your Qt application. -QML is an extension to \l -{http://www.ecma-international.org/publications/standards/Ecma-262.htm} -{JavaScript}, that provides a mechanism to declaratively build an -object tree of \l {QML Elements}{QML elements}. QML improves the -integration between JavaScript and Qt's existing QObject based type +QML provides mechanisms to declaratively build an object tree using +\l {QML Elements}{QML elements}. QML improves the integration between +\l {http://www.ecma-international.org/publications/standards/Ecma-262.htm}{JavaScript} +and Qt's existing QObject based type system, adds support for automatic \l {Property Binding}{property bindings} and provides \l {Network Transparency}{network transparency} at the language level. @@ -87,11 +86,11 @@ application or to build completely new applications. QML is fully \l \o \l {qdeclarativemodules.html}{Modules} \o \l {Extending types from QML} \o \l {qdeclarativedynamicobjects.html}{Dynamic Object Creation} -\o \l {qmlruntime.html}{The Qt Declarative Runtime} \endlist \section1 Using QML with C++ \list +\o \l {qmlruntime.html}{The Qt Declarative Runtime} \o \l {Using QML in C++ Applications} \o \l {Integrating QML with existing Qt UI code} \o \l {Tutorial: Writing QML extensions with C++} diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 300799c..997f601 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -148,17 +148,47 @@ lots of dynamically created items, however, you may receive a worthwhile performance benefit if unused items are deleted. Note that you should never manually delete items that were dynamically created -by QML elements (such as \l Loader and \l Repeater). Also, you should generally avoid deleting +by QML elements (such as \l Loader and \l Repeater). Also, you should avoid deleting items that you did not dynamically create yourself. Items can be deleted using the \c destroy() method. This method has an optional argument (which defaults to 0) that specifies the approximate delay in milliseconds -before the object is to be destroyed. This allows you to wait until the completion of -an animation or transition. An example: +before the object is to be destroyed. -\snippet doc/src/snippets/declarative/dynamicObjects.qml 0 +Here is an example. The \c application.qml creates five instances of the \c SelfDestroyingRect.qml +component. Each instance runs a NumberAnimation, and when the animation has finished, calls +\c destroy() on its root item to destroy itself: + +\table +\row +\o \c application.qml +\o \c SelfDestroyingRect.qml + +\row +\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0 +\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0 + +\endtable + +Alternatively, the \c application.qml could have destroyed the created object +by calling \c object.destroy(). + +Notice that if a \c SelfDestroyingRect instance was created statically like this: + +\qml +Item { + SelfDestroyingRect { ... } +} +\endqml + +This would result in an error, since items can only be dynamically +destroyed if they were dynamically created. + +Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} +can similarly be destroyed using \c destroy(): + +\snippet doc/src/snippets/declarative/createQmlObject.qml 0 +\snippet doc/src/snippets/declarative/createQmlObject.qml destroy -Here, \c Rectangle objects are destroyed one second after they are created, which is long -enough for the \c NumberAnimation to be played before the object is destroyed. */ diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index c2930b3..c008404 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -114,6 +114,7 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \row \o \l {Component} \o Encapsulate QML items as a component \row \o \l {Timer} \o Provides timed triggers \row \o \l {QML:QtObject} {QtObject} \o Basic element containing only the objectName property +\row \o \l {QML:Qt} {Qt} \o The QML global Qt object provides useful enums and functions from Qt. \row \o \l {WorkerScript} \o Enables the use of threads in QML \row \o \l {Loader} \o Controls the loading of items or components \row \o \l {Repeater} \o Uses a model to create multiples of components diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index f056892..1a40f14 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -115,7 +115,7 @@ For more information on scripts see \l{Integrating JavaScript}. 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 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. -For more information on transitions see \l{state-transitions}{QML Transitions}. +For more information on transitions see \l{qdeclarativeanimation.html#transitions}{QML Transitions}. \section1 Usage The switch can be used in a QML file, like this: diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 39da323..9929cfe 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -203,6 +203,11 @@ The examples can be found in Qt's \c examples/declarative directory. \o \l{declarative/threading/workerscript}{WorkerScript} \endlist +\section2 Screen orientation +\list +\o \l{declarative/screenorientation}{Example} +\endlist + \section2 SQL Local Storage \list \o \l{declarative/sqllocalstorage}{Example} diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index bc849b0..d128d0f 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -421,7 +421,7 @@ To create a plugin library, we need: \list \o A plugin class that registers our QML types \o A project file that describes the plugin -\o A "qmldir" file that tells the QML engine to load the plugin +\o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin \endlist First, we create a plugin class named \c ChartsPlugin. It subclasses QDeclarativeExtensionPlugin @@ -441,8 +441,8 @@ and specifies with DESTDIR that library files should be built into a "lib" subdi \quotefile declarative/tutorials/extending/chapter6-plugins/chapter6-plugins.pro -Finally, we add a \c qmldir file that is automatically parsed by the QML engine. -Here, we specify that a plugin named "chapter6-plugin" (the name +Finally, we add a \l{Writing a qmldir file}{qmldir} file that is automatically 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 declarative/tutorials/extending/chapter6-plugins/qmldir diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index e3ca963..56ea165 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -266,7 +266,7 @@ When a QML item explicitly relinquishes focus (by setting its does not automatically select another element to receive focus. That is, it is possible for there to be no currently \e {active focus}. -See the {declarative/keyinteraction/focus}{Keyboard Focus example} for a +See the \l{declarative/keyinteraction/focus}{Keyboard Focus example} for a demonstration of moving keyboard focus between multiple areas using FocusScope elements. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 938222a..467b7d0 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -30,152 +30,285 @@ \title Modules \section1 QML Modules -A \bold {QML module} is a collection of QML types. They allow you to organize your QML content -into independent units. Modules have an optional versioning mechanism that allows for independent + +A module is a set of QML content files that can be imported as a unit into a QML +application. Modules can be used to organize QML content into independent units, +and they can use a versioning mechanism that allows for independent upgradability of the modules. -There are two types of modules: -location modules (defined by a URL), -and -installed modules (defined by a URI). +While QML component files within the same directory are automatically accessible +within the global namespace, components defined elsewhere must be imported +explicitly using the \c import statement to import them as modules. For +example, an \c import statement is required to use: + +\list +\o A component defined in another QML file that is not in the same directory +\o A component defined in a QML file located on a remote server +\o A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} library (unless the plugin is installed in the same directory) +\o A JavaScript file (note this must be imported using \l {#namespaces}{named imports}) +\endlist + +An \c import statement includes the module name, and possibly a version number. +This can be seen in the snippet commonly found at the top of QML files: + +\qml + import Qt 4.7 +\endqml + +This imports version 4.7 of the "Qt" module into the global namespace. (The QML +library itself must be imported to use any of the \l {QML Elements}, as they +are not included in the global namespace by default.) + +The \c Qt module is an \e installed module; it is found in the +\l{The QML import path}{import path}. There are two types of QML modules: +location modules (defined by a URL) and installed modules (defined by a URI). + + +\section1 Location Modules + +Location modules can reside on the local filesystem or a network resource, +and are referred to by a quoted location URL that specifies the filesystem +or network URL. They allow any directory with QML content to be imported +as a module, whether the directory is on the local filesystem or a remote +server. + +For example, a QML project may have a separate directory for a set of +custom UI components. These components can be accessed by importing the +directory using a relative or absolute path, like this: + +\table +\row +\o Directory structure +\o Contents of application.qml + +\row +\o +\code +MyQMLProject + |- MyComponents + |- Slider.qml + |- CheckBox.qml + |- Main + |- application.qml +\endcode + +\o +\code +import "../MyComponents" + +Slider { ... } +CheckBox { ... } +\endcode + +\endtable -Location modules types are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins} -in a directory refered to directly by -the location URL, either on the local filesystem, or as a network resource. The URL that locates them -can be relative, in which case they actual URL is resolved by the QML file containing the import. -When importing a location module, a quoted URL is used: +Similarly, if the directory resided on a network source, it could +be imported like this: \code -import "https://qml.nokia.com/qml/example" 1.0 -import "https://qml.nokia.com/qml/example" as NokiaExample -import "mymodule" 1.0 -import "mymodule" + import "https://qml.nokia.com/qml/qmlcomponents" + import "https://qml.nokia.com/qml/qmlcomponents" 1.0 \endcode -Installed modules can \e only be on the local file system or in application C++ code. Again they -are defined in QML files and \l{QDeclarativeExtensionPlugin}{QML C++ plugins} in a directory, -but the directory is indirectly referred to by the URI. The mapping to actual content is either -by application C++ code registering a C++ type to a module URI (see \l{Extending QML in C++}), -or in the referenced subdirectory of a path on the import path (see below). -When importing a location module, an un-quoted URI is used: +Remote location modules must have a \l{Writing a qmldir file}{qmldir file} in the +same directory to specify which QML files should be made available. See the +\l {#qmldirexample}{example} below. The qmldir file is optional for modules on +the local filesystem. + + + +\section1 Installed modules + + +Installed modules are modules that are installed on the +local filesystem within the QML import path, or modules defined in C++ +application code. When importing an installed module, an un-quoted URI is +used, with a mandatory version number: \code -import com.nokia.qml.mymodule 1.0 -import com.nokia.qml.mymodule as MyModule + import Qt 4.7 + import com.nokia.qml.mymodule 1.0 \endcode +Installed modules that are installed into the import path or created +as a \l{QDeclarativeExtensionPlugin}{QML C++ plugin} must define a +\l{Writing a qmldir file}{qmldir file}. + + +\section2 The QML import path -For either type of module, a \c qmldir file in the module directory defines the content of the module. This file is -optional for location modules, but only for local filesystem content or a single remote content with a namespace. -The second exception is explained in more detail in the section below on Namespaces. +The QML engine will search the import path for a requested installed module. +The default import path includes: -\section2 The Import Path +\list +\o The directory of the current file +\o The location specified by QLibraryInfo::ImportsPath +\o Paths specified by the \c QML_IMPORT_PATH environment variable +\endlist -Installed modules are searched for on the import path. -The \c -I option to the \l {QML Viewer} adds paths to the import path. +The import path can be queried using QDeclarativeEngine::importPathList() and modified using QDeclarativeEngine::addImportPath(). -From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to -using \l QDeclarativeEngine::addImportPath(). +When running the \l {QML Viewer}, use the \c -I option to add paths to the import path. -\section2 The \c qmldir File -Installed QML modules and remote content without a namespace require a file \c qmldir which -specifies the mapping from all type names to versioned QML files. It is a list of lines of the form: +\section2 Creating installed modules in C++ + +C++ applications can dynamically define installed modules using +qmlRegisterType(). + +For \l{QDeclarativeExtensionPlugin}{QML C++ plugins}, the +module URI is automatically passed to QDeclarativeExtensionPlugin::registerTypes(). +The QDeclarativeExtensionPlugin documentation shows how to use this URI +to call qmlRegisterType() to enable the plugin library to be built as +an installed module. Once the plugin is built and installed, the module is importable +in QML, like this: + +\code +import com.nokia.TimeExample 1.0 +\endcode + +A \l{QDeclarativeExtensionPlugin}{QML C++ plugin} also requires a +\l{Writing a qmldir file}{qmldir file} to make it available to the +QML engine. + + + +\target namespaces +\section1 Namespaces: Using Named Imports + +By default, when a module is imported, its contents are imported into the global namespace. You may choose to import the module into another namespace, either to allow identically-named types to be referenced, or purely for readability. + +To import a module into a specific namespace, use the \e as keyword: + +\qml + import Qt 4.7 as QtLibrary + import "../MyComponents" as MyComponents + import com.nokia.qml.mymodule 1.0 as MyModule +\endqml + +Types from these modules can then only be used when qualified by the namespace: + +\qml + QtLibrary.Rectangle { ... } + + MyComponents.Slider { ... } + + MyModule.SomeComponent { ... } +\endqml + +Multiple modules can be imported into the same namespace in the same way that multiple modules can be imported into the global namespace: + +\qml + import Qt 4.7 as Nokia + import Ovi 1.0 as Nokia +\endqml + +\section2 JavaScript files + +JavaScript files must always be imported with a named import: + +\qml + import "somescript.js" as MyScript + + Item { + //... + Component.onCompleted: MyScript.doSomething() + } +\endqml + + + +\section1 Writing a qmldir file + +A \c qmldir file is a metadata file for a module that maps all type names in +the module to versioned QML files. It is required for installed modules, and +location modules that are loaded from a network source. + +It is defined by a plain text file named "qmldir" that contains one or more lines of the form: \code # <Comment> <TypeName> [<InitialVersion>] <File> -internal <Name> <File> +internal <TypeName> <File> plugin <Name> [<Path>] \endcode -# <Comment> lines are ignored, and can be used for comments. +\bold {# <Commment>} lines are used for comments. They are ignored by the QML engine. -<TypeName> <InitialVersion> <File> lines are used to add QML files as types. -<TypeName> is the type being made available; the optional <InitialVersion> is a version -number like \c 4.0; <File> is the (relative) -file name of the QML file defining the type. +\bold {<TypeName> [<InitialVersion>] <File>} lines are used to add QML files as types. +<TypeName> is the type being made available, the optional <InitialVersion> is a version +number, and <File> is the (relative) file name of the QML file defining the type. Installed files do not need to import the module of which they are a part, as they can refer to the other QML files in the module as relative (local) files, but if the module is imported from a remote location, those files must nevertheless be listed in the \c qmldir file. Types which you do not wish to export to users of your module -may be marked with the \c internal keyword: \c internal <TypeName> <File>. +may be marked with the \c internal keyword: \bold {internal <TypeName> <File>}. The same type can be provided by different files in different versions, in which case later versions (eg. 1.2) must precede earlier versions (eg. 1.0), since the \e first name-version match is used and a request for a version of a type can be fulfilled by one defined in an earlier version of the module. If a user attempts to import a version earlier than the earliest provided or later than the latest provided, -an error results, but if the user imports a version within the range of versions provided, -even if no type is specific to that version, no error results. +the import produces a runtime error, but if the user imports a version within the range of versions provided, +even if no type is specific to that version, no error will occur. A single module, in all versions, may only be provided in a single directory (and a single \c qmldir file). If multiple are provided, only the first in the search path will be used (regardless of whether other versions are provided by directories later in the search path). -Installed and remote files without a namespace \e must be referred to by version information described above, -local files \e may have it. - The versioning system ensures that a given QML file will work regardless of the version of installed software, since a versioned import \e only imports types for that version, leaving other identifiers available, even if the actual installed version might otherwise provide those identifiers. -\c plugin <Name> [<Path>] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} -to the module. - -<Name> is the name of the library. It is usually not the same as the file name -of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce -a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. -By default the engine searches for the plugin library in the directory containing the \c qmldir -file. The \c -P option to the \l {QML Viewer} adds paths to the -plugin search path. -From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to -using \l QDeclarativeEngine::addPluginPath(). +\bold {plugin <Name> [<Path>]} lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} to the module. <Name> is the name of the library. It is usually not the same as the file name +of the plugin binary, which is platform dependent; e.g. the library \c MyAppTypes would produce +\c libMyAppTypes.so on Linux and \c MyAppTypes.dll on Windows. <Path> is an optional argument specifying either an absolute path to the directory containing the plugin file, or a relative path from the directory containing the \c qmldir file to the directory -containing the plugin file. - +containing the plugin file. By default the engine searches for the plugin library in the directory that contains the \c qmldir +file. The plugin search path can be queried with QDeclarativeEngine::pluginPathList() and modified using QDeclarativeEngine::addPluginPath(). When running the \l {QML Viewer}, use the \c -P option to add paths to the plugin search path. -\section2 Namespaces - Named Imports -When importing content it by default imports types into the global namespace. -You may choose to import the module into another namespace, either to allow identically-named -types to be referenced, or purely for readability. +\target qmldirexample +\section2 Example -To import a module into a namespace: +If the components in the \c MyComponents directory from the +\l{Location Modules}{earlier example} were to be made available as a network resource, +the directory would need to contain a \c qmldir file similar to this: \code -import Qt 4.7 as TheQtLibrary +ComponentA 1.0 ComponentA.qml +ComponentB 1.0 ComponentB.qml \endcode -Types from the Qt 4.7 module may then be used, but only by qualifying them with the namespace: +The \c MyComponents directory could then be imported as a module using: \code -TheQtLibrary.Rectangle { ... } +import "http://the-server-name.com/MyComponents" + +Slider { ... } +CheckBox { ... } \endcode -Multiple modules can be imported into the same namespace in the same way that multiple -modules can be imported into the global namespace: +with an optional "1.0" version specification. Notice the import fails if +a later version is used, as the \c qmldir file specifies that these elements +are only available in the 1.0 version. -\code -import Qt 4.7 as Nokia -import Ovi 1.0 as Nokia -\endcode -While import statements are needed to make any types available in QML, the directory of the -current file is implicitly loaded. This is the exact same as if you had added 'import "."' to -the start of every QML file. The effect of this is that you can automatically use types defined in C++ plugins -or QML files if they reside in the same directory. This is the last location searched for types - so if you -happen to have a "Text.qml" file, or "text.qml" on case-insensitive file systems, it will not override -the one from Qt if you import Qt. +For examples of \c qmldir files for plugins, see the +\l {declarative/cppextensions/plugins}{Plugins} example and +\l {Tutorial: Writing QML extensions with C++}. -*/ -/* +\section1 Debugging + +The \c QML_IMPORT_TRACE environment variable can be useful for debugging +when there are problems with finding and loading modules. See +\l{Debugging module imports} for more information. -Original requirement is QT-558. */ +/ diff --git a/doc/src/declarative/pics/anatomy-component.png b/doc/src/declarative/pics/anatomy-component.png Binary files differindex 70ed983..6125b00 100644 --- a/doc/src/declarative/pics/anatomy-component.png +++ b/doc/src/declarative/pics/anatomy-component.png diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index a2ed205..068297a 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -73,51 +73,61 @@ document - such as \c Rectangle and \c ListView - including those made within an import statements. QML does not import any modules by default, so at least one \c import statement must be present or no elements will be available! +Each \c id value in a QML document must be unique within that document. They +do not need to be unique across different documents as id values are +resolved according to the document scope. + + +\section1 Documents as Component Definitions + A QML document defines a single, top-level \l {QDeclarativeComponent}{QML component}. A QML component is a template that is interpreted by the QML runtime to create an object with some predefined behaviour. As it is a template, a single QML component can be "run" multiple times to produce several objects, each of which are said to be \e instances of the component. Once created, instances are not dependent on the component that created them, so they can -operate on independent data. Here is an example of a simple "Button" component that is -instantiated four times, each with a different value for its \c text property. +operate on independent data. Here is an example of a simple "Button" component (defined +in a \c Button.qml file) that is instantiated four times by \c application.qml. +Each instance is created with a different value for its \c text property: -\raw HTML -<table><tr><td> -\endraw -\code +\table +\row +\o Button.qml +\o application.qml + +\row +\o \snippet doc/src/snippets/declarative/qmldocuments.qml 0 +\o +\qml import Qt 4.7 -BorderImage { - property alias text: textElement.text - width: 100; height: 30; source: "images/toolbutton.sci" - - Text { - id: textElement - anchors.centerIn: parent - font.pointSize: 20 - style: Text.Raised - color: "white" - } +Column { + spacing: 10 + + Button { text: "Apple" } + Button { text: "Orange" } + Button { text: "Pear" } + Button { text: "Grape" } } -\endcode -\raw HTML -</td> <td> -\endraw +\endqml + \image anatomy-component.png -\raw HTML -</td> </tr> </table> -\endraw + +\endtable Any snippet of QML code can become a component, just by placing it in the file "<Name>.qml" -where <Name> is the new element name, and begins with an uppercase letter. Note that +where <Name> is the new element name, and begins with an \bold uppercase letter. Note that the case of all characters in the <Name> are significant on some filesystems, notably UNIX filesystems. It is recommended that the case of the filename matches the case of the component name in QML exactly, regardless of the platform the QML will be deployed to. -These QML files automatically become available as new QML element types +These QML component files automatically become available as new QML element types to other QML components and applications in the same directory. + + +\section1 Inline Components + In addition to the top-level component that all QML documents define, and any reusable components placed in separate files, documents may also include \e inline components. Inline components are declared using the diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index b6e6c6e..70a3587 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -80,5 +80,5 @@ qmlviewer -translation hello.qm hello.qml \endcode -You can see a complete example and source code in the {declarative/i18n}{QML Internationalization example}. +You can see a complete example and source code in the \l{declarative/i18n}{QML Internationalization example}. */ diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 75055d8..fa42f59 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -87,6 +87,10 @@ Rectangle { width: 100; height: 100 } When multiple property/value pairs are specified on a single line, they must be separated by a semicolon. +The \c import statement imports the \c Qt \l{QML Modules}{module}, which contains all of the +standard \l {QML Elements}. Without this import statement, the \l Rectangle +and \l Image elements would not be available. + \section1 Expressions In addition to assigning values to properties, you can also assign @@ -181,7 +185,8 @@ Item { \section3 The \c id property -Each object can be given a special unique property called an \e id. Assigning an id enables the object +Each object can be given a special unique property called an \e id. No other object within the +same \l{QML Documents}{QML document} can have the same \c id value. Assigning an id enables the object to be referred to by other objects and scripts. The first Rectangle element below has an \e id, "myRect". The second Rectange element defines its diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index 6461925..274040a 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -32,57 +32,197 @@ \section1 Overview -QML states typically describe user interface configurations, including: -\list -\o What UI elements are present -\o The properties of those elements (including how they behave) -\o What actions are available -\endlist - -A state can also be thought of as a set of batched changes from a default configuration. - -Examples of states in modern UI: -\list -\o An Address Book application with a 'View Contact' state and an 'Edit Contact' State. In the first state the contact information presented is read-only (using labels), and in the second it is editable (using editors). -\o A button with a pressed and unpressed state. When pressed the text moves slightly down and to the right, and the button has a slightly darker appearance. -\endlist - -\section1 States in QML +User interfaces are designed to present different interface configurations in +different scenarios, or to modify their appearances in response to user +interaction. Often, there are a set of changes that are made concurrently, such +that the interface could be seen to be internally changing from one \e state to +another. + +This applies generally to interface elements regardless of their complexity. +A photo viewer may initially present images in a grid, and when an image is +clicked, change to a "detailed" state where the individual image is expanded +and the interface is changed to present new options for image editing. On the +other end of the scale, when a simple button is pressed, it may change to a +"pressed" state in which its color and position is modified to give a pressed +appearance. + +In QML, any object can change between different \e states to apply sets of +changes that modify the properties of relevant items. Each \e state could +present a different configuration that could, for example: -In QML: \list -\o Any object can use states. -\o There is a default state. The default state can be explicitly set. -\o A state can affect the properties of other objects, not just the object owning the state (and not just that object's children). +\o Show some UI elements and hide others +\o Present different available actions to the user +\o Start, stop or pause animations +\o Execute some script required in the new state +\o Change a property value for a particular item +\o Show a different view or "screen" \endlist -To define a state for an item, add a \l State element to the \l{Item::states}{states} property. To -change the current state of an \l Item, set the \l{Item::state}{state} property to the name -of the required state. +Changes between states can be animated using \l {Transitions}{transitions}, as +discussed further below. -Here is an example of using states. In the default state \c myRect is positioned at 0,0. In the 'moved' state it is positioned at 50,50. Clicking within the mouse area changes the state from the default state to the 'moved' state, thus moving the rectangle. +All \l {Item}-based objects have a \e {default state}, and can specify additional +states by adding new \l State objects to the item's \l {Item::}{states} +property. Each state has a \e name that is unique for all states within that +item; the default state's name is an empty string. To change the current state +of an item, set the \l {Item::}{state} property to the name of the state. -\snippet doc/src/snippets/declarative/states.qml 0 -\snippet doc/src/snippets/declarative/states.qml 1 +Non-Item objects can use states through the StateGroup element. -State changes can be animated using \l{state-transitions}{Transitions}. -For example, adding this code to the above \c Item element animates the transition to the "moved" state: +\section1 Creating states -\snippet doc/src/snippets/declarative/states.qml transitions +To create a state, add a \l State object to the item's \l {Item::}{states} property, +which holds a list of states for that item. -See \l{state-transitions}{Transitions} for more information. +Following is an example. Here, the \l Rectangle is initially placed in the +default (0, 0) position. It has defined an additional state named "moved", in +which a PropertyChanges object repositions the rectangle to (50, 50). Clicking +within the MouseArea changes the state to the "moved" state, thus moving the \l +Rectangle. +\snippet doc/src/snippets/declarative/states.qml 0 + +The \l State item defines all the changes to be made in the new state. It +could specify additional properties to be changed, or create additional +PropertyChanges for other objects. It can also modify the properties of other +objects, not just the object that owns the state. For example: + +\qml +Rectangle { + ... + states: [ + State { + name: "moved" + PropertyChanges { target: myRect; x: 50; y: 50; color: "blue" } + PropertyChanges { target: someOtherItem; width: 1000 } + } + ] +} +\endqml + +As a convenience, if an item only has one state, its \l {Item::}{states} +property can be defined as a single \l State, without the square-brace list +syntax: + +\qml +Item { + ... + states: State { + ... + } +} +\endqml + +A \l State is not limited to performing modifications on property values. It +can also: -Other things you can do in a state change: \list -\o Override signal handlers with PropertyChanges -\o Change an item's visual parent with ParentChange -\o Change an item's anchors with AnchorChanges -\o Run some script with StateChangeScript +\o Run some script using StateChangeScript +\o Override an existing signal handler for an object using PropertyChanges +\o Re-parent an \l Item using ParentChanges +\o Modify anchor values using AnchorChanges \endlist - -The {declarative/animation/states}{States and Transitions example} demonstrates how to declare a basic set of states and then apply animated transitions between them. +The \l {declarative/animation/states}{States and Transitions example} +demonstrates how to declare a basic set of states and apply animated +transitions between them. + + +\section1 The default state + +Of course, the \l Rectangle in the example above could have simply been moved +by setting its position to (50, 50) in the mouse area's \c onClicked handler. +However, aside from enabling batched property changes, one of the features of +QML states is the ability of an item to revert to its \e {default state}. +The default state contains all of an item's initial property values before +they were modified in a state change. + +For example, suppose the \l Rectangle should move to (50,50) when the mouse is +pressed, and then move back to its original position when the mouse is +released. This can be achieved by using the \l {State::}{when} property, +like this: + +\qml +Rectangle { + ... + + MouseArea { + id: mouseArea + anchors.fill: parent + } + + states: State { + name: "moved"; when: mouseArea.pressed + ... + } +} +\endqml + +The \l {State::}{when} property is set to an expression that evaluates to +\c true when the item should be set to that state. When the mouse is pressed, +the state is changed to \e moved. When it is released, the item reverts to its +\e default state, which defines all of the item's original property values. + +Alternatively, an item can be explicitly set to its default state by setting its +\l {Item::}{state} property to an empty string (""). For example, instead of +using the \l {State::}{when} property, the above code could be changed to: + +\qml +Rectangle { + ... + + MouseArea { + anchors.fill: parent + onPressed: myRect.state = 'moved'; + onReleased: myRect.state = ''; + } + + states: State { + name: "moved" + ... + } +} +\endqml + +Obviously it makes sense to use the \l {State::}{when} property when possible +as it provides a simpler (and a better, more declarative) solution than +assigning the state from signal handlers. + + +\section1 Animating state changes + + +State changes can be easily animated through \l {Transitions}{transitions}. A +\l Transition defines the animations that should be applied when an item +changes from one state to another. + +If the above example was modified to include the following \l Transition, the +movement of the \l Rectangle would be animated: + +\qml +Rectangle { + ... + + MouseArea { ... } + + states: [ + ... + ] + + transitions: [ + Transition { + NumberAnimation { properties: "x,y"; duration: 500 } + } + ] + } +\endqml + +This \l Transition defines that if any \c x or \c y properties have changed +during a state change within this item, their values should be animated over 500 +millliseconds. + +See the \l Transitions documentation for more information. */ diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index 5efc0ce..41c4c80 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -197,10 +197,10 @@ Rectangle { \o \c runtime.orientation \o This property indicates the current orientation of the QML Viewer. On the -N900 platform, this property automatically updates to reflect the device's -actual orientation; on other platforms, this indicates the orientation currently -selected in the QML Viewer's \e {Settings -> Properties} menu. The -\c orientation value can be one of the following: +N900 platform and most S60 5.0-based or newer Symbian devices, this property +automatically updates to reflect the device's actual orientation; on other platforms, +this indicates the orientation currently selected in the QML Viewer's +\e {Settings -> Properties} menu. The \c orientation value can be one of the following: \list \o \c Orientation.Portrait diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index fb50286..b4f4c83 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -48,7 +48,7 @@ \endcode For more information on the Qt Declarative module, see the - \l{declarativeui.html}{Qt Quick} documentation. + \l{Qt Quick} documentation. */ @@ -70,13 +70,23 @@ Returns the QML type id. - Example: Register the C++ class \c MinehuntGame as the QML type - named \c Game for version 0.1 in the import library \c MinehuntCore: + For example, this registers a C++ class \c MySliderItem as a QML type + named \c Slider for version 1.0 of a \l{QML Modules}{module} called + "com.mycompany.qmlcomponents": \code - qmlRegisterType<MinehuntGame>("MinehuntCore", 0, 1, "Game"); + qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider"); \endcode + Once this is registered, the type can be used in QML by importing the + specified module name and version number: + + \qml + imoprt com.mycompany.qmlcomponents 1.0 + + Slider { ... } + \endqml + Note that it's perfectly reasonable for a library to register types to older versions than the actual version of the library. Indeed, it is normal for the new library to allow QML written to previous versions to continue to work, even if more advanced versions of diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index 7a97eb1..f913d44 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -222,5 +222,5 @@ This is equivalent to writing the two transitions separately. The \l ParallelAnimation element makes sure that the two types of animations (number and color) start at the same time. We could also run them one after the other by using \l SequentialAnimation instead. -For more details on states and transitions, see \l {QML States} and the {declarative/animation/states}{states and transitions example}. +For more details on states and transitions, see \l {QML States} and the \l{declarative/animation/states}{states and transitions example}. */ diff --git a/doc/src/demos/spectrum.qdoc b/doc/src/demos/spectrum.qdoc new file mode 100644 index 0000000..d5a3f85 --- /dev/null +++ b/doc/src/demos/spectrum.qdoc @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/spectrum + \title Spectrum Analyzer + + The Spectrum Analyzer demo shows how the \l{QtMultimedia Module} can be + used in Qt applications to capture and then play back an audio stream. + + \image spectrum-demo.png + + Because QtMultimedia allows the application to access the raw audio + stream, the data can either be inspected or modified by the application. + The Spectrum Analyzer demo displays three pieces of information while + audio is being either captured or played back: + + \list + \o Information about the raw audio stream, shown in the uppermost widget: + \list + \o The amount of data currently in the buffer, shown in blue + \o The segment of data which was most recently analysed to compute + the frequency spectrum, shown in green + \o The raw audio waveform, shown in white and scrolling from right to + left + \endlist + \o A representation of the frequency spectrum, shown at the lower left + \o The current RMS level of the audio stream, and the recent 'high + watermark' level, shown at the lower right + \endlist + + Spectrum analysis is performed by calculating the Fast Fourier Transform + (FFT) of a segment of audio data. An open-source library, + \l{http://ldesoras.free.fr/prod.html}{FFTReal}, against which the + application is dynamically linked, is used to compute the transform. +*/ + diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 4573f3c..00771ed 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -155,7 +155,7 @@ \row \o QtWebKit \o WebKit \o WebKit is licensed under the GNU LGPL version 2 or later. This has implications for developers of closed source applications. - Please see \l{QtWebKit Module#License Information}{the QtWebKit module + Please see \l{WebKit in Qt#License Information}{the QtWebKit module documentation} for more information. \row \o \l{Phonon Module}{Phonon} \o Phonon @@ -1458,8 +1458,10 @@ /*! \page deployment-symbian.html \contentspage Deploying Qt Applications + \ingroup qtsymbian + \title Deploying an Application on the Symbian Platform - \title Deploying an Application on the Symbian platform + \section1 Overview Applications are deployed to Symbian devices in signed \c .sis package files. The \c .sis file content is controlled with \c .pkg files. The \c .pkg file contains a set @@ -1469,10 +1471,17 @@ to end-users some changes are needed. This document describes what changes are typically needed and how to implement them. + \section1 Requirements + + Download the latest release of the Smart Installer from + \l{http://get.qt.nokia.com/nokiasmartinstaller/}, and install it on top + of the Qt package. + \section1 Static Linking - Qt for the Symbian platform does currently not support static linking of - Qt libraries. + Qt for the Symbian platform does not currently support static linking of + Qt libraries with application binaries. You will need to build shared + libraries as described below and link your application with them. \section1 Shared Libraries @@ -1518,7 +1527,7 @@ S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices. Now we are ready to compile the application and create the application - deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss) + deployment file. Run \c qmake to create Symbian specific makefiles, resources (\c .rss) and deployment packaging files (\c .pkg). And do build to create the application binaries and resources. @@ -1548,4 +1557,14 @@ For more information about creating a \c .sis file and installing it to device see also \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. + \section1 Further Reading + + This document aims to cover the common case for developers who want to + deploy Qt applications on devices using the Smart Installer. It does not + aim to cover every possible way of installing applications, Qt and other + dependencies on a device. + + A wider selection of deployment methods is described in the + \l{Deploying a Qt Application article} on the Symbian Foundation + Developer Wiki. */ diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc index 36970ee..9e881d1 100644 --- a/doc/src/development/debug.qdoc +++ b/doc/src/development/debug.qdoc @@ -49,7 +49,7 @@ The basic stuff you need to know about debug libraries and frameworks is found at developer.apple.com in: \l{http://developer.apple.com/technotes/tn2004/tn2124.html#SECDEBUGLIB} - {Apple Technicle Note TN2124} Qt follows that. + {Apple Technical Note TN2124}. When you build Qt, frameworks are built by default, and inside the framework you will find both a release and a debug version (e.g., diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index ffc5a8e..b88fe3f 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -27,12 +27,22 @@ /*! \page developing-with-qt.html - \title Cross Platform Development with Qt + + \title Cross-platform & Platform-specific Development + Qt allows you to write advanced applications and UIs once, and deploy them + across desktop and embedded operating systems without rewriting the source + code. The top section of this page provides an overview of the tools and + techniques used in Qt application development. Still, you might want to add + platform-specific features to your code. The bottom section of the page + links to documents that describe platform-specific features provided by Qt, + and discuss issues related to particular platforms and environments. + + \section1 Cross-platform Development with Qt Qt is provided with a set of build tools to help developers automate the process of building and installing Qt applications. - \table 100% + \table \header \o Development \o Cross-Platform Issues \o Specific Tools \row \o @@ -57,4 +67,49 @@ \o \l {Resource Compiler (rcc)} \endlist \endtable -*/ + + \section1 Platform-specific Development with Qt + + These documents describe platform-specific features provided by Qt, and + discuss issues related to particular platforms and environments. + + \table + \row + \o + \list + \o \l {Calling Qt Functions From Unix Signal Handlers} + \o \l {Compiler Notes} + \o \l {Developing Qt Applications for Mac OS X} + \o \l {Known Issues} + \o \l {Platform Notes} + \o \l {Platform Notes - Symbian} + \o \l {ActiveX in Qt} + \o \l {Qt for Embedded Linux Classes} + \o \l {Qt for Embedded Platforms} + \o \l {Qt for Mac OS X - Specific Issues} + \o \l {Qt is Mac OS X Native} + \o \l {Supported Platforms} + \o \l {The qtmain Library} + \o \l {Window System Specific Notes} + \endlist + \o + \list + \o Workaround to make it work. + \o Information about the C++ compilers and tools used to build Qt. + \o Information for developing Qt applications for Mac OS X + \o A summary of known issues in this Qt version at the time of release. + \o Information about the platforms on which Qt can be used. + \o Information about the state of support for the Symbian platform. + \o Qt API's for using ActiveX controls, servers, and COM. + \o Classes that are specific to Qt for Embedded Linux. + \o Documents related to Qt for Embedded Platforms. + \o A description of issues with Qt that are specific to Mac OS X. + \o An explanation of Qt's native features on Mac OS X. + \o The platforms supported by Nokia for Qt. + \o Describes the use and license of the qtmain helper library. + \o Collections of notes about Qt implementations on different window systems. + \endlist + \endtable + + +*/
\ No newline at end of file diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 0fdeff8..baa30fc 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -3015,6 +3015,13 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150 + \target SYMBIAN_VERSION + \section1 SYMBIAN_VERSION + + \e {This is only used on the Symbian platform.} + + Contains the version number of the underlying Symbian SDK; e.g. "9.2" or "Symbian3". + \target TARGET \section1 TARGET diff --git a/doc/src/examples/imagegestures.qdoc b/doc/src/examples/imagegestures.qdoc index 57479d8..3d4e467 100644 --- a/doc/src/examples/imagegestures.qdoc +++ b/doc/src/examples/imagegestures.qdoc @@ -32,8 +32,6 @@ This example shows how to enable gestures for a widget and use gesture input to perform actions. - \image imagegestures-example.png Screenshot of the Image Gestures example. - We use two classes to create the user interface for the application: \c MainWidget and \c ImageWidget. The \c MainWidget class is simply used as a container for the \c ImageWidget class, which we will configure to accept gesture input. Since we diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 3fd4ea8..0d191c9 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \title Animation: Basics + \title Animation: Basics Example \example declarative/animation/basics This example shows how to create and combine \l{QML Animation}{animations} in QML. @@ -47,7 +47,7 @@ */ /*! - \title Animation: Behaviors + \title Animation: Behavior Examples \example declarative/animation/behaviors This example shows how to use QML behaviors. @@ -56,7 +56,7 @@ */ /*! - \title Animation: Easing + \title Animation: Easing Example \example declarative/animation/easing This example shows the different easing modes available for \l{QML Animation}{animations}. @@ -65,7 +65,7 @@ */ /*! - \title Animation: States + \title Animation: States Example \example declarative/animation/states These examples show how to use \l{States}{states} and \l{Transitions}{transitions}. @@ -89,7 +89,7 @@ */ /*! - \title Image Elements: Border Image + \title Image Elements: Border Image Example \example declarative/imageelements/borderimage These examples show how to use the BorderImage element. @@ -110,7 +110,7 @@ */ /*! - \title Image Elements: Image + \title Image Elements: Image Example \example declarative/imageelements/image This example shows how to use the \l Image element and its \l{Image::fillMode}{fillModes}. @@ -147,7 +147,7 @@ */ /*! - \title C++ Extensions: Plugins + \title C++ Extensions: Plugins Example \example declarative/cppextensions/plugins This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin. @@ -156,7 +156,7 @@ */ /*! - \title LayoutItem + \title LayoutItem Example \example declarative/cppextensions/qgraphicslayouts/layoutitem This example show how to use the LayoutItem element to integrate QML items into an existing @@ -165,7 +165,7 @@ \image qml-layoutitem-example.png */ /*! - \title QGraphicsGridLayout + \title QGraphicsGridLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout This example shows how to use QGraphicsGridLayout to lay out QML items. This is @@ -175,7 +175,7 @@ \image qml-qgraphicsgridlayout-example.png */ /*! - \title QGraphicsLinearLayout + \title QGraphicsLinearLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout This example shows how to use QGraphicsLinearLayout to lay out QML items. This is @@ -185,8 +185,8 @@ \image qml-qgraphicslinearlayout-example.png */ /*! + \title C++ Extensions: QGraphicsLayouts examples \page declarative-cppextensions-qgraphicslayouts.html - \title C++ Extensions: QGraphicsLayouts These examples show how to integrate \l{Graphics View Framework}{Graphics View} layout components with QML: @@ -202,7 +202,7 @@ */ /*! - \title C++ Extensions: QWidgets + \title C++ Extensions: QWidgets Example \example declarative/cppextensions/qwidgets This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget. @@ -211,7 +211,7 @@ */ /*! - \title C++ Extensions: Image Provider + \title C++ Extensions: Image Provider Example \example declarative/cppextensions/imageprovider This examples shows how to use QDeclarativeImageProvider to serve images @@ -221,7 +221,7 @@ */ /*! - \title C++ Extensions: Network access manager factory + \title C++ Extensions: Network Access Manager Factory Example \example declarative/cppextensions/networkaccessmanagerfactory This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager @@ -229,7 +229,7 @@ */ /*! - \title Internationlization + \title Internationlization Example \example declarative/i18n This example shows how to enable text translation in QML. @@ -238,7 +238,7 @@ */ /*! - \title Positioners + \title Positioners Example \example declarative/positioners This example shows how to use positioner elements such as \l Row, \l Column, @@ -248,7 +248,7 @@ */ /*! - \title Key Interaction: Focus + \title Key Interaction: Focus Example \example declarative/keyinteraction/focus This example shows how to handle keyboard input and focus in QML. @@ -257,7 +257,7 @@ */ /*! - \title Models and Views: AbstractItemModel + \title Models and Views: AbstractItemModel Example \example declarative/modelviews/abstractitemmodel This example shows how to use a QAbstractItemModel subclass as a model in QML. @@ -266,7 +266,7 @@ */ /*! - \title Models and Views: GridView + \title Models and Views: GridView Example \example declarative/modelviews/gridview This example shows how to use the GridView element. @@ -275,7 +275,7 @@ */ /*! - \title Models and Views: ListView + \title Models and Views: ListView Example \example declarative/modelviews/listview These examples show how to use the ListView element. @@ -317,7 +317,7 @@ */ /*! - \title Models and Views: PathView + \title Models and Views: PathView Example \example declarative/modelviews/pathview This example shows how to use the PathView element. @@ -326,7 +326,7 @@ */ /*! - \title Models and Views: Object ListModel + \title Models and Views: Object ListModel Example \example declarative/modelviews/objectlistmodel This example shows how to use a QList<QObject*> as a model in QML. @@ -335,7 +335,7 @@ */ /*! - \title Models and Views: Package + \title Models and Views: Package Example \example declarative/modelviews/package This example shows how to use the \l Package element. @@ -344,7 +344,7 @@ */ /*! - \title Models and Views: Parallax + \title Models and Views: Parallax Example \example declarative/modelviews/parallax This example shows how to combine and switch between views. @@ -353,7 +353,7 @@ */ /*! - \title Models and Views: String ListModel + \title Models and Views: String ListModel Example \example declarative/modelviews/stringlistmodel This example shows how to use a QStringList as a model in QML. @@ -362,7 +362,7 @@ */ /*! - \title Models and Views: VisualItemModel + \title Models and Views: VisualItemModel Example \example declarative/modelviews/visualitemmodel This example shows how to use the VisualItemModel element. @@ -371,7 +371,7 @@ */ /*! - \title Models and Views: WebView + \title Models and Views: WebView Example \example declarative/modelviews/webview These examples shows how to use the WebView element. @@ -412,15 +412,23 @@ \endtable */ + +/*! + \title Screen orientation + \example declarative/screenorientation + + This example shows how to implement screen orientation support for your application. +*/ + /*! - \title SQL Local Storage + \title SQL Local Storage Example \example declarative/sqllocalstorage This example shows how to use the SQL Local Storage API in QML. */ /*! - \title Text: Fonts + \title Text: Fonts Example \example declarative/text/fonts These examples show how to discover available fonts from QML and manipulate @@ -456,7 +464,7 @@ */ /*! - \title Text: Text Selection + \title Text: Text Selection Example \example declarative/text/textselection This example shows how text selection, copy and paste operations @@ -466,7 +474,7 @@ */ /*! - \title Threading: Threaded ListModel + \title Threading: Threaded ListModel Example \example declarative/threading/threadedlistmodel This example shows how to use a ListModel from multiple threads using @@ -474,14 +482,14 @@ */ /*! - \title Threading: WorkerScript + \title Threading: WorkerScript Example \example declarative/threading/workerscript This example shows how to use the WorkerScript element for threading in QML. */ /*! - \title Toys: Clocks + \title Toys: Clocks Example \example declarative/toys/clocks This example displays a set of clocks with different times for different cities. @@ -492,7 +500,7 @@ */ /*! - \title Toys: Corkboards + \title Toys: Corkboards Example \example declarative/toys/corkboards This example presents a flickable set of interactive corkboards. It is created @@ -503,7 +511,7 @@ */ /*! - \title Toys: Dynamic Scene + \title Toys: Dynamic Scene Example \example declarative/toys/dynamicscene This example presents an interactive drag-and-drop scene. It demonstrates @@ -514,7 +522,7 @@ */ /*! - \title Toys: Tic-Tac-Toe + \title Toys: Tic-Tac-Toe Example \example declarative/toys/tic-tac-toe This example presents a simple implementation of Tic Tac Toe. @@ -523,7 +531,7 @@ */ /*! - \title Toys: TV Tennis + \title Toys: TV Tennis Example \example declarative/toys/tvtennis This example shows how to use animation components such as \l SpringAnimation, @@ -533,14 +541,14 @@ */ /*! - \title Touch Interaction: Gestures + \title Touch Interaction: Gestures Example \example declarative/touchinteraction/gestures This example shows how to use the GestureArea element. */ /*! - \title Touch Interaction: MouseArea + \title Touch Interaction: MouseArea Example \example declarative/touchinteraction/mousearea This example shows how to use the MouseArea element to access information @@ -550,11 +558,11 @@ */ /*! - \title UI Components: Dial + \title UI Components: Dial Control Example \example declarative/ui-components/dialcontrol This example shows how to create a dial-type control. It combines - \l Image elements with \l Rotation transforms and \l SpringAnimatino behaviors + \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors to produce an interactive speedometer-type dial. \image qml-dialcontrol-example.png @@ -562,7 +570,7 @@ /*! - \title UI Components: Flipable + \title UI Components: Flipable Example \example declarative/ui-components/flipable This example shows how to use the \l Flipable element. @@ -571,7 +579,7 @@ */ /*! - \title UI Components: Progress Bars + \title UI Components: Progress Bars Example \example declarative/ui-components/progressbar This example shows how to create a progress bar. @@ -580,7 +588,7 @@ */ /*! - \title UI Components: Scroll Bar + \title UI Components: Scroll Bar Example \example declarative/ui-components/scrollbar This example shows how to create scroll bars for a \l Flickable element @@ -591,7 +599,7 @@ */ /*! - \title UI Components: Search Box + \title UI Components: Search Box Example \example declarative/ui-components/searchbox This example shows how to combine TextInput, FocusScope and BorderImage @@ -601,7 +609,7 @@ */ /*! - \title UI Components: Slide Switch + \title UI Components: Slide Switch Example \example declarative/ui-components/slideswitch This example shows how to create a slide switch control. @@ -610,7 +618,7 @@ */ /*! - \title UI Components: Spinner + \title UI Components: Spinner Example \example declarative/ui-components/spinner This example shows how to create a spinner-type component using the PathView element. @@ -619,7 +627,7 @@ */ /*! - \title UI Components: Tab Widget + \title UI Components: Tab Widget Example \example declarative/ui-components/tabwidget This example shows how to create a tab widget. It also demonstrates how @@ -630,7 +638,7 @@ */ /*! - \title XML: XMLHttpRequest + \title XML: XMLHttpRequest Example \example declarative/xml/xmlhttprequest This example shows how to use the \l XmlHttpRequest API in QML. diff --git a/doc/src/examples/simpletreemodel.qdoc b/doc/src/examples/simpletreemodel.qdoc index c34f4af..88aa27a 100644 --- a/doc/src/examples/simpletreemodel.qdoc +++ b/doc/src/examples/simpletreemodel.qdoc @@ -32,17 +32,19 @@ The Simple Tree Model example shows how to create a basic, read-only hierarchical model to use with Qt's standard view classes. For a description of simple non-hierarchical list and table models, see the - \l{model-view-programming.html}{Model/View Programming} overview. + \l{Model/View Programming} overview. \image simpletreemodel-example.png - Qt's model/view architecture provides a standard way for views to manipulate - information in a data source, using an abstract model of the data to - simplify and standardize the way it is accessed. Simple models represent - data as a table of items, and allow views to access this data via an - \l{model-view-model.html}{index-based} system. More generally, models can - be used to represent data in the form of a tree structure by allowing each - item to act as a parent to a table of child items. + Qt's model/view architecture provides a standard way for views to + manipulate information in a data source, using an abstract model + of the data to simplify and standardize the way it is accessed. + Simple models represent data as a table of items, and allow views + to access this data via an + \l{Model/View Programming#model-indexes} {index-based} + system. More generally, models can be used to represent data in + the form of a tree structure by allowing each item to act as a + parent to a table of child items. Before attempting to implement a tree model, it is worth considering whether the data is supplied by an external source, or whether it is going to be diff --git a/doc/src/examples/spinboxdelegate.qdoc b/doc/src/examples/spinboxdelegate.qdoc index 49e3295..44308ca 100644 --- a/doc/src/examples/spinboxdelegate.qdoc +++ b/doc/src/examples/spinboxdelegate.qdoc @@ -42,8 +42,8 @@ \image spinboxdelegate-example.png This concepts behind this example are covered in the - \l{model-view-delegate.html}{Delegate Classes} chapter of the - \l{model-view-programming.html}{Model/View Programming} overview. + \l{Model/View Programming#Delegate Classes}{Delegate Classes} chapter + of the \l{Model/View Programming} overview. \section1 SpinBoxDelegate Class Definition diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 61c9da2..e901124c 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -416,5 +416,15 @@ /*! \externalpage http://opensource.org/licenses/bsd-license.php - \title BSD License + \title New and Modified BSD Licenses +*/ + +/*! + \externalpage http://developer.symbian.org/wiki/index.php/Platform_Security_%28Fundamentals_of_Symbian_C%2B%2B%29#Self-Signed_Applications + \title Symbian Platform Security +*/ + +/*! + \externalpage http://developer.symbian.org/wiki/index.php/Deploying_a_Qt_Application + \title Deploying a Qt Application article */ diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc index b0b0e3c..3177af8 100644 --- a/doc/src/files-and-resources/resources.qdoc +++ b/doc/src/files-and-resources/resources.qdoc @@ -54,7 +54,7 @@ The resource system is based on tight cooperation between \l qmake, \l rcc (Qt's resource compiler), and QFile. It obsoletes Qt 3's \c qembed tool and the - \l{http://qt.nokia.com/doc/qq/qq05-iconography.html#imagestorage}{image + \l{http://doc.qt.nokia.com/qq/qq05-iconography.html}{image collection} mechanism. \section1 Resource Collection Files (\c{.qrc}) diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc index 58061ad..797326e 100644 --- a/doc/src/frameworks-technologies/containers.qdoc +++ b/doc/src/frameworks-technologies/containers.qdoc @@ -43,7 +43,7 @@ /*! \page containers.html - \title Generic Containers + \title Container Classes \ingroup technology-apis \ingroup groups \keyword container class diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc index 181a8d9..f193a67 100644 --- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc +++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc @@ -30,7 +30,6 @@ \title Using QtDBus Adaptors \brief How to create and use DBus adaptors in Qt. - \ingroup technology-apis \ingroup best-practices Adaptors are special classes that are attached to any QObject-derived class diff --git a/doc/src/frameworks-technologies/dbus-intro.qdoc b/doc/src/frameworks-technologies/dbus-intro.qdoc index bccb6da..9d4cd95 100644 --- a/doc/src/frameworks-technologies/dbus-intro.qdoc +++ b/doc/src/frameworks-technologies/dbus-intro.qdoc @@ -27,7 +27,7 @@ /*! \page intro-to-dbus.html - \title Introduction to D-Bus + \title D-Bus \brief An introduction to Inter-Process Communication and Remote Procedure Calling with D-Bus. \keyword QtDBus diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index c5dd27c..ebfa39e 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -30,7 +30,6 @@ \title Drag and Drop \brief An overview of the drag and drop system provided by Qt. - \ingroup technology-apis \ingroup qt-gui-concepts Drag and drop provides a simple visual mechanism which users can use diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc index e792161..fb14a3b 100644 --- a/doc/src/frameworks-technologies/eventsandfilters.qdoc +++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc @@ -100,7 +100,7 @@ event delivery mechanisms are flexible. The documentation for QCoreApplication::notify() concisely tells the whole story; the \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq11-events.html}{Another Look at Events} + \l{http://doc.qt.nokia.com/qq/qq11-events.html}{Another Look at Events} rehashes it less concisely. Here we will explain enough for 95% of applications. diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 927df22..f7c8312 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -60,7 +60,8 @@ \section1 Using Standard Gestures with Widgets Gestures can be enabled for instances of QWidget and QGraphicsObject subclasses. - An object that accepts gesture input is referred to as a \e{target object}. + An object that accepts gesture input is referred to throughout the documentation + as a \e{target object}. To enable a gesture for a target object, call its QWidget::grabGesture() or QGraphicsObject::grabGesture() function with an argument describing the @@ -69,13 +70,57 @@ \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures - In the above code, the gesture is set up in the constructor of the target object + In the above code, the gestures are set up in the constructor of the target object itself. + \section1 Handling Events + When the user performs a gesture, QGestureEvent events will be delivered to the target object, and these can be handled by reimplementing the QWidget::event() handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects. + As one target object can subscribe to more than one gesture type, the QGestureEvent + can contain more than one QGesture, indicating several possible gestures are active + at the same time. It is then up to the widget to determine how to handle those + multiple gestures and choose if some should be canceled in favor of others. + + Each QGesture contained within a QGestureEvent object can be accepted() or ignored() + individually, or all together. Additionally, you can query the individual QGesture + data objects (the state) using several getters. + + \section2 Standard Procedure for Event Handling + + A QGesture is by default accepted when it arrives at your widget. However, it is good + practice to always explicitly accept or reject a gesture. The general rule is that, if + you accept a gesture, you are using it. If you are ignoring it you are not interested + in it. Ignoring a gesture may mean it gets offered to another target object, or it will + get canceled. + + Each QGesture has several states it goes through; there is a well defined way to change + the state, typically the user input is the cause of state changes (by starting and + stopping interaction, for instance) but the widget can also cause state changes. + + The first time a particular QGesture is delivered to a widget or graphics item, it will + be in the Qt::GestureStarted state. The way you handle the gesture at this point + influences whether you can interact with it later. + + \list + \o Accepting the gesture means the widget acts on the gesture and there will follow + gestures with the Qt::GestureUpdatedstate. + \o Ignoring the gesture will mean the gesture will never be offered to you again. + It will be offered to a parent widget or item as well. + \o Calling setGestureCancelPolicy() on the gesture when it is in its starting state, + and is also accepted can cause other gestures to be canceled. + \endlist + + Using QGesture::CancelAllInContext to cancel a gesture will cause all gestures, in any + state, to be canceled unless they are explicitly accepted. This means that active + gestures on children will get canceled. It also means that gestures delivered in the + same QGestureEvent will get canceled if the widget ignores them. This can be a useful + way to filter out all gestures except the one you are interested in. + + \section2 Example Event Handling + For convenience, the \l{Image Gestures Example} reimplements the general \l{QWidget::}{event()} handler function and delegates gesture events to a specialized gestureEvent() function: diff --git a/doc/src/frameworks-technologies/ipc.qdoc b/doc/src/frameworks-technologies/ipc.qdoc index 23234ae..26a8cec 100644 --- a/doc/src/frameworks-technologies/ipc.qdoc +++ b/doc/src/frameworks-technologies/ipc.qdoc @@ -56,13 +56,12 @@ \section1 D-Bus - The \l{QtDBus} module is a Unix-only library - you can use to implement IPC using the D-Bus protocol. It extends - Qt's \l{signalsandslots.html} {Signals and Slots} mechanism to the - IPC level, allowing a signal emitted by one process to be - connected to a slot in another process. This \l {Introduction to - D-Bus} page has detailed information on how to use the \l{QtDBus} - module. + The \l{QtDBus} module is a Unix-only library you can use to + implement IPC using the D-Bus protocol. It extends Qt's + \l{signalsandslots.html} {Signals and Slots} mechanism to the IPC + level, allowing a signal emitted by one process to be connected to + a slot in another process. This \l {D-Bus} page has detailed + information on how to use the \l{QtDBus} module. \section1 Qt COmmunications Protocol (QCOP) diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 131f063..7167f97 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -1011,7 +1011,7 @@ \snippet doc/src/snippets/reading-selections/window.cpp 0 - The above code uses Qt's convenient \l{Generic Containers}{foreach + The above code uses Qt's convenient \l{Container Classes}{foreach keyword} to iterate over, and modify, the items corresponding to the indexes returned by the selection model. diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index ef16224..4003988 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -134,7 +134,7 @@ \section1 QtWebKit \list - \o \l{Web Browser} demonstrates how Qt's \l{QtWebKit Module}{WebKit module} + \o \l{Web Browser} demonstrates how Qt's \l{WebKit in Qt}{WebKit module} can be used to implement a small Web browser. \endlist @@ -147,6 +147,15 @@ \note The Phonon demos are currently not available for the MinGW platform. + \section1 Multimedia + + \list + \o \l{demos/spectrum}{Spectrum Analyzer} demonstrates how the \l{QtMultimedia Module} + can be used to capture and play back an audio stream, at the same time allowing the + application to access the raw audio data. This application analyzes the audio stream + in order to display a frequency spectrum. + \endlist + \section1 Animation \list diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index b2895ba..1bf86e5 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -529,7 +529,7 @@ \title OpenVG Examples \brief Accessing OpenVG from Qt - \image openvg-examples.png + \image opengl-examples.png Qt provides support for integration with OpenVG implementations on platforms with suitable drivers. diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc new file mode 100644 index 0000000..e58305a --- /dev/null +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Getting Started Guides + + \group gettingStarted + + \section1 + Creating applications using Qt and QML is easy enough once you get started. + To get you started we have created two tutorials creating two similar applications, + but using diiferent approaches. One tutorial implements the user interface using + QML, while the other implements the whole application using traditional Qt. + + Please click on the links below to start the ride. + \generatelist{related} + +*/ + diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc new file mode 100644 index 0000000..6c85776 --- /dev/null +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -0,0 +1,1051 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qml-textEditor.html + + \title Getting Started programming with QML + \ingroup gettingStarted + + Welcome to the world of QML - the declarative UI language. In this Getting + Started guide, we create a simple text editor application using QML. + After reading this guide, you should be ready to start developing your own + applications using QML and Qt C++. + + \example tutorials/gettingStarted/gsQml + + \section1 QML to Build User Interfaces + + Here we are building is a simple text editor that con load, save, + and perform some text manipulation. This guide consists of two parts. The + first part involves designing the application layout and behaviors using + declarative language in QML. For the second part, file loading and saving is + implemented using Qt C++. + Using \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ + functions as properties that QML elements can use. By utilizing QML and Qt C++, + we can efficiently decouple the interface logic from the application logic. + + \image qml-texteditor5_editmenu.png + + To run the QML example code, we merely provide the included \l{QML Viewer}{qmlviewer} + tool with the QML file as the argument. The C++ portion of this tutorial assumes + that the reader possesses basic knowledge of Qt's compilation procedures. + + \omit + Tutorial chapters: + \list 1 + \o \l {Defining a Button and a Menu}{Defining a Button and a Menu} + \o \l {Implementing a Menu Bar}{Implementing a Menu Bar} + \o \l {Building a Text Editor}{Building a Text Editor} + \o \l {Decorating the Text Editor}{Decorating the Text Editor} + \o \l {Extending QML using Qt C++}{Extending QML using Qt C++} + \endlist + \endomit + + \section1 Defining a Button and a Menu + + \section2 Basic Component - a Button + + We start our text editor by building a button. Functionally, a button has a mouse + sensitive area and a label. Buttons perform actions when a user presses the button. + + In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The + \c Rectangle element has properties to control the element's appearance and location. + + \code + import Qt 4.7 + Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + } + \endcode + + First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements + we will later use. This line must exist for every QML file. Notice that the version + of Qt modules is included in the import statement. + + This simple rectangle has a unique identifier, \c simplebutton, which is bound to the + id property. The \c Rectangle element's properties are bound to values by listing the + property, followed by a colon, then the value. In the code sample, the color \c grey + is bound to the the Rectangle's \c color property. Similarly, we bind the \c width + and \c height of the Rectangle. + + The \l {Text}{Text} element is a non-editable text field. We name this \c Text element + \c buttonLabel. To set the string content of the Text field, we bind a value to the + \c text property. The label is contained within the Rectangle and in order to center + it in the middle, we assign the \c anchors of the Text element to its parent, which + is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout + assignments simpler. + + We save this code as \c SimpleButton.qml. Running qmlviewer with the file as the + argument will display the grey rectangle with a text label. + + \image qml-texteditor1_simplebutton.png + + To implement the button click functionality, we can use QML's event handling. QML's event + handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals + are emitted and the connected slot is called. + + \code + Rectangle{ + id:simplebutton + ... + + MouseArea{ + id: buttonMouseArea + + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } + } + \endcode + + We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe + the interactive area where mouse movements are detected. For our button, we anchor the + whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is + one way of accessing a specific property called \c fill inside a group of properties + called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where + items can anchor to another item, creating robust layouts. + + The \c MouseArea has many signal handlers that are called during mouse movements within + the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called + whenever the acceptable mouse button is clicked, the left click being the default. We + can bind actions to the onClicked handler. In our example, \c console.log() outputs text + whenever the mouse area is clicked. The function \c console.log() is a useful tool for + debugging purposes and for outputting text. + + The code in \c SimpleButton.qml is sufficient to display a button on the screen and + output text whenever it is clicked with a mouse. + + \code + Rectangle { + id:Button + ... + + property color buttonColor: "lightblue" + property color onHoverColor: "gold" + property color borderColor: "white" + + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + MouseArea{ + onClicked: buttonClick() + hoverEnabled: true + onEntered: parent.border.color = onHoverColor + onExited: parent.border.color = borderColor + } + + //determines the color of the button by using the conditional operator + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + } + \endcode + + A fully functioning button is in \c Button.qml. The code snippets in this article + have some code omitted, denoted by ellipses because they were either introduced + earlier in the previous sections or irrelevant to the current code discussion. + + Custom properties are declared using the \c {property type name} syntax. In the + code, the property \c buttonColor, of type \c color, is declared and bound to + the value \c{"lightblue"}. The \c buttonColor is later used in a conditional + operation to determine the buttons's fill color. Note that property value + assignment is possible using the \c= equals sign, in addition to value binding + using the \c : colon character. Custom properties allow internal items to be + accessible outside of the Rectangle's scope. There are basic + \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as + a type called \c variant. + + By binding the \c onEntered and \c onExited signal handlers to colors, the + button's border will turn yellow when the mouse hovers above the button and + reverts the color when the mouse exits the mouse area. + + A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal + keyword in front of the signal name. All signals have their handlers automatically + created, their names starting with \c on. As a result, the \c onButtonClick is + \c buttonClick's handler. The \c onButtonClick is then assigned an action to + perform. In our button example, the \c onClicked mouse handler will simply call + \c onButtonClick, which displays a text. The \c onButtonClick enables outside + objects to access the \c {Button}'s mouse area easily. For example, items may + have more than one \c MouseArea declarations and a \c buttonClick signal can + make the distinction between the several \c MouseArea signal handlers better. + + We now have the basic knowledge to implement items in QML that can handle + basic mouse movements. We created a \c Text label inside a \c Rectangle, + customized its properties, and implemented behaviors that respond to mouse + movements. This idea of creating elements within elements is repeated + throughout the text editor application. + + This button is not useful unless used as a component to perform an action. + In the next section, we will soon create a menu containing several of these + buttons. + + \image qml-texteditor1_button.png + + \section2 Creating a Menu Page + + Up to this stage, we covered how to create elements and assign behaviors inside + a single QML file. In this section, we will cover how to import QML elements and how + to reuse some of the created components to build other components. + + Menus display the contents of a list, each item having the ability to perform an action. + In QML, we can create a menu in several ways. First, we will create a menu containing + buttons which will eventually perform different actions. The menu code is in + \c FileMenu.qml. + + \code + import Qt 4.7 \\import the main Qt QML module + import “folderName” \\import the contents of the folder + import “Button.qml” \\import a QML file + import “NewButton.qml” as ButtonModule \\import a QML file and give it a name + import “script.js” as Script \\import a Javascript file and name it as Script + \endcode + + To use the \c Button element in \c FileMenu.qml, we need to import \c Button.qml. + The syntax shown above, shows how to use the \c import keyword. However, the + \c {import Button.qml} is not necessary; qmlviewer will import all the contents + of the current directory. We can directly create a \c Button element by declaring + \c Button{}, similar to a \c Rectangle{} declaration. + + \code + In FileMenu.qml: + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + onButtonClick: Qt.quit() + } + } + \endcode + + In \c FileMenu.qml, we declare three \c Button elements. They are declared + inside a \l {Row}{Row} element, a positioner that will position its children + along a vertical row. The \c Button declaration resides in Button.qml, + which is the same as the \c Button.qml we used in the previous section. + New property bindings can be declared within the newly created buttons, + effectively overwriting the properties set in \c Button.qml. The button + called \c exitButton will quit and close the window when it is clicked. + Note that the signal handler \c onButtonClick in \c Button.qml will be + called in addition to the \c onButtonClick handler in \c exitButton. + + \image qml-texteditor1_filemenu.png + + The \c Row declaration is declared in a \c Rectangle, creating a rectangle + container for the row of buttons. This additional rectangle creates an indirect + way of organizing the row of buttons inside a menu. + + The declaration of the edit menu is very similar at this stage. The menu has + buttons that have the labels: \c Copy, \c Paste, and \c {Select All}. + + \image qml-texteditor1_editmenu.png + + Armed with our knowledge of importing and customizing previously made + components, we may now combine these menu pages to create a menu bar, + consisting of buttons to select the menu, and look at how we may structure + data using QML. + + \section1 Implementing a Menu Bar + + Our text editor application will need a way to display menus using a menu bar. + The menu bar will switch the different menus and the user can choose which menu + to display. Menu switching implies that the menus need more structure than + merely displaying them in a row. QML uses models and views to structure data + and display the structured data. + + \section2 Using Data Models and Views + + QML has different \l {Data Models}{data views} that display + \l {Data Models}{data models}. Our menu bar will display the menus in a list, + with a header that displays a row of menu names. The list of menus are declared + inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel} + element contains items that already have views such as \c Rectangle elements + and imported UI elements. Other model types such as the \l {ListModel}{\c ListModel} + element need a delegate to display their data. + + We declare two visual items in the \c menuListModel, the \c FileMenu and the + \c EditMenu. We customize the two menus and display them using a + \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations + and a simple edit menu is defined in \c EditMenu.qml. + + \code + VisualItemModel{ + id: menuListModel + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + } + } + \endcode + + The \l {ListView}{ListView} element will display a model according to a delegate. + The delegate may declare the model items to display in a \c Row element or display + the items in a grid. Our \c menuListModel already has visible items, therefore, + we do not need to declare a delegate. + + \code + ListView{ + id: menuListView + + //Anchors are set to react to window anchors + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + \endcode + + Additionally, \c ListView inherits from \l {Flickable}{\c Flickable}, making + the list respond to mouse drags and other gestures. The last portion of the + code above sets \c Flickable properties to create the desired flicking movement + to our view. In particular,the property \c highlightMoveDuration changes the + duration of the flick transition. A higher \c highlightMoveDuration value + results in slower menu switching. + + The \c ListView maintains the model items through an \c index and each visual + item in the model is accessible through the \c index, in the order of the + declaration. Changing the \c currentIndex effectively changes the highlighted + item in the \c ListView. The header of our menu bar exemplify this effect. + There are two buttons in a row, both changing the current menu when clicked. + The \c fileButton changes the current menu to the file menu when clicked, + the \c index being \c 0 because \c FileMenu is declared first in the + \c menuListModel. Similarly, the \c editButton will change the current + menu to the \c EditMenu when clicked. + + The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed + at the front of the menu bar. Items with higher \c z values are displayed in front + of items with lower \c z values. The default \c z value is \c 0. + + \code + Rectangle{ + id: labelList + ... + z: 1 + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + label: "File" + id: fileButton + ... + onButtonClick: menuListView.currentIndex = 0 + } + Button{ + id: editButton + label: "Edit" + ... + onButtonClick: menuListView.currentIndex = 1 + } + } + } + \endcode + + The menu bar we just created can be flicked to access the menus or by clicking + on the menu names at the top. Switching menu screens feel intuitive and responsive. + + \image qml-texteditor2_menubar.png + + \section1 Building a Text Editor + + \section2 Declaring a TextArea + + Our text editor is not a text editor if it didn't contain an editable text area. + QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line + editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text} + element, which doesn't allow the user to directly edit the text. + + \code + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + \endcode + + The editor has its font color property set and set to wrap the text. The + \c TextEdit area is inside a flickable area that will scroll the text if the + text cursor is outside the visible area. The function \c ensureVisible() will + check if the cursor rectangle is outside the visible boundaries and move the + text area accordingly. QML uses Javascript syntax for its scripts, and as previously + mentioned, Javascript files can be imported and used within a QML file. + + \code + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + \endcode + + \section1 Combining Components for the Text Editor + + We are now ready to create the layout of our text editor using QML. The text + editor has two components, the menu bar we created and the text area. QML allows + us to reuse components, therefore making our code simpler, by importing components + and customizing when necessary. Our text editor splits the window into two; + one-third of the screen is dedicated to the menu bar and two-thirds of the screen + displays the text area. The menu bar is displayed in front of any other elements. + + \code + Rectangle{ + + id: screen + width: 1000; height: 1000 + + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "white" + height: partition*2 + width:parent.width + } + } + \endcode + + By importing reusable components, our \c TextEditor code looks much simpler. + We can then customize the main application, without worrying about properties + that already have defined behaviors. Using this approach, application layouts + and UI components can be created easily. + + \image qml-texteditor3_texteditor.png + + \section1 Decorating the Text Editor + \section2 Implementing a Drawer Interface + + Our text editor looks simple and we need to decorate it. Using QML, we can declare + transitions and animate our text editor. Our menu bar is occupying one-third of the + screen and it would be nice to have it only appear when we want it. + + We can add a drawer interface, that will contract or expand the menu bar when clicked. + In our implementation, we have a thin rectangle that responds to mouse clicks. The + \c drawer, as well as the application, has two sates: the "drawer is open" state and + the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small + height. There is a nested \l {Image}{Image} element declaring that an arrow icon will + be centered inside the drawer. The drawer assigns a state to the whole application, + with the identifier \c screen, whenever a user clicks the mouse area. + + \code + Rectangle{ + id:drawer + height:15 + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + ... + } + } + \endcode + + A state is simply a collection of configurations and it is declared in a + \l{State}{State} element. A list of states can be listed and bound to the + \c states property. In our application, the two states are called + \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in + \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state, + there are four items that will receive property changes. The first target, + \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea + will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea, + the \c drawer, and the drawer's icon will undergo property changes to meet the + current state. + + \code + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + + \endcode + + State changes are abrupt and needs smoother transitions. Transitions between states + are defined using the \l {Transition}{Transition} element, which can then bind to + the item's \c transitions property. Our text editor has a state transition whenever + the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the + transition needs a \c from and a \c to state but for our transitions, we can use + the wild card \c * symbol to denote that the transition applies to all state changes. + + During transitions, we can assign animations to the property changes. Our + \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate + this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare + that the targets' properties will animate for a certain duration of time and using + a certain easing curve. An easing curve controls the animation rates and + interpolation behavior during state transitions. The easing curve we chose is + \l{PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near + the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation} + article. + + \code + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint } + } + ] + \endcode + + Another way of animating property changes is by declaring a \l {Behavior}{Behavior} + element. A transition only works during state changes and \c Behavior can set an + animation for a general property change. In the text editor, the arrow has a + \c NumberAnimation animating its \c rotation property whenever the property changes. + + \code + In TextEditor.qml: + + Behavior{ + NumberAnimation{property: "rotation";easing.type: Easing.OutExpo } + } + \endcode + + Going back to our components with knowledge of states and animations, we can improve + the appearances of the components. In \c Button.qml, we can add \c color and \c scale + property changes when the button is clicked. Color types are animated using + \l {ColorAnimation}{ColorAnimation} and numbers are animated using + \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below + is helpful when targeting a single property. + + \code + In Button.qml: + ... + + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + Behavior on color { ColorAnimation{ duration: 55} } + + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + Behavior on scale { NumberAnimation{ duration: 55} } + \endcode + + Additionally, we can enhance the appearances of our QML components by adding color + effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient} + element will override the \c color property of the element. You may declare a color + in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is + positioned using a scale, between \c 0.0 and \c 1.0. + + \code + In MenuBar.qml + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + \endcode + + This gradient is used by the menu bar to display a gradient simulating depth. + The first color starts at \c 0.0 and the last color is at \c 1.0. + + + \section2 Where to Go from Here + + We are finished building the user interface of a very simple text editor. + Going forward, the user interface is complete, and we can implement the + application logic using regular Qt and C++. QML works nicely as a prototyping + tool, separating the application logic away from the UI design. + + \image qml-texteditor4_texteditor.png + + \section1 Extending QML using Qt C++ + + Now that we have our text editor layout, we may now implement the text editor + functionalities in C++. Using QML with C++ enables us to create our application + logic using Qt. We can create a QML context in a C++ application using the + \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML + elements using a Graphics Scene. Alternatively, we can export our C++ code into + a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application, + we shall implement the load and save functions in C++ and export it as a plugin. + This way, we only need to load the QML file directly instead of running an executable. + + \section2 Exposing C++ Classes to QML + + We will be implementing file loading and saving using Qt and C++. C++ classes + and functions can be used in QML by registering them. The class also needs to be + compiled as a Qt plugin and the QML file will need to know where the plugin is located. + + For our application, we need to create the following items: + \list 1 + \o \c Directory class that will handle directory related operations + \o \c File class which is a QObject, simulating the list of files in a directory + \o plugin class that will register the class to the QML context + \o Qt project file that will compile the plugin + \o A \c qmldir file telling the qmlviewer tool where to find the plugin + \endlist + + \section2 Building a Qt Plugin + + To build a plugin, we need to set the following in a Qt project file. First, + the necessary sources, headers, and Qt modules need to be added into our + project file. All the C++ code and project files are in the \c filedialog + directory. + + \code + In cppPlugins.pro: + + TEMPLATE = lib + CONFIG += qt plugin + QT += declarative + + DESTDIR += ../plugins + OBJECTS_DIR = tmp + MOC_DIR = tmp + + TARGET = FileDialog + + HEADERS += directory.h \ + file.h \ + dialogPlugin.h + + SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp + \endcode + + In particular, we compile Qt with the \c declarative module and configure it as a + \c plugin, needing a \c lib template. We shall put the compiled plugin into the + parent's \c plugins directory. + + + \section2 Registering a Class into QML + + \code + In dialogPlugin.h: + + #include <QtDeclarative/QDeclarativeExtensionPlugin> + + class DialogPlugin : public QDeclarativeExtensionPlugin + { + Q_OBJECT + + public: + void registerTypes(const char *uri); + + }; + + \endcode + + Our plugin class, \c DialogPlugin is a subclass of \l + {QDeclarativeExtensionPlugin}{QDeclarativeExtensionPlugin}. We + need to implement the inherited function, \l + {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes}. The + \c dialogPlugin.cpp file looks like this: + + \code + DialogPlugin.cpp: + + #include "dialogPlugin.h" + #include "directory.h" + #include "file.h" + #include <QtDeclarative/qdeclarative.h> + + void DialogPlugin::registerTypes(const char *uri){ + + qmlRegisterType<Directory>(uri, 1, 0, "Directory"); + qmlRegisterType<File>(uri, 1, 0,"File"); + } + + Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); + \endcode + + The \l {QDeclarativeExtensionPlugin::registerTypes()}{registerTypes} + function registers our File and Directory classes into QML. This function + needs the class name for its template, a major version number, a minor version + number, and a name for our classes. + + We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2} + macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT} + macro at the top of our class. As well, we need to run \c qmake on the project + file to generate the necessary meta-object code. + + + \section2 Creating QML Properties in a C++ class + + We can create QML elements and properties using C++ and + \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement + properties using slots and signals, making Qt aware of these properties. + These properties can then be used in QML. + + For the text editor, we need to be able to load and save files. Typically, + these features are contained in a file dialog. Fortunately, we can use + \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to + implement directory reading and input/output streams. + + \code + class Directory : public QObject{ + + Q_OBJECT + + Q_PROPERTY(int filesCount READ filesCount CONSTANT) + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT ) + + ... + \endcode + + The \c Directory class uses Qt's Meta-Object System to register properties it + needs to accomplish file handling. The \c Directory class is exported as a plugin + and is useable in QML as the \c Directory element. Each of the listed properties + using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property. + + The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and + write functions into Qt's Meta-Object System. For example, the \c filename + property, of type \l {QString}{QString}, is readable using the \c filename() + function and writable using the function \c setFilename(). Additionally, there + is a signal associated to the filename property called \c filenameChanged(), + which is emitted whenever the property changes. The read and write functions + are declared as \c public in the header file. + + Similarly, we have the other properties declared according to their uses. The + \c filesCount property indicates the number of files in a directory. The filename + property is set to the currently selected file's name and the loaded/saved file + content is stored in \c fileContent property. + + \code + Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT ) + \endcode + + The \c files list property is a list of all the filtered files in a directory. + The \c Directory class is implemented to filter out invalid text files; only + files with a \c .txt extension are valid. Further, \l {QList}{QLists} can be + used in QML files by declaring them as a \c QDeclarativeListProperty in C++. + The templated object needs to inherit from a \l {QObject}{QObject}, therefore, + the \c File class must also inherit from \c QObject. In the \c Directory class, + the list of \c File objects is stored in a \c QList called \c m_fileList. + + \code + class File : public QObject{ + + Q_OBJECT + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + ... + }; + \endcode + + The properties can then be used in QML as part of the \c Directory element's + properties. Note that we do not have to create an identifier \c id property + in our C++ code. + + \code + Directory{ + id: directory + + filesCount + filename + fileContent + files + + files[0].name + } + + \endcode + + Because QML uses Javascript's syntax and structure, we can iterate through + the list of files and retrieve its properties. To retrieve the first file's + name property, we can call \c { files[0].name }. + + Regular C++ functions are also accessible from QML. The file loading and saving + functions are implemented in C++ and declared using the + \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions + as a \c slot and the functions will be accessible from QML. + + \code + In Directory.h: + + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + \endcode + + The \c Directory class also has to notify other objects whenever the directory + contents change. This feature is performed using a \c signal. As previously + mentioned, QML signals have a corresponding handler with their names prepended + with \c on. The signal is called \c directoryChanged and it is emitted whenever + there is a directory refresh. The refresh simply reloads the directory contents + and updates the list of valid files in the directory. QML items can then be + notified by attaching an action to the \c onDirectoryChanged signal handler. + + The \c list properties need to be explored further. This is because list + properties use callbacks to access and modify the list contents. The list + property is of type \c QDeclarativeListProperty<File>. Whenever the list + is accessed, the accessor function needs to return a + \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a + \c QObject derivative. Further, to create the + \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor + and modifiers need to be passed to the consructor as function pointers. The list, + a \c QList in our case, also needs to be a list of \c File pointers. + + The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty} + constructor and the \c Directory implementation: + \code + QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 ) + QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); + \endcode + + The constructor passes pointers to functions that will append the list, count + the list, retrieve the item using an index, and empty the list. Only the append + function is mandatory. Note that the function pointers must match the definition + of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction}, + \l {QDeclarativeListProperty::CountFunction}{CountFunction}, + \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or + \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}. + + \code + void appendFiles(QDeclarativeListProperty<File> * property, File * file) + File* fileAt(QDeclarativeListProperty<File> * property, int index) + int filesSize(QDeclarativeListProperty<File> * property) + void clearFilesPtr(QDeclarativeListProperty<File> *property) + \endcode + + To simplify our file dialog, the \c Directory class filters out invalid text + files, which are files that do not have a \c .txt extension. If a file name + doesn't have the \c .txt extension, then it won't be seen in our file dialog. + Also, the implementation makes sure that saved files have a \c .txt extension in + the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file + and to output the file contents to a file. + + With our \c Directory element, we can retrieve the files as a list, know how many + text files is in the application directory, get the file's name and content as a + string, and be notified whenever there are changes in the directory contents. + + To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run + \c make to build and transfer the plugin to the \c plugins directory. + + + \section2 Importing a Plugin in QML + + The qmlviewer tool imports files that are in the same directory as the + application. We can also create a \c qmldir file containing the locations of + QML files we wish to import. The \c qmldir file can also store locations of + plugins and other resources. + + \code + In qmldir: + + Button ./Button.qml + FileDialog ./FileDialog.qml + TextArea ./TextArea.qml + TextEditor ./TextEditor.qml + EditMenu ./EditMenu.qml + + plugin FileDialog plugins + \endcode + + The plugin we just created is called \c FileDialog, as indicated by the + \c TARGET field in the project file. The compiled plugin is in the \c plugins directory. + + + \section2 Integrating a File Dialog into the File Menu + + Our \c FileMenu needs to display the \c FileDialog element, containing a list of + the text files in a directory thus allowing the user to select the file by + clicking on the list. We also need to assign the save, load, and new buttons + to their respective actions. The FileMenu contains an editable text input to + allow the user to type a file name using the keyboard. + + The \c Directory element is used in the \c FileMenu.qml file and it notifies the + \c FileDialog element that the directory refreshed its contents. This notification + is performed in the signal handler, \c onDirectoryChanged. + + \code + In FileMenu.qml: + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged: fileDialog.notifyRefresh() + } + \endcode + + Keeping with the simplicity of our application, the file dialog will always be + visible and will not display invalid text files, which do not have a \c .txt + extension to their filenames. + + \code + In FileDialog.qml: + + signal notifyRefresh() + onNotifyRefresh: dirView.model = directory.files + \endcode + + The \c FileDialog element will display the contents of a directory by reading its + list property called \c files. The files are used as the model of a + \l {GridView}{GridView} element, which displays data items in a grid according + to a delegate. The delegate handles the appearance of the model and our file + dialog will simply create a grid with text centered in the middle. Clicking on + the file name will result in the appearance of a rectangle to highlight the file + name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted, + reloading the files in the directory. + + \code + In FileMenu.qml: + + Button{ + id: newButton + label: "New" + onButtonClick:{ + textArea.textContent = "" + } + } + Button{ + id: loadButton + label: "Load" + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + } + Button{ + id: saveButton + label: "Save" + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + } + Button{ + id: exitButton + label: "Exit" + onButtonClick:{ + Qt.quit() + } + } + \endcode + + Our \c FileMenu can now connect to their respective actions. The \c saveButton + will transfer the text from the \c TextEdit onto the directory's \c fileContent + property, then copy its file name from the editable text input. Finally, the button + calls the \c saveFile() function, saving the file. The \c sloadButton has a similar + execution. Also, the \c New action will empty the contents of the \c TextEdit. + + Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy, + paste, and select all the text in the text editor. + + \image qml-texteditor5_filemenu.png + + \section1 Text Editor Completion + + \image qml-texteditor5_newfile.png + + The application can function as a simple text editor, able to accept text + and save the text into a file. The text editor can also load from a file and + perform text manipulation. + + +*/
\ No newline at end of file diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc new file mode 100644 index 0000000..1b3770f --- /dev/null +++ b/doc/src/getting-started/gettingstartedqt.qdoc @@ -0,0 +1,517 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page gettingstartedqt.html + + \title Getting Started programming with Qt + \ingroup gettingStarted + + Welcome to the world of Qt--the cross-platform GUI toolkit. In + this getting started guide, we teach basic Qt knowledge by + implementing a simple Notepad application. After reading this + guide, you should be ready to delve into our overviews and API + documentation, and find the information you need for the + application you are developing. + + \section1 Hello Notepad + + In this first example, we simply create and show a text edit in a + window frame on the desktop. This represents the simplest possible + Qt program that has a GUI. + + \image gs1.png + + Here is the code: + + \code + 1 #include <QApplication> + 2 #include <QTextEdit> + 3 + 4 int main(int argv, char **args) + 5 { + 6 QApplication app(argv, args); + 7 + 8 QTextEdit textEdit; + 9 textEdit.show(); +10 +11 return app.exec(); +12 } + \endcode + + Let us go through the code line by line. In the first two lines, we + include the header files for QApplication and QTextEdit, which are + the two classes that we need for this example. All Qt classes have + a header file named after them. + + Line 6 creates a QApplication object. This object manages + application-wide resources and is necessary to run any Qt program + that has a GUI. It needs \c argv and \c args because Qt accepts a + few command line arguments. + + Line 8 creates a QTextEdit object. A text edit is a visual element + in the GUI. In Qt, we call such elements widgets. Examples of + other widgets are scroll bars, labels, and radio buttons. A widget + can also be a container for other widgets; a dialog or a main + application window, for example. + + Line 9 shows the text edit on the screen in its own window frame. + Since widgets also function as containers (for instance a + QMainWindow, which has toolbars, menus, a status bar, and a few + other widgets), it is possible to show a single widget in its own + window. Widgets are not visible by default; the function + \l{QWidget::}{show()} makes the widget visible. + + Line 11 makes the QApplication enter its event loop. When a Qt + application is running, events are generated and sent to the + widgets of the application. Examples of events are mouse presses + and key strokes. When you type text in the text edit widget, it + receives key pressed events and responds by drawing the text + typed. + + To run the application, open a command prompt, and enter the + directory in which you have the \c .cpp file of the program. The + following shell commands build the program. + + \code + qmake -project + qmake + make + \endcode + + This will leave an executable in the \c part1 directory (note that + on Windows, you may have to use \c nmake instead of \c make. Also, + the executable will be placed in part1/debug or part1/release). \c + qmake is Qt's build tool, which takes a configuration file. \c + qmake generates this for us when given the \c{-project} argument. + Given the configuration file (suffixed .pro), \c qmake produces a + \c make file that will build the program for you. We will look + into writing our own \c .pro files later. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Widgets and Window Geometry + \o \l{Window and Dialog Widgets} + \row + \o Events and event handling + \o \l{The Event System} + \endtable + + \section1 Adding a Quit Button + + In a real application, you will normally need more than one + widget. We will now introduce a QPushButton beneath the text edit. + The button will exit the Notepad application when pushed (i.e., + clicked on with the mouse). + + \image gs2.png + + Let us take a look at the code. + + \code + 1 #include <QtGui> + 2 + 3 int main(int argv, char **args) + 4 { + 5 QApplication app(argv, args); + 6 + 7 QTextEdit textEdit; + 8 QPushButton quitButton("Quit"); + 9 +10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); +11 +12 QVBoxLayout layout; +13 layout.addWidget(&textEdit); +14 layout.addWidget(&quitButton); +15 +16 QWidget window; +17 window.setLayout(&layout); +18 +19 window.show(); +20 +21 return app.exec(); +22 } + \endcode + + Line 1 includes QtGui, which contains all of Qt's GUI classes. + + Line 10 uses Qt's Signals and Slots mechanism to make the + application exit when the \gui {Quit button} is pushed. A slot is + a function that can be invoked at runtime using its name (as a + literal string). A signal is a function that when called will + invoke slots registered with it; we call that to connect the slot + to the signal and to emit the signal. + + \l{QApplication::}{quit()} is a slot of QApplication that exits + the application. \l{QPushButton::}{clicked()} is a signal that + QPushButton emits when it is pushed. The static + QObject::connect() function takes care of connecting the slot to + the signal. SIGNAL() and SLOT() are two macros that take the + function signatures of the signal and slot to connect. We also + need to give pointers to the objects that should send and receive + the signal. + + Line 12 creates a QVBoxLayout. As mentioned, widgets can contain + other widgets. It is possible to set the bounds (the location and + size) of child widgets directly, but it is usually easier to use a + layout. A layout manages the bounds of a widget's children. + QVBoxLayout, for instance, places the children in a vertical row. + + Line 13 and 14 adds the text edit and button to the layout. In + line 17, we set the layout on a widget. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Signals and slots + \o \l{Signals & Slots} + \row + \o Layouts + \o \l{Layout Management}, + \l{Widgets and Layouts}, + \l{Layout Examples} + \row + \o The widgets that come with Qt + \o \l{Qt Widget Gallery}, + \l{Widget Examples} + \endtable + + \section1 Subclassing QWidget + + When the user wants to quit an application, you might want to + pop-up a dialog that asks whether he/she really wants to quit. In + this example, we subclass QWidget, and add a slot that we connect + to the \gui {Quit button}. + + \image gs3.png + + Let us look at the code: + + \code + 5 class Notepad : public QWidget + 6 { + 7 Q_OBJECT + 8 + 9 public: +10 Notepad(); +11 +12 private slots: +13 void quit(); +14 +15 private: +16 QTextEdit *textEdit; +17 QPushButton *quitButton; +18 }; + \endcode + + The \c Q_OBJECT macro must be first in the class definition, and + declares our class as a \c QObject (Naturally, it must also + inherit from QObject). A \l{QObject} adds several abilities to a + normal C++ class. Notably, the class name and slot names can be + queried at run-time. It is also possible to query a slot's + parameter types and invoke it. + + Line 13 declares the slot \c quit(). This is easy using the \c + slots macro. The \c quit() slot can now be connected to signals + with a matching signature (any signal that takes no parameters). + + Instead of setting up the GUI and connecting the slot in the \c + main() function, we now use \c{Notepad}'s constructor. + + \code + Notepad::Notepad() + { + textEdit = new QTextEdit; + quitButton = new QPushButton(tr("Quit")); + + connect(quitButton, SIGNAL(clicked()), this, SLOT(quit())); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(textEdit); + layout->addWidget(quitButton); + + setLayout(layout); + + setWindowTitle(tr("Notepad")); + } + \endcode + + As you saw in the class definition, we use pointers to our \l + {QObject}s (\c textEdit and \c quitButton). As a rule, you should + always allocate \l{QObject}s on the heap and never copy them. + + We now use the function \l{QObject::}{tr()} around our user + visible strings. This function is necessary when you want to + provide your application in more than one language (e.g. English + and Chinese). We will not go into details here, but you can follow + the \c {Qt Linguist} link from the learn more table. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o tr() and internationalization + \o \l{Qt Linguist Manual}, + \l{Writing Source Code for Translation}, + \l{Hello tr() Example}, + \l{Internationalization with Qt} + \row + \o QObjects and the Qt Object model (This is essential to understand Qt) + \o \l{Object Model} + \row + \o qmake and the Qt build system + \o \l{qmake Manual} + \endtable + + \section2 Creating a .pro file + + For this example, we write our own \c .pro file instead of + using \c qmake's \c -project option. + + \code + HEADERS = notepad.h + SOURCES = notepad.cpp \ + main.cpp + \endcode + + The following shell commands build the example. + + \code + qmake + make + \endcode + + \section1 Using a QMainWindow + + Many applications will benefit from using a QMainWindow, which has + its own layout to which you can add a menu bar, dock widgets, tool + bars, and a status bar. QMainWindow has a center area that can be + occupied by any kind of widget. In our case, we will place our + text edit there. + + \image gs4.png + + Let us look at the new \c Notepad class definition. + + \code + #include <QtGui> + + class Notepad : public QMainWindow + { + Q_OBJECT + + public: + Notepad(); + + private slots: + void open(); + void save(); + void quit(); + + private: + QTextEdit *textEdit; + + QAction *openAction; + QAction *saveAction; + QAction *exitAction; + + QMenu *fileMenu; + }; + \endcode + + We include two more slots that can save and open a document. We + will implement these in the next section. + + Often, in a main window, the same slot should be invoked by + several widgets. Examples are menu items and buttons on a tool + bar. To make this easier, Qt provides QAction, which can be given + to several widgets, and be connected to a slot. For instance, both + QMenu and QToolBar can create menu items and tool buttons from the + same \l{QAction}s. We will see how this works shortly. + + As before, we use the \c {Notepad}s constructor to set up the + GUI. + + \code + Notepad::Notepad() + { + saveAction = new QAction(tr("&Open"), this); + saveAction = new QAction(tr("&Save"), this); + exitAction = new QAction(tr("E&xit"), this); + + connect(openAction, SIGNAL(triggered()), this, SLOT(open())); + connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); + connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + + fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->addAction(openAction); + fileMenu->addAction(saveAction); + fileMenu->addSeparator(); + fileMenu->addAction(exitAction); + + textEdit = new QTextEdit; + setCentralWidget(textEdit); + + setWindowTitle(tr("Notepad")); + } + \endcode + + \l{QAction}s are created with the text that should appear on the + widgets that we add them to (in our case, menu items). If we also + wanted to add them to a tool bar, we could have given + \l{QIcon}{icons} to the actions. + + When a menu item is clicked now, the item will trigger the action, + and the respective slot will be invoked. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Main windows and main window classes + \o \l{Application Main Window}, + \l{Main Window Examples} + \row + \o MDI applications + \o QMdiArea, + \l{MDI Example} + \endtable + + \section1 Saving and Loading + + In this example, we will implement the functionality of the \c + open() and \c save() slots that we added in the previous example. + + \image gs5.png + + We will start with the \c open() slot: + + \code + QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", + tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); + + if (fileName != "") { + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::critical(this, tr("Error"), + tr("Could not open file")); + return; + } + QString contents = file.readAll().constData(); + textEdit->setPlainText(contents); + file.close(); + } + \endcode + + The first step is asking the user for the name of the file to + open. Qt comes with QFileDialog, which is a dialog from which the + user can select a file. The image above shows the dialog on + Kubuntu. The static \l{QFileDialog::}{getOpenFileName()} function + displays a modal file dialog, and does not return until the user + has selected a file. It returns the file path of the file + selected, or an empty string if the user canceled the dialog. + + If we have a file name, we try to open the file with + \l{QIODevice::}{open()}, which returns true if the file could be + opened. We will not go into error handling here, but you can follow + the links from the learn more section. If the file could not be + opened, we use QMessageBox to display a dialog with an error + message (see the QMessageBox class description for further + details). + + Actually reading in the data is trivial using the + \l{QIODevice::}{readAll()} function, which returns all data in the + file in a QByteArray. The \l{QByteArray::}{constData()} returns all + data in the array as a const char*, which QString has a + constructor for. The contents can then be displayed in the text + edit. We then \l{QIODevice::}{close()} the file to return the file + descriptor back to the operating system. + + Now, let us move on to the the \c save() slot. + + \code + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", + tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); + + if (fileName != "") { + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly)) { + // error message + } else { + QTextStream stream(&file); + stream << textEdit->toPlainText(); + stream.flush(); + file.close(); + } + } + \endcode + + When we write the contents of the text edit to the file, we use + the QTextStream class, which wraps the QFile object. The text + stream can write QStrings directly to the file; QFile only accepts + raw data (char*) with the \l{QIODevice::}{write()} functions of + QIODevice. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Files and I/O devices + \o QFile, QIODevice + \endtable + + \omit + \section1 Moving On + + This may not be true for the first release. + The Qt documentation comes with three getting started guides. You + have come to the end of the first, which concerns itself with + basic Qt concepts. We also have guides covering intermediate and + advanced topics. They are found here: You may also have noticed that the learn more sections in + this guide frequently linked to them. + Basic Qt Architecture + \endomit +*/ + diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 90723ec..629d8b7 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -30,10 +30,13 @@ \title Installation \brief Installing Qt on supported platforms. -The installation procedure is different on each Qt platform. -Please follow the instructions for your platform from the following list. +The installation procedure is different on each Qt platform. This page provides +information on how to install Qt, as well as software and hardware requirements +for using Qt on each of the supported platforms. Please follow the instructions +for your platform from the following list. \generatelist{related} + */ /*! \page install-x11.html diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png Binary files differindex ef514c8..b19cb36 100644 --- a/doc/src/images/addressbook-tutorial-part1-labeled-layout.png +++ b/doc/src/images/addressbook-tutorial-part1-labeled-layout.png diff --git a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png Binary files differindex 4381079..f9b91ee 100644 --- a/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part1-labeled-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-part1-screenshot.png b/doc/src/images/addressbook-tutorial-part1-screenshot.png Binary files differindex cf15627..454b095 100644 --- a/doc/src/images/addressbook-tutorial-part1-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part1-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-part2-add-contact.png b/doc/src/images/addressbook-tutorial-part2-add-contact.png Binary files differindex 330858d..6f2b947 100644 --- a/doc/src/images/addressbook-tutorial-part2-add-contact.png +++ b/doc/src/images/addressbook-tutorial-part2-add-contact.png diff --git a/doc/src/images/addressbook-tutorial-part2-add-successful.png b/doc/src/images/addressbook-tutorial-part2-add-successful.png Binary files differindex 3b108fb..99a2154 100644 --- a/doc/src/images/addressbook-tutorial-part2-add-successful.png +++ b/doc/src/images/addressbook-tutorial-part2-add-successful.png diff --git a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png Binary files differindex 73f6dfb..1e000c8 100644 --- a/doc/src/images/addressbook-tutorial-part2-labeled-layout.png +++ b/doc/src/images/addressbook-tutorial-part2-labeled-layout.png diff --git a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png Binary files differindex 662fa7f..1981ba8 100644 --- a/doc/src/images/addressbook-tutorial-part3-labeled-layout.png +++ b/doc/src/images/addressbook-tutorial-part3-labeled-layout.png diff --git a/doc/src/images/addressbook-tutorial-part3-screenshot.png b/doc/src/images/addressbook-tutorial-part3-screenshot.png Binary files differindex 97d1357..75159b4 100644 --- a/doc/src/images/addressbook-tutorial-part3-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part3-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-part4-remove.png b/doc/src/images/addressbook-tutorial-part4-remove.png Binary files differindex 42b0f92..8eb259e 100644 --- a/doc/src/images/addressbook-tutorial-part4-remove.png +++ b/doc/src/images/addressbook-tutorial-part4-remove.png diff --git a/doc/src/images/addressbook-tutorial-part5-finddialog.png b/doc/src/images/addressbook-tutorial-part5-finddialog.png Binary files differindex 18e5451..743d92e 100644 --- a/doc/src/images/addressbook-tutorial-part5-finddialog.png +++ b/doc/src/images/addressbook-tutorial-part5-finddialog.png diff --git a/doc/src/images/addressbook-tutorial-part5-notfound.png b/doc/src/images/addressbook-tutorial-part5-notfound.png Binary files differindex be7172e..2d35766 100644 --- a/doc/src/images/addressbook-tutorial-part5-notfound.png +++ b/doc/src/images/addressbook-tutorial-part5-notfound.png diff --git a/doc/src/images/addressbook-tutorial-part5-screenshot.png b/doc/src/images/addressbook-tutorial-part5-screenshot.png Binary files differindex ea4a66c..3abe277 100644 --- a/doc/src/images/addressbook-tutorial-part5-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part5-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-part6-load.png b/doc/src/images/addressbook-tutorial-part6-load.png Binary files differindex 95fdcaf..a027a1d 100644 --- a/doc/src/images/addressbook-tutorial-part6-load.png +++ b/doc/src/images/addressbook-tutorial-part6-load.png diff --git a/doc/src/images/addressbook-tutorial-part6-save.png b/doc/src/images/addressbook-tutorial-part6-save.png Binary files differindex c0deb70..757feeb 100644 --- a/doc/src/images/addressbook-tutorial-part6-save.png +++ b/doc/src/images/addressbook-tutorial-part6-save.png diff --git a/doc/src/images/addressbook-tutorial-part6-screenshot.png b/doc/src/images/addressbook-tutorial-part6-screenshot.png Binary files differindex f77bf03..7bb2f74 100644 --- a/doc/src/images/addressbook-tutorial-part6-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part6-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-part7-screenshot.png b/doc/src/images/addressbook-tutorial-part7-screenshot.png Binary files differindex d6b0a50..3e7b3ca 100644 --- a/doc/src/images/addressbook-tutorial-part7-screenshot.png +++ b/doc/src/images/addressbook-tutorial-part7-screenshot.png diff --git a/doc/src/images/addressbook-tutorial-screenshot.png b/doc/src/images/addressbook-tutorial-screenshot.png Binary files differindex d6727dc..3fba6e8 100644 --- a/doc/src/images/addressbook-tutorial-screenshot.png +++ b/doc/src/images/addressbook-tutorial-screenshot.png diff --git a/doc/src/images/addressbook-tutorial.png b/doc/src/images/addressbook-tutorial.png Binary files differindex 495edda..f80b42d 100644 --- a/doc/src/images/addressbook-tutorial.png +++ b/doc/src/images/addressbook-tutorial.png diff --git a/doc/src/images/arrow.png b/doc/src/images/arrow.png Binary files differnew file mode 100644 index 0000000..14978c2 --- /dev/null +++ b/doc/src/images/arrow.png diff --git a/doc/src/images/gs1.png b/doc/src/images/gs1.png Binary files differnew file mode 100644 index 0000000..875dd39 --- /dev/null +++ b/doc/src/images/gs1.png diff --git a/doc/src/images/gs2.png b/doc/src/images/gs2.png Binary files differnew file mode 100644 index 0000000..aaba3b2 --- /dev/null +++ b/doc/src/images/gs2.png diff --git a/doc/src/images/gs3.png b/doc/src/images/gs3.png Binary files differnew file mode 100644 index 0000000..5e474e3 --- /dev/null +++ b/doc/src/images/gs3.png diff --git a/doc/src/images/gs4.png b/doc/src/images/gs4.png Binary files differnew file mode 100644 index 0000000..7a8237e --- /dev/null +++ b/doc/src/images/gs4.png diff --git a/doc/src/images/gs5.png b/doc/src/images/gs5.png Binary files differnew file mode 100644 index 0000000..b3cab60 --- /dev/null +++ b/doc/src/images/gs5.png diff --git a/doc/src/images/qml-pathview-example.png b/doc/src/images/qml-pathview-example.png Binary files differnew file mode 100644 index 0000000..c874c5c --- /dev/null +++ b/doc/src/images/qml-pathview-example.png diff --git a/doc/src/images/qml-texteditor1_button.png b/doc/src/images/qml-texteditor1_button.png Binary files differnew file mode 100644 index 0000000..aab64bc --- /dev/null +++ b/doc/src/images/qml-texteditor1_button.png diff --git a/doc/src/images/qml-texteditor1_editmenu.png b/doc/src/images/qml-texteditor1_editmenu.png Binary files differnew file mode 100644 index 0000000..af8028b --- /dev/null +++ b/doc/src/images/qml-texteditor1_editmenu.png diff --git a/doc/src/images/qml-texteditor1_filemenu.png b/doc/src/images/qml-texteditor1_filemenu.png Binary files differnew file mode 100644 index 0000000..ccc008c --- /dev/null +++ b/doc/src/images/qml-texteditor1_filemenu.png diff --git a/doc/src/images/qml-texteditor1_simplebutton.png b/doc/src/images/qml-texteditor1_simplebutton.png Binary files differnew file mode 100644 index 0000000..21ce509 --- /dev/null +++ b/doc/src/images/qml-texteditor1_simplebutton.png diff --git a/doc/src/images/qml-texteditor2_menubar.png b/doc/src/images/qml-texteditor2_menubar.png Binary files differnew file mode 100644 index 0000000..691a833 --- /dev/null +++ b/doc/src/images/qml-texteditor2_menubar.png diff --git a/doc/src/images/qml-texteditor3_textarea.png b/doc/src/images/qml-texteditor3_textarea.png Binary files differnew file mode 100644 index 0000000..95abcd6 --- /dev/null +++ b/doc/src/images/qml-texteditor3_textarea.png diff --git a/doc/src/images/qml-texteditor3_texteditor.png b/doc/src/images/qml-texteditor3_texteditor.png Binary files differnew file mode 100644 index 0000000..bdf6957 --- /dev/null +++ b/doc/src/images/qml-texteditor3_texteditor.png diff --git a/doc/src/images/qml-texteditor4_texteditor.png b/doc/src/images/qml-texteditor4_texteditor.png Binary files differnew file mode 100644 index 0000000..85d216b --- /dev/null +++ b/doc/src/images/qml-texteditor4_texteditor.png diff --git a/doc/src/images/qml-texteditor5_editmenu.png b/doc/src/images/qml-texteditor5_editmenu.png Binary files differnew file mode 100644 index 0000000..7365690 --- /dev/null +++ b/doc/src/images/qml-texteditor5_editmenu.png diff --git a/doc/src/images/qml-texteditor5_filemenu.png b/doc/src/images/qml-texteditor5_filemenu.png Binary files differnew file mode 100644 index 0000000..7078022 --- /dev/null +++ b/doc/src/images/qml-texteditor5_filemenu.png diff --git a/doc/src/images/qml-texteditor5_newfile.png b/doc/src/images/qml-texteditor5_newfile.png Binary files differnew file mode 100644 index 0000000..e493941 --- /dev/null +++ b/doc/src/images/qml-texteditor5_newfile.png diff --git a/doc/src/images/spectrum-demo.png b/doc/src/images/spectrum-demo.png Binary files differnew file mode 100644 index 0000000..7f4938f --- /dev/null +++ b/doc/src/images/spectrum-demo.png diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index bd3ac05..38586ef 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -40,7 +40,7 @@ </div> <div class="section sectionlist"> <ul> - <li><a href="how-to-learn-qt.html">Getting started</a></li> + <li><a href="gettingstarted.html">Getting started</a></li> <li><a href="installation.html">Installation</a></li> <li><a href="how-to-learn-qt.html">How to learn Qt</a></li> <li><a href="tutorials.html">Tutorials</a></li> @@ -65,8 +65,8 @@ </div> <div class="sectionlist tricol"> <ul> - <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> - <li><a href="qt-basic-concepts.html">Qt Architecture</a></li> + <li><a href="qt-basic-concepts.html">Basic Qt Architecture</a></li> + <li><a href="qt-gui-concepts.html">UI Components</a></li> <li><a href="developing-with-qt.html">Cross-platform & Platform-specific Development</a></li> <li><a href="technology-apis.html">Qt & standard technologies </a></li> <li><a href="best-practices.html">Qt How-to's & best practices</a></li> @@ -74,11 +74,13 @@ </div> <div class="sectionlist"> <ul> - <li><a href="declarativeui.html">Qt Quick</a></li> + <li><a href="qtquick.html">Qt Quick</a></li> <li><a href="qdeclarativeintroduction.html">Introduction to QML</a></li> <li><a href="qdeclarativeelements.html">QML Elements</a></li> <li><a href="qt-gui-concepts.html">UI components</a></li> - <li><a href="declarativeui.html">Qt & GUI design</a></li> + <li><a href="model-view-programming.html">Model/View Programming</a></li> + <li><a href="qt-network.html">Network Programming</a></li> + <li><a href="qt-graphics.html">Graphics and Printing</a></li> </ul> </div> </div> @@ -98,6 +100,7 @@ <li><a href="designer-manual.html">Qt Designer</a></li> <li><a href="linguist-manual.html">Qt Linguist</a></li> <li><a href="assistant-manual.html">Qt Assistant</a></li> + <li><a href="qmake-manual.html">Qt qmake</a></li> <li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a></li> <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> and <a href="http://qt.nokia.com/products/appdev">add-ins</a></li> <li><a href="qvfb.html">Virtual Framebuffer</a></li> @@ -107,4 +110,5 @@ </div> \endraw + */ diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index c8d8e9d..fa992af 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -1414,8 +1414,8 @@ \c -pluralonly command line option, which allows the creation of TS files containing only entries with plural forms. - See the \l{http://qt.nokia.com/doc/qq/}{Qt Quarterly} Article - \l{http://qt.nokia.com/doc/qq/qq19-plurals.html}{Plural Forms in Translations} + See the \l{http://doc.qt.nokia.com/qq/}{Qt Quarterly} Article + \l{http://doc.qt.nokia.com/qq/qq19-plurals.html}{Plural Forms in Translations} for further details on this issue. \section2 Coping With C++ Namespaces diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc index a04a256..12aca6b 100644 --- a/doc/src/legal/licenses.qdoc +++ b/doc/src/legal/licenses.qdoc @@ -262,14 +262,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\br - Â Â * Redistributions of source code must retain the above copyright - Â Â Â notice, this list of conditions and the following disclaimer.\br - Â Â * 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.\br - Â Â * Neither the name of Research In Motion Limited nor the - Â Â Â names of its contributors may be used to endorse or promote products - Â Â Â derived from this software without specific prior written permission. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + * 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.\br + * Neither the name of Research In Motion Limited 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 Research In Motion Limited ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -476,6 +476,24 @@ \hr + Copyright 2001, 2002 Catharon Productions Inc. + + This file is part of the Catharon Typography Project and shall only + be used, modified, and distributed under the terms of the Catharon + Open Source License that should come with this file under the name + `CatharonLicense.txt'. By continuing to use, modify, or distribute + this file you indicate that you have read the license and + understand and accept it fully. + + Note that this license is compatible with the FreeType license. + + \list + \o Included in the build system of the FreeType library + \o See \l{CatharonLicense.txt} for more information + \endlist + + \hr + Copyright (C) 2006 Apple Computer, Inc. All rights reserved.\br Copyright (C) 2007 Eric Seidel <eric@webkit.org>\br Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com)\br @@ -987,3 +1005,15 @@ and have given a quick thought about whether Roman might perhaps be interested to read what you did with his stuff. Horizontal rules don't apply.} */ + +/*! + \page catharon-license.html + \title CatharonLicense.txt + \ingroup licensing + \brief The Catharon License used in parts of FreeType. + + See the \l{Other Licenses Used in Qt} document for information on the + context in which this license is applied to code in the FreeType library. + + \quotefile doc/src/snippets/legal/CatharonLicense.txt +*/ diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index a81bfb2..8912490 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -40,7 +40,7 @@ \header \o {2,1} \bold{Modules for general software development} \row \o \l{QtCore} \o Core non-graphical classes used by other modules \row \o \l{QtGui} \o Graphical user interface (GUI) components - \row \o \l{QtMultimedia} \o Classes for low-level multimedia functionality + \row \o \l{qtmultimedia-module.html}{QtMultimedia} \o Classes for low-level multimedia functionality \row \o \l{QtNetwork} \o Classes for network programming \row \o \l{QtOpenGL} \o OpenGL support classes \row \o \l{QtOpenVG} \o OpenVG support classes @@ -82,9 +82,6 @@ /*! \module QtCore \title QtCore Module - \contentspage All Modules - \previouspage All Modules - \nextpage QtGui \ingroup modules \keyword QtCore @@ -101,9 +98,6 @@ /*! \module QtGui \title QtGui Module - \contentspage All Modules - \previouspage QtCore - \nextpage QtNetwork \ingroup modules \brief The QtGui module extends QtCore with GUI functionality. @@ -116,11 +110,7 @@ /*! \module QtMultimedia - \page qtmultimedia-module.html \title QtMultimedia Module - \contentspage All Modules - \previouspage QtCore - \nextpage QtNetwork \ingroup modules \brief The QtMultimedia module provides low-level multimedia functionality. @@ -142,9 +132,6 @@ /*! \module QtNetwork \title QtNetwork Module - \contentspage All Modules - \previouspage QtMultimedia - \nextpage QtOpenGL \ingroup modules \brief The QtNetwork module provides classes to make network programming @@ -164,9 +151,6 @@ /*! \module QtOpenGL \title QtOpenGL Module - \contentspage All Modules - \previouspage QtNetwork - \nextpage QtOpenVG \ingroup modules \brief The QtOpenGL module offers classes that make it easy to @@ -217,9 +201,6 @@ \module QtOpenVG \title QtOpenVG Module \since 4.6 - \contentspage All Modules - \previouspage QtOpenGL - \nextpage QtScript \ingroup modules \brief The QtOpenVG module is a plugin that provides support for @@ -272,9 +253,6 @@ \module QtScript \title QtScript Module \since 4.3 - \contentspage All Modules - \previouspage QtOpenVG - \nextpage QtScriptTools \ingroup modules \brief The QtScript module provides classes for making Qt applications scriptable. @@ -332,9 +310,6 @@ \module QtScriptTools \title QtScriptTools Module \since 4.5 - \contentspage All Modules - \previouspage QtScript - \nextpage QtSql \ingroup modules \brief The QtScriptTools module provides additional components for applications that use Qt Script. @@ -356,9 +331,6 @@ /*! \module QtSql \title QtSql Module - \contentspage All Modules - \previouspage QtScript - \nextpage QtSvg \ingroup modules To include the definitions of the module's classes, use the @@ -379,9 +351,6 @@ \module QtSvg \title QtSvg Module \since 4.1 - \contentspage All Modules - \previouspage QtSql - \nextpage QtWebKit \ingroup modules \brief The QtSvg module provides classes for displaying and creating SVG files. @@ -430,9 +399,6 @@ /*! \module QtXml \title QtXml Module - \contentspage All Modules - \previouspage QtSvg - \nextpage QtXmlPatterns \ingroup modules \brief The QtXml module provides a stream reader and writer for @@ -457,9 +423,6 @@ \module QtXmlPatterns \title QtXmlPatterns Module \since 4.4 - \contentspage All Modules - \previouspage QtXml - \nextpage Phonon Module \ingroup modules \brief The QtXmlPatterns module provides support for XPath, @@ -478,7 +441,7 @@ \section1 Further Reading General overviews of XQuery and XSchema can be found in the - \l{Using XML Technologies} document. + \l{XQuery} document. An introduction to the XQuery language can be found in \l{A Short Path to XQuery}. @@ -537,9 +500,6 @@ \page phonon-module.html \module Phonon \title Phonon Module - \contentspage All Modules - \previouspage QtXmlPatterns - \nextpage Qt3Support \ingroup modules \brief The Phonon module contains namespaces and classes for multimedia functionality. @@ -607,9 +567,6 @@ /*! \module Qt3Support \title Qt3Support Module - \contentspage All Modules - \previouspage Phonon Module - \nextpage QtDesigner \ingroup modules \keyword Qt3Support @@ -640,9 +597,6 @@ /*! \module QtDesigner \title QtDesigner Module - \contentspage All Modules - \previouspage Qt3Support - \nextpage QtUiTools \ingroup modules \brief The QtDesigner module provides classes that allow you to @@ -667,9 +621,6 @@ \module QtUiTools \title QtUiTools Module \since 4.1 - \contentspage All Modules - \previouspage QtDesigner - \nextpage QtHelp \ingroup modules \brief The QtUiTools module provides classes to handle forms created @@ -703,9 +654,6 @@ /*! \module QtHelp \title QtHelp Module - \contentspage All Modules - \previouspage QtUiTools - \nextpage QtTest \ingroup modules \brief The QtHelp module provides classes for integrating @@ -762,9 +710,6 @@ /*! \module QtTest \title QtTest Module - \contentspage All Modules - \previouspage QtHelp - \nextpage QAxContainer \ingroup modules \keyword QtTest @@ -792,9 +737,6 @@ /*! \module QAxContainer \title QAxContainer Module - \contentspage All Modules - \previouspage QtTest - \nextpage QAxServer \ingroup modules \brief The QAxContainer module is a Windows-only extension for @@ -844,9 +786,6 @@ /*! \module QAxServer \title QAxServer Module - \contentspage All Modules - \previouspage QAxContainer - \nextpage QtDBus module \ingroup modules \brief The QAxServer module is a Windows-only static library that @@ -896,16 +835,13 @@ /*! \module QtDBus \title QtDBus module - \contentspage All Modules - \previouspage QAxServer \ingroup modules \keyword QtDBus \target The QDBus compiler \brief The QtDBus module is a Unix-only library that you can use - to perform Inter-Process Communication using the \l{Introduction to - D-Bus}{D-Bus} protocol. + to perform Inter-Process Communication using the \l{D-Bus} protocol. Applications using the QtDBus module can provide services to other, remote applications by exporting objects, as well as use @@ -931,7 +867,7 @@ directory. When installing Qt from source, this module is built when Qt's tools are built. - See the \l {Introduction to D-Bus} page for detailed information on + See the \l {D-Bus} page for detailed information on how to use this module. This module is part of all \l{Qt editions}. diff --git a/doc/src/objectmodel/metaobjects.qdoc b/doc/src/objectmodel/metaobjects.qdoc index dd00c5e..0597cd6 100644 --- a/doc/src/objectmodel/metaobjects.qdoc +++ b/doc/src/objectmodel/metaobjects.qdoc @@ -28,8 +28,9 @@ /*! \page metaobjects.html \title The Meta-Object System - \ingroup qt-basic-concepts \brief An overview of Qt's meta-object system and introspection capabilities. + + \ingroup qt-basic-concepts \keyword meta-object \target Meta-Object System diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc index 356aaaf..dca332e 100644 --- a/doc/src/objectmodel/properties.qdoc +++ b/doc/src/objectmodel/properties.qdoc @@ -28,8 +28,9 @@ /*! \page properties.html \title The Property System - \ingroup qt-basic-concepts \brief An overview of Qt's property system. + + \ingroup qt-basic-concepts \target Qt's Property System Qt provides a sophisticated property system similar to the ones diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index a1773a3..1c35a63 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -55,15 +55,14 @@ These pages are about Qt's traditional set of GUI components for building both native look ^ feel and custom UI's for the desktop - environment. Use \l {declarativeui.html} {Qt Quick} for building - UI's for mobile devices. + environment. Use \l{Qt Quick} for building UI's for mobile devices. \generatelist {related} */ /*! \group qt-graphics - \title Qt Graphics and Painting + \title Qt Graphics and Printing \brief The Qt components for doing graphics. @@ -91,11 +90,12 @@ /*! \group qt-activex - \title Qt For ActiveX - \brief Qt API's for using ActiveX controls, servers, and COM. + \title ActiveX in Qt \ingroup technology-apis \ingroup platform-specific + \brief Qt API's for using ActiveX controls, servers, and COM. + These pages document Qt's API's for developing with ActiveX controls, servers, and COM. @@ -104,7 +104,7 @@ /*! \group qt-sql - \title Using SQL in Qt + \title SQL in Qt \brief Qt API's for using SQL. \ingroup technology-apis \ingroup best-practices diff --git a/doc/src/painting-and-printing/paintsystem.qdoc b/doc/src/painting-and-printing/paintsystem.qdoc index e5eb75d..4c6fd91 100644 --- a/doc/src/painting-and-printing/paintsystem.qdoc +++ b/doc/src/painting-and-printing/paintsystem.qdoc @@ -273,7 +273,7 @@ \previouspage Paint Devices and Backends \contentspage The Paint System - \nextpage The Coordinate System + \nextpage Coordinate System \section1 Drawing @@ -395,7 +395,7 @@ \page paintsystem-images.html \title Reading and Writing Image Files - \previouspage The Coordinate System + \previouspage Coordinate System \contentspage The Paint System \nextpage Styling @@ -554,5 +554,5 @@ \endtable For more information about widget styling and appearance, see the - \l{Styles & Style Aware Widgets}. + \l{Styles and Style Aware Widgets}. */ diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc index b4f44bf..f416819 100644 --- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -147,12 +147,23 @@ your qmake.conf. #DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" \endcode -As demonstrated above, you need to Qt which drawing operations you want to -warn/disable. Since there are varying implementations of DirectFB from +As demonstrated above, you need to tell Qt which drawing operations you want +to warn/disable. Since there are varying implementations of DirectFB from manufacturer to manufacture, different operations will be optimized. This require you to define the operations you want to warn about or disable. These are listed above in the DIRECTFB_DRAWINGOPERATIONS variable. +You can also customize this with environment variables. + +E.g. If you want to disable fallbacks for drawPixmap and fillRect and also get +a warning printed on stderr when a fallback would have happened. + +\code +$ export QT_DIRECTFB_WARN_ON_RASTERFALLBACKS="FILL_RECT|DRAW_PIXMAP" +$ export QT_DIRECTFB_DISABLE_RASTERFALLBACKS="FILL_RECT|DRAW_PIXMAP" +$ ./app -qws -display directfb +\endcode + Following is a table showing which options you have. \table diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index 766c619..2501656 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -175,6 +175,9 @@ \l{http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/index.html} {Apple's Developer Website}. + Note: QCoreApplication::applicationDirPath() can be used to determine + the path of the binary within the bundle. + \section2 Translating the Application Menu and Native Dialogs The items in the Application Menu will be merged correctly for diff --git a/doc/src/platforms/platform-notes.qdocinc b/doc/src/platforms/platform-notes.qdocinc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/src/platforms/platform-notes.qdocinc diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index afb17c4..701707e 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -86,12 +86,12 @@ \tableofcontents - \section1 Required tools + \section1 Required Tools See \l{Qt for the Symbian platform Requirements} to see what tools are required to use Qt for the Symbian platform. - \section1 Installing Qt and running demos + \section1 Installing Qt and Running Demos Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} to learn how to install Qt using a binary package and how to build and run Qt demos. @@ -99,7 +99,7 @@ Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. - \section1 Building your own applications + \section1 Building Your Own Applications If you are new to Qt development, have a look at \l{How to Learn Qt}. In general, the difference between developing a @@ -112,12 +112,19 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 0 For more information on how to use qmake have a look at the \l - {qmake Tutorial}. + {qmake Tutorial}. In particular, see the + \l{qmake Platform Notes#Symbian platform}{qmake Platform Notes} for + details of Symbian-specific build settings. Now you can build the Qt for the Symbian platform application with - standard build tools. By default, running \c make will produce binaries for - the emulator. However, the Symbian platform comes with several alternative - build targets, as shown in the table below: + standard build tools. + + \section2 Alternative Build Targets + + By default, running \c make will produce binaries for the emulator. + However, the Symbian platform comes with several alternative + build targets that can be used to create binaries for target hardware + and deploy them on devices, as shown in the table below: \table \row \o \c debug-winscw \o Build debug binaries for the emulator (default). @@ -149,19 +156,30 @@ To work on your project in Carbide, simply import the \c .pro file by right clicking on the project explorer and executing "Import...". - \section2 Smart Installer + \section1 Running Applications from the Command Line - The Smart Installer makes sure that deployed applications have all the Qt dependencies - they need to run on a device. + The application can be launched on the emulator using \c{make run} command. - Download the latest release of the Smart Installer from \l{http://get.qt.nokia.com/nokiasmartinstaller/}, - and install it on top of the Qt package. + The application can be launched on a device using \c{make runonphone} command. + When this command is invoked, a \c .sis file is first created as if \c{make sis} + command was invoked (see above for details). + \bold{Note:} Running the application on a device using this command requires + \c TRK application to be running on the device. - \section1 Installing your own applications + Additional environment variables that can be utilized with these commands are: + \table + \row \o \c QT_RUN_OPTIONS \o Any command line parameters you wish to pass + to your application. + \row \o \c QT_RUN_ON_PHONE_OPTIONS \o Options for runonphone application. + Execute \c runonphone from command line for + more information about available options. + \c{make runonphone} only. + \endtable + + \section1 Installing Your Own Applications To install your own applications on hardware, you need a signed \c .sis file. - (Refer to the \l{http://developer.symbian.org/wiki/index.php/Platform_Security_%28Fundamentals_of_Symbian_C%2B%2B%29#Self-Signed_Applications} - {Platform Security Article} for more informations about self-signing.) + (Refer to the \l{Symbian Platform Security} article for more informations about self-signing.) The signed \c .sis file can be created with \c make \c sis target. \c sis target is only supported for executables or projects with \c DEPLOYMENT statements. By default the \c sis target will create signed \c .sis file for last build @@ -220,23 +238,19 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5 - \section1 Running applications from command line + \section1 Deployment and the Smart Installer - The application can be launched on the emulator using \c{make run} command. + Although some Symbian devices may already have a version of Qt installed + on them, there needs to be a way to ensure that an appropriate version + of Qt is available for your application to use. Rather than deploy the + required Qt libraries with your application, the preferred way to + package Qt applications for deployment is to download and use the Smart + Installer. - The application can be launched on a device using \c{make runonphone} command. - When this command is invoked, a \c .sis file is first created as if \c{make sis} - command was invoked (see above for details). - \bold{Note:} Running the application on a device using this command requires - \c TRK application to be running on the device. + The Smart Installer makes sure that deployed applications have all the + Qt dependencies they need to run on a device, performing the necessary + updates when the user installs the application. - Additional environment variables that can be utilized with these commands are: - \table - \row \o \c QT_RUN_OPTIONS \o Any command line parameters you wish to pass - to your application. - \row \o \c QT_RUN_ON_PHONE_OPTIONS \o Options for runonphone application. - Execute \c runonphone from command line for - more information about available options. - \c{make runonphone} only. - \endtable + More information about deployment can be found in the + \l{Deploying an Application on the Symbian Platform} document. */ diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index 698e4a5..69bf877 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -472,7 +472,7 @@ \section1 Explicit Sharing Qt 4 is the first version of Qt that contains no \link - http://qt.nokia.com/doc/3.3/shclass.html explicitly shared + http://doc.qt.nokia.com/3.3/shclass.html explicitly shared \endlink classes. All classes that were explicitly shared in Qt 3 are \e implicitly shared in Qt 4: @@ -1079,7 +1079,7 @@ ensuring that the string is '\\0'-terminated. Another important issue was that conversions between \c QCString and QByteArray often gave confusing results. (See the - \l{http://qt.nokia.com/doc/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung! + \l{http://doc.qt.nokia.com/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung! Binary and Character Data} article in \e{Qt Quarterly} for an overview of the pitfalls.) @@ -2440,13 +2440,13 @@ that provides the old semantics. See the Q3Painter documentation for details and for the reasons why we had to make this change. - The \l{http://qt.nokia.com/doc/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode} + The \l{http://doc.qt.nokia.com/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode} enum has been removed in Qt 4. All clipping operations are now defined using logical coordinates and are subject to transformation operations. The - \l{http://qt.nokia.com/doc/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP} + \l{http://doc.qt.nokia.com/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP} enum has been replaced with QPainter::CompositionMode. \section1 QPicture @@ -2598,7 +2598,7 @@ seems feeble. \endomit - See \l{Generic Containers} for a list of Qt 4 containers. + See \l{Container Classes} for a list of Qt 4 containers. \section1 QPtrDict<T> @@ -3258,7 +3258,7 @@ \list \o If you use Q3SocketDevice in a thread to perform blocking network I/O (a technique encouraged by the \e{Qt Quarterly} - article \l{http://qt.nokia.com/doc/qq/qq09-networkthread.html} + article \l{http://doc.qt.nokia.com/qq/qq09-networkthread.html} {Unblocking Networking}), you can now use QTcpSocket, QFtp, or QNetworkAccessManager, which can be used from non-GUI threads. @@ -3939,7 +3939,7 @@ check the index against QVector::size() yourself. \endlist - See \l{Generic Containers} for an overview of the Qt 4 container + See \l{Container Classes} for an overview of the Qt 4 container classes. \section1 QVariant @@ -4052,7 +4052,7 @@ Sample code on how to do obtain similar behavior from Qt 4, previously handled by some of the above functions can be found in the - \l{http://qt.nokia.com/doc/qwidget-qt3.html}{Qt 3 Support Members for QWidget} + \l{http://doc.qt.nokia.com/qwidget-qt3.html}{Qt 3 Support Members for QWidget} page. A widget now receives change events in its QWidget::changeEvent() @@ -4150,7 +4150,7 @@ clearWFlags() has no direct replacement. You can use QWidget::setAttribute() instead. For example, \c{setAttribute(..., false)} to clear an attribute. More information - is available \l{http://qt.nokia.com/doc/qwidget.html#setAttribute}{here}. + is available \l{http://doc.qt.nokia.com/qwidget.html#setAttribute}{here}. testWFlags() was renamed to \l{QWidget::testAttribute()}{testAttribute()}. diff --git a/doc/src/porting/qt4-tulip.qdoc b/doc/src/porting/qt4-tulip.qdoc index 08542a6..333af84 100644 --- a/doc/src/porting/qt4-tulip.qdoc +++ b/doc/src/porting/qt4-tulip.qdoc @@ -97,7 +97,7 @@ you are iterating, that won't affect the loop. For details about the new containers, see the - \l{Generic Containers} and \l{Generic Algorithms} overview documents. + \l{Container Classes} and \l{Generic Algorithms} overview documents. In addition to the new containers, considerable work has also gone into QByteArray and QString. The Qt 3 QCString class has been diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 89d564f..5d9b41b 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -141,7 +141,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/supported-platforms.html + \externalpage http://doc.qt.nokia.com/supported-platforms.html \title Platform Support Policy */ @@ -151,7 +151,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/supported-platforms.html + \externalpage http://doc.qt.nokia.com/supported-platforms.html \title Qt 4 Platforms Overview */ @@ -161,7 +161,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/qq/ + \externalpage http://doc.qt.nokia.com/qq/ \title Qt Quarterly */ @@ -181,7 +181,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/qtcanvas + \externalpage http://doc.qt.nokia.com/qtcanvas \title QtCanvas */ @@ -234,3 +234,8 @@ \externalpage http://qt.gitorious.org \title Public Qt Repository */ + +/*! + \externalpage http://get.qt.nokia.com/nokiasmartinstaller/ + \title Smart Installer +*/ diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 8867fd9..88ef2a8 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -86,7 +86,7 @@ In Qt 4.4: \list - \o \l{QtWebkit Module}{Qt WebKit integration}, making it possible for developers + \o \l{Webkit in QT}{Qt WebKit integration}, making it possible for developers to use a fully-featured Web browser to display documents and access online services. \o A multimedia API provided by the \l{Phonon Overview}{Phonon Multimedia Framework}. diff --git a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp index 088e043..0bd5fdf 100644 --- a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp +++ b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp @@ -87,14 +87,9 @@ void myFunction(bool useSubClass) // is equivalent to: const QScopedPointer<QWidget> p(new QWidget()); - QWidget *const p = new QWidget(); - // is equivalent to: - const QScopedPointer<QWidget> p(new QWidget()); - const QWidget *p = new QWidget(); // is equivalent to: QScopedPointer<const QWidget> p(new QWidget()); - //! [2] //! [3] diff --git a/doc/src/snippets/declarative/dynamicObjects.qml b/doc/src/snippets/declarative/SelfDestroyingRect.qml index 3698499..f14d2d2 100644 --- a/doc/src/snippets/declarative/dynamicObjects.qml +++ b/doc/src/snippets/declarative/SelfDestroyingRect.qml @@ -37,33 +37,24 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Qt 4.7 -//![0] Rectangle { - id: rootItem - width: 300 - height: 300 - - Component { - id: rectComponent - - Rectangle { - id: rect - width: 40; height: 40; - color: "red" - - NumberAnimation on opacity { from: 1; to: 0; duration: 1000 } - - Component.onCompleted: rect.destroy(1000); + id: rect + width: 80; height: 80 + color: "red" + + NumberAnimation on opacity { + to: 0 + duration: 1000 + + onRunningChanged: { + if (!running) { + console.log("Destroying...") + rect.destroy(); + } } } - - function createRectangle() { - var object = rectComponent.createObject(rootItem); - } - - Component.onCompleted: createRectangle() } //![0] diff --git a/doc/src/snippets/declarative/animation-behavioral.qml b/doc/src/snippets/declarative/animation-behavioral.qml new file mode 100644 index 0000000..dc79018 --- /dev/null +++ b/doc/src/snippets/declarative/animation-behavioral.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Item { + width: 100; height: 100 + + Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + Behavior on x { PropertyAnimation { duration: 500 } } + Behavior on y { PropertyAnimation { duration: 500 } } + } + + MouseArea { + anchors.fill: parent + onClicked: { rect.x = mouse.x; rect.y = mouse.y } + } +} +//![0] + diff --git a/doc/src/snippets/declarative/animation-easing.qml b/doc/src/snippets/declarative/animation-easing.qml new file mode 100644 index 0000000..e65c470 --- /dev/null +++ b/doc/src/snippets/declarative/animation-easing.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + width: 100; height: 100 + color: "red" + + PropertyAnimation on x { to: 50; duration: 1000; easing.type: Easing.OutBounce } + PropertyAnimation on y { to: 50; duration: 1000; easing.type: Easing.OutBounce } +} +//![0] + diff --git a/doc/src/snippets/declarative/animation-elements.qml b/doc/src/snippets/declarative/animation-elements.qml new file mode 100644 index 0000000..7cb253e --- /dev/null +++ b/doc/src/snippets/declarative/animation-elements.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Row { + +//![color] +Rectangle { + width: 100; height: 100 + + ColorAnimation on color { from: "red"; to: "yellow"; duration: 1000 } +} +//![color] + +//![rotation] +Item { + width: 300; height: 300 + + Rectangle { + width: 100; height: 100; anchors.centerIn: parent + color: "red" + + RotationAnimation on rotation { to: 90; direction: RotationAnimation.Clockwise } + } +} +//![rotation] + +} diff --git a/doc/src/snippets/declarative/animation-groups.qml b/doc/src/snippets/declarative/animation-groups.qml new file mode 100644 index 0000000..8a8f925 --- /dev/null +++ b/doc/src/snippets/declarative/animation-groups.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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 Qt 4.7 + +Row { + +//![0] +Rectangle { + id: rect + width: 120; height: 200 + + Image { + id: img + source: "pics/qt.png" + anchors.horizontalCenter: parent.horizontalCenter + y: 0 + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { to: rect.height - img.height; easing.type: Easing.OutBounce; duration: 2000 } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 } + } + } +} +//![0] + +//![1] +Rectangle { + id: redRect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "pressed"; when: mouseArea.pressed + PropertyChanges { target: redRect; color: "blue"; y: mouseArea.mouseY; width: mouseArea.mouseX } + } + + transitions: Transition { + + SequentialAnimation { + ColorAnimation { duration: 200 } + PauseAnimation { duration: 100 } + + ParallelAnimation { + NumberAnimation { + duration: 500 + easing.type: Easing.OutBounce + targets: redRect + properties: "y" + } + + NumberAnimation { + duration: 800 + easing.type: Easing.InOutQuad + targets: redRect + properties: "width" + } + } + } + } +} +//![1] + +} diff --git a/doc/src/snippets/declarative/animation-propertyvaluesource.qml b/doc/src/snippets/declarative/animation-propertyvaluesource.qml new file mode 100644 index 0000000..ac5f071 --- /dev/null +++ b/doc/src/snippets/declarative/animation-propertyvaluesource.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + width: 100; height: 100 + color: "red" + + PropertyAnimation on x { to: 50; duration: 1000; loops: Animation.Infinite } + PropertyAnimation on y { to: 50; duration: 1000; loops: Animation.Infinite } +} +//![0] + diff --git a/doc/src/snippets/declarative/animation-signalhandler.qml b/doc/src/snippets/declarative/animation-signalhandler.qml new file mode 100644 index 0000000..749596c --- /dev/null +++ b/doc/src/snippets/declarative/animation-signalhandler.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { + anchors.fill: parent + onClicked: PropertyAnimation { target: rect; properties: "x,y"; to: 50; duration: 1000 } + } +} + +//![0] + diff --git a/doc/src/snippets/declarative/animation-standalone.qml b/doc/src/snippets/declarative/animation-standalone.qml new file mode 100644 index 0000000..d75fd92 --- /dev/null +++ b/doc/src/snippets/declarative/animation-standalone.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + PropertyAnimation { + id: animation + target: rect + properties: "x,y" + duration: 1000 + } + + MouseArea { + anchors.fill: parent + onClicked: { + animation.to = 50; + animation.running = true; + } + } +} +//![0] diff --git a/doc/src/snippets/declarative/animation-transitions.qml b/doc/src/snippets/declarative/animation-transitions.qml new file mode 100644 index 0000000..3265065 --- /dev/null +++ b/doc/src/snippets/declarative/animation-transitions.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { + anchors.fill: parent + onClicked: rect.state = "moved" + } + + states: State { + name: "moved" + PropertyChanges { target: rect; x: 50; y: 50 } + } + + transitions: Transition { + PropertyAnimation { properties: "x,y"; duration: 1000 } + } +} +//![0] diff --git a/doc/src/snippets/declarative/animation.qml b/doc/src/snippets/declarative/animation.qml deleted file mode 100644 index 65acd36..0000000 --- a/doc/src/snippets/declarative/animation.qml +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import Qt 4.7 - -Row { - -//![property-anim-1] -Rectangle { - id: rect - width: 120; height: 200 - - Image { - id: img - source: "pics/qt.png" - x: 60 - img.width/2 - y: 0 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { to: 200 - img.height; easing.type: Easing.OutBounce; duration: 2000 } - PauseAnimation { duration: 1000 } - NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 } - } - } -} -//![property-anim-1] - -//![property-anim-2] -Rectangle { - width: 200; height: 200 - - Rectangle { - color: "red" - width: 50; height: 50 - NumberAnimation on x { to: 50 } - } -} -//![property-anim-2] - - -Item { -//![property-anim-3] -PropertyAnimation { - id: animation - target: image - property: "scale" - from: 1; to: 0.5 -} - -Image { - id: image - source: "pics/qt.png" - MouseArea { - anchors.fill: parent - onPressed: animation.start() - } -} -//![property-anim-3] -} - - -//![transitions-1] -transitions: [ - Transition { - NumberAnimation { - properties: "x,y" - easing.type: Easing.OutBounce - duration: 200 - } - } -] -//![transitions-1] - - -//![transitions-2] -Transition { - from: "*" - to: "MyState" - reversible: true - - SequentialAnimation { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutBounce - - // animate myItem's x and y if they have changed in the state - target: myItem - properties: "x,y" - } - - NumberAnimation { - duration: 1000 - - // animate myItem2's y to 200, regardless of what happens in the state - target: myItem2 - property: "y" - to: 200 - } - } -} -//![transitions-2] - - -//![transitions-3] -Transition { - from: "*" - to: "MyState" - reversible: true - - SequentialAnimation { - ColorAnimation { duration: 1000 } - PauseAnimation { duration: 1000 } - - ParallelAnimation { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutBounce - targets: box1 - properties: "x,y" - } - NumberAnimation { - duration: 1000 - targets: box2 - properties: "x,y" - } - } - } -} -//![transitions-3] - -//![behavior] -Rectangle { - id: redRect - color: "red" - width: 100; height: 100 - - Behavior on x { - NumberAnimation { duration: 300; easing.type: Easing.InOutQuad } - } -} -//![behavior] - -} diff --git a/doc/src/snippets/declarative/component.qml b/doc/src/snippets/declarative/component.qml new file mode 100644 index 0000000..09c4aa2 --- /dev/null +++ b/doc/src/snippets/declarative/component.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Item { + width: 100; height: 100 + + Component { + id: redSquare + + Rectangle { + color: "red" + width: 10 + height: 10 + } + } + + Loader { sourceComponent: redSquare } + Loader { sourceComponent: redSquare; x: 20 } +} +//![0] diff --git a/doc/src/snippets/declarative/createComponent-simple.qml b/doc/src/snippets/declarative/createComponent-simple.qml new file mode 100644 index 0000000..9669580 --- /dev/null +++ b/doc/src/snippets/declarative/createComponent-simple.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Item { + id: container + width: 300; height: 300 + + function loadButton() { + var component = Qt.createComponent("Button.qml"); + if (component.status == Component.Ready) { + var button = component.createObject(container); + button.color = "red"; + } + } + + Component.onCompleted: loadButton() +} +//![0] diff --git a/doc/src/snippets/declarative/createQmlObject.qml b/doc/src/snippets/declarative/createQmlObject.qml index 64dd21d..a5f15f4 100644 --- a/doc/src/snippets/declarative/createQmlObject.qml +++ b/doc/src/snippets/declarative/createQmlObject.qml @@ -51,6 +51,10 @@ Rectangle { var newObject = Qt.createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}', parentItem, "dynamicSnippet1"); //![0] + +//![destroy] +newObject.destroy(1000); +//![destroy] } Component.onCompleted: createIt() diff --git a/doc/src/snippets/declarative/dynamicObjects-destroy.qml b/doc/src/snippets/declarative/dynamicObjects-destroy.qml new file mode 100644 index 0000000..2c0c2fb --- /dev/null +++ b/doc/src/snippets/declarative/dynamicObjects-destroy.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Nokia Corporation 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$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Item { + id: container + width: 500; height: 100 + + Component.onCompleted: { + var component = Qt.createComponent("SelfDestroyingRect.qml"); + for (var i=0; i<5; i++) { + var object = component.createObject(container); + object.x = (object.width + 10) * i; + } + } +} +//![0] diff --git a/doc/src/snippets/declarative/qmldocuments.qml b/doc/src/snippets/declarative/qmldocuments.qml new file mode 100644 index 0000000..c19a658 --- /dev/null +++ b/doc/src/snippets/declarative/qmldocuments.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import Qt 4.7 + +Rectangle { + property alias text: textItem.text + + width: 100; height: 30 + border.width: 1 + radius: 5 + smooth: true + + gradient: Gradient { + GradientStop { position: 0.0; color: "darkGray" } + GradientStop { position: 0.5; color: "black" } + GradientStop { position: 1.0; color: "darkGray" } + } + + Text { + id: textItem + anchors.centerIn: parent + font.pointSize: 20 + color: "white" + } + +} +//![0] diff --git a/doc/src/snippets/declarative/state-when.qml b/doc/src/snippets/declarative/state-when.qml new file mode 100644 index 0000000..6d3bb75 --- /dev/null +++ b/doc/src/snippets/declarative/state-when.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import Qt 4.7 +//![0] +Rectangle { + id: myRect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "hidden"; when: mouseArea.pressed + PropertyChanges { target: myRect; opacity: 0 } + } +} +//![0] diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml index af6b103..ce2653b 100644 --- a/doc/src/snippets/declarative/state.qml +++ b/doc/src/snippets/declarative/state.qml @@ -44,13 +44,19 @@ import Qt 4.7 Rectangle { id: myRect width: 100; height: 100 - color: "red" + color: "black" - MouseArea { id: mouseArea; anchors.fill: parent } - - states: State { - name: "hidden"; when: mouseArea.pressed - PropertyChanges { target: myRect; opacity: 0 } + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: myRect.state == 'clicked' ? myRect.state = "" : myRect.state = 'clicked'; } + + states: [ + State { + name: "clicked" + PropertyChanges { target: myRect; color: "red" } + } + ] } //![0] diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml index c3b1796..127e3a7 100644 --- a/doc/src/snippets/declarative/states.qml +++ b/doc/src/snippets/declarative/states.qml @@ -40,42 +40,22 @@ ****************************************************************************/ //![0] import Qt 4.7 - -Item { - id: myItem + +Rectangle { + id: myRect width: 200; height: 200 + color: "red" - Rectangle { - id: myRect - width: 100; height: 100 - color: "red" + MouseArea { + anchors.fill: parent + onClicked: myRect.state = 'moved' } states: [ State { name: "moved" - PropertyChanges { - target: myRect - x: 50 - y: 50 - } + PropertyChanges { target: myRect; x: 50; y: 50 } } ] - - MouseArea { - anchors.fill: parent - onClicked: myItem.state = 'moved' - } -//![0] - -//![transitions] -transitions: [ - Transition { - NumberAnimation { properties: "x,y"; duration: 500 } - } -] -//![transitions] - -//![1] } -//![1] +//![0] diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml index b884750..098d509 100644 --- a/doc/src/snippets/declarative/transition.qml +++ b/doc/src/snippets/declarative/transition.qml @@ -46,13 +46,18 @@ Rectangle { width: 100; height: 100 color: "red" + MouseArea { + id: mouseArea + anchors.fill: parent + } + states: State { - name: "moved" + name: "moved"; when: mouseArea.pressed PropertyChanges { target: rect; x: 50; y: 50 } } transitions: Transition { - PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } + NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } } } //![0] diff --git a/doc/src/snippets/legal/CatharonLicense.txt b/doc/src/snippets/legal/CatharonLicense.txt new file mode 100644 index 0000000..789c8c9 --- /dev/null +++ b/doc/src/snippets/legal/CatharonLicense.txt @@ -0,0 +1,123 @@ + The Catharon Open Source LICENSE + ---------------------------- + + 2000-Jul-04 + + Copyright (C) 2000 by Catharon Productions, Inc. + + + +Introduction +============ + + This license applies to source files distributed by Catharon + Productions, Inc. in several archive packages. This license + applies to all files found in such packages which do not fall + under their own explicit license. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we are + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + Catharon Code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering the packages distributed by + Catharon Productions, Inc. and assume no liability related to + their use. + + +Legal Terms +=========== + +0. Definitions +-------------- + + Throughout this license, the terms `Catharon Package', `package', + and `Catharon Code' refer to the set of files originally + distributed by Catharon Productions, Inc. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using one of the + Catharon Packages'. + + This license applies to all files distributed in the original + Catharon Package(s), including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The Catharon Packages are copyright (C) 2000 by Catharon + Productions, Inc. All rights reserved except as specified below. + +1. No Warranty +-------------- + + THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO + USE THE CATHARON PACKAGE. + +2. Redistribution +----------------- + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the Catharon Packages (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`license.txt') unaltered; any additions, deletions or changes + to the original files must be clearly indicated in + accompanying documentation. The copyright notices of the + unaltered, original files must be preserved in all copies of + source files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part on the work of + Catharon Productions, Inc. in the distribution documentation. + + These conditions apply to any software derived from or based on + the Catharon Packages, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising +-------------- + + Neither Catharon Productions, Inc. and contributors nor you shall + use the name of the other for commercial, advertising, or + promotional purposes without specific prior written permission. + + We suggest, but do not require, that you use the following phrase + to refer to this software in your documentation: 'this software is + based in part on the Catharon Typography Project'. + + As you have not signed this license, you are not required to + accept it. However, as the Catharon Packages are copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the Catharon + Packages, you indicate that you understand and accept all the + terms of this license. + +--- end of license.txt --- diff --git a/doc/src/snippets/sharedemployee/employee.h b/doc/src/snippets/sharedemployee/employee.h index 18b47e0..2c9ba6f 100644 --- a/doc/src/snippets/sharedemployee/employee.h +++ b/doc/src/snippets/sharedemployee/employee.h @@ -48,7 +48,7 @@ class EmployeeData : public QSharedData { public: - EmployeeData() : id(-1) { name.clear(); } + EmployeeData() : id(-1) { } EmployeeData(const EmployeeData &other) : QSharedData(other), id(other.id), name(other.name) { } ~EmployeeData() { } diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css deleted file mode 100644 index 9f5d28b..0000000 --- a/doc/src/template/style/OfflineStyle.css +++ /dev/null @@ -1,251 +0,0 @@ -@media screen -{ - - .wrapper - { - top:50px; - background: none; - - } - .wrapper .bd - { - background: none; - position: relative; - } - - - - - body.offline - { - background-image: none; - background-color: #FFFFFF; - - } - - .offline .footer { - margin: 0; - } - .offline .header - { - width: 100%; - margin: 0; - height: auto; - background-color: #ffffff; - padding: 10px 0 5px 0; - overflow: visible; - border-bottom: solid #E5E5E5 1px; - z-index:1; - position:fixed; - } - - .offline .header .content - { - } - .offline .header .qtref - { - color: #00732F; - position: static; - float: left; - margin-left: 5px; - font: bold 18px/1 Arial; - } - - .offline .header .qtref:visited - { - color: #00732F; - } - .offline .header .qtref:hover - { - color: #00732F; - text-decoration:none; - } - .offline .header .qtref span - { - background-image: none; - text-indent: 0; - text-decoration:none; - } - - .offline .wrap - { - margin: 0 5px 0 5px; - } - - .offline .wrap .toolbar - { - display:block; - padding-top:5px; - } - - .offline .wrap .breadcrumb ul li { - font-weight: normal; - } - - .offline .wrap .breadcrumb ul li a { - /*color: #44a51c;*/ - } - - .offline .wrap .breadcrumb ul li.last a { - /*color: #363534;*/ - } - - - - .narrow .indexboxcont .section { - width: 64%; - padding-left: 0; - } - - .narrow .indexboxcont .sectionlist { - width: 32.5%; - } - - .header .icon, - .sidebar, - .feedback, - .t_button, - .feedback, - #feedbackBox, - #feedback, - #blurpage, - .indexbox .indexIcon span, - .wrapper .hd, - .offline .indexbox .indexIcon, - .offline .header #nav-logo, - #offlinemenu, - #offlinesearch, - .offline .header #nav-topright, - .offline .header #shortCut , - .offline .wrapper .hd, - .offline .wrapper .ft, - .offline .sidebar, - .offline .wrap .feedback - { - display:none; - } - - /* end offline mode */ -#narrowmenu { - display: none; - float: right; - margin: 15px 40px 0 0; - font-size: 11px; - } - - .narrow #narrowmenu { - display: block; - } - - #narrowsearch{ - display:none; - } - - #narrowmenu ul - { - border-bottom:solid 1px #E5E5E5; - border-left:solid 1px #E5E5E5; - border-right:solid 1px #E5E5E5; - } - - #narrowmenu a { - line-height: 1.1; - background: url(../images/arrow_down.png) no-repeat 100% 50%; - white-space: nowrap; - padding: 0 16px 0 5px; - } - - #narrowmenu li { - margin-left: 20px; - } - - #narrowmenu li li { - margin: 0 0 5px 0; - } - - #narrowmenu li li a { - padding: 0; - background-image: none; - } - - #narrowmenu li, - #narrowmenu li ul { - background-color: #fff; - } - - #narrowmenu li ul { - width: auto; - padding: 5px; - margin-top:-15px; - } - - .sf-menu li:hover ul, .sf-menu li.sfHover ul { - top: 1.2em; - } -.sf-menu, .sf-menu * { - margin: 0; - padding: 0; - list-style: none; -} -.sf-menu { - line-height: 1.0; -} -.sf-menu ul { - position: absolute; - top: -999em; - width: 10em; /* left offset of submenus need to match (see below) */ -} -.sf-menu ul li { - width: 100%; -} -.sf-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ -} -.sf-menu li { - float: left; - position: relative; -} -.sf-menu a { - display: block; - position: relative; -} -.sf-menu li:hover ul, -.sf-menu li.sfHover ul { - left: 0; - top: 2.5em; /* match top ul list item height */ - z-index: 99; -} -ul.sf-menu li:hover li ul, -ul.sf-menu li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li:hover ul, -ul.sf-menu li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} -ul.sf-menu li li:hover li ul, -ul.sf-menu li li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li li:hover ul, -ul.sf-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} - .wrap .content ol li { - background:none; - font:400 10pt/1 Verdana; - margin-bottom:10px; - margin-left:12px; - } - .wrap .content ol li { - list-style-type:decimal; - - } - - - -} -/* end of screen media */ - diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index 05159aa..e4ad135 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -15,7 +15,12 @@ } .narrow .footer { - margin: 0; + margin: 0px; + } + + .creator .header, .creator .header .content, .creator .footer, .creator .wrapper { + margin: 0px; + min-width: 300px; } .narrow .header { @@ -126,6 +131,11 @@ margin: 0 5px 0 5px; } + .creator .wrap + { + margin: 0px; + background:#FFFFFF; + } .narrow .wrap .toolbar { border-bottom: none; @@ -135,7 +145,14 @@ { padding-top: 15px; } - + .creator .wrap .content + { + padding-top: 10px; + } + .creator .wrap .content .guide + { + padding-top: 15px; + } .narrow .wrap .feedback { display: none; diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 9f80921..6a32e53 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -114,6 +114,8 @@ { border: 1px solid #DDDDDD; -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; margin: 0 20px 10px 10px; padding: 20px 15px 20px 20px; overflow-x: auto; @@ -121,6 +123,8 @@ table, pre { -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; @@ -855,6 +859,8 @@ background-color:#F6F6F6; border:1px solid #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; font-size:12pt; padding-left:10px; margin-top:10px; @@ -911,6 +917,8 @@ { display: none; -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; position: fixed; top: 100px; @@ -974,6 +982,8 @@ { float: right; -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border: 1px solid #DDDDDD; margin: 0 20px 10px 10px; @@ -1068,6 +1078,8 @@ .relpage { -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; padding: 25px 25px; clear: both; @@ -1084,6 +1096,8 @@ h3.fn, span.fn { -moz-border-radius:7px 7px 7px 7px; + -webkit-border-radius:7px 7px 7px 7px; + border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; @@ -1102,6 +1116,8 @@ border-style: solid; border-color: #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; width:100%; } @@ -1345,7 +1361,7 @@ font: normal 13px/1.2 Verdana; color: #363534; - background-color: #FFFFFF; + background-color: #FAFAFA; } @@ -1359,7 +1375,7 @@ .creator .wrapper { position:relative; - top:50px; + top:5px; } .creator .wrapper .bd { @@ -1406,7 +1422,9 @@ border-bottom:1px solid #E5E5E5; - width:100%, + /*width:100%;*/ + margin-left:-5px; + margin-right:-5px; } .creator .wrap .breadcrumb ul li a { @@ -1468,7 +1486,7 @@ - position:fixed; + /* position:fixed;*/ } @@ -1550,18 +1568,17 @@ @media print { - input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft + input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult { display: none; background: none; } .content { - position: absolute; - top: 0px; - left: 0px; background: none; display: block; + width: 100%; margin: 0; float: none; + } } /* end of print media */ diff --git a/doc/src/template/style/superfish_skin.css b/doc/src/template/style/superfish_skin.css deleted file mode 100644 index 8d84827..0000000 --- a/doc/src/template/style/superfish_skin.css +++ /dev/null @@ -1,83 +0,0 @@ - -/*** DEMO SKIN ***/ -.sf-menu { - float: left; - margin-bottom: 1em; -} -.sf-menu a { - border-left: 1px solid #fff; - border-top: 1px solid #CFDEFF; - padding: .75em 1em; - text-decoration:none; -} -.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ - color: #13a; -} -.sf-menu li { - background: #BDD2FF; -} -.sf-menu li li { - background: #AABDE6; -} -.sf-menu li li li { - background: #9AAEDB; -} -.sf-menu li:hover, .sf-menu li.sfHover, -.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active { - background: #CFDEFF; - outline: 0; -} - -/*** arrows **/ -.sf-menu a.sf-with-ul { - padding-right: 2.25em; - min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */ -} -.sf-sub-indicator { - position: absolute; - display: block; - right: .75em; - top: 1.05em; /* IE6 only */ - width: 10px; - height: 10px; - text-indent: -999em; - overflow: hidden; - background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */ -} -a > .sf-sub-indicator { /* give all except IE6 the correct values */ - top: .8em; - background-position: 0 -100px; /* use translucent arrow for modern browsers*/ -} -/* apply hovers to modern browsers */ -a:focus > .sf-sub-indicator, -a:hover > .sf-sub-indicator, -a:active > .sf-sub-indicator, -li:hover > a > .sf-sub-indicator, -li.sfHover > a > .sf-sub-indicator { - background-position: -10px -100px; /* arrow hovers for modern browsers*/ -} - -/* point right for anchors in subs */ -.sf-menu ul .sf-sub-indicator { background-position: -10px 0; } -.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; } -/* apply hovers to modern browsers */ -.sf-menu ul a:focus > .sf-sub-indicator, -.sf-menu ul a:hover > .sf-sub-indicator, -.sf-menu ul a:active > .sf-sub-indicator, -.sf-menu ul li:hover > a > .sf-sub-indicator, -.sf-menu ul li.sfHover > a > .sf-sub-indicator { - background-position: -10px 0; /* arrow hovers for modern browsers*/ -} - -/*** shadows for all but IE6 ***/ -.sf-shadow ul { - background: url('../images/shadow.png') no-repeat bottom right; - padding: 0 8px 9px 0; - -moz-border-radius-bottomleft: 17px; - -moz-border-radius-topright: 17px; - -webkit-border-top-right-radius: 17px; - -webkit-border-bottom-left-radius: 17px; -} -.sf-shadow ul.sf-shadow-off { - background: transparent; -} diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 98096a0..b39a01c 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -80,8 +80,8 @@ /*! \page modelview-part1.html - \contentspage {modelview-index.html}{Model/View Contents} - \previouspage {modelview-index.html}{Model/View Contents} + \contentspage {modelview.html}{Model/View Contents} + \previouspage {modelview.html}{Model/View Contents} \nextpage {modelview-part2.html}{Developing a Simple Model/View Application} \title An Introduction to Model/View Programming diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc index aa4a933..d2687ea 100644 --- a/doc/src/widgets-and-layouts/layout.qdoc +++ b/doc/src/widgets-and-layouts/layout.qdoc @@ -37,9 +37,9 @@ \brief A tour of the standard layout managers and an introduction to custom layouts. - \previouspage Widget Classes + \previouspage Widgets and Layouts \contentspage Widgets and Layouts - \nextpage {Implementing Styles and Style Aware Widgets}{Styles} + \nextpage {Styles and Style Aware Widgets}{Styles} \ingroup frameworks-technologies @@ -242,7 +242,7 @@ For further guidance when implementing these functions, see the \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq04-height-for-width.html} + \l{http://doc.qt.nokia.com/qq/qq04-height-for-width.html} {Trading Height for Width}. diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index eab7014..180260b 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -33,7 +33,7 @@ /*! \page style-reference.html - \title Styles & Style Aware Widgets + \title Styles and Style Aware Widgets \ingroup qt-gui-concepts \brief Styles and the styling of widgets. diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 1390376..5c72570 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -32,7 +32,7 @@ \ingroup frameworks-technologies - \previouspage {Implementing Styles and Style Aware Widgets}{Styles} + \previouspage {Styles and Style Aware Widgets}{Styles} \contentspage Widgets and Layouts \nextpage The Style Sheet Syntax @@ -925,7 +925,7 @@ The scroller is styled using the \l{#scroller-sub}{::scroller}. - The tear-off is styled using the \l{#tear-off-sub}{::tear-off}. + The tear-off is styled using the \l{#tearoff-sub}{::tearoff}. See \l{Qt Style Sheets Examples#Customizing QMenu}{Customizing QMenu} for an example. @@ -3337,7 +3337,7 @@ \o The tear indicator of a QTabBar. \row - \o \c ::tear-off \target tear-off-sub + \o \c ::tearoff \target tearoff-sub \o The tear-off indicator of a QMenu. \row diff --git a/doc/src/widgets-and-layouts/widgets.qdoc b/doc/src/widgets-and-layouts/widgets.qdoc index 18b8be1..fbce744 100644 --- a/doc/src/widgets-and-layouts/widgets.qdoc +++ b/doc/src/widgets-and-layouts/widgets.qdoc @@ -67,7 +67,7 @@ \section1 Widget Styles - \l{Styles & Style Aware Widgets}{Styles} draw on behalf of + \l{Styles and Style Aware Widgets}{Styles} draw on behalf of widgets and encapsulate the look and feel of a GUI. Qt's built-in widgets use the QStyle class to perform nearly all of their drawing, ensuring that they look exactly like the equivalent native widgets. diff --git a/doc/src/windows-and-dialogs/dialogs.qdoc b/doc/src/windows-and-dialogs/dialogs.qdoc index 6316dc9..bcf9c0e 100644 --- a/doc/src/windows-and-dialogs/dialogs.qdoc +++ b/doc/src/windows-and-dialogs/dialogs.qdoc @@ -27,12 +27,9 @@ /*! \group standard-dialogs - \title Standard Dialog Classes -*/ - -/*! - \group dialog-classes - \title Classes for Building Dialogs + \ingroup qt-gui-concepts + \title Standard Dialogs + \brief A list of Qt classes for implementing standard dialogs. */ /*! @@ -41,7 +38,7 @@ \ingroup qt-gui-concepts \brief An overview over dialog windows. - \previouspage The Application Main Window + \previouspage Application Main Window \contentspage Application Windows and Dialogs \nextpage Desktop Integration diff --git a/doc/src/xml-processing/xml-patterns.qdoc b/doc/src/xml-processing/xml-patterns.qdoc index 3e591da..9f1917d 100644 --- a/doc/src/xml-processing/xml-patterns.qdoc +++ b/doc/src/xml-processing/xml-patterns.qdoc @@ -27,7 +27,7 @@ /*! \page xmlprocessing.html - \title Using XML Technologies + \title XQuery \previouspage Working with the DOM Tree \contentspage XML Processing diff --git a/doc/src/xml-processing/xml-processing.qdoc b/doc/src/xml-processing/xml-processing.qdoc index 0d58301..dcdd8d1 100644 --- a/doc/src/xml-processing/xml-processing.qdoc +++ b/doc/src/xml-processing/xml-processing.qdoc @@ -32,13 +32,15 @@ \brief Classes that support XML, via, for example DOM and SAX. These classes are relevant to XML users. - + \generatelist{related} */ /*! \page xml-processing.html \title XML Processing + \ingroup technology-apis + \brief An Overview of the XML processing facilities in Qt. In addition to core XML support, classes for higher level querying @@ -57,7 +59,7 @@ \o \l {XML Streaming} \o \l {The SAX Interface} \o \l {Working with the DOM Tree} - \o \l {Using XML Technologies}{XQuery/XPath and XML Schema} + \o \l {XQuery}{XQuery/XPath and XML Schema} \list \o \l{A Short Path to XQuery} \endlist @@ -525,7 +527,7 @@ \previouspage The SAX Interface \contentspage XML Processing - \nextpage {Using XML Technologies}{XQuery/XPath and XML Schema} + \nextpage {XQuery}{XQuery/XPath and XML Schema} DOM Level 2 is a W3C Recommendation for XML interfaces that maps the constituents of an XML document to a tree structure. The specification diff --git a/doc/src/xml-processing/xquery-introduction.qdoc b/doc/src/xml-processing/xquery-introduction.qdoc index 09af688..b79c205 100644 --- a/doc/src/xml-processing/xquery-introduction.qdoc +++ b/doc/src/xml-processing/xquery-introduction.qdoc @@ -29,7 +29,7 @@ \page xquery-introduction.html \title A Short Path to XQuery -\startpage Using XML Technologies +\startpage XQuery \target XQuery-introduction XQuery is a language for querying XML data or non-XML data that can be |