From 177d6865c65719c7c6ffdb6c8fd1e7c3e049e1e1 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 13 Dec 2010 16:03:20 +0100 Subject: Added \ingroup for the overview pages and \group page. --- doc/src/declarative/anchor-layout.qdoc | 5 +- doc/src/declarative/animation.qdoc | 34 ++++---- doc/src/declarative/basictypes.qdoc | 18 ++-- doc/src/declarative/declarativeui.qdoc | 124 ++++++++++++++-------------- doc/src/declarative/dynamicobjects.qdoc | 24 +++--- doc/src/declarative/extending.qdoc | 25 +++--- doc/src/declarative/focus.qdoc | 2 + doc/src/declarative/integrating.qdoc | 11 +-- doc/src/declarative/network.qdoc | 3 +- doc/src/declarative/positioners.qdoc | 5 ++ doc/src/declarative/propertybinding.qdoc | 30 ++++--- doc/src/declarative/qdeclarativei18n.qdoc | 1 + doc/src/declarative/qdeclarativemodels.qdoc | 44 +++++----- doc/src/declarative/qdeclarativestates.qdoc | 42 +++++----- doc/src/declarative/qtbinding.qdoc | 1 + doc/src/overviews.qdoc | 28 ++++++- 16 files changed, 229 insertions(+), 168 deletions(-) diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index b77ce36..2435e4e 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -28,13 +28,16 @@ /*! \page qml-anchor-layout.html \target anchor-layout +\contentspage QML Features +\previouspage Using QML Positioner and Repeater Items +\nextpage Using QML Positioner and Repeater Items \title Anchor-based Layout in QML In addition to the more traditional \l Grid, \l Row, and \l Column, QML also provides a way to layout items using the concept of \e anchors. Each item can be thought of as having a set of 7 invisible "anchor lines": \l {Item::anchors.left}{left}, \l {Item::anchors.horizontalCenter}{horizontalCenter}, -\l {Item::anchors.right}{right}, \l {Item::anchors.top}{top}, +\l {Item::anchors.right}{right}, \l {Item::anchors.top}{top}, \l {Item::anchors.verticalCenter}{verticalCenter}, \l {Item::anchors.baseline}{baseline}, and \l {Item::anchors.bottom}{bottom}. diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 208a1c4..708f412 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -27,6 +27,8 @@ /*! \page qdeclarativeanimation.html +\ingroup qml-features +\contentspage QML Features \title QML Animation @@ -80,7 +82,7 @@ States}{state changes} 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 +create an animation. See the \l {Animation Elements} section further below for details. @@ -92,7 +94,7 @@ 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 @@ -141,7 +143,7 @@ demonstration of behavioral animations. 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 @@ -156,8 +158,8 @@ The \l {PropertyAnimation::}{to} property is also required to specify the new \section2 Standalone Animations Animations can also be created as ordinary QML objects that are not bound to -any particular objects and properties. Here is an example, using a -PropertyAnimation object. The animation is explicitly started when the +any particular objects and properties. Here is an example, using a +PropertyAnimation object. The animation is explicitly started when the \l Rectangle is clicked: \snippet doc/src/snippets/declarative/animation-standalone.qml 0 @@ -187,10 +189,10 @@ object and add it to an item's \l {Item::}{transitions} property. An example: The PropertyChanges object in the \e moved state defines that when the \l Rectangle is in this state, its position should be changed -to (50, 50). When the \l Rectangle changes to the \e moved state, the +to (50, 50). When the \l Rectangle changes to the \e moved state, the \l Transition will be triggered, and the transition's \l PropertyAnimation will animate the changes in the \c x and \c y properties to their new values. -The animation will not be applied at any time other than during the state +The animation will not be applied at any time other than during the state change. Notice the example does not set any \l {PropertyAnimation::}{from} and \l @@ -231,13 +233,13 @@ It can also define the number of \l {Animation::}{loops} for an animation. 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. +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. -A ColorAnimation allows color values for the \l {ColorAnimation::}{from} +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: @@ -251,10 +253,10 @@ animates the rectangle's \l {Item::rotation} property: In addition, the following specialized animation elements are available: \list -\o SmoothedAnimation: a specialized NumberAnimation that provides smooth +\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}, +\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) diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 034b7d1..0277ccb 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -27,12 +27,14 @@ /*! \page qdeclarativebasictypes.html + \ingroup qml-features + \contentspage QML Features \title QML Basic Types QML has a set of primitive types, as listed below, that are used throughout the \l {QML Elements}. - Some of these types can also be used for defining + Some of these types can also be used for defining \c property values in QML. See \l{Writing QML Components: Properties, Methods and Signals} for the list of types that can be used for \c property values. @@ -43,7 +45,7 @@ \qmlbasictype int \ingroup qmlbasictypes - \brief An integer is a whole number, e.g. 0, 10, or -20. + \brief An integer is a whole number, e.g. 0, 10, or -20. An integer is a whole number, e.g. 0, 10, or -20. The possible \c int values range from around -2000000000 to around 2000000000, @@ -117,7 +119,7 @@ \qmlbasictype url \ingroup qmlbasictypes - \brief A URL is a resource locator, like a file name. + \brief A URL is a resource locator, like a file name. A URL is a resource locator, like a file name. It can be either absolute, e.g. "http://qt.nokia.com", or relative, e.g. @@ -198,7 +200,7 @@ /*! \qmlbasictype size \ingroup qmlbasictypes - + \brief A size type has width and height attributes A \c size type has \c width and \c height attributes. @@ -237,7 +239,7 @@ For example, to read the \l {Item::childrenRect.x}{Item::childrenRect} \c rect property: \qml - Rectangle { + Rectangle { width: childrenRect.width height: childrenRect.height @@ -273,7 +275,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } \endqml - To read a date value returned from a C++ extension class, use + To read a date value returned from a C++ extension class, use \l{QML:Qt::formatDate()}{Qt.formatDate()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. \sa {QML Basic Types} @@ -292,7 +294,7 @@ MyTimePicker { time: "14:22:15" } \endqml - To read a time value returned from a C++ extension class, use + To read a time value returned from a C++ extension class, use \l{QML:Qt::formatTime()}{Qt.formatTime()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. \sa {QML Basic Types} @@ -493,7 +495,7 @@ \qml Text { horizontalAlignment: "AlignRight" } \endqml - + or as \c {.}: \qml Text { horizontalAlignment: Text.AlignRight } diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 41b9952..b17d178 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -31,12 +31,12 @@ \ingroup qt-gui-concepts \brief Qt Quick provides a declarative framework for building highly -dynamic, custom user interfaces. +dynamic user interfaces. \section1 Introduction Qt Quick is a collection of technologies that are designed to help -developers create the kind of intuitive, modern-looking, fluid user +developers create the kind of intuitive, modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other portable devices. @@ -45,7 +45,7 @@ language for describing user interfaces and a language runtime. A collection of C++ APIs is used to integrate these high level features with classic Qt applications. -\section2 QML, Elements and the Qt Declarative Module +\section2 QML User interfaces and their behavior are described using QML, an extension to \l{About JavaScript}{JavaScript} that lets developers and designers @@ -55,64 +55,62 @@ graphical and behavioral building blocks that can be combined together in \l{QML Documents}{QML documents} to build components ranging in complexity from simple buttons and sliders, to complete Internet-enabled applications. -QML improves the integration between 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. +\section2 Qt Declarative Module -The Qt Declarative module implements the interface between the QML language -and the elements available to it. It also provides a C++ API that can be -used to load and interact with QML files from within Qt applications. +The Qt Declarative module provides a C++ API that is for interacting with QML files from within Qt applications. The module allows the programmer to build applications' backend logic using Qt. -Qt Quick builds on \l{QML for Qt programmers}{Qt's existing strengths}. -QML can be be used to incrementally extend an existing application or -to build completely new applications. QML is fully -\l{Extending QML in C++}{extensible from C++} through the Qt Declarative -Module. +QML and the Qt Declarative Module separate the frontend UI logic from the backend logic. \section1 Getting Started \list -\o \l{What's new in Qt Quick} -\o \l{Introduction to the QML language} -\o \l{QML for Qt Programmers} +\o \l{Intro to Qt Quick}{Introduction to Qt Quick} +\o \l{Introduction to the QML language}{Introduction to the QML Language} +\o \l{QML for Qt Programmers}{QML Programming for Qt Programmers} \o \l{Getting Started Programming with QML} -\o \l{Intro to Qt Quick} +\o \l{What's new in Qt Quick}{What's New in the Qt Quick Release} \endlist -\list -\o \l{QML Tutorial}{Tutorial: "Hello World"} -\o \l{QML Advanced Tutorial}{Tutorial: "Same Game"} -\o \l{QML Examples and Demos} -\endlist - -\section1 QML Concepts +\section1 QML Features \list -\o \l{QML Documents} \o \l{Property Binding} -\o \l{Anchor-based Layout in QML} -\o \l{Writing QML Components: Properties, Methods and Signals} -\o \l{QML Scope} -\o \l{QML Modules} +\o \l{Using QML Positioner and Repeater Items}{Component Layouts} +\o \l{Anchor-based Layout in QML}{Anchor Layout} +\o \l{Writing QML Components: Properties, Methods and Signals}{Reusable Components} +\o \l{Text Handling} +\o \l{Keyboard Focus in QML}{Keyboard Focus} +\o \l{Mouse Events} +\o \l{QML States} {States} +\o \l{QML Animation}{Animation and Transitions} +\o \l{QML Basic Types}{QML Basic Data Types} +\o \l{QML Data Models}{Structuring Data with Models} +\o \l{Presenting Data with QML}{Presenting Data with Views} +\o \l{Affine Transformations} +\o \l{Dynamic Object Management in QML}{Dynamic Object Management} +\o \l{Network Transparency}{Resource Loading} +\o \l{Extending QML in C++}{Extending QML Functionalities using C++} +\o \l{Using QML in C++ Applications} +\o \l{Integrating QML with existing Qt UI code}{Integrating QML Code with Existing Qt UI Code} +\o \l{Signals and Slots Event System} +\o \l{QML Internationalization}{Internationalization} +\o \l{Graphical Effects} \endlist -\section1 User Interaction +\section1 QML Add-Ons \list -\o \l{Keyboard Focus in QML} -\o \l{QML States} -\o \l{QML Animation} +\o \l{Qt WebKit} +\o \l{Mobility QML bindings} \endlist -\section1 Handling Data +\section1 Qt Quick Tools \list -\o \l{QML Basic Types}{QML Basic Data Types} -\o \l{Using QML Positioner and Repeater Items} -\o \l{QML Data Models} -\o \l{Presenting Data with QML} -\o \l{Network Transparency} +\o \l{Debugging QML} +\o \l{QML Viewer} +\o \l{QML Performance} +\o \l{Developing Qt Quick Applications}{Developing with Qt Creator} \endlist \section1 Architecture @@ -120,39 +118,45 @@ Module. \list \o \l{Qt Declarative UI Runtime} \o \l{Integrating JavaScript} -\o \l{Dynamic Object Management in QML} -\endlist - -\section1 Using QML with C++ - -\list -\o \l{Qt Declarative UI 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++} -\o \l{Extending QML in C++} +\o \l{QML Scope} +\o \l{QML Modules} +\o \l{QML Documents} +\o \l{QML Global Object} +\o \l{QML Security} +\o \l{Qt Declarative Module} \endlist \section1 Reference \list \o \l{QML Elements} -\o \l{QML Basic Types} -\o \l{QML Global Object} -\o \l{QML Internationalization} -\o \l{QML Security} \o \l{Qt Declarative Module} -\o \l{Debugging QML} -\o \l{QML Viewer} -\o \l{QML Performance} +\o \l{QML Basic Types}{QML Data Types} \o \l{QML Coding Conventions} +\o \l{Qt Creator Manual} +\o \l{Programming with Qt} +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/index.html}{Qt Mobility Documentation} \endlist -\section1 Online Examples +\section1 Examples \list +\o \l{QML Tutorial}{"Hello World" Tutorial} +\o \l{Getting Started Programming with QML} +\o \l{QML Advanced Tutorial}{Tutorial: "Same Game"} +\o \l{Tutorial: Writing QML extensions with C++} +\o \l{QML Examples and Demos} + \o Forum Nokia: \l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick examples for porting} \endlist + +\section1 Best Practices + +\list +\o \l{QML Best Practices: Data Types}{Using Data Types in QML} +\o \l{QML Best Practices: Coding Conventions}{Coding Tips} +\o \l{Geir's screen size document} +\endlist */ diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index fcc9fd4..1e43166 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -27,11 +27,13 @@ /*! \page qdeclarativedynamicobjects.html +\ingroup qml-features +\contentspage {QML Features} \title Dynamic Object Management in QML -QML provides a number of ways to dynamically create and manage QML objects. +QML provides a number of ways to dynamically create and manage QML objects. The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements -all support dynamic object management. Objects can also be created and managed +all support dynamic object management. Objects can also be created and managed from C++, and this is the preferred method for hybrid QML/C++ applications (see \l{Using QML in C++ Applications}). @@ -45,20 +47,20 @@ of the concepts discussed on this page. \section1 Creating Objects Dynamically -There are two ways to create objects dynamically from JavaScript. You can either call +There are two ways to create objects dynamically from JavaScript. You can either call \l {QML:Qt::createComponent()}{Qt.createComponent()} to dynamically create a \l Component object, or use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} to create an item from a string of QML. -Creating a component is better if you have an existing component defined in a \c .qml +Creating a component is better if you have an existing component defined in a \c .qml file, and you want to dynamically create instances of that component. Otherwise, -creating an item from a string of QML is useful when the item QML itself is generated +creating an item from a string of QML is useful when the item QML itself is generated at runtime. \section2 Creating a Component dynamically -To dynamically load a component defined in a QML file, call the -\l {QML:Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}. +To dynamically load a component defined in a QML file, call the +\l {QML:Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}. This function takes the URL of the QML file as its only argument and creates a \l Component object from this URL. @@ -88,14 +90,14 @@ in case the QML file is loaded over a network and thus is not ready immediately. \codeline \snippet doc/src/snippets/declarative/componentCreation.js finishCreation -If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation() +If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation() function and call \l {Component::createObject()}{createObject()} immediately: \snippet doc/src/snippets/declarative/componentCreation.js func \snippet doc/src/snippets/declarative/componentCreation.js local \snippet doc/src/snippets/declarative/componentCreation.js func-end -Notice in both instances, \l {Component::createObject()}{createObject()} is called with +Notice in both instances, \l {Component::createObject()}{createObject()} is called with \c appWindow passed as an argument so that the created object will become a child of the \c appWindow item in \c main.qml. Otherwise, the new item will not appear in the scene. @@ -156,7 +158,7 @@ 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. +before the object is to be destroyed. 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 @@ -188,7 +190,7 @@ Item { } \endqml -This would result in an error, since items can only be dynamically +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()} diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index e23ca91..e61447a 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -27,6 +27,8 @@ /*! \page qml-extending.html +\ingroup qml-features +\contentspage QML Features \title Extending QML in C++ The QML syntax declaratively describes how to construct an in-memory object @@ -360,28 +362,28 @@ pointers to invalid objects. QML makes the following guarentees: \list \o An object assigned to a QObject (or QObject-derived) pointer property will be -valid at the time of assignment. +valid at the time of assignment. -Following assignment, it is the responsibility of the class to subsequently guard +Following assignment, it is the responsibility of the class to subsequently guard this pointer, either through a class specific method or the generic QPointer class. -\o An object assigned to a QVariant will be valid at the time of assignment. +\o An object assigned to a QVariant will be valid at the time of assignment. -When assigning an object to a QVariant property, QML will always use a QMetaType::QObjectStar -typed QVariant. It is the responsibility of the class to guard the pointer. A -general rule when writing a class that uses QVariant properties is to check the -type of the QVariant when it is set and if the type is not handled by your class, +When assigning an object to a QVariant property, QML will always use a QMetaType::QObjectStar +typed QVariant. It is the responsibility of the class to guard the pointer. A +general rule when writing a class that uses QVariant properties is to check the +type of the QVariant when it is set and if the type is not handled by your class, reset it to an invalid variant. -\o An object assigned to a QObject (or QObject-derived) list property will be -valid at the time of assignment. +\o An object assigned to a QObject (or QObject-derived) list property will be +valid at the time of assignment. -Following assignment, it is the responsibility of the class to subsequently guard +Following assignment, it is the responsibility of the class to subsequently guard this pointer, either through a class specific method or the generic QPointer class. \endlist Elements should assume that any QML assigned object can be deleted at any time, and -respond accordingly. If documented as such an element need not continue to work in +respond accordingly. If documented as such an element need not continue to work in this situation, but it must not crash. \section1 Signal Support @@ -637,6 +639,7 @@ public: /*! \page qml-extending-types.html +\ingroup qml-features \title Writing QML Components: Properties, Methods and Signals One of the key concepts in QML is the ability to define your own QML components that suit diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index ae72c3c..3da60f1 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -28,6 +28,8 @@ /*! \target qmlfocus \page qdeclarativefocus.html +\ingroup qml-features +\contentspage QML Features \title Keyboard Focus in QML When a key is pressed or released, a key event is generated and delivered to the diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 7028585..23235d7 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -27,6 +27,7 @@ /*! \page qml-integration.html +\ingroup qml-features \title Integrating QML with existing Qt UI code There are a number of ways to integrate QML into QWidget-based UI applications, @@ -37,8 +38,8 @@ depending on the characteristics of your existing UI code. If you have an existing QWidget-based UI, QML widgets can be integrated into it using QDeclarativeView. QDeclarativeView is a subclass of QWidget so you -can add it to your user interface like any other QWidget. Use -QDeclarativeView::setSource() to load a QML file into the view, then add the +can add it to your user interface like any other QWidget. Use +QDeclarativeView::setSource() to load a QML file into the view, then add the view to your UI: \code @@ -52,7 +53,7 @@ layout->addWidget(qmlView); The one drawback to this approach is that QDeclarativeView is slower to initialize and uses more memory than a QWidget, and creating large numbers of QDeclarativeView -objects may lead to performance degradation. If this is the case, it may be +objects may lead to performance degradation. If this is the case, it may be better to rewrite your widgets in QML, and load the widgets from a main QML widget instead of using QDeclarativeView. @@ -70,7 +71,7 @@ of simple and dynamic elements. If you have an existing UI based on the \l{Graphics View Framework}, you can integrate QML widgets directly into your QGraphicsScene. Use QDeclarativeComponent to create a QGraphicsObject from a QML file, and -place the graphics object into your scene using \l{QGraphicsScene::addItem()}, or +place the graphics object into your scene using \l{QGraphicsScene::addItem()}, or reparent it to an item already in the \l{QGraphicsScene}. For example: @@ -95,7 +96,7 @@ of QML UIs: \section2 Loading QGraphicsWidget objects in QML -An alternative approach is to expose your existing QGraphicsWidget objects to +An alternative approach is to expose your existing QGraphicsWidget objects to QML and construct your scene in QML instead. See the \l {declarative-cppextensions-qgraphicslayouts.html}{graphics layouts example} which shows how to expose Qt's graphics layout classes to QML in order to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index a19ca6b..4354f9d 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -27,6 +27,7 @@ /*! \page qdeclarativenetwork.html +\ingroup qml-features \title Network Transparency QML supports network transparency by using URLs (rather than file names) for all @@ -57,7 +58,7 @@ Network transparency is supported throughout QML, for example: Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load \tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file. -For example if the qmldir file contains the line "World World.qml", it will load +For example if the qmldir file contains the line "World World.qml", it will load \tt http://example.com/mystuff/World.qml Any other resources that \tt Hello.qml referred to, usually by a relative URL, would similarly be loaded from the network. diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index 9265732..7faac03 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -27,8 +27,13 @@ /*! \page qml-positioners.html +\ingroup qml-features +\previouspage Property Binding +\nextpage Anchor-based Layout in QML +\contentspage QML Features \title Using QML Positioner and Repeater Items + \section1 Introduction Positioner items are container items that manage the positions and sizes of diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 3bf85de..92cf874 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -27,15 +27,21 @@ /*! \page propertybinding.html +\ingroup qml-features +\contentspage QML Features +\previouspage QML Features +\nextpage Using QML Positioner and Repeater Items \title Property Binding + +\section1 Introduction Property binding is a declarative way of specifying the value of a property. Binding allows a property's value to be expressed as an JavaScript expression that defines the value relative -to other property values or data accessible in the application. The property value is +to other property values or data accessible in the application. The property value is automatically kept up to date if the other properties or data values change. -Property bindings are created implicitly in QML whenever a property is assigned an JavaScript -expression. The following QML uses two property bindings to connect the size of the rectangle +Property bindings are created implicitly in QML whenever a property is assigned a JavaScript +expression. The following QML code uses two property bindings to connect the size of the rectangle to that of \c otherItem. \code @@ -45,9 +51,9 @@ Rectangle { } \endcode -QML extends a standards compliant JavaScript engine, so any valid JavaScript expression can be +QML extends a standards compliant JavaScript engine, so any valid JavaScript expression can be used as a property binding. Bindings can access object properties, make function calls and even -use builtin JavaScript objects like \e {Date} and \e {Math}. Assigning a constant value to a +use built-in JavaScript objects like \c {Date} and \c {Math}. Assigning a constant value to a property can even be thought of as a binding - after all, a constant is a valid JavaScript expression! Here are some examples of more complex bindings: @@ -71,10 +77,10 @@ function. \section1 Changing Bindings -The \l PropertyChanges element can be used within a state change to modify the bindings on -properties. +The \l PropertyChanges element can be used within a state change to modify the bindings on +properties. -This example modifies the \l Rectangle's width property binding to be \c {otherItem.height} +This example modifies the \l Rectangle's width property binding to be \c {otherItem.height} when in the "square" state. When it returns to its default state, width's original property binding will have been restored. @@ -97,7 +103,7 @@ Rectangle { \section1 Effects of Property Assignment in JavaScript -Assigning a property value from JavaScript does \e not create a property binding. +Assigning a property value from JavaScript does \i not create a property binding. For example: \code @@ -110,10 +116,10 @@ Rectangle { \endcode Instead of creating a property binding, this simply sets the \c width of the \l Rectangle -to the value of \c other.width at the time the JavaScript code is invoked. See +to the value of \c other.width at the time the JavaScript code is invoked. See \l {Property Assignment vs Property Binding} for more details. -Also note that assigning a value to a property that is currently bound will remove the binding. +Also note that assigning a value to a property that is currently bound will remove the previous binding. A property can only have one value at a time, and if any code explicitly sets this value, the binding is removed. The \l Rectangle in the example below will have a width of 13, regardless of the \c otherItem's width. @@ -135,7 +141,7 @@ although it is possible to set up a \l Binding object (shown below). \section1 Binding Element The implicit binding syntax shown previously is easy to use and works perfectly for most uses -of bindings. In some advanced cases, it is necessary to create bindings explicitly using the +of bindings. In some advanced cases, it is necessary to create bindings explicitly using the \l Binding element. For example, to bind a property exposed from C++ (\c system.brightness) to a value diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 0d5fbcc..fac1e55 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -27,6 +27,7 @@ /*! \page qdeclarativei18n.html +\ingroup qml-features \title QML Internationalization \section1 Overview diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index e11cd56..fdae0bb 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -27,10 +27,12 @@ /*! \page qdeclarativemodels.html +\ingroup qml-features +\contentspage QML Features \target qmlmodels \title QML Data Models -QML items such as ListView, GridView and \l Repeater require Data Models +QML items such as ListView, GridView and \l Repeater require Data Models that provide the data to be displayed. These items typically require a \e delegate component that creates an instance for each item in the model. Models may be static, or @@ -38,7 +40,7 @@ have items modified, inserted, removed or moved dynamically. Data is provided to the delegate via named data roles which the delegate may bind to. Here is a ListModel with two roles, \e type and \e age, -and a ListView with a delegate that binds to these roles to display their +and a ListView with a delegate that binds to these roles to display their values: \snippet doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml document @@ -48,7 +50,7 @@ properties, the roles can be accessed with the qualified \e model name instead. For example, if a \l Text element had \e type or \e age properties, the text in the above example would display those property values instead of the \e type and \e age values from the model item. In this case, the properties could have been referenced as -\c model.type and \c model.age instead to ensure the delegate displays the +\c model.type and \c model.age instead to ensure the delegate displays the property values from the model item. A special \e index role containing the index of the item in the model @@ -125,10 +127,10 @@ be used to display an RSS feed. \section2 VisualItemModel -VisualItemModel allows QML items to be provided as a model. +VisualItemModel allows QML items to be provided as a model. This model contains both the data and delegate; the child items of a -VisualItemModel provide the contents of the delegate. The model +VisualItemModel provide the contents of the delegate. The model does not provide any roles. \code @@ -165,7 +167,7 @@ models. A model may be a simple QStringList, which provides the contents of the list via the \e modelData role. -Here is a ListView with a delegate that references its model item's +Here is a ListView with a delegate that references its model item's value using the \c modelData role: \snippet examples/declarative/modelviews/stringlistmodel/view.qml 0 @@ -184,7 +186,7 @@ the model by calling QDeclarativeContext::setContextProperty() again. \section2 QList -A list of QObject* values can also be used as a model. A QList provides +A list of QObject* values can also be used as a model. A QList provides the properties of the objects in the list as roles. The following application creates a \c DataObject class that with @@ -205,7 +207,7 @@ the ListView delegate: \snippet examples/declarative/modelviews/objectlistmodel/view.qml 0 -Note the use of the fully qualified access to the \c color property. +Note the use of the fully qualified access to the \c color property. The properties of the object are not replicated in the \c model object, since they are easily available via the \c modelData object. @@ -221,10 +223,10 @@ the model by calling QDeclarativeContext::setContextProperty() again. A model can be defined by subclassing QAbstractItemModel. This is the best approach if you have a more complex model that cannot be supported -by the other approaches. A QAbstractItemModel can also automatically +by the other approaches. A QAbstractItemModel can also automatically notify a QML view when the model data has changed. -The roles of a QAbstractItemModel subclass can be exposed to QML by calling +The roles of a QAbstractItemModel subclass can be exposed to QML by calling QAbstractItemModel::setRoleNames(). The default role names set by Qt are: \table @@ -244,9 +246,9 @@ that has \e type and \e size roles. It calls QAbstractItemModel::setRoleNames() role names for accessing the properties via QML: \snippet examples/declarative/modelviews/abstractitemmodel/model.h 0 -\dots +\dots \snippet examples/declarative/modelviews/abstractitemmodel/model.h 1 -\dots +\dots \snippet examples/declarative/modelviews/abstractitemmodel/model.h 2 \codeline \snippet examples/declarative/modelviews/abstractitemmodel/model.cpp 0 @@ -261,14 +263,14 @@ roles: QML views are automatically updated when the model changes. Remember the model must follow the standard rules for model changes and notify the view when -the model has changed by using QAbstractItemModel::dataChanged(), +the model has changed by using QAbstractItemModel::dataChanged(), QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for more information. The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory. QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML -can only display list data. +can only display list data. In order to display child lists of a hierarchical model the VisualDataModel element provides several properties and functions for use with models of type QAbstractItemModel: @@ -283,14 +285,14 @@ with models of type QAbstractItemModel: \section2 Exposing C++ data models to QML -The above examples use QDeclarativeContext::setContextProperty() to set -model values directly in QML components. An alternative to this is to -register the C++ model class as a QML type from a QML C++ plugin using -QDeclarativeExtensionPlugin. This would allow the model classes to be +The above examples use QDeclarativeContext::setContextProperty() to set +model values directly in QML components. An alternative to this is to +register the C++ model class as a QML type from a QML C++ plugin using +QDeclarativeExtensionPlugin. This would allow the model classes to be created directly as elements within QML: \table -\row +\row \o \code @@ -299,7 +301,7 @@ class MyModelPlugin : public QDeclarativeExtensionPlugin public: void registerTypes(const char *uri) { - qmlRegisterType(uri, 1, 0, + qmlRegisterType(uri, 1, 0, "MyModel"); } } @@ -466,6 +468,8 @@ updated, and that \e{value} holds the new value. /*! \page qml-presenting-data.html +\ingroup qml-features +\contentspage QML Features \title Presenting Data with QML \section1 Introduction diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index b663d43..f378ce6 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -27,6 +27,8 @@ /*! \page qdeclarativestates.html +\ingroup qml-features +\contentspage QML Features \target qmlstates \title QML States @@ -36,9 +38,9 @@ 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. +another. -This applies generally to interface elements regardless of their complexity. +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 @@ -47,7 +49,7 @@ other end of the scale, when a simple button is pressed, it may change to a 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 +changes that modify the properties of relevant items. Each \e state could present a different configuration that could, for example: \list @@ -83,10 +85,10 @@ 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 +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 @@ -96,13 +98,13 @@ Rectangle { State { name: "moved" PropertyChanges { target: myRect; x: 50; y: 50; color: "blue" } - PropertyChanges { target: someOtherItem; width: 1000 } + PropertyChanges { target: someOtherItem; width: 1000 } } ] } \endqml -As a convenience, if an item only has one state, its \l {Item::}{states} +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: @@ -115,7 +117,7 @@ Item { } \endqml -A \l State is not limited to performing modifications on property values. It +A \l State is not limited to performing modifications on property values. It can also: \list @@ -125,8 +127,8 @@ can also: \o Modify anchor values using AnchorChanges \endlist -The \l {declarative/animation/states}{States and Transitions example} -demonstrates how to declare a basic set of states and apply animated +The \l {declarative/animation/states}{States and Transitions example} +demonstrates how to declare a basic set of states and apply animated transitions between them. @@ -136,15 +138,15 @@ 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 +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 +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 +\qml Rectangle { ... @@ -158,7 +160,7 @@ Rectangle { ... } } -\endqml +\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, @@ -169,7 +171,7 @@ 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 +\qml Rectangle { ... @@ -184,10 +186,10 @@ Rectangle { ... } } -\endqml +\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 +as it provides a simpler (and a better, more declarative) solution than assigning the state from signal handlers. @@ -210,14 +212,14 @@ Rectangle { states: [ ... ] - + transitions: [ Transition { NumberAnimation { properties: "x,y"; duration: 500 } } ] } -\endqml +\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 diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 71f41bc..347fd94 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -27,6 +27,7 @@ /*! \page qtbinding.html +\ingroup qml-features \target qtbinding \title Using QML in C++ Applications diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index b9bd3b4..3bb7aec 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -43,7 +43,7 @@ web-enabled applications for desktop, mobile, and embedded operating systems. This page contains links to articles and overviews explaining key components and techniuqes used in Qt development. - + \generatelist {related} */ @@ -112,7 +112,7 @@ \ingroup technology-apis \ingroup best-practices \ingroup qt-basic-concepts - + These pages document Qt's API's for using SQL database systems in Qt applications. @@ -133,7 +133,7 @@ \generatelist{related} */ -/*! +/*! \group licensing \title Qt Licenses and Credits @@ -146,3 +146,25 @@ \generatelist {related} */ + +/*! + \group qml-best-practices + \title QML Best Practices Guides + + \brief QML Programming Best Practices Guides + + These documents provide guidelines and best practices for using QML and Qt + to solve specific technical problems. + + \generatelist {related} +*/ +/*! + \group qml-features + \title QML Features + + \brief Features of the QML Language + + These are overviews of the many features of the QML Language. + + \generatelist {related} +*/ -- cgit v0.12 From d108279da20ad84e0d662a905bc12e00c1011d50 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 13 Dec 2010 18:24:10 +0100 Subject: Added JavaScript Reserved Word link into resource file. Task-number: QTBUG-16071 --- doc/src/external-resources.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 9bc3b1c..c02556f 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -453,3 +453,9 @@ \externalpage http://www.libusb.org/ \title libusb */ + +/*! + \externalpage https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words + \title JavaScript Reserved Words +*/ + -- cgit v0.12 From 7b608475fb40c790fba5c618be51a92fd9d5ca92 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 14 Dec 2010 15:39:53 +0100 Subject: Doc: Added QML Syntax overview page. Modified landing page. QML Syntax is to provide essential QML and JavaScript language info. Task-number:#QTBUG-16071 --- doc/src/declarative/declarativeui.qdoc | 29 +++--- doc/src/declarative/qmlsyntax.qdoc | 158 +++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+), 13 deletions(-) create mode 100644 doc/src/declarative/qmlsyntax.qdoc diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index b17d178..771a421 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -65,15 +65,17 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \list \o \l{Intro to Qt Quick}{Introduction to Qt Quick} -\o \l{Introduction to the QML language}{Introduction to the QML Language} \o \l{QML for Qt Programmers}{QML Programming for Qt Programmers} \o \l{Getting Started Programming with QML} + \o \l{What's new in Qt Quick}{What's New in the Qt Quick Release} +\o \l{QML Examples and Demos} \endlist \section1 QML Features \list +\o \l{QML Syntax} \o \l{Property Binding} \o \l{Using QML Positioner and Repeater Items}{Component Layouts} \o \l{Anchor-based Layout in QML}{Anchor Layout} @@ -113,6 +115,19 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \o \l{Developing Qt Quick Applications}{Developing with Qt Creator} \endlist +\section1 Reference + +\list +\o \l{Introduction to the QML language}{QML Syntax} +\o \l{QML Elements} +\o \l{Qt Declarative Module} +\o \l{QML Basic Types}{QML Data Types} +\o \l{QML Coding Conventions} +\o \l{Qt Creator Manual} +\o \l{Programming with Qt} +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/index.html}{Qt Mobility Documentation} +\endlist + \section1 Architecture \list @@ -126,18 +141,6 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \o \l{Qt Declarative Module} \endlist -\section1 Reference - -\list -\o \l{QML Elements} -\o \l{Qt Declarative Module} -\o \l{QML Basic Types}{QML Data Types} -\o \l{QML Coding Conventions} -\o \l{Qt Creator Manual} -\o \l{Programming with Qt} -\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/index.html}{Qt Mobility Documentation} -\endlist - \section1 Examples \list diff --git a/doc/src/declarative/qmlsyntax.qdoc b/doc/src/declarative/qmlsyntax.qdoc new file mode 100644 index 0000000..4ff2437 --- /dev/null +++ b/doc/src/declarative/qmlsyntax.qdoc @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlsyntax.html +\title QML Syntax +\ingroup QML Features +\previouspage QML Features +\contentspage QML Features + +\tableofcontents + +QML is a declarative language designed to describe the user interface of a +program: both what it looks like, and how it behaves. In QML, a user +interface is specified as a tree of objects with properties. + +This introduction is meant for those with little or no programming +experience. JavaScript is used as a scripting language in QML, so you may want +to learn a bit more about it (\l{Javascript Guide}) before diving +deeper into QML. It's also helpful to have a basic understanding of other web +technologies like HTML and CSS, but it's not required. + +\section1 Basic QML Syntax + +QML looks like this: + +\code +import QtQuick 1.0 + +Rectangle { + width: 200 + height: 200 + color: "blue" + + Image { + source: "pics/logo.png" + anchors.centerIn: parent + } +} +\endcode + +Objects are specified by their type, followed by a pair of braces. Object +types always begin with a capital letter. In the above example, there are +two objects, a \l Rectangle, and an \l Image. Between the braces, we can specify +information about the object, such as its properties. + +Properties are specified as \c {property: value}. In the above example, we +can see the Image has a property named \c source, which has been assigned the +value \c "pics/logo.png". The property and its value are separated by a colon. + +Properties can be specified one-per-line: + +\code +Rectangle { + width: 100 + height: 100 +} +\endcode + +or you can put multiple properties on a single line: + +\code +Rectangle { width: 100; height: 100 } +\endcode + +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 +expressions written in JavaScript. + +\code +Rotation { + angle: 360 * 3 +} +\endcode + +These expressions can include references to other objects and properties, in which case +a \e binding is established: when the value of the expression changes, the property the +expression has been assigned to is automatically updated to that value. + +\code +Item { + Text { + id: text1 + text: "Hello World" + } + Text { + id: text2 + text: text1.text + } +} +\endcode + +In the example above, the \c text2 object will display the same text as \c text1. If \c text1 is changed, +\c text2 is automatically changed to the same value. + +Note that to refer to other objects, we use their \e id values. (See below for more +information on the \e id property.) + +\section1 QML Comments + +Commenting in QML is similar to JavaScript. +\list +\o Single line comments start with // and finish at the end of the line. +\o Multiline comments start with /* and finish with *\/ +\endlist + +\snippet doc/src/snippets/declarative/comments.qml 0 + +Comments are ignored by the engine. They are useful for explaining what you +are doing; for referring back to at a later date, or for others reading +your QML files. + +Comments can also be used to prevent the execution of code, which is +sometimes useful for tracking down problems. + +\code +Text { + text: "Hello world!" + //opacity: 0.5 +} +\endcode + +In the above example, the Text object will have normal opacity, since the +line opacity: 0.5 has been turned into a comment. + +*/ -- cgit v0.12 From 380a85758b673563b2912b413bbcfce49fc564b7 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 14 Dec 2010 15:56:30 +0100 Subject: Added an entry for QML Architecture in the overviews page. This is for adding architecture information in the documentation. Task-number: QTBUG-16071 --- doc/src/overviews.qdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 3bb7aec..5c48a33 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -168,3 +168,13 @@ \generatelist {related} */ +/*! + \group qml-architecture + \title QML Architecture + + \brief QML Architecture + + These are overviews of the architecture of QML and Qt Declarative Module. + + \generatelist {related} +*/ -- cgit v0.12 From 401e43aa33a3c1a914f4280190a9d514a6fe0918 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 20 Dec 2010 16:15:25 +0100 Subject: Adding two QML Best Practice guides. Task-number: QTBUG-15757 --- .../qmlbestpractices/qmlbestpractices-coding.qdoc | 94 ++++++++++++++++++++++ .../qmlbestpractices-datatypes.qdoc | 49 +++++++++++ 2 files changed, 143 insertions(+) create mode 100644 doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc create mode 100644 doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc diff --git a/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc b/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc new file mode 100644 index 0000000..6c83c80 --- /dev/null +++ b/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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$ +** 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 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-best-practices-coding.html + \ingroup qml-best-practices + \contentspage QML Best Practices Guides + \previouspage QML Best Practices Guides + \startpage QML Best Practices Guides + \title QML Best Practices: Coding Conventions + + \brief QML Coding Conventions and Importing Files + + There are many different ways to code using QML. These are a set of + guidelines to help your code look better and consistent. + + \section1 Coding Conventions + + The official QML Coding Conventions may be found at + \l {QML Coding Conventions}. This is the recommended convention that will be + used throughout the QML documentation. + + In addition, Qt's official code style may be found at the \l {Qt Coding Style}. + + \section1 Importing Files into QML + + To import items such as directories, use the "import" keyword, similar to + the way the \c {import QtQuick 1.0} statement is used. + + \qml + import QtQuick 1.0 + import QtWebKit 1.0 + import "subdirectory" + import "script.js" + \endqml + + To facilitate the importation of QML components, it is best to begin the QML + file with an uppercase character. This way, the user can simply declare the + component using the file name as the component name. For example, if a QML + component is in a file named \c Button.qml, then the user may import the + component by declaring a \c {Button {}}. Note that this method only works if + the QML files are in the same directory. + + \qml + import QtQuick 1.0 + + Rectangle { + width: 50; height: 50 + + Button {} //Button is defined in Button.qml in the same directory + } + \endqml + + It is also possible to import QML files which have file names that begin in + lower case or files in a different directory by using a \c qmldir file. + + A \c qmldir file tells your QML application which QML components, plugins, + or directories to import. The \c qmldir file must reside in an imported + directory. + + \code + //A very simple qmldir file + + Button ./custom.qml //a QML component called Button in the file custom.qml + plugin FilePlugin ./plugins //a plugin called FileDialog in the plugins directory + \endcode + + By using the \c qmldir file, users may import any QML file and assign any + valid QML component name to the component. +*/ diff --git a/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc b/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc new file mode 100644 index 0000000..0f6d74b --- /dev/null +++ b/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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$ +** 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 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-best-practices-datatypes.html + \ingroup qml-best-practices + \contentspage QML Best Practices Guides + \previouspage QML Best Practices Guides + \startpage QML Best Practices Guides + \title QML Best Practices: Data Types + + \brief Using Basic Data Types and Custom Types in QML + + QML supports many basic data types, Qt data types, and custom data types. + + \section1 Basic Data Types + + \section1 Qt Data Types + + \section1 Exporting Qt Types to QML + + Programmers may create C++ data structures and expose them to QML, making + data accessible from QML. + + \section2 Using QStringLists in QML +*/ -- cgit v0.12 From 9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 20 Dec 2010 17:29:06 +0100 Subject: Re-organized the Qt Quick page. Changed titles and links. Task-number: QTBUG-16071 --- doc/src/declarative/anchor-layout.qdoc | 4 +- doc/src/declarative/animation.qdoc | 4 +- doc/src/declarative/basicelements.qdoc | 37 ++ doc/src/declarative/basictypes.qdoc | 4 +- doc/src/declarative/declarativeui.qdoc | 40 +- doc/src/declarative/dynamicobjects.qdoc | 4 +- doc/src/declarative/extending-tutorial.qdoc | 48 +- doc/src/declarative/extending.qdoc | 472 +------------------ doc/src/declarative/focus.qdoc | 5 +- doc/src/declarative/graphicaleffects.qdoc | 36 ++ doc/src/declarative/integrating.qdoc | 8 +- doc/src/declarative/mouseevents.qdoc | 52 +++ doc/src/declarative/network.qdoc | 3 + doc/src/declarative/propertybinding.qdoc | 177 +++++++- doc/src/declarative/qdeclarativei18n.qdoc | 3 + doc/src/declarative/qdeclarativemodels.qdoc | 88 +--- doc/src/declarative/qdeclarativestates.qdoc | 2 + doc/src/declarative/qmlevents.qdoc | 37 ++ doc/src/declarative/qmlreusablecomponents.qdoc | 497 +++++++++++++++++++++ doc/src/declarative/qmlruntime.qdoc | 42 +- doc/src/declarative/qmlsyntax.qdoc | 7 +- doc/src/declarative/qmltexthandling.qdoc | 55 +++ doc/src/declarative/qmlviewer.qdoc | 60 +-- doc/src/declarative/qmlviews.qdoc | 111 +++++ doc/src/declarative/qmlwebkit.qdoc | 47 ++ doc/src/declarative/qtbinding.qdoc | 17 +- doc/src/declarative/qtprogrammers.qdoc | 3 +- doc/src/examples/qml-examples.qdoc | 28 +- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- doc/src/overviews.qdoc | 29 +- doc/src/qt-webpages.qdoc | 16 + .../ui-components/tabwidget/TabWidget.qml | 2 +- .../graphicsitems/qdeclarativeflipable.cpp | 14 +- src/declarative/qml/qdeclarativecomponent.cpp | 52 +-- src/declarative/qml/qdeclarativecontext.cpp | 46 +- src/declarative/util/qdeclarativeanimation.cpp | 170 +++---- src/declarative/util/qdeclarativebehavior.cpp | 6 +- .../util/qdeclarativesmoothedanimation.cpp | 12 +- .../util/qdeclarativespringanimation.cpp | 20 +- src/declarative/util/qdeclarativetransition.cpp | 24 +- src/declarative/util/qdeclarativeview.cpp | 12 +- 41 files changed, 1428 insertions(+), 868 deletions(-) create mode 100644 doc/src/declarative/basicelements.qdoc create mode 100644 doc/src/declarative/graphicaleffects.qdoc create mode 100644 doc/src/declarative/mouseevents.qdoc create mode 100644 doc/src/declarative/qmlevents.qdoc create mode 100644 doc/src/declarative/qmlreusablecomponents.qdoc create mode 100644 doc/src/declarative/qmltexthandling.qdoc create mode 100644 doc/src/declarative/qmlviews.qdoc create mode 100644 doc/src/declarative/qmlwebkit.qdoc diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 4953b22..11acbad 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -29,8 +29,8 @@ \page qml-anchor-layout.html \target anchor-layout \contentspage QML Features -\previouspage Using QML Positioner and Repeater Items -\nextpage Using QML Positioner and Repeater Items +\previouspage {Using QML Positioner and Repeater Items}{Component Layouts} +\nextpage {QML Mouse Events}{Mouse Events} \title Anchor-based Layout in QML \section1 Overview diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 708f412..099f02d 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -29,7 +29,9 @@ \page qdeclarativeanimation.html \ingroup qml-features \contentspage QML Features -\title QML Animation +\previouspage {QML States}{States} +\nextpage {QML Data Models}{Structuring Data with Models} +\title QML Animation and Transitions In QML, animations are created by applying animation objects to object property diff --git a/doc/src/declarative/basicelements.qdoc b/doc/src/declarative/basicelements.qdoc new file mode 100644 index 0000000..d0c16b6 --- /dev/null +++ b/doc/src/declarative/basicelements.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlbasicelements.html + \ingroup qml-features + \contentspage QML Features + \previouspage {QML Basic Types}{Data Types} + \nextpage {Using QML Positioner and Repeater Items}{Component Layouts} + + \title QML Basic Elements + +*/ diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 0277ccb..59772c5 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -29,13 +29,15 @@ \page qdeclarativebasictypes.html \ingroup qml-features \contentspage QML Features + \previouspage {Property Binding} + \nextpage {QML Basic Elements}{Basic Elements} \title QML Basic Types QML has a set of primitive types, as listed below, that are used throughout the \l {QML Elements}. Some of these types can also be used for defining - \c property values in QML. See \l{Writing QML Components: Properties, Methods and Signals} for the + \c property values in QML. See \l{Importing Reusable Components} for the list of types that can be used for \c property values. \annotatedlist qmlbasictypes diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 771a421..473cbdd 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -77,42 +77,41 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \list \o \l{QML Syntax} \o \l{Property Binding} +\o \l{QML Basic Types}{Data Types} +\o \l{QML Basic Elements}{Basic Elements} \o \l{Using QML Positioner and Repeater Items}{Component Layouts} -\o \l{Anchor-based Layout in QML}{Anchor Layout} -\o \l{Writing QML Components: Properties, Methods and Signals}{Reusable Components} -\o \l{Text Handling} -\o \l{Keyboard Focus in QML}{Keyboard Focus} +\o \l{Anchor-based Layout in QML}{Layouts using Anchors} \o \l{Mouse Events} -\o \l{QML States} {States} -\o \l{QML Animation}{Animation and Transitions} -\o \l{QML Basic Types}{QML Basic Data Types} +\o \l{QML Text Handling and Validators}{Text Handling and Validators} +\o \l{Keyboard Focus in QML}{Keyboard Focus} +\o \l{Importing Reusable Components} +\o \l{QML States}{States} +\o \l{QML Animation and Transitions}{Animation and Transitions} \o \l{QML Data Models}{Structuring Data with Models} -\o \l{Presenting Data with QML}{Presenting Data with Views} -\o \l{Affine Transformations} +\o \l{Presenting Data with Views} +\o \l{Extending QML Functionalities using C++} +\o \l{Using QML Bindings in C++ Applications} +\o \l{Integrating QML Code with Existing Qt UI Code} +\o \l{QML Signal and Handler Event System}{Signal and Handler Event System} \o \l{Dynamic Object Management in QML}{Dynamic Object Management} -\o \l{Network Transparency}{Resource Loading} -\o \l{Extending QML in C++}{Extending QML Functionalities using C++} -\o \l{Using QML in C++ Applications} -\o \l{Integrating QML with existing Qt UI code}{Integrating QML Code with Existing Qt UI Code} -\o \l{Signals and Slots Event System} +\o \l{Network Transparency}{Loading Resources in QML} \o \l{QML Internationalization}{Internationalization} -\o \l{Graphical Effects} +\o \l{QML Graphical Effects}{Graphical Effects} \endlist \section1 QML Add-Ons \list -\o \l{Qt WebKit} -\o \l{Mobility QML bindings} +\o \l{QtWebKit QML Module} +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins} \endlist \section1 Qt Quick Tools \list \o \l{Debugging QML} +\o \l{Developing Qt Quick Applications with Creator}{Developing with Qt Creator} \o \l{QML Viewer} -\o \l{QML Performance} -\o \l{Developing Qt Quick Applications}{Developing with Qt Creator} \endlist \section1 Reference @@ -160,6 +159,9 @@ examples for porting} \list \o \l{QML Best Practices: Data Types}{Using Data Types in QML} \o \l{QML Best Practices: Coding Conventions}{Coding Tips} +\o \l{QML Performance}{Performance Tips} +\omit \o \l{Geir's screen size document} +\endomit \endlist */ diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 1e43166..e5077ba 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -29,13 +29,15 @@ \page qdeclarativedynamicobjects.html \ingroup qml-features \contentspage {QML Features} +\previouspage {QML Signal and Handler Event System}{Signal and Handler Event System} +\nextpage {Network Transparency}{Loading Resources in QML} \title Dynamic Object Management in QML QML provides a number of ways to dynamically create and manage QML objects. The \l{Loader}, \l{Repeater}, \l{ListView}, \l{GridView} and \l{PathView} elements all support dynamic object management. Objects can also be created and managed from C++, and this is the preferred method for hybrid QML/C++ applications -(see \l{Using QML in C++ Applications}). +(see \l{Using QML Bindings in C++ Applications}). QML also supports the dynamic creation of objects from within JavaScript code. This is useful if the existing QML elements do not fit the needs of your diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index c998c5c..25be0f9 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -33,7 +33,7 @@ The Qt Declarative module provides a set of APIs for extending QML through C++ extensions. You can write extensions to add your own QML types, extend existing Qt types, or call C/C++ functions that are not accessible from ordinary QML code. -This tutorial shows how to write a QML extension using C++ that includes +This tutorial shows how to write a QML extension using C++ that includes core QML features, including properties, signals and bindings. It also shows how extensions can be deployed through plugins. @@ -67,18 +67,18 @@ like network programming that are not accessible through built-in QML features. In this tutorial, we will show how to use the C++ classes in the Qt Declarative module to extend QML. The end result will be a simple Pie Chart display implemented by -several custom QML types connected together through QML features like bindings and +several custom QML types connected together through QML features like bindings and signals, and made available to the QML runtime through a plugin. To begin with, let's create a new QML type called "PieChart" that has two properties: a name and a color. We will make it available in a \l {Modules}{module} called "Charts", with -a module version of 1.0. +a module version of 1.0. We want this \c PieChart type to be usable from QML like this: \code import Charts 1.0 - + PieChart { width: 100; height: 100 name: "A simple pie chart" @@ -99,16 +99,16 @@ Here is our \c PieChart class, defined in \c piechart.h: \snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0 -The class inherits from QDeclarativeItem because we want to override +The class inherits from QDeclarativeItem because we want to override QDeclarativeItem::paint() in order to draw. If the class just represented some data type and was not an item that actually needed to be displayed, it could simply inherit -from QObject. Or, if we want to extend the functionality of an existing QObject-based +from QObject. Or, if we want to extend the functionality of an existing QObject-based class, it could inherit from that class instead. The \c PieChart class defines the two properties, \c name and \c color, with the Q_PROPERTY macro, -and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp -simply sets and returns the \c m_name and \c m_color values as appropriate, and -implements \c paint() to draw a simple pie chart. It also turns off the +and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp +simply sets and returns the \c m_name and \c m_color values as appropriate, and +implements \c paint() to draw a simple pie chart. It also turns off the QGraphicsItem::ItemHasNoContents flag to enable painting: \snippet declarative/tutorials/extending/chapter1-basics/piechart.cpp 0 @@ -150,19 +150,19 @@ Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-b At the moment, the \c app.qml is run from within a C++ application. This may seem odd if you're used to running QML files with the \l {QML Viewer}. -Later on, we'll show how to create a plugin so that you can run \c app.qml using the +Later on, we'll show how to create a plugin so that you can run \c app.qml using the \l {QML Viewer} instead. */ /*! -\title Chapter 2: Connecting to C++ Methods and Signals +\title Chapter 2: Connecting to C++ Methods and Signals \example declarative/tutorials/extending/chapter2-methods Suppose we want \c PieChart to have a "clearChart()" method that erases the -chart and then emits a "chartCleared" signal. Our \c app.qml would be able +chart and then emits a "chartCleared" signal. Our \c app.qml would be able to call \c clearChart() and receive \c chartCleared() signals like this: \snippet declarative/tutorials/extending/chapter2-methods/app.qml 0 @@ -210,7 +210,7 @@ Property bindings is a powerful feature of QML that allows values of different elements to be synchronized automatically. It uses signals to notify and update other elements' values when property values are changed. -Let's enable property bindings for the \c color property. That means +Let's enable property bindings for the \c color property. That means if we have code like this: \snippet declarative/tutorials/extending/chapter3-bindings/app.qml 0 @@ -224,7 +224,7 @@ updates to the same value. When the window is clicked, the \c onClicked handler in the MouseArea changes the color of \c chartA, thereby changing both charts to the color blue. -It's easy to enable property binding for the \c color property. +It's easy to enable property binding for the \c color property. We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal is emitted whenever the value changes. @@ -244,7 +244,7 @@ It's important for \c setColor() to check that the color value has actually chan before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and also prevents loops when other elements respond to the value change. -The use of bindings is essential to QML. You should always add NOTIFY +The use of bindings is essential to QML. You should always add NOTIFY signals for properties if they are able to be implemented, so that your properties can be used in bindings. Properties that cannot be bound cannot be automatically updated and cannot be used as flexibly in QML. Also, since @@ -299,7 +299,7 @@ listed in the \l{Adding Properties} documentation, which includes the following: If we want to create a property whose type is not supported by QML by default, we need to register the type with QML. -For example, let's replace the use of the \c property with a type called +For example, let's replace the use of the \c property with a type called "PieSlice" that has a \c color property. Instead of assigning a color, we assign an \c PieSlice value which itself contains a \c color: @@ -358,10 +358,10 @@ have a \c slices property that accepts a list of \c PieSlice items: \image extending-tutorial-chapter5.png To do this, we replace the \c pieSlice property in \c PieChart with a \c slices property, -declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the +declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the creation of list properties in QML extensions. We replace the \c pieSlice() -function with a \c slices() function that returns a list of slices, and add -an internal \c append_slice() function (discussed below). We also use a QList to +function with a \c slices() function that returns a list of slices, and add +an internal \c append_slice() function (discussed below). We also use a QList to store the internal list of slices as \c m_slices: \snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 0 @@ -409,7 +409,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 project file that describes the plugin \o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin \endlist @@ -468,8 +468,9 @@ In this tutorial, we've shown the basic steps for creating a QML extension: \endlist -The \l {Extending QML in C++} reference documentation shows other useful features that can be added to -QML extensions. For example, we could use \l{Default Property}{default properties} to allow +The \l {Extending QML Functionalities using C++} reference documentation shows +other useful features that can be added to QML extensions. For example, we +could use \l{Default Property}{default properties} to allow slices to be added without using the \c slices property: \code @@ -489,7 +490,8 @@ Or randomly add and remove slices from time to time using \l{Property Value Sour \endcode -See the \l{Extending QML in C++}{reference documentation} for more information. +See the \l{Extending QML Functionalities using C++} reference documentation +for more information. */ diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 51b52b0..d3f1521 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -29,7 +29,9 @@ \page qml-extending.html \ingroup qml-features \contentspage QML Features -\title Extending QML in C++ +\previouspage {Presenting Data with Views} +\nextpage {Using QML Bindings in C++ Applications} +\title Extending QML Functionalities using C++ The QML syntax declaratively describes how to construct an in-memory object tree. In Qt, QML is mainly used to describe a visual scene graph, but it is @@ -431,7 +433,7 @@ onChanged, regardless of the name used for the NOTIFY signal in C++. We recommend using Changed() for the NOTIFY signal in C++. -See also \l {Writing QML Components: Properties, Methods and Signals} +See also \l {Importing Reusable Components} \section1 Methods @@ -637,469 +639,3 @@ public: */ -/*! -\page qml-extending-types.html -\ingroup qml-features -\title Writing QML Components: Properties, Methods and Signals - -One of the key concepts in QML is the ability to define your own QML components that suit -the purposes of your application. The standard \l {QML Elements} provide the essential components -for creating a QML application; beyond these, you can write your own custom components that can -be created and reused, without the use of C++. - -Components are the building blocks of a QML project. When writing a QML application, whether -large or small, it is best to separate QML code into smaller components that perform specific -sets of operations, instead of creating mammoth QML files with large, combined functionality -that is more difficult to manage and may contain duplicated code. - - -\section1 Defining New Components - -A component is a reusable type with a well-defined interface, built entirely in QML. -Any snippet of QML code can become a component, by placing the code in a file ".qml" where - is the new component name, beginning with an uppercase letter. These QML files automatically -become available as new QML element types to other QML components and applications in the same directory. - -For example, one of the simplest and most common components you can build in QML is a -button-type component. Below, we implement this component as a \l Rectangle with a clickable -\l MouseArea, in a file named \c Button.qml: - -\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 - -Now this component can be reused by another file within the same directory. Since the file is -named \c Button.qml, the component is referred to as \c Button: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 -\o \image qml-extending-types.png -\endtable - -The root object in \c Button.qml defines the attributes that are available to users of the -\c Button component. In this case, the root object is a \l Rectangle, so any properties, methods -and signals of \l Rectangle are made available, allowing \c application.qml to -customize the \c width, \c height, \c radius and \c color properties of \c Button objects. - - -If \c Button.qml was not in the same directory, \c application.qml would need to load it as a -\l {Modules}{module} from a specific filesystem path or \l{QDeclarativeExtensionPlugin}{plugin}. -Also, note the letter case of the component file name is significant on some (notably UNIX) -filesystems. It is recommended the file name case matches the case of the QML component name -exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the -QML component will be deployed. - -To write a useful component, it is generally necessary to provide it with custom attributes that store and -communicate specific data. This is achieved by adding the following attributes to your components: - -\list -\o \bold Properties that can be accessed externally to modify an object (for example, \l Item has - \l {Item::}{width} and \l {Item::}{height} properties) and used in \l {Property Binding} -\o \bold Methods of JavaScript code can be invoked internally or externally (for example, - \l Animation has a \l {Animation::}{start()} method) -\o \bold Signals to notify other objects when an event has occurred (for example, MouseArea has a - \c clicked signal) -\endlist - -The following sections show how these attributes can be added to QML components. - - -\section1 Adding Properties - -A property is a value of a QML component that can be read and modified by other objects. For -example, a \l Rectangle component has \l {Item::}{width}, \l {Item::}{height} and \l -{Rectangle::}{color} properties. Significantly, properties be used with \l {Property Binding}, where -a property value is automatically updated using the value of another property. - -The syntax for defining a new property is: - -\code -[default] property [: defaultValue] -\endcode - -A \c property declaration can appear anywhere within a QML component definition, but it is customary -to place it at the top. A component cannot declare more than one property with the same name. (It is -possible to have a property name that is the same as an existing property in a type, but this is not -recommended as the existing property becomes hidden and inaccessible.) - -Below is an example. The \c ImageViewer component has defined a \c string type property named -\c currentImage, and its initial value is "default-image.png". This property is used to set the image -displayed in the child \l Image object. Another file, \c application.qml, can create -an \c ImageViewer object and read or modify the \c currentImage value: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/application.qml 0 -\endtable - -It is optional for a property to have a default value. The default value is a convenient shortcut, and is -behaviorally identical to doing it in two steps, like this: - -\qml -// Use default value -property int myProperty: 10 - -// Longer, but behaviorally identical -property int myProperty -myProperty: 10 -\endqml - - -\section2 Supported property types - -All QML properties are typed. The examples above show properties with \c int and \c string types; -notice that the type of the property must be declared. The type is used to determine the property -behavior, and how the property is defined in C++. - -A number of property types are supported by default. These are listed in the table below, -with their default values and the corresponding C++ type: - -\table -\header \o QML Type Name \o Default value \o C++ Type Name -\row \o int \o 0 \o int -\row \o bool \o \c false \o bool -\row \o double \o 0.0 \o double -\row \o real \o 0.0 \o double -\row \o string \o "" (empty string) \o QString -\row \o url \o "" (empty url) \o QUrl -\row \o color \o #000000 (black) \o QColor -\row \o date \o \c undefined \o QDateTime -\row \o variant \o \c undefined \o QVariant -\endtable - -QML object types can also be used as property types. This includes -\l {Defining new QML elements}{custom QML types} implemented in C++. Such properties are -defined like this: - -\qml -property Item itemProperty -property QtObject objectProperty -property MyCustomType customProperty -\endqml - -Such object-type properties default to an \c undefined value. - -\l{list}{List properties} are created with the \c list syntax, and default to an empty -list: - -\qml -property list listOfItems -\endqml - -Note that list properties cannot be modified like ordinary JavaScript -arrays. See the \l {list}{list type documentation} for details. - -For details about accessing and manipulating QML properties from C++, see \l {Using QML with C++}. - - -\section2 Property change signals - -Adding a \c property to an item automatically adds a \e {value changed} -signal handler to the item. To connect to this signal, use a \l {Signal Handlers}{signal handler} -named with the \c onChanged syntax, using upper case for the first letter of the -property name. - -For example, the following \c onMyNumberChanged signal handler is automatically called whenever the -\c myNumber property changes: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/property-signals.qml 0 - - -\section2 Default properties - -The optional \c default attribute for a property marks it as the \e {default property} -for a type. This allows other items to specify the default property's value -as child elements. For example, the \l Item element's default property is its -\l{Item::children}{children} property. This allows the children of an \l Item -to be set like this: - -\qml -Item { - Rectangle {} - Rectangle {} -} -\endqml - -If the \l{Item::children}{children} property was not the default property for -\l Item, its value would have to be set like this instead: - -\qml -Item { - children: [ - Rectangle {} - Rectangle {} - ] -} -\endqml - -See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a -demonstration of using default properties. - -Specifying a default property overrides any existing default property (for -example, any default property inherited from a parent item). Using the -\c default attribute twice in the same type block is an error. - - -\section2 Property aliases - -Property aliases are a more advanced form of property declaration. Unlike a -property definition, which allocates a new, unique storage space for the -property, a property alias connects the newly declared property (called the -aliasing property) as a direct reference to an existing property (the aliased property). Read -operations on the aliasing property act as read operations on the aliased -property, and write operations on the aliasing property as write operations on -the aliased property. - -A property alias declaration looks a lot like an ordinary property definition: -\code - [default] property alias : -\endcode - -As the aliasing property has the same type as the aliased property, an explicit -type is omitted, and the special "alias" keyword is used. Instead of a default -value, a property alias includes a compulsory alias reference. The alias -reference is used to locate the aliased property. While similar to a property -binding, the alias reference syntax is highly restricted. - -An alias reference takes one of the following forms: -\code - . - -\endcode - -where must refer to an object id within the same component as the type -declaring the alias, and, optionally, refers to a property on that object. - -For example, below is a \c Button.qml component with a \c buttonText aliased property which is -connected to the child Text object's \c text property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias.qml 0 - -The following code would create a \c Button with a defined text string for the -child \l Text object: - -\qml -Button { buttonText: "This is a button" } -\endqml - -Here, modifying \c buttonText directly modifies the \c textItem.text value; it does not -change some other value that then updates \c textItem.text. - -In this case, the use of aliased properties is essential. If \c buttonText was not an alias, -changing its value would not actually change the displayed text at all, as -\l {Property Binding}{property bindings} are not bi-directional: the \c buttonText value would -change when \c textItem.text changes, but not the other way around. - -Aliased properties are also useful for allowing external objects to directly modify and -access child objects in a component. For example, here is a modified version of the \c ImageViewer -component shown \l {Adding Properties}{earlier} on this page. The \c currentImage property has -been changed to an alias to the child \l Image object: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/application.qml 0 -\endtable - -Instead of being limited to setting the \l Image source, \c application.qml can now directly -access and modify the child \l Image object and its properties. - -Obviously, exposing child objects in this manner should be done with care, as it allows external -objects to modify them freely. However, this use of aliased properties can be quite useful in -particular situations, such as for the \l {declarative/ui-components/tabwidget}{TabWidget} -example, where new tab items are actually parented to a child object that displays the current tab. - - -\section3 Considerations for property aliases - -Aliases are only activated once the component specifying them is completed. The -most obvious consequence of this is that the component itself cannot generally -use the aliased property directly during creation. For example, this will not work: - -\code - // Does NOT work - property alias buttonText: textItem.text - buttonText: "Some text" // buttonText is not yet defined when this value is set -\endcode - -A second, much less significant, consequence of the delayed activation of -aliases is that an alias reference cannot refer to another aliasing property -declared within the same component. This will not work: - -\code - // Does NOT work - id: root - property alias buttonText: textItem.text - property alias buttonText2: root.buttonText -\endcode - -At the time the component is created, the \c buttonText value has not yet been assigned, -so \c root.buttonText would refer to an undefined value. (From outside the component, -however, aliasing properties appear as regular Qt properties and consequently can be -used in alias references.) - -It is possible for an aliased property to have the same name as an existing property. For example, -the following component has a \c color alias property, named the same as the built-in -\l {Rectangle::color} property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias-override.qml 0 - -Any objects that use this component and refer to its \c color property will be -referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, -however, the rectangle can correctly set this property to "red" and refer to the actual defined -property rather than the alias. - - -\section1 Adding Methods - -A QML component can define methods of JavaScript code. These methods can be invoked -either internally or by other objects. - -The syntax for defining a method is: - -\code -function ([[, ...]]) { } -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two methods or signals with the -same name in the same type block is an error. However, a new method may reuse -the name of an existing method on the type. (This should be done with caution, -as the existing method may be hidden and become inaccessible.) - -Unlike \l{Adding Signals}{signals}, method parameter types do not have to be declared as they -default to the \c variant type. The body of the method is written in JavaScript and may access -the parameters by name. - -Here is an example of a component with a \c say() method that accepts a single \c text argument: - -\snippet doc/src/snippets/declarative/qml-extending-types/methods/app.qml 0 - -A method can be connected to a signal so that it is automatically invoked whenever the signal -is emitted. See \l {Connecting signals to methods and other signals} below. - -Also see \l {Integrating JavaScript} for more information on using JavaScript with QML. - - -\section1 Adding Signals - -Signals provide a way to notify other objects when an event has occurred. For example, the MouseArea -\c clicked signal notifies other objects that the mouse has been clicked within the area. - -The syntax for defining a new signal is: - -\code -signal [([ [, ...]])] -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two signals or methods with the -same name in the same type block is an error. However, a new signal may reuse -the name of an existing signal on the type. (This should be done with caution, -as the existing signal may be hidden and become inaccessible.) - -Here are three examples of signal declarations: - -\code -Item { - signal clicked - signal hovered() - signal performAction(string action, variant actionArgument) -} -\endcode - -If the signal has no parameters, the "()" brackets are optional. If parameters are used, the -parameter types must be declared, as for the \c string and \c variant arguments for the \c -performAction signal above; the allowed parameter types are the same as those listed in the \l -{Adding Properties} section on this page. - -Adding a signal to an item automatically adds a \l {Signal Handlers}{signal handler} as well. -The signal hander is named \c on, with the first letter of the signal being upper -cased. The above example item would now have the following signal handlers: - -\list -\o onClicked -\o onHovered -\o onPerformAction -\endlist - -To emit a signal, simply invoke it in the same way as a method. Below left, when the \l MouseArea is -clicked, it emits the parent \c buttonClicked signal by invoking \c rect.buttonClicked(). The -signal is received by \c application.qml through an \c onButtonClicked signal handler: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/basic.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/no-parameters.qml 0 -\endtable - -If the signal has parameters, they are accessible by parameter name in the signal handler. -In the example below, \c buttonClicked is emitted with \c xPos and \c yPos parameters instead: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/Button.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/parameters.qml 0 -\endtable - - -\section2 Connecting signals to methods and other signals - -Signal objects have a \c connect() method that can be used to a connect a signal to a method or -another signal. When a signal is connected to a method, the method is automatically invoked -whenever the signal is emitted. (In Qt terminology, the method is a \e slot that is connected -to the \e signal; all methods defined in QML are created as Qt slots.) This enables a signal -to be received by a method instead of a \l {Signal Handlers}{signal handler}. - -For example, the \c application.qml above could be rewritten as: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectslots.qml 0 - -The \c myMethod() method will be called whenever the \c buttonClicked signal is received. - -In many cases it is sufficient to receive signals through signal handlers rather than using -the \c connect() function; the above example does not provide any improvements over using a -simple \c onButtonClicked handler. However, if you are \l{Dynamic Object Management in QML}{creating objects dynamically}, -or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find the -\c connect() method useful. For example, the component below creates three \c Button -objects dynamically, and connects the \c buttonClicked signal of each object to the -\c myMethod() function: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectdynamic.qml 0 - -In the same way, you could connect a signal to methods defined in a dynamically -created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. - -There is also a corresponding \c disconnect() method for removing connected signals. The following -code removes the connection created in \c application.qml above: - -\qml -// application.qml -Item { - ... - - function removeSignal() { - button.clicked.disconnect(item.myMethod) - } -} -\endqml - - -\section3 Forwarding signals - -The \c connect() method can also connect a signal to other signals. This has the effect -of "forwarding" a signal: it is automatically emitted whenever the relevant signal is emitted. For -example, the MouseArea \c onClicked handler in \c Button.qml above could have been replaced with -a call to \c connect(): - -\qml -MouseArea { - anchors.fill: parent - Component.onCompleted: clicked.connect(item.buttonClicked) -} -\endqml - -Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will -automatically be emitted as well. - -*/ diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index 3da60f1..be1000e 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -30,11 +30,14 @@ \page qdeclarativefocus.html \ingroup qml-features \contentspage QML Features +\previouspage {QML Text Handling and Validators}{Text Handling and Validators} +\nextpage {Importing Reusable Components} + \title Keyboard Focus in QML When a key is pressed or released, a key event is generated and delivered to the focused QML \l Item. To facilitate the construction of reusable components -and to address some of the cases unique to fluid user interfaces, the QML items add a +and to address some of the cases unique to fluid user interfaces, the QML items add aged \e scope based extension to Qt's traditional keyboard focus model. \tableofcontents diff --git a/doc/src/declarative/graphicaleffects.qdoc b/doc/src/declarative/graphicaleffects.qdoc new file mode 100644 index 0000000..b5ef601 --- /dev/null +++ b/doc/src/declarative/graphicaleffects.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlgraphicaleffects.html +\ingroup qml-features +\contentspage QML Features +\previouspage {QML Internationalization}{Internationalization} +\nextpage {QML Features} +\title QML Graphical Effects + +*/ diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 23235d7..caba2cd 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -28,7 +28,10 @@ /*! \page qml-integration.html \ingroup qml-features -\title Integrating QML with existing Qt UI code +\previouspage {Using QML Bindings in C++ Applications} +\nextpage {QML Signal and Handler Event System} +\contentspage QML Features +\title Integrating QML Code with Existing Qt UI Code There are a number of ways to integrate QML into QWidget-based UI applications, depending on the characteristics of your existing UI code. @@ -102,6 +105,7 @@ which shows how to expose Qt's graphics layout classes to QML in order to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. To expose your existing QGraphicsWidget classes to QML, use \l {qmlRegisterType()}. -See \l{Extending QML in C++} for further information on using C++ types in QML. +See \l{Extending QML Functionalities using C++} for further information on +how to use C++ types in QML. */ diff --git a/doc/src/declarative/mouseevents.qdoc b/doc/src/declarative/mouseevents.qdoc new file mode 100644 index 0000000..f6512a7 --- /dev/null +++ b/doc/src/declarative/mouseevents.qdoc @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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$ +** 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 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 mouseevents.html +\title QML Mouse Events +\ingroup QML Features +\previouspage {Anchor-based Layout in QML}{Layouts using Anchors} +\nextpage {QML Text Handling and Validators}{Text Handling and Validators} +\contentspage QML Features + +\tableofcontents + +\section1 Introduction + +\section1 Mouse Events + +\list +\o \l{MouseArea} Element +\o \l{MouseEvent} Object +\endlist + +\section1 Mouse Event Handling +go over the slots and signals feature (without the C++) + +To learn more about QML's event system, please read the \l {QML Signal and Handler Event System} document. + +*/ diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index 4354f9d..3348eb8 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -28,6 +28,9 @@ /*! \page qdeclarativenetwork.html \ingroup qml-features +\previouspage {Dynamic Object Management in QML}{Dynamic Object Management} +\nextpage {QML Internationalization}{Internationalization} +\contentspage QML Features \title Network Transparency QML supports network transparency by using URLs (rather than file names) for all diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 92cf874..6f7c40a 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -29,12 +29,179 @@ \page propertybinding.html \ingroup qml-features \contentspage QML Features -\previouspage QML Features -\nextpage Using QML Positioner and Repeater Items +\previouspage QML Syntax +\nextpage {QML Basic Types}{Data Types} \title Property Binding +\section1 Properties -\section1 Introduction +QML property rules coincide with many of JavaScript's property rules. +Properties begin with a lowercase letter (with the exception of +\l{Attached Properties}). \l {JavaScript Reserved Words}{JavaScript reserved words} +are not valid property names. + +\section1 Property types + +QML supports properties of many types (see \l{QML Basic Types}). The basic types +include int, real, bool, string, color, and lists. + +\code +Item { + x: 10.5 // a 'real' property + ... + state: "details" // a 'string' property + focus: true // a 'bool' property +} +\endcode + +QML properties are \i type-safe. That is, properties only allow you to assign +a value that matches the property type. For example, the \c x property of item is a real, and if you try to assign +a string to it you will get an error. + +\badcode +Item { + property real value: "hello" // illegal! +} +\endcode + +\section1 The \c id Property + +Each object can be given a special unique property called an \c id. No other object within the +same QML component (see \l{QML Documents}) 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 \c id, "myRect". The second Rectangle element defines its +own width by referring to \tt myRect.width, which means it will have the same \tt width +value as the first Rectangle element. + +\code +Item { + Rectangle { + id: myRect + width: 100 + height: 100 + } + Rectangle { + width: myRect.width + height: 200 + } +} +\endcode + +Note that an \c id must begin with a lower-case letter or an underscore. The \c id cannot contain characters other than letters, numbers, underscores, and \l {JavaScript Reserved Words}{JavaScript reserved words}. + + +\section1 List properties + +List properties look like this: + +\code +Item { + children: [ + Image {}, + Text {} + ] +} +\endcode + +The list is enclosed in square brackets, with a comma separating the +list elements. In cases where you are only assigning a single item to a +list, you can omit the square brackets: + +\code +Image { + children: Rectangle {} +} +\endcode + +Items in the list can be accessed by the \c index. See the \l{list}{list type} documentation +for more details about list properties and their available operations. + + +\section1 Default Properties + +Each object type can specify one of its list or object properties as its default property. +If a property has been declared as the default property, the property tag can be omitted. + +For example this code: +\code +State { + changes: [ + PropertyChanges {}, + PropertyChanges {} + ] +} +\endcode + +can be simplified to: + +\code +State { + PropertyChanges {} + PropertyChanges {} +} +\endcode + +because \c changes is the default property of the \c State type. + +\section1 Grouped Properties +\target dot properties + +In some cases properties form a logical group and use a 'dot' or grouped notation +to show this. + +Grouped properties can be written like this: +\qml +Text { + font.pixelSize: 12 + font.bold: true +} +\endqml + +or like this: +\qml +Text { + font { pixelSize: 12; bold: true } +} +\endqml + +In the element documentation grouped properties are shown using the 'dot' notation. + +\section1 Attached Properties +\target attached-properties + +Some objects attach properties to another object. Attached Properties +are of the form \c {Type.property} where \c Type is the type of the +element that attaches \c property. + +For example: +\code +Component { + id: myDelegate + Text { + text: "Hello" + color: ListView.isCurrentItem ? "red" : "blue" + } +} +ListView { + delegate: myDelegate +} +\endcode + +The \l ListView element attaches the \c ListView.isCurrentItem property +to each delegate it creates. + +Another example of attached properties is the \l Keys element which +attaches properties for handling key presses to +any visual Item, for example: + +\code +Item { + focus: true + Keys.onSelectPressed: console.log("Selected") +} +\endcode +\section1 Property Binding Property binding is a declarative way of specifying the value of a property. Binding allows a property's value to be expressed as an JavaScript expression that defines the value relative to other property values or data accessible in the application. The property value is @@ -103,7 +270,7 @@ Rectangle { \section1 Effects of Property Assignment in JavaScript -Assigning a property value from JavaScript does \i not create a property binding. +Assigning a property value from JavaScript does \e not create a property binding. For example: \code @@ -153,7 +320,5 @@ Binding { value: slider.value } \endqml - - */ diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index fac1e55..cd4ccf0 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -28,6 +28,9 @@ /*! \page qdeclarativei18n.html \ingroup qml-features +\contentspage QML Features +\previouspage {Network Transparency}{Loading Resources in QML} +\nextpage {QML Graphical Effects}{Graphical Effects} \title QML Internationalization \section1 Overview diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 0be29e1..e1a425f 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -29,6 +29,8 @@ \page qdeclarativemodels.html \ingroup qml-features \contentspage QML Features +\previouspage {QML Animation and Transitions}{Animation and Transitions} +\nextpage {Presenting Data with Views} \target qmlmodels \title QML Data Models @@ -70,7 +72,8 @@ QML provides several types of data models among the built-in set of QML elements. In addition, models can be created with C++ and then made available to QML components. -The views used to access data models are described in \l{Presenting Data with QML}. +The views used to access data models are described in the +\l{Presenting Data with Views} overview. The use of positioner items to arrange items from a model is covered in \l{Using QML Positioner and Repeater Items}. @@ -465,86 +468,3 @@ a function in the model, e.g.: updated, and that \e{value} holds the new value. */ - -/*! -\page qml-presenting-data.html -\ingroup qml-features -\contentspage QML Features -\title Presenting Data with QML - -\section1 Introduction - -Qt Quick contains a set of standard items that can be used to present data in a -number of different ways. For simple user interfaces, -\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used -in combination with -\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} -to obtain pieces of data and arrange them in a user interface. However, when -large quantities of data are involved, it is often better to use models with -the standard views since these contain many built-in display and navigation -features. - -\section1 Views - -Views are scrolling containers for collections of items. They are feature-rich, -supporting many of the use cases found in typical applications, and can be -customized to meet requirements on style and behavior. - -A set of standard views are provided in the basic set of Qt Quick -graphical elements: - -\list -\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list -\o \l{#GridView}{GridView} arranges items in a grid within the available space -\o \l{#PathView}{PathView} arranges items on a path -\endlist - -Unlike these items, \l WebView is not a fully-featured view item, and needs -to be combined with a \l Flickable item to create a view that performs like -a Web browser. - -\section2 ListView - -\l ListView shows a classic list of items with horizontal or vertical placing -of items. - -\div{float-right} -\inlineimage qml-listview-snippet.png -\enddiv - -The following example shows a minimal ListView displaying a sequence of -numbers (using an \l{QML Data Models#An Integer}{integer as a model}). -A simple delegate is used to define an items for each piece of data in the -model. - -\clearfloat -\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document - - - -\section2 GridView - -\l GridView displays items in a grid like an file manager's icon view. - -\section2 PathView - -\l PathView displays items on a path, where the selection remains in -the same place and the items move around it. - -\section1 Decorating Views - -\section2 Headers and Footers - -\section2 Sections - -\section2 Navigation - -In traditional user interfaces, views can be scrolled using standard -controls, such as scroll bars and arrow buttons. In some situations, it -is also possible to drag the view directly by pressing and holding a -mouse button while moving the cursor. In touch-based user interfaces, -this dragging action is often complemented with a flicking action, where -scrolling continues after the user has stopped touching the view. - -\section1 Further Reading -*/ diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index f378ce6..3266bae 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -29,6 +29,8 @@ \page qdeclarativestates.html \ingroup qml-features \contentspage QML Features +\previouspage {Importing Reusable Components} +\nextpage {QML Animation and Transitions}{Animation and Transitions} \target qmlstates \title QML States diff --git a/doc/src/declarative/qmlevents.qdoc b/doc/src/declarative/qmlevents.qdoc new file mode 100644 index 0000000..3c1c8df --- /dev/null +++ b/doc/src/declarative/qmlevents.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlevents.html + \ingroup qml-features + \contentspage QML Features + \previouspage {Integrating QML Code with Existing Qt UI Code} + \nextpage {Dynamic Object Management in QML}{Dynamic Object Management} + + \title QML Signal and Handler Event System + +*/ diff --git a/doc/src/declarative/qmlreusablecomponents.qdoc b/doc/src/declarative/qmlreusablecomponents.qdoc new file mode 100644 index 0000000..78865a1 --- /dev/null +++ b/doc/src/declarative/qmlreusablecomponents.qdoc @@ -0,0 +1,497 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlreusablecomponents.html +\ingroup qml-features +\previouspage {Keyboard Focus in QML}{Keyboard Focus} +\nextpage {QML States}{States} +\contentspage QML Features + +\title Importing Reusable Components + +One of the key concepts in QML is the ability to define your own QML components that suit +the purposes of your application. The standard \l {QML Elements} provide the essential components +for creating a QML application; beyond these, you can write your own custom components that can +be created and reused, without the use of C++. + +Components are the building blocks of a QML project. When writing a QML application, whether +large or small, it is best to separate QML code into smaller components that perform specific +sets of operations, instead of creating mammoth QML files with large, combined functionality +that is more difficult to manage and may contain duplicated code. + + +\section1 Defining New Components + +A component is a reusable type with a well-defined interface, built entirely in QML. +Any snippet of QML code can become a component, by placing the code in a file ".qml" where + is the new component name, beginning with an uppercase letter. These QML files automatically +become available as new QML element types to other QML components and applications in the same directory. + +For example, one of the simplest and most common components you can build in QML is a +button-type component. Below, we implement this component as a \l Rectangle with a clickable +\l MouseArea, in a file named \c Button.qml: + +\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 + +Now this component can be reused by another file within the same directory. Since the file is +named \c Button.qml, the component is referred to as \c Button: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 +\o \image qml-extending-types.png +\endtable + +The root object in \c Button.qml defines the attributes that are available to users of the +\c Button component. In this case, the root object is a \l Rectangle, so any properties, methods +and signals of \l Rectangle are made available, allowing \c application.qml to +customize the \c width, \c height, \c radius and \c color properties of \c Button objects. + + +If \c Button.qml was not in the same directory, \c application.qml would need to load it as a +\l {Modules}{module} from a specific filesystem path or \l{QDeclarativeExtensionPlugin}{plugin}. +Also, note the letter case of the component file name is significant on some (notably UNIX) +filesystems. It is recommended the file name case matches the case of the QML component name +exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the +QML component will be deployed. + +To write a useful component, it is generally necessary to provide it with custom attributes that store and +communicate specific data. This is achieved by adding the following attributes to your components: + +\list +\o \bold Properties that can be accessed externally to modify an object (for example, \l Item has + \l {Item::}{width} and \l {Item::}{height} properties) and used in \l {Property Binding} +\o \bold Methods of JavaScript code can be invoked internally or externally (for example, + \l Animation has a \l {Animation::}{start()} method) +\o \bold Signals to notify other objects when an event has occurred (for example, MouseArea has a + \c clicked signal) +\endlist + +The following sections show how these attributes can be added to QML components. + + +\section1 Adding Properties + +A property is a value of a QML component that can be read and modified by other objects. For +example, a \l Rectangle component has \l {Item::}{width}, \l {Item::}{height} and \l +{Rectangle::}{color} properties. Significantly, properties be used with \l {Property Binding}, where +a property value is automatically updated using the value of another property. + +The syntax for defining a new property is: + +\code +[default] property [: defaultValue] +\endcode + +A \c property declaration can appear anywhere within a QML component definition, but it is customary +to place it at the top. A component cannot declare more than one property with the same name. (It is +possible to have a property name that is the same as an existing property in a type, but this is not +recommended as the existing property becomes hidden and inaccessible.) + +Below is an example. The \c ImageViewer component has defined a \c string type property named +\c currentImage, and its initial value is "default-image.png". This property is used to set the image +displayed in the child \l Image object. Another file, \c application.qml, can create +an \c ImageViewer object and read or modify the \c currentImage value: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/ImageViewer.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/application.qml 0 +\endtable + +It is optional for a property to have a default value. The default value is a convenient shortcut, and is +behaviorally identical to doing it in two steps, like this: + +\qml +// Use default value +property int myProperty: 10 + +// Longer, but behaviorally identical +property int myProperty +myProperty: 10 +\endqml + + +\section2 Supported property types + +All QML properties are typed. The examples above show properties with \c int and \c string types; +notice that the type of the property must be declared. The type is used to determine the property +behavior, and how the property is defined in C++. + +A number of property types are supported by default. These are listed in the table below, +with their default values and the corresponding C++ type: + +\table +\header \o QML Type Name \o Default value \o C++ Type Name +\row \o int \o 0 \o int +\row \o bool \o \c false \o bool +\row \o double \o 0.0 \o double +\row \o real \o 0.0 \o double +\row \o string \o "" (empty string) \o QString +\row \o url \o "" (empty url) \o QUrl +\row \o color \o #000000 (black) \o QColor +\row \o date \o \c undefined \o QDateTime +\row \o variant \o \c undefined \o QVariant +\endtable + +QML object types can also be used as property types. This includes +\l {Defining new QML elements}{custom QML types} implemented in C++. Such properties are +defined like this: + +\qml +property Item itemProperty +property QtObject objectProperty +property MyCustomType customProperty +\endqml + +Such object-type properties default to an \c undefined value. + +\l{list}{List properties} are created with the \c list syntax, and default to an empty +list: + +\qml +property list listOfItems +\endqml + +Note that list properties cannot be modified like ordinary JavaScript +arrays. See the \l {list}{list type documentation} for details. + +For details about accessing and manipulating QML properties from C++, see \l {Using QML Bindings in C++ Applications}. + + +\section2 Property change signals + +Adding a \c property to an item automatically adds a \e {value changed} +signal handler to the item. To connect to this signal, use a \l {Signal Handlers}{signal handler} +named with the \c onChanged syntax, using upper case for the first letter of the +property name. + +For example, the following \c onMyNumberChanged signal handler is automatically called whenever the +\c myNumber property changes: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/property-signals.qml 0 + + +\section2 Default properties + +The optional \c default attribute for a property marks it as the \e {default property} +for a type. This allows other items to specify the default property's value +as child elements. For example, the \l Item element's default property is its +\l{Item::children}{children} property. This allows the children of an \l Item +to be set like this: + +\qml +Item { + Rectangle {} + Rectangle {} +} +\endqml + +If the \l{Item::children}{children} property was not the default property for +\l Item, its value would have to be set like this instead: + +\qml +Item { + children: [ + Rectangle {} + Rectangle {} + ] +} +\endqml + +See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a +demonstration of using default properties. + +Specifying a default property overrides any existing default property (for +example, any default property inherited from a parent item). Using the +\c default attribute twice in the same type block is an error. + + +\section2 Property aliases + +Property aliases are a more advanced form of property declaration. Unlike a +property definition, which allocates a new, unique storage space for the +property, a property alias connects the newly declared property (called the +aliasing property) as a direct reference to an existing property (the aliased property). Read +operations on the aliasing property act as read operations on the aliased +property, and write operations on the aliasing property as write operations on +the aliased property. + +A property alias declaration looks a lot like an ordinary property definition: +\code + [default] property alias : +\endcode + +As the aliasing property has the same type as the aliased property, an explicit +type is omitted, and the special "alias" keyword is used. Instead of a default +value, a property alias includes a compulsory alias reference. The alias +reference is used to locate the aliased property. While similar to a property +binding, the alias reference syntax is highly restricted. + +An alias reference takes one of the following forms: +\code + . + +\endcode + +where must refer to an object id within the same component as the type +declaring the alias, and, optionally, refers to a property on that object. + +For example, below is a \c Button.qml component with a \c buttonText aliased property which is +connected to the child Text object's \c text property: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias.qml 0 + +The following code would create a \c Button with a defined text string for the +child \l Text object: + +\qml +Button { buttonText: "This is a button" } +\endqml + +Here, modifying \c buttonText directly modifies the \c textItem.text value; it does not +change some other value that then updates \c textItem.text. + +In this case, the use of aliased properties is essential. If \c buttonText was not an alias, +changing its value would not actually change the displayed text at all, as +\l {Property Binding}{property bindings} are not bi-directional: the \c buttonText value would +change when \c textItem.text changes, but not the other way around. + +Aliased properties are also useful for allowing external objects to directly modify and +access child objects in a component. For example, here is a modified version of the \c ImageViewer +component shown \l {Adding Properties}{earlier} on this page. The \c currentImage property has +been changed to an alias to the child \l Image object: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/ImageViewer.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/application.qml 0 +\endtable + +Instead of being limited to setting the \l Image source, \c application.qml can now directly +access and modify the child \l Image object and its properties. + +Obviously, exposing child objects in this manner should be done with care, as it allows external +objects to modify them freely. However, this use of aliased properties can be quite useful in +particular situations, such as for the \l {declarative/ui-components/tabwidget}{TabWidget} +example, where new tab items are actually parented to a child object that displays the current tab. + + +\section3 Considerations for property aliases + +Aliases are only activated once the component specifying them is completed. The +most obvious consequence of this is that the component itself cannot generally +use the aliased property directly during creation. For example, this will not work: + +\code + // Does NOT work + property alias buttonText: textItem.text + buttonText: "Some text" // buttonText is not yet defined when this value is set +\endcode + +A second, much less significant, consequence of the delayed activation of +aliases is that an alias reference cannot refer to another aliasing property +declared within the same component. This will not work: + +\code + // Does NOT work + id: root + property alias buttonText: textItem.text + property alias buttonText2: root.buttonText +\endcode + +At the time the component is created, the \c buttonText value has not yet been assigned, +so \c root.buttonText would refer to an undefined value. (From outside the component, +however, aliasing properties appear as regular Qt properties and consequently can be +used in alias references.) + +It is possible for an aliased property to have the same name as an existing property. For example, +the following component has a \c color alias property, named the same as the built-in +\l {Rectangle::color} property: + +\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias-override.qml 0 + +Any objects that use this component and refer to its \c color property will be +referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, +however, the rectangle can correctly set this property to "red" and refer to the actual defined +property rather than the alias. + + +\section1 Adding Methods + +A QML component can define methods of JavaScript code. These methods can be invoked +either internally or by other objects. + +The syntax for defining a method is: + +\code +function ([[, ...]]) { } +\endcode + +This declaration may appear anywhere within a type body, but it is customary to +include it at the top. Attempting to declare two methods or signals with the +same name in the same type block is an error. However, a new method may reuse +the name of an existing method on the type. (This should be done with caution, +as the existing method may be hidden and become inaccessible.) + +Unlike \l{Adding Signals}{signals}, method parameter types do not have to be declared as they +default to the \c variant type. The body of the method is written in JavaScript and may access +the parameters by name. + +Here is an example of a component with a \c say() method that accepts a single \c text argument: + +\snippet doc/src/snippets/declarative/qml-extending-types/methods/app.qml 0 + +A method can be connected to a signal so that it is automatically invoked whenever the signal +is emitted. See \l {Connecting signals to methods and other signals} below. + +Also see \l {Integrating JavaScript} for more information on using JavaScript with QML. + + +\section1 Adding Signals + +Signals provide a way to notify other objects when an event has occurred. For example, the MouseArea +\c clicked signal notifies other objects that the mouse has been clicked within the area. + +The syntax for defining a new signal is: + +\code +signal [([ [, ...]])] +\endcode + +This declaration may appear anywhere within a type body, but it is customary to +include it at the top. Attempting to declare two signals or methods with the +same name in the same type block is an error. However, a new signal may reuse +the name of an existing signal on the type. (This should be done with caution, +as the existing signal may be hidden and become inaccessible.) + +Here are three examples of signal declarations: + +\code +Item { + signal clicked + signal hovered() + signal performAction(string action, variant actionArgument) +} +\endcode + +If the signal has no parameters, the "()" brackets are optional. If parameters are used, the +parameter types must be declared, as for the \c string and \c variant arguments for the \c +performAction signal above; the allowed parameter types are the same as those listed in the \l +{Adding Properties} section on this page. + +Adding a signal to an item automatically adds a \l {Signal Handlers}{signal handler} as well. +The signal hander is named \c on, with the first letter of the signal being upper +cased. The above example item would now have the following signal handlers: + +\list +\o onClicked +\o onHovered +\o onPerformAction +\endlist + +To emit a signal, simply invoke it in the same way as a method. Below left, when the \l MouseArea is +clicked, it emits the parent \c buttonClicked signal by invoking \c rect.buttonClicked(). The +signal is received by \c application.qml through an \c onButtonClicked signal handler: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/basic.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/no-parameters.qml 0 +\endtable + +If the signal has parameters, they are accessible by parameter name in the signal handler. +In the example below, \c buttonClicked is emitted with \c xPos and \c yPos parameters instead: + +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/Button.qml 0 +\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/parameters.qml 0 +\endtable + + +\section2 Connecting signals to methods and other signals + +Signal objects have a \c connect() method that can be used to a connect a signal to a method or +another signal. When a signal is connected to a method, the method is automatically invoked +whenever the signal is emitted. (In Qt terminology, the method is a \e slot that is connected +to the \e signal; all methods defined in QML are created as Qt slots.) This enables a signal +to be received by a method instead of a \l {Signal Handlers}{signal handler}. + +For example, the \c application.qml above could be rewritten as: + +\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectslots.qml 0 + +The \c myMethod() method will be called whenever the \c buttonClicked signal is received. + +In many cases it is sufficient to receive signals through signal handlers rather than using +the \c connect() function; the above example does not provide any improvements over using a +simple \c onButtonClicked handler. However, if you are \l{Dynamic Object Management in QML}{creating objects dynamically}, +or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find the +\c connect() method useful. For example, the component below creates three \c Button +objects dynamically, and connects the \c buttonClicked signal of each object to the +\c myMethod() function: + +\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectdynamic.qml 0 + +In the same way, you could connect a signal to methods defined in a dynamically +created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. + +There is also a corresponding \c disconnect() method for removing connected signals. The following +code removes the connection created in \c application.qml above: + +\qml +// application.qml +Item { + ... + + function removeSignal() { + button.clicked.disconnect(item.myMethod) + } +} +\endqml + + +\section3 Forwarding signals + +The \c connect() method can also connect a signal to other signals. This has the effect +of "forwarding" a signal: it is automatically emitted whenever the relevant signal is emitted. For +example, the MouseArea \c onClicked handler in \c Button.qml above could have been replaced with +a call to \c connect(): + +\qml +MouseArea { + anchors.fill: parent + Component.onCompleted: clicked.connect(item.buttonClicked) +} +\endqml + +Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will +automatically be emitted as well. + +*/ diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index dfc0ad9..7a59959 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -29,13 +29,13 @@ \page qmlruntime.html \title Qt Declarative UI Runtime -QML documents are loaded and executed by the QML runtime. This includes the +QML documents are loaded and executed by the QML runtime. This includes the Declarative UI engine along with the built-in QML elements and plugin modules, and it also provides access to third-party QML elements and modules. -Applications that use QML need to invoke the QML runtime in order to -execute QML documents. This can be done by creating a QDeclarativeView -or a QDeclarativeEngine, as described below. In addition, the Declarative UI +Applications that use QML need to invoke the QML runtime in order to +execute QML documents. This can be done by creating a QDeclarativeView +or a QDeclarativeEngine, as described below. In addition, the Declarative UI package includes the \QQV tool, which loads \c .qml files. This tool is useful for developing and testing QML code without the need to write a C++ application to load the QML runtime. @@ -44,7 +44,7 @@ a C++ application to load the QML runtime. \section1 Deploying QML-based applications -To deploy an application that uses QML, the QML runtime must be invoked by +To deploy an application that uses QML, the QML runtime must be invoked by the application. This is done by writing a Qt C++ application that loads the QDeclarativeEngine by either: @@ -61,12 +61,12 @@ For example, if there is a QML file, \c application.qml, like this: \qml import QtQuick 1.0 - + Rectangle { width: 100; height: 100; color: "red" } \endqml It can be loaded in a Qt application's \c main.cpp file like this: - + \code #include #include @@ -82,10 +82,10 @@ It can be loaded in a Qt application's \c main.cpp file like this: return app.exec(); } \endcode - -This creates a QWidget-based view that displays the contents of + +This creates a QWidget-based view that displays the contents of \c application.qml. - + The application's \c .pro \l{qmake Project Files}{project file} must specify the \c declarative module for the \c QT variable. For example: @@ -97,36 +97,36 @@ the \c declarative module for the \c QT variable. For example: \section2 Creating a QDeclarativeEngine directly - -If \c application.qml does not have any graphical components, or if it is + +If \c application.qml does not have any graphical components, or if it is preferred to avoid QDeclarativeView for other reasons, the QDeclarativeEngine can be constructed directly instead. In this case, \c application.qml is loaded as a QDeclarativeComponent instance rather than placed into a view: \code #include - #include + #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); - + QDeclarativeEngine engine; QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext()); - + QDeclarativeComponent component(&engine, "application.qml"); QObject *object = component.create(objectContext); - + // ... delete object and objectContext when necessary - + return app.exec(); } \endcode -See \l {Using QML in C++ Applications} for more information about using -QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well +See \l {Using QML Bindings in C++ Applications} for more information about using +QDeclarativeEngine, QDeclarativeContext and QDeclarativeComponent, as well as details on including QML files through \l{The Qt Resource System}{Qt's Resource system}. @@ -135,8 +135,8 @@ as details on including QML files through \l{The Qt Resource System}{Qt's Resour The Declarative UI package includes a QML runtime tool, the \QQV, which loads and displays QML documents. This is useful during the application development -phase for prototyping QML-based applications without writing your own C++ -applications to invoke the QML runtime. +phase for prototyping QML-based applications without writing your own C++ +applications to invoke the QML runtime. See the \l{QML Viewer} documentation for more details. diff --git a/doc/src/declarative/qmlsyntax.qdoc b/doc/src/declarative/qmlsyntax.qdoc index 4ff2437..908b924 100644 --- a/doc/src/declarative/qmlsyntax.qdoc +++ b/doc/src/declarative/qmlsyntax.qdoc @@ -30,6 +30,7 @@ \title QML Syntax \ingroup QML Features \previouspage QML Features +\nextpage Property Binding \contentspage QML Features \tableofcontents @@ -38,11 +39,9 @@ QML is a declarative language designed to describe the user interface of a program: both what it looks like, and how it behaves. In QML, a user interface is specified as a tree of objects with properties. -This introduction is meant for those with little or no programming -experience. JavaScript is used as a scripting language in QML, so you may want +JavaScript is used as a scripting language in QML, so you may want to learn a bit more about it (\l{Javascript Guide}) before diving -deeper into QML. It's also helpful to have a basic understanding of other web -technologies like HTML and CSS, but it's not required. +deeper into QML. \section1 Basic QML Syntax diff --git a/doc/src/declarative/qmltexthandling.qdoc b/doc/src/declarative/qmltexthandling.qdoc new file mode 100644 index 0000000..c5a6bc9 --- /dev/null +++ b/doc/src/declarative/qmltexthandling.qdoc @@ -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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 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 texthandling.html +\title QML Text Handling and Validators +\ingroup QML Features +\previouspage {QML Mouse Events}{Mouse Events} +\nextpage {Keyboard Focus in QML}{Keyboard Focus} +\contentspage QML Features + +\tableofcontents + +\section1 Introduction + +\section1 Text Elements + +\list +\o \l{Text} +\o \l{TextInput} +\o \l{TextEdit} +\endlist + +\section1 Validators +\list +\o \l{IntValidator} +\o \l{DoubleValidator} +\o \l{RegExpValidator} +\endlist + +*/ diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index 82f1fec..551b20c 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -31,34 +31,34 @@ \title QML Viewer \ingroup qttools -The Declarative UI package includes \QQV, a tool for loading QML documents that -makes it easy to quickly develop and debug QML applications. It invokes the QML -runtime to load QML documents and also includes additional features useful for +The Declarative UI package includes \QQV, a tool for loading QML documents that +makes it easy to quickly develop and debug QML applications. It invokes the QML +runtime to load QML documents and also includes additional features useful for the development of QML-based applications. -The QML Viewer is a tool for testing and developing QML applications. It is -\e not intended for use in a production environment and should not be used for the +The QML Viewer is a tool for testing and developing QML applications. It is +\e not intended for use in a production environment and should not be used for the deployment of QML applications. In those cases, the QML runtime should be invoked from a Qt application instead; see \l {Qt Declarative UI Runtime} for more information. The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file -with the viewer, run the viewer and select the file to be opened, or provide the +with the viewer, run the viewer and select the file to be opened, or provide the file path on the command line: \code qmlviewer myqmlfile.qml \endcode - + On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You -can launch the viewer by opening the QMLViewer application from the Finder, or +can launch the viewer by opening the QMLViewer application from the Finder, or from the command line: \code QMLViewer.app/Contents/MacOS/QMLViewer myqmlfile.qml \endcode -The QML Viewer has a number of configuration options involving features such as +The QML Viewer has a number of configuration options involving features such as fullscreen display, module import path configurations, video recording of QML animations, and OpenGL support. @@ -68,7 +68,7 @@ To see the configuration options, run \c qmlviewer with the \c -help argument. \section1 Adding module import paths Additional module import paths can be provided using the \c -I flag. -For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates +For example, the \l{declarative/cppextensions/plugins}{QML plugins example} creates a C++ plugin identified as \c com.nokia.TimeExample. Since this has a namespaced identifier, the viewer has to be run with the \c -I flag from the example's base directory: @@ -87,16 +87,16 @@ the path is explicitly added. \section1 Loading translation files -When the QML Viewer loads a QML file, it installs a translation file from a -"i18n" subdirectory relative to that initial file. This directory should contain +When the QML Viewer loads a QML file, it installs a translation file from a +"i18n" subdirectory relative to that initial file. This directory should contain translation files named "qml_.qm", where is a two-letter ISO 639 language, such as "qml_fr.qm", optionally followed by an underscore and an uppercase two-letter ISO 3166 country code, such as "qml_fr_FR.qm" or -"qml_fr_CA.qm". +"qml_fr_CA.qm". Such files can be created using \l {Qt Linguist}. -The actual translation file that is loaded depends on the system locale. +The actual translation file that is loaded depends on the system locale. Additionally, the viewer will load any translation files specified on the command line via the \c -translation option. @@ -110,7 +110,7 @@ shows how JavaScript code in QML files can be made to use translatable strings. Often, QML applications are prototyped with fake data that is later replaced by real data sources from C++ plugins. QML Viewer assists in this aspect by loading fake data into the application context: it looks for a directory named -"dummydata" in the same directory as the target QML file, and any \c .qml +"dummydata" in the same directory as the target QML file, and any \c .qml files in that directory are loaded as QML objects and bound to the root context as properties named after the files. @@ -124,7 +124,7 @@ ListView { width: 200; height: 300 model: lottoNumbers delegate: Text { text: number } -} +} \endqml If within the document's directory, there is a "dummydata" directory which @@ -146,30 +146,30 @@ Child properties are included when loaded from dummy data. The following documen refers to a \c clock.time property: \qml -import QtQuick 1.0 +import QtQuick 1.0 Text { text: clock.time } \endqml - + The text value could be filled by a \c dummydata/clock.qml file with a \c time property in the root context: \qml -import QtQuick 1.0 +import QtQuick 1.0 QtObject { property int time: 54321 } \endqml To replace this with real data, you can simply bind the real data object to the root context in C++ using QDeclarativeContext::setContextProperty(). This -is detailed in \l {Using QML in C++ Applications}. +is detailed in \l {Using QML Bindings in C++ Applications}. \section1 Using the \c runtime object QML applications that are loaded with the QML Viewer have access to a special -\c runtime property on the root context. This property provides additional +\c runtime property on the root context. This property provides additional information about the application's runtime environment through the following properties: \table -\row +\row \o \c runtime.isActiveWindow @@ -177,9 +177,9 @@ information about the application's runtime environment through the following pr window on the system. It is useful for "pausing" an application, particularly animations, when the QML Viewer loses focus or moves to the background. -For example, the following animation is only played when the QML Viewer is +For example, the following animation is only played when the QML Viewer is the active window: - + \qml Rectangle { width: 200; height: 200 @@ -197,9 +197,9 @@ Rectangle { \o \c runtime.orientation \o This property indicates the current orientation of the QML Viewer. On the -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 +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 @@ -210,7 +210,7 @@ this indicates the orientation currently selected in the QML Viewer's \endlist When the viewer's orientation changes, the appearance of the loaded QML document -does not change unless it has been set to respond to changes in +does not change unless it has been set to respond to changes in \c runtime.orientation. For example, the following Rectangle changes its aspect ratio depending on the orientation of the QML Viewer: @@ -218,12 +218,12 @@ aspect ratio depending on the orientation of the QML Viewer: Rectangle { id: window width: 640; height: 480 - + states: State { name: "landscape" PropertyChanges { target: window; width: 480; height: 640 } } - state: (runtime.orientation == Orientation.Landscape + state: (runtime.orientation == Orientation.Landscape || runtime.orientation == Orientation.LandscapeInverted) ? 'landscape' : '' } \endqml diff --git a/doc/src/declarative/qmlviews.qdoc b/doc/src/declarative/qmlviews.qdoc new file mode 100644 index 0000000..3f74214 --- /dev/null +++ b/doc/src/declarative/qmlviews.qdoc @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** 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$ +** 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 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-views.html +\ingroup qml-features +\contentspage QML Features +\previouspage {QML Data Models}{Structuring Data with Models} +\nextpage {Extending QML Functionalities using C++} +\title Presenting Data with Views + +\section1 Introduction + +Qt Quick contains a set of standard items that can be used to present data in a +number of different ways. For simple user interfaces, +\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used +in combination with +\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} +to obtain pieces of data and arrange them in a user interface. However, when +large quantities of data are involved, it is often better to use models with +the standard views since these contain many built-in display and navigation +features. + +\section1 Views + +Views are scrolling containers for collections of items. They are feature-rich, +supporting many of the use cases found in typical applications, and can be +customized to meet requirements on style and behavior. + +A set of standard views are provided in the basic set of Qt Quick +graphical elements: + +\list +\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list +\o \l{#GridView}{GridView} arranges items in a grid within the available space +\o \l{#PathView}{PathView} arranges items on a path +\endlist + +Unlike these items, \l WebView is not a fully-featured view item, and needs +to be combined with a \l Flickable item to create a view that performs like +a Web browser. + +\section2 ListView + +\l ListView shows a classic list of items with horizontal or vertical placing +of items. + +\beginfloatright +\inlineimage qml-listview-snippet.png +\endfloat + +The following example shows a minimal ListView displaying a sequence of +numbers (using an \l{QML Data Models#An Integer}{integer as a model}). +A simple delegate is used to define an items for each piece of data in the +model. + +\clearfloat +\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document + + + +\section2 GridView + +\l GridView displays items in a grid like an file manager's icon view. + +\section2 PathView + +\l PathView displays items on a path, where the selection remains in +the same place and the items move around it. + +\section1 Decorating Views + +\section2 Headers and Footers + +\section2 Sections + +\section2 Navigation + +In traditional user interfaces, views can be scrolled using standard +controls, such as scroll bars and arrow buttons. In some situations, it +is also possible to drag the view directly by pressing and holding a +mouse button while moving the cursor. In touch-based user interfaces, +this dragging action is often complemented with a flicking action, where +scrolling continues after the user has stopped touching the view. + +\section1 Further Reading +*/ diff --git a/doc/src/declarative/qmlwebkit.qdoc b/doc/src/declarative/qmlwebkit.qdoc new file mode 100644 index 0000000..0f4e86b --- /dev/null +++ b/doc/src/declarative/qmlwebkit.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** 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 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 qmlwebkit.html + + \title QtWebKit QML Module + + Qt WebKit QML + + \section1 WebKit QML Elements + \list + \o \l WebView + \o \l FlickableWebView + \endlist + + \section1 Content + + \section1 Usage Ideas + + \section1 Other Suggestions + +*/ diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 0a66226..a7aacdb 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -28,10 +28,12 @@ /*! \page qtbinding.html \ingroup qml-features -\target qtbinding -\title Using QML in C++ Applications +\previouspage {Extending QML Functionalities using C++} +\nextpage {Integrating QML Code with Existing Qt UI Code} +\contentspage QML Features +\title Using QML Bindings in C++ Applications -QML is designed to be easily extensible from C++. The classes in the +QML is designed to be easily extensible to and from C++. The classes in the Qt Declarative module allow QML components to be loaded and manipulated from C++, and through Qt's \l{The Meta-Object System}{meta-object system}, QML and C++ objects can easily communicate through Qt signals and slots. In addition, QML plugins can be written to create @@ -86,7 +88,7 @@ delete rectangleInstance; QML documents can also be loaded using QDeclarativeView. This class provides a convenient QWidget-based view for embedding QML components into QGraphicsView-based applications. (For other -methods of integrating QML into QWidget-based applications, see \l {Integrating QML with existing Qt +methods of integrating QML into QWidget-based applications, see \l {Integrating QML Code with existing Qt UI code}.) @@ -254,8 +256,8 @@ Note that custom C++ types do not have to inherit from QDeclarativeItem; this is a displayable item. If the item is not displayable, it can simply inherit from QObject. For more information on defining new QML elements, see the \l {Tutorial: Writing QML extensions with C++} -{Writing QML extensions with C++} tutorial and the \l {Extending QML in C++} reference -documentation. +{Writing QML extensions with C++} tutorial and the +\l {Extending QML Functionalities using C++} reference documentation. @@ -485,7 +487,8 @@ can be registered using qmlRegisterUncreatableType(). To be accessible from QML must begin with a capital letter. See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions with C++} tutorial and -the \l {Extending QML in C++} reference documentation for more information. +the \l {Extending QML Functionalities using C++} reference documentation for +more information. \section2 Automatic type conversion from strings diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index 0c14093..1746c31 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -48,7 +48,8 @@ QML provides direct access to the following concepts from Qt: \o Qt models - used directly in data binding (QAbstractItemModel) \endlist -Qt knowledge is \e required for \l {Extending QML in C++}, and also for \l{Integrating QML with existing Qt UI code}. +Qt knowledge is \e required for \l {Extending QML Functionalities using C++}, +and also for \l{Integrating QML Code with existing Qt UI code}. \section1 QML Items compared with QWidgets diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 0834527..9dad84a 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -29,7 +29,7 @@ \title Animation: Basics Example \example declarative/animation/basics - This example shows how to create and combine \l{QML Animation}{animations} in QML. + This example shows how to create and combine \l{QML Animation and Transitions}{animations} in QML. \table \row @@ -50,16 +50,16 @@ \title Animation: Behavior Examples \example declarative/animation/behaviors - This example shows how to use QML behaviors. + This example shows how to use QML behaviors. \image qml-behaviors-example.png */ /*! - \title Animation: Easing Example + \title Animation: Easing Example \example declarative/animation/easing - This example shows the different easing modes available for \l{QML Animation}{animations}. + This example shows the different easing modes available for \l{QML Animation and Transitions}{animations}. \image qml-easing-example.png */ @@ -122,9 +122,9 @@ \page declarative-cppextensions-reference.html \title C++ Extensions: Reference examples - These examples show how QML can be extended from C++ in various ways. - - The code for these examples is used throughout the \l {Extending QML in C++} reference + These examples show how QML can be extended from C++ in various ways. + + The code for these examples is used throughout the \l {Extending QML Functionalities using C++} reference documentation, which highlights the main principles demonstrated in each example. Furthermore, here are additional pages that discuss each example in detail: @@ -160,7 +160,7 @@ \title LayoutItem Example \example declarative/cppextensions/qgraphicslayouts/layoutitem - This example show how to use the LayoutItem element to integrate QML items into an existing + This example show how to use the LayoutItem element to integrate QML items into an existing \l{Graphics View Framework}{Graphics View}-based application. \image qml-layoutitem-example.png @@ -169,7 +169,7 @@ \title QGraphicsGridLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout - This example shows how to use QGraphicsGridLayout to lay out QML items. This is + This example shows how to use QGraphicsGridLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. @@ -179,10 +179,10 @@ \title QGraphicsLinearLayout Example \example declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout - This example shows how to use QGraphicsLinearLayout to lay out QML items. This is + This example shows how to use QGraphicsLinearLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. - + \image qml-qgraphicslinearlayout-example.png */ /*! @@ -198,7 +198,7 @@ \o \l{declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout}{QGraphicsLinearLayout} \endlist - Also see \l {Integrating QML with existing Qt UI code} for information on using QML + Also see \l {Integrating QML Code with Existing Qt UI Code} for information on using QML in Qt applications that use the Graphics View framework or ordinary QWidget-based views. */ @@ -215,7 +215,7 @@ \title C++ Extensions: Image Provider Example \example declarative/cppextensions/imageprovider - This examples shows how to use QDeclarativeImageProvider to serve images + This examples shows how to use QDeclarativeImageProvider to serve images to QML image elements. \image qml-imageprovider-example.png @@ -525,7 +525,7 @@ \example declarative/toys/clocks This example displays a set of clocks with different times for different cities. - Each clock is created by combining \l Image elements with \l Rotation transforms + Each clock is created by combining \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors. \image qml-clocks-example.png diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index e3977bb..d2fc4ea 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -631,7 +631,7 @@ 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 + \l {Using QML Bindings 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. diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 5c48a33..96805d0 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -164,9 +164,32 @@ \brief Features of the QML Language - These are overviews of the many features of the QML Language. - - \generatelist {related} + These are overviews of the many features of the QML language. + + \list + \o \l{QML Syntax} + \o \l{Property Binding} + \o \l{QML Basic Types}{Data Types} + \o \l{QML Basic Elements}{Basic Elements} + \o \l{Using QML Positioner and Repeater Items}{Component Layouts} + \o \l{Anchor-based Layout in QML}{Layouts using Anchors} + \o \l{Mouse Events} + \o \l{QML Text Handling and Validators}{Text Handling and Validators} + \o \l{Keyboard Focus in QML}{Keyboard Focus} + \o \l{Importing Reusable Components} + \o \l{QML States}{States} + \o \l{QML Animation and Transitions}{Animation and Transitions} + \o \l{QML Data Models}{Structuring Data with Models} + \o \l{Presenting Data with Views} + \o \l{Extending QML Functionalities using C++} + \o \l{Using QML Bindings in C++ Applications} + \o \l{Integrating QML Code with Existing Qt UI Code} + \o \l{QML Signal and Handler Event System}{Signal and Handler Event System} + \o \l{Dynamic Object Management in QML}{Dynamic Object Management} + \o \l{Network Transparency}{Loading Resources in QML} + \o \l{QML Internationalization}{Internationalization} + \o \l{QML Graphical Effects}{Graphical Effects} + \endlist */ /*! \group qml-architecture diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 0a03157..516f2c5 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -244,3 +244,19 @@ \externalpage http://labs.qt.nokia.com \title Qt Labs */ + +/*! + \externalpage http://doc.qt.nokia.com/qtcreator-snapshot/index.html + \title Qt Creator Manual +*/ + +/*! + \externalpage http://doc.qt.nokia.com/qtcreator-snapshot/creator-qml-application.html + \title Developing Qt Quick Applications with Creator +*/ + +/*! + \externalpage http://qt.gitorious.org/qt/pages/QtCodingStyle + \title Qt Coding Style +*/ + diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/declarative/ui-components/tabwidget/TabWidget.qml index 2a74c46..c8f5711 100644 --- a/examples/declarative/ui-components/tabwidget/TabWidget.qml +++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml @@ -45,7 +45,7 @@ Item { // Setting the default property to stack.children means any child items // of the TabWidget are actually added to the 'stack' item's children. - // See the "Writing QML Components: Properties, Methods and Signals" + // See the "Property Binding" // documentation for details on default properties. default property alias content: stack.children diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index f118a85..48b6ba0 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -86,13 +86,13 @@ public: The following example shows a Flipable item that flips whenever it is clicked, rotating about the y-axis. - This flipable item has a \c flipped boolean property that is toggled - whenever the MouseArea within the flipable is clicked. When - \c flipped is true, the item changes to the "back" state; in this + This flipable item has a \c flipped boolean property that is toggled + whenever the MouseArea within the flipable is clicked. When + \c flipped is true, the item changes to the "back" state; in this state, the \c angle of the \l Rotation item is changed to 180 degrees to produce the flipping effect. When \c flipped is false, the - item reverts to the default state, in which the \c angle value is 0. - + item reverts to the default state, in which the \c angle value is 0. + \snippet doc/src/snippets/declarative/flipable/flipable.qml 0 \image flipable.gif @@ -103,8 +103,8 @@ public: its old and new values. See \l {QML States} for details on state changes and the default - state, and \l {QML Animation} for more information on how animations - work within transitions. + state, and \l {QML Animation and Transitions} for more information on how + animations work within transitions. \sa {declarative/ui-components/flipable}{Flipable example} */ diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 77fc925..edc7b2a 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -135,7 +135,7 @@ class QByteArray; } \endcode - \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} + \sa {Using QML Bindings in C++ Applications}, {Integrating QML Code with Existing Qt UI Code} */ /*! @@ -157,7 +157,7 @@ class QByteArray; \snippet doc/src/snippets/declarative/component.qml 0 - Notice that while a \l Rectangle by itself would be automatically + Notice that while a \l Rectangle by itself would be automatically rendered and displayed, this is not the case for the above rectangle because it is defined inside a \c Component. The component encapsulates the QML elements within, as if they were defined in a separate QML @@ -227,7 +227,7 @@ class QByteArray; /*! \enum QDeclarativeComponent::Status - + Specifies the loading status of the QDeclarativeComponent. \value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content. @@ -279,8 +279,8 @@ void QDeclarativeComponentPrivate::clear() typeData->release(); typeData = 0; } - - if (cc) { + + if (cc) { cc->release(); cc = 0; } @@ -436,12 +436,12 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const Q } /*! - Create a QDeclarativeComponent from the given \a fileName and give it the specified + Create a QDeclarativeComponent from the given \a fileName and give it the specified \a parent and \a engine. \sa loadUrl() */ -QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, +QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, QObject *parent) : QObject(*(new QDeclarativeComponentPrivate), parent) { @@ -480,7 +480,7 @@ void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url); - + if (typeData->isCompleteOrError()) { d->fromTypeData(typeData); } else { @@ -615,7 +615,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q /*! \qmlmethod object Component::createObject(Item parent) - Creates and returns an object instance of this component that will have the given + Creates and returns an object instance of this component that will have the given \a parent. Returns null if object creation fails. The object will be created in the same context as the one in which the component @@ -623,8 +623,8 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q which were not created in QML. If you wish to create an object without setting a parent, specify \c null for - the \a parent value. Note that if the returned object is to be displayed, you - must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} + the \a parent value. Note that if the returned object is to be displayed, you + must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} property, or else the object will not be visible. Dynamically created instances can be deleted with the \c destroy() method. @@ -669,7 +669,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) } } - if (needParent) + if (needParent) qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene."); } completeCreate(); @@ -682,7 +682,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) /*! Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. If \a context is 0 (the default), it will create the instance in the engine' s \l {QDeclarativeEngine::rootContext()}{root context}. @@ -699,7 +699,7 @@ QObject *QDeclarativeComponent::create(QDeclarativeContext *context) return rv; } -QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, +QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, const QBitField &bindings) { if (!context) @@ -712,21 +712,21 @@ QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. When QDeclarativeComponent constructs an instance, it occurs in three steps: \list 1 \i The object hierarchy is created, and constant values are assigned. \i Property bindings are evaluated for the the first time. \i If applicable, QDeclarativeParserStatus::componentComplete() is called on objects. - \endlist + \endlist QDeclarativeComponent::beginCreate() differs from QDeclarativeComponent::create() in that it - only performs step 1. QDeclarativeComponent::completeCreate() must be called to + only performs step 1. QDeclarativeComponent::completeCreate() must be called to complete steps 2 and 3. This breaking point is sometimes useful when using attached properties to @@ -777,7 +777,7 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons return begin(context, creationContext, cc, start, count, &state, 0, bindings); } -QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, +QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList *errors, @@ -789,7 +789,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided - if (isRoot) + if (isRoot) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); QDeclarativeContextData *ctxt = new QDeclarativeContextData; @@ -798,7 +798,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon ctxt->imports = component->importCache; // Nested global imports - if (componentCreationContext && start != -1) + if (componentCreationContext && start != -1) ctxt->importedScripts = componentCreationContext->importedScripts; component->importCache->addref(); @@ -850,7 +850,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi QDeclarativeVME vme; vme.runDeferred(object); - if (vme.isError()) + if (vme.isError()) state->errors = vme.errors(); if (isRoot) { @@ -877,13 +877,13 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri if (state->completePending) { for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList bv = + QDeclarativeEnginePrivate::SimpleList bv = state->bindValues.at(ii); for (int jj = 0; jj < bv.count; ++jj) { if(bv.at(jj)) { // XXX akennedy bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } } @@ -891,7 +891,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri } for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList ps = + QDeclarativeEnginePrivate::SimpleList ps = state->parserStatus.at(ii); for (int jj = ps.count - 1; jj >= 0; --jj) { @@ -942,7 +942,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Complete a component creation begin with QDeclarativeComponent::beginCreate(). diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 3ee0e6f..dff90b4 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -72,10 +72,10 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() Contexts allow data to be exposed to the QML components instantiated by the QML engine. - Each QDeclarativeContext contains a set of properties, distinct from its QObject - properties, that allow data to be explicitly bound to a context by name. The - context properties are defined and updated by calling - QDeclarativeContext::setContextProperty(). The following example shows a Qt model + Each QDeclarativeContext contains a set of properties, distinct from its QObject + properties, that allow data to be explicitly bound to a context by name. The + context properties are defined and updated by calling + QDeclarativeContext::setContextProperty(). The following example shows a Qt model being bound to a context and then accessed from a QML file. \code @@ -97,8 +97,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls - to QDeclarativeContext::setContextProperty(). Changes to the property's values are - detected through the property's notify signal. Setting a context object is both + to QDeclarativeContext::setContextProperty(). Changes to the property's values are + detected through the property's notify signal. Setting a context object is both faster and easier than manually adding and maintaing context property values. The following example has the same effect as the previous one, but it uses a context @@ -121,7 +121,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() component.create(context); \endcode - All properties added explicitly by QDeclarativeContext::setContextProperty() take + All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. \section2 The Context Hierarchy @@ -147,8 +147,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context2->setContextProperty("b", 15); \endcode - While QML objects instantiated in a context are not strictly owned by that - context, their bindings are. If a context is destroyed, the property bindings of + While QML objects instantiated in a context are not strictly owned by that + context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. \warning Setting the context object or adding new context properties after an object @@ -156,7 +156,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. - \sa {Using QML in C++ Applications} + \sa {Using QML Bindings in C++ Applications} */ /*! \internal */ @@ -223,7 +223,7 @@ QDeclarativeContext::~QDeclarativeContext() /*! Returns whether the context is valid. - To be valid, a context must have a engine, and it's contextObject(), if any, + To be valid, a context must have a engine, and it's contextObject(), if any, must not have been deleted. */ bool QDeclarativeContext::isValid() const @@ -384,7 +384,7 @@ QVariant QDeclarativeContext::contextProperty(const QString &name) const if (data->contextObject) { QObject *obj = data->contextObject; QDeclarativePropertyCache::Data local; - QDeclarativePropertyCache::Data *property = + QDeclarativePropertyCache::Data *property = QDeclarativePropertyCache::property(data->engine, obj, name, local); if (property) value = obj->metaObject()->property(property->coreIndex).read(obj); @@ -461,7 +461,7 @@ QUrl QDeclarativeContext::baseUrl() const { Q_D(const QDeclarativeContext); const QDeclarativeContextData* data = d->data; - while (data && data->url.isEmpty()) + while (data && data->url.isEmpty()) data = data->parent; if (data) @@ -515,7 +515,7 @@ QDeclarativeContextData::QDeclarativeContextData(QDeclarativeContext *ctxt) void QDeclarativeContextData::invalidate() { - while (childContexts) + while (childContexts) childContexts->invalidate(); while (componentAttached) { @@ -570,7 +570,7 @@ void QDeclarativeContextData::clearContext() void QDeclarativeContextData::destroy() { - if (linkedContext) + if (linkedContext) linkedContext->destroy(); if (engine) invalidate(); @@ -626,9 +626,9 @@ void QDeclarativeContextData::setParent(QDeclarativeContextData *p) } } -/* -Refreshes all expressions that could possibly depend on this context. Refreshing flushes all -context-tree dependent caches in the expressions, and should occur every time the context tree +/* +Refreshes all expressions that could possibly depend on this context. Refreshing flushes all +context-tree dependent caches in the expressions, and should occur every time the context tree *structure* (not values) changes. */ void QDeclarativeContextData::refreshExpressions() @@ -656,7 +656,7 @@ void QDeclarativeContextData::addObject(QObject *o) data->outerContext = this; data->nextContextObject = contextObjects; - if (data->nextContextObject) + if (data->nextContextObject) data->nextContextObject->prevContextObject = &data->nextContextObject; data->prevContextObject = &contextObjects; contextObjects = data; @@ -664,7 +664,7 @@ void QDeclarativeContextData::addObject(QObject *o) void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script) { - if (!engine) + if (!engine) return; QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); @@ -684,7 +684,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url)); scriptContext->pushScope(enginePriv->globalClass->staticGlobalObject()); - + QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(scriptEngine); scriptContext->pushScope(scope); @@ -752,7 +752,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const for (int i=0; ifindId(i); - } + } if (linkedContext) return linkedContext->findObjectId(obj); @@ -761,7 +761,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const QDeclarativeContext *QDeclarativeContextData::asQDeclarativeContext() { - if (!publicContext) + if (!publicContext) publicContext = new QDeclarativeContext(this); return publicContext; } diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index dd7e5fd..8c3d3da 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -569,7 +569,7 @@ void QDeclarativeAbstractAnimation::timelineComplete() } \endcode - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativePauseAnimation::QDeclarativePauseAnimation(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePauseAnimationPrivate), parent) @@ -628,27 +628,27 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() \inherits PropertyAnimation \brief The ColorAnimation element animates changes in color values. - ColorAnimation is a specialized PropertyAnimation that defines an + ColorAnimation is a specialized PropertyAnimation that defines an animation to be applied when a color value changes. - Here is a ColorAnimation applied to the \c color property of a \l Rectangle - as a property value source. It animates the \c color property's value from + Here is a ColorAnimation applied to the \c color property of a \l Rectangle + as a property value source. It animates the \c color property's value from its current value to a value of "red", over 1000 milliseconds: \snippet doc/src/snippets/declarative/coloranimation.qml 0 Like any other animation element, a ColorAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. - - For convenience, when a ColorAnimation is used in a \l Transition, it will - animate any \c color properties that have been modified during the state - change. If a \l{PropertyAnimation::}{property} or - \l{PropertyAnimation::}{properties} are explicitly set for the animation, + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. + + For convenience, when a ColorAnimation is used in a \l Transition, it will + animate any \c color properties that have been modified during the state + change. If a \l{PropertyAnimation::}{property} or + \l{PropertyAnimation::}{properties} are explicitly set for the animation, then those are used instead. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeColorAnimation::QDeclarativeColorAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -682,10 +682,10 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() If the ColorAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QColor QDeclarativeColorAnimation::from() const { @@ -708,7 +708,7 @@ void QDeclarativeColorAnimation::setFrom(const QColor &f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QColor QDeclarativeColorAnimation::to() const { @@ -875,7 +875,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. - PropertyAction is used to specify an immediate property change during an + PropertyAction is used to specify an immediate property change during an animation. The property change is not animated. It is useful for setting non-animated property values during an animation. @@ -886,9 +886,9 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() \snippet doc/src/snippets/declarative/propertyaction.qml standalone - PropertyAction is also useful for setting the exact point at which a property - change should occur during a \l Transition. For example, if PropertyChanges - was used in a \l State to rotate an item around a particular + PropertyAction is also useful for setting the exact point at which a property + change should occur during a \l Transition. For example, if PropertyChanges + was used in a \l State to rotate an item around a particular \l {Item::}{transformOrigin}, it might be implemented like this: \snippet doc/src/snippets/declarative/propertyaction.qml transition @@ -896,7 +896,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of a transition. The animation would rotate at the default \c transformOrigin, - then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges + then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges before the RotationAnimation begins: \qml @@ -907,13 +907,13 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() } } \endqml - + This immediately sets the \c transformOrigin property to the value defined - in the end state of the \l Transition (i.e. the value defined in the + in the end state of the \l Transition (i.e. the value defined in the PropertyChanges object) so that the rotation animation begins with the correct transform origin. - \sa {QML Animation}, QtDeclarative + \sa {QML Animation and Transitions}, QtDeclarative */ QDeclarativePropertyAction::QDeclarativePropertyAction(QObject *parent) : QDeclarativeAbstractAnimation(*(new QDeclarativePropertyActionPrivate), parent) @@ -1143,25 +1143,25 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, \inherits PropertyAnimation \brief The NumberAnimation element animates changes in qreal-type values. - NumberAnimation is a specialized PropertyAnimation that defines an + NumberAnimation is a specialized PropertyAnimation that defines an animation to be applied when a numerical value changes. - Here is a NumberAnimation applied to the \c x property of a \l Rectangle - as a property value source. It animates the \c x value from its current + Here is a NumberAnimation applied to the \c x property of a \l Rectangle + as a property value source. It animates the \c x value from its current value to a value of 50, over 1000 milliseconds: \snippet doc/src/snippets/declarative/numberanimation.qml 0 Like any other animation element, a NumberAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. Note that NumberAnimation may not animate smoothly if there are irregular changes in the number value that it is tracking. If this is the case, use SmoothedAnimation instead. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -1205,10 +1205,10 @@ void QDeclarativeNumberAnimation::init() If the NumberAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeNumberAnimation::from() const @@ -1231,7 +1231,7 @@ void QDeclarativeNumberAnimation::setFrom(qreal f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeNumberAnimation::to() const { @@ -1253,15 +1253,15 @@ void QDeclarativeNumberAnimation::setTo(qreal t) \inherits PropertyAnimation \brief The Vector3dAnimation element animates changes in QVector3d values. - Vector3dAnimation is a specialized PropertyAnimation that defines an + Vector3dAnimation is a specialized PropertyAnimation that defines an animation to be applied when a Vector3d value changes. Like any other animation element, a Vector3dAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent) : QDeclarativePropertyAnimation(parent) @@ -1282,10 +1282,10 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation() If the Vector3dAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVector3D QDeclarativeVector3dAnimation::from() const { @@ -1307,7 +1307,7 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVector3D QDeclarativeVector3dAnimation::to() const { @@ -1330,7 +1330,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \brief The RotationAnimation element animates changes in rotation values. RotationAnimation is a specialized PropertyAnimation that gives control - over the direction of rotation during an animation. + over the direction of rotation during an animation. By default, it rotates in the direction of the numerical change; a rotation from 0 to 240 will rotate 240 degrees @@ -1346,7 +1346,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing - your own properties via \l {PropertyAnimation::properties}{properties} or + your own properties via \l {PropertyAnimation::properties}{properties} or \l {PropertyAnimation::property}{property}. Also, note the \l Rectangle will be rotated around its default @@ -1356,11 +1356,11 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) PropertyAction documentation for more details. Like any other animation element, a RotationAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress) { @@ -1431,10 +1431,10 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() If the RotationAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeRotationAnimation::from() const { @@ -1456,7 +1456,7 @@ void QDeclarativeRotationAnimation::setFrom(qreal f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ qreal QDeclarativeRotationAnimation::to() const { @@ -1582,15 +1582,15 @@ QDeclarativeListProperty QDeclarativeAnimationGro if this is the preferred behavior. Like any other animation element, a SequentialAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \note Once an animation has been grouped into a SequentialAnimation or + \note Once an animation has been grouped into a SequentialAnimation or ParallelAnimation, it cannot be individually started and stopped; the SequentialAnimation or ParallelAnimation must be started and stopped as a group. - - \sa ParallelAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + + \sa ParallelAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent) : @@ -1652,15 +1652,15 @@ void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actio \snippet doc/src/snippets/declarative/parallelanimation.qml 0 Like any other animation element, a ParallelAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \note Once an animation has been grouped into a SequentialAnimation or + \note Once an animation has been grouped into a SequentialAnimation or ParallelAnimation, it cannot be individually started and stopped; the SequentialAnimation or ParallelAnimation must be started and stopped as a group. - \sa SequentialAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa SequentialAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) : QDeclarativeAnimationGroup(parent) @@ -1755,14 +1755,14 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int \inherits Animation \brief The PropertyAnimation element animates changes in property values. - PropertyAnimation provides a way to animate changes to a property's value. + PropertyAnimation provides a way to animate changes to a property's value. It can be used to define animations in a number of ways: - + \list \o In a \l Transition - For example, to animate any objects that have changed their \c x or \c y properties + For example, to animate any objects that have changed their \c x or \c y properties as a result of a state change, using an \c InOutQuad easing curve: \snippet doc/src/snippets/declarative/propertyanimation.qml transition @@ -1802,12 +1802,12 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int Depending on how the animation is used, the set of properties normally used will be different. For more information see the individual property documentation, as well - as the \l{QML Animation} introduction. + as the \l{QML Animation and Transitions} introduction. Note that PropertyAnimation inherits the abstract \l Animation element. This includes additional properties and methods for controlling the animation. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativePropertyAnimation::QDeclarativePropertyAnimation(QObject *parent) @@ -1867,10 +1867,10 @@ void QDeclarativePropertyAnimation::setDuration(int duration) If the PropertyAnimation is defined within a \l Transition or \l Behavior, this value defaults to the value defined in the starting state of the - \l Transition, or the current value of the property at the moment the + \l Transition, or the current value of the property at the moment the \l Behavior is triggered. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVariant QDeclarativePropertyAnimation::from() const { @@ -1897,7 +1897,7 @@ void QDeclarativePropertyAnimation::setFrom(const QVariant &f) \l Transition, or the value of the property change that triggered the \l Behavior. - \sa {QML Animation} + \sa {QML Animation and Transitions} */ QVariant QDeclarativePropertyAnimation::to() const { @@ -2264,7 +2264,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) As seen in the above example, properties is specified as a comma-separated string of property names to animate. - \sa exclude, {QML Animation} + \sa exclude, {QML Animation and Transitions} */ QDeclarativeListProperty QDeclarativePropertyAnimation::targets() { @@ -2447,7 +2447,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions ParentAnimation is used to animate a parent change for an \l Item. For example, the following ParentChange changes \c blueRect to become - a child of \c redRect when it is clicked. The inclusion of the + a child of \c redRect when it is clicked. The inclusion of the ParentAnimation, which defines a NumberAnimation to be applied during the transition, ensures the item animates smoothly as it moves to its new parent: @@ -2462,17 +2462,17 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions to animate the parent change via another item that does not have clipping enabled. Such an item can be set using the \l via property. - For convenience, when a ParentAnimation is used in a \l Transition, it will - animate any ParentChange that has occurred during the state change. + For convenience, when a ParentAnimation is used in a \l Transition, it will + animate any ParentChange that has occurred during the state change. This can be overridden by setting a specific target item using the \l target property. Like any other animation element, a ParentAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent) @@ -2803,23 +2803,23 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation() \inherits Animation \brief The AnchorAnimation element animates changes in anchor values. - AnchorAnimation is used to animate an anchor change. + AnchorAnimation is used to animate an anchor change. In the following snippet we animate the addition of a right anchor to a \l Rectangle: \snippet doc/src/snippets/declarative/anchoranimation.qml 0 - For convenience, when an AnchorAnimation is used in a \l Transition, it will - animate any AnchorChanges that have occurred during the state change. + For convenience, when an AnchorAnimation is used in a \l Transition, it will + animate any AnchorChanges that have occurred during the state change. This can be overridden by setting a specific target item using the \l target property. Like any other animation element, an AnchorAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa {QML Animation}, AnchorChanges + \sa {QML Animation and Transitions}, AnchorChanges */ QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(QObject *parent) diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index f1b6f9a..45257de 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -76,7 +76,7 @@ public: \since 4.7 \brief The Behavior element allows you to specify a default animation for a property change. - A Behavior defines the default animation to be applied whenever a + A Behavior defines the default animation to be applied whenever a particular property value changes. For example, the following Behavior defines a NumberAnimation to be run @@ -93,7 +93,7 @@ public: Behavior, the \l Transition animation overrides the Behavior for that state change. - \sa {QML Animation}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative + \sa {QML Animation and Transitions}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative */ @@ -205,7 +205,7 @@ void QDeclarativeBehavior::write(const QVariant &value) d->animation->qtAnimation()->start(); d->blockRunningChanged = false; if (!after.contains(d->property)) - QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property) diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index ca83c52..da4c707 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -257,8 +257,8 @@ void QSmoothedAnimation::init() A SmoothedAnimation animates a property's value to a set target value using an ease in/out quad easing curve. When the target value changes, - the easing curves used to animate between the old and new target values - are smoothly spliced together to create a smooth movement to the new + the easing curves used to animate between the old and new target values + are smoothly spliced together to create a smooth movement to the new target value that maintains the current velocity. The follow example shows one \l Rectangle tracking the position of another @@ -288,11 +288,11 @@ void QSmoothedAnimation::init() of 0.5 will take 2000 ms to complete. Like any other animation element, a SmoothedAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa SpringAnimation, NumberAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example} + \sa SpringAnimation, NumberAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example} */ QDeclarativeSmoothedAnimation::QDeclarativeSmoothedAnimation(QObject *parent) diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index e0fc45d..ccebe82 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -246,19 +246,19 @@ void QDeclarativeSpringAnimationPrivate::updateMode() You can also limit the maximum \l velocity of the animation. - The following \l Rectangle moves to the position of the mouse using a + The following \l Rectangle moves to the position of the mouse using a SpringAnimation when the mouse is clicked. The use of the \l Behavior - on the \c x and \c y values indicates that whenever these values are + on the \c x and \c y values indicates that whenever these values are changed, a SpringAnimation should be applied. \snippet doc/src/snippets/declarative/springanimation.qml 0 Like any other animation element, a SpringAnimation can be applied in a - number of ways, including transitions, behaviors and property value - sources. The \l {QML Animation} documentation shows a variety of methods - for creating animations. + number of ways, including transitions, behaviors and property value + sources. The \l {QML Animation and Transitions} documentation shows a + variety of methods for creating animations. - \sa SmoothedAnimation, {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} + \sa SmoothedAnimation, {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} */ QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent) @@ -299,7 +299,7 @@ void QDeclarativeSpringAnimation::setVelocity(qreal velocity) This property describes how strongly the target is pulled towards the source. The default value is 0 (that is, the spring-like motion is disabled). - + The useful value range is 0 - 5.0. When this property is set and the \l velocity value is greater than 0, @@ -394,9 +394,9 @@ void QDeclarativeSpringAnimation::setModulus(qreal modulus) \qmlproperty real SpringAnimation::mass This property holds the "mass" of the property being moved. - The value is 1.0 by default. - - A greater mass causes slower movement and a greater spring-like + The value is 1.0 by default. + + A greater mass causes slower movement and a greater spring-like motion when an item comes to rest. */ qreal QDeclarativeSpringAnimation::mass() const diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index c8bc7b3..49f0000 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -60,24 +60,24 @@ QT_BEGIN_NAMESPACE A Transition defines the animations to be applied when a \l State change occurs. For example, the following \l Rectangle has two states: the default state, and - an added "moved" state. In the "moved state, the rectangle's position changes + an added "moved" state. In the "moved state, the rectangle's position changes to (50, 50). The added Transition specifies that when the rectangle changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. \snippet doc/src/snippets/declarative/transition.qml 0 - Notice the example does not require \l{PropertyAnimation::}{to} and + Notice the example does not require \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values for the NumberAnimation. As a convenience, these properties are automatically set to the values of \c x and \c y before and after the state change; the \c from values are provided by the current values of \c x and \c y, and the \c to values are provided by - the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and + the PropertyChanges object. If you wish, you can provide \l{PropertyAnimation::}{to} and \l{PropertyAnimation::}{from} values anyway to override the default values. - By default, a Transition's animations are applied for any state change in the - parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to} - values can be set to restrict the animations to only be applied when changing + By default, a Transition's animations are applied for any state change in the + parent item. The Transition \l {Transition::}{from} and \l {Transition::}{to} + values can be set to restrict the animations to only be applied when changing from one particular state to another. To define multiple transitions, specify \l Item::transitions as a list: @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE \l Behavior, the Transition animation overrides the \l Behavior for that state change. - \sa {QML Animation}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} + \sa {QML Animation and Transitions}, {declarative/animation/states}{states example}, {qmlstates}{States}, {QtDeclarative} */ //ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting @@ -119,8 +119,8 @@ class QDeclarativeTransitionPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeTransition) public: - QDeclarativeTransitionPrivate() - : fromState(QLatin1String("*")), toState(QLatin1String("*")), + QDeclarativeTransitionPrivate() + : fromState(QLatin1String("*")), toState(QLatin1String("*")), reversed(false), reversible(false), endState(0) { group.trans = this; @@ -223,7 +223,7 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act If the transition was changed to this: \qml - transitions: Transition { + transitions: Transition { to: "brighter" ColorAnimation { duration: 1000 } } @@ -263,7 +263,7 @@ void QDeclarativeTransition::setFromState(const QString &f) is reversed, and it is not necessary to set this property to reverse the transition. - However, if a SequentialAnimation is used, or if the \l from or \l to + However, if a SequentialAnimation is used, or if the \l from or \l to properties have been set, this property will need to be set to reverse a transition when a state change is reverted. For example, the following transition applies a sequential animation when the mouse is pressed, @@ -271,7 +271,7 @@ void QDeclarativeTransition::setFromState(const QString &f) \snippet doc/src/snippets/declarative/transition-reversible.qml 0 - If the transition did not set the \c to and \c reversible values, then + If the transition did not set the \c to and \c reversible values, then on the mouse release, the transition would play the PropertyAnimation before the ColorAnimation instead of reversing the sequence. */ diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index c22f200..e1cf6d7 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -195,9 +195,9 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, \since 4.7 \brief The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface. - QDeclarativeItem objects can be placed on a standard QGraphicsScene and - displayed with QGraphicsView. QDeclarativeView is a QGraphicsView subclass - provided as a convenience for displaying QML files, and connecting between + QDeclarativeItem objects can be placed on a standard QGraphicsScene and + displayed with QGraphicsView. QDeclarativeView is a QGraphicsView subclass + provided as a convenience for displaying QML files, and connecting between QML and C++ Qt objects. QDeclarativeView provides: @@ -234,7 +234,7 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, you can connect to the statusChanged() signal and monitor for QDeclarativeView::Error. The errors are available via QDeclarativeView::errors(). - \sa {Integrating QML with existing Qt UI code}, {Using QML in C++ Applications} + \sa {Integrating QML Code with Existing Qt UI Code}, {Using QML Bindings in C++ Applications} */ @@ -248,7 +248,7 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, /*! \fn QDeclarativeView::QDeclarativeView(QWidget *parent) - + Constructs a QDeclarativeView with the given \a parent. */ QDeclarativeView::QDeclarativeView(QWidget *parent) @@ -695,7 +695,7 @@ void QDeclarativeView::paintEvent(QPaintEvent *event) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Painting); int time = 0; - if (frameRateDebug()) + if (frameRateDebug()) time = d->frameTimer.restart(); #ifdef Q_WS_MAC -- cgit v0.12 From 666a94d7758e466e044bafa943b2c252ef4b5228 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 3 Jan 2011 15:11:09 +0100 Subject: qdoc: Added format="html" to every for http. --- tools/qdoc3/ditaxmlgenerator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 7b40886..1deafda 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -331,6 +331,7 @@ void DitaXmlGenerator::addLink(const QString& href, { if (!href.isEmpty()) { xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href", href); writeCharacters(text.toString()); xmlWriter().writeEndElement(); // @@ -1026,6 +1027,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("Class "); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); writeCharacters(protectEnc(pieces.last())); @@ -2001,6 +2003,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex { xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",link); writeCharacters(text); xmlWriter().writeEndElement(); // @@ -2777,6 +2780,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); QString guid = lookupGuid(outFileName(),QString(ch)); QString attr = outFileName() + QString("#%1").arg(guid); xmlWriter().writeAttribute("href", attr); @@ -2836,6 +2840,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, require some special formatting. */ xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; @@ -2870,6 +2875,7 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, for (int i = 0; i < 26; i++) { QChar ch('a' + i); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); QString guid = lookupGuid(outFileName(),QString(ch)); QString attr = outFileName() + QString("#%1").arg(guid); xmlWriter().writeAttribute("href", attr); @@ -3050,6 +3056,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); writeCharacters(protectEnc(groupNode->fullTitle())); xmlWriter().writeEndElement(); // @@ -3064,6 +3071,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* title.remove(0, 4); xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // @@ -3085,6 +3093,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* title.remove(0, 4); xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // @@ -3143,6 +3152,7 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, text += " inherited from "; writeCharacters(text); xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); @@ -3718,6 +3728,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, if (actualNode == 0) actualNode = apparentNode; xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); QString href = linkForNode(actualNode, relative); xmlWriter().writeAttribute("href",href); writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); @@ -4146,6 +4157,7 @@ void DitaXmlGenerator::beginLink(const QString& link) if (link.isEmpty()) return; xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("format", "html"); xmlWriter().writeAttribute("href",link); inLink = true; } -- cgit v0.12 From 527ad2dde3379e42d8831783c37c470e0f23a2f1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 4 Jan 2011 11:19:38 +0100 Subject: qdoc: Changed to . Removed format="html" from the because it didn't work. Investigating further. --- tools/qdoc3/ditaxmlgenerator.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 1deafda..1595f72 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -331,7 +331,7 @@ void DitaXmlGenerator::addLink(const QString& href, { if (!href.isEmpty()) { xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href", href); writeCharacters(text.toString()); xmlWriter().writeEndElement(); // @@ -753,12 +753,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::Div: - xmlWriter().writeStartElement("bodydiv"); + xmlWriter().writeStartElement("sectiondiv"); if (!atom->string().isEmpty()) xmlWriter().writeAttribute("outputclass", atom->string()); break; case Atom::EndDiv: - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: // ### For now @@ -1027,7 +1027,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("Class "); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); writeCharacters(protectEnc(pieces.last())); @@ -2003,7 +2003,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex { xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",link); writeCharacters(text); xmlWriter().writeEndElement(); // @@ -2780,7 +2780,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml QString guid = lookupGuid(outFileName(),QString(ch)); QString attr = outFileName() + QString("#%1").arg(guid); xmlWriter().writeAttribute("href", attr); @@ -2840,7 +2840,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, require some special formatting. */ xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; @@ -2875,7 +2875,7 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, for (int i = 0; i < 26; i++) { QChar ch('a' + i); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml QString guid = lookupGuid(outFileName(),QString(ch)); QString attr = outFileName() + QString("#%1").arg(guid); xmlWriter().writeAttribute("href", attr); @@ -3056,7 +3056,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); writeCharacters(protectEnc(groupNode->fullTitle())); xmlWriter().writeEndElement(); // @@ -3071,7 +3071,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* title.remove(0, 4); xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // @@ -3093,7 +3093,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* title.remove(0, 4); xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // @@ -3152,7 +3152,7 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, text += " inherited from "; writeCharacters(text); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); @@ -3728,7 +3728,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, if (actualNode == 0) actualNode = apparentNode; xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml QString href = linkForNode(actualNode, relative); xmlWriter().writeAttribute("href",href); writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); @@ -4157,7 +4157,7 @@ void DitaXmlGenerator::beginLink(const QString& link) if (link.isEmpty()) return; xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("format", "html"); + // formathtml xmlWriter().writeAttribute("href",link); inLink = true; } -- cgit v0.12 From 04a3fdb6a243e00b809d3e81264fce077121862b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 4 Jan 2011 14:54:26 +0100 Subject: qdoc: Replaced many raw-html cases with \div {something}. --- doc/src/development/designer-manual.qdoc | 96 ++++++++++---------------------- doc/src/template/style/style.css | 12 ++++ 2 files changed, 42 insertions(+), 66 deletions(-) diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index df82fba..e5f3b99 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -1385,17 +1385,13 @@ \target CreatingAMenu - \raw HTML -
- \endraw + \div {float-left} \inlineimage designer-creating-menu1.png \inlineimage designer-creating-menu2.png \br \inlineimage designer-creating-menu3.png \inlineimage designer-creating-menu4.png - \raw HTML -
- \endraw + \enddiv \section2 Creating a Menu @@ -1410,9 +1406,8 @@ \key Escape to reject it. You can undo the editing operation later if required. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv Menus can also be rearranged in the menu bar simply by dragging and dropping them in the preferred location. A vertical red line indicates the @@ -1423,17 +1418,13 @@ navigating the menu structure in the usual way. \target CreatingAMenuEntry - \raw HTML -
- \endraw + \div {float-right} \inlineimage designer-creating-menu-entry1.png \inlineimage designer-creating-menu-entry2.png \br \inlineimage designer-creating-menu-entry3.png \inlineimage designer-creating-menu-entry4.png - \raw HTML -
- \endraw + \enddiv \section2 Creating a Menu Entry @@ -1453,9 +1444,8 @@ be accessible via the \l{#TheActionEditor}{Action Editor}, and any associated keyboard shortcut can be set there. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv Just like with menus, entries can be moved around simply by dragging and dropping them in the preferred location. When an entry is dragged over a @@ -1465,13 +1455,9 @@ \section1 Toolbars - \raw HTML -
- \endraw + \div {float-left} \inlineimage designer-creating-toolbar.png - \raw HTML -
- \endraw + \enddiv \section2 Creating and Removing a Toolbar @@ -1483,9 +1469,8 @@ Toolbars are removed from the form via an entry in the toolbar's context menu. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv \section2 Adding and Removing Toolbar Buttons @@ -1494,14 +1479,10 @@ Since actions can be represented by menu entries and toolbar buttons, they can be moved between menus and toolbars. - \raw HTML -
- \endraw + \div {float-right} \inlineimage designer-adding-toolbar-action.png \inlineimage designer-removing-toolbar-action.png - \raw HTML -
- \endraw + \enddiv To share an action between a menu and a toolbar, drag its icon from the action editor to the toolbar rather than from the menu where its entry is @@ -1510,9 +1491,8 @@ Toolbar buttons are removed via the toolbar's context menu. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv \section1 Actions @@ -1521,13 +1501,9 @@ action editor window, simplifying the creation and management of actions. \target TheActionEditor - \raw HTML -
- \endraw + \div {float-left} \inlineimage designer-action-editor.png - \raw HTML -
- \endraw + \enddiv \section2 The Action Editor @@ -1543,9 +1519,8 @@ \gui{Detailed View}. You can also copy and paste actions between menus, toolbars and forms. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv \section2 Creating an Action @@ -1560,19 +1535,14 @@ Once the action is created, it can be used wherever actions are applicable. - \raw HTML -
- \endraw + \div {clear-left} + \enddiv \target AddingAnAction - \raw HTML -
- \endraw + \div {float-right} \inlineimage designer-adding-menu-action.png \inlineimage designer-adding-toolbar-action.png - \raw HTML -
- \endraw + \enddiv \section2 Adding an Action @@ -1584,9 +1554,8 @@ will be added. Release the mouse button to add the action when you have found the right spot. - \raw HTML -
- \endraw + \div {clear-right} + \enddiv \section1 Dock Widgets @@ -1598,13 +1567,9 @@ \target AddingADockWidget - \raw HTML -
- \endraw + \div {float-left} \inlineimage designer-adding-dockwidget.png - \raw HTML -
- \endraw + \enddiv \section2 Adding a Dock Widget @@ -1623,9 +1588,8 @@ \l{QDockWidget::}{windowTitle} property. This also helps to identify them on the form. - \raw HTML -
- \endraw + \div {clear-both} + \enddiv */ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index d623bd4..4005a8a 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -185,6 +185,18 @@ { float: right; margin-left: 2em } + div.clear-both + { + clear: both + } + div.clear-left + { + clear: left + } + div.clear-right + { + clear: right + } span.comment { -- cgit v0.12 From c196394ce305a7343cc5f51f166b76746f9d9903 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 5 Jan 2011 11:47:12 +0100 Subject: Fixed merge conflict --- doc/src/declarative/anchor-layout.qdoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 70381de..11acbad 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -28,14 +28,10 @@ /*! \page qml-anchor-layout.html \target anchor-layout -<<<<<<< HEAD \contentspage QML Features \previouspage {Using QML Positioner and Repeater Items}{Component Layouts} \nextpage {QML Mouse Events}{Mouse Events} \title Anchor-based Layout in QML -======= -\title Anchor-Based Layout in QML ->>>>>>> f44f7084a3020ed8e249644d5b5e07f74cb7b070 \section1 Overview -- cgit v0.12 From e3a3ae24e54a4461498ae8185b89bdf429e68574 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 5 Jan 2011 12:07:20 +0100 Subject: qdoc: Replaced many raw-html cases with \div {something}. --- doc/src/tutorials/widgets-tutorial.qdoc | 82 ++++++++++++--------------------- 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc index df911a5..42c8852 100644 --- a/doc/src/tutorials/widgets-tutorial.qdoc +++ b/doc/src/tutorials/widgets-tutorial.qdoc @@ -133,19 +133,13 @@ In the following example, we use QWidget to create and show a window with a default size: - \raw HTML - - -
- \endraw - \snippet tutorials/widgets/toplevel/main.cpp main program - \raw HTML - - \endraw - \inlineimage widgets-tutorial-toplevel.png - \raw HTML -
- \endraw + \div {qt-code} + \table + \row + \o \snippet tutorials/widgets/toplevel/main.cpp main program + \o \inlineimage widgets-tutorial-toplevel.png + \endtable + \enddiv To create a real GUI, we need to place widgets inside the window. To do this, we pass a QWidget instance to a widget's constructor, as we will @@ -161,19 +155,13 @@ passing \c window as the parent to its constructor. In this case, we add a button to the window and place it in a specific location: - \raw HTML - - -
- \endraw - \snippet tutorials/widgets/childwidget/main.cpp main program - \raw HTML - - \endraw - \inlineimage widgets-tutorial-childwidget.png - \raw HTML -
- \endraw + \div {qt-code} + \table + \row + \o \snippet tutorials/widgets/childwidget/main.cpp main program + \o \inlineimage widgets-tutorial-childwidget.png + \endtable + \enddiv The button is now a child of the window and will be deleted when the window is destroyed. Note that hiding or closing the window does not @@ -189,19 +177,13 @@ construct a label and line edit widget that we would like to arrange side-by-side. - \raw HTML - - -
- \endraw - \snippet tutorials/widgets/windowlayout/main.cpp main program - \raw HTML - - \endraw - \inlineimage widgets-tutorial-windowlayout.png - \raw HTML -
- \endraw + \div {qt-code} + \table + \row + \o \snippet tutorials/widgets/windowlayout/main.cpp main program + \o \inlineimage widgets-tutorial-windowlayout.png + \endtable + \enddiv The \c layout object we construct manages the positions and sizes of widgets supplied to it with the \l{QHBoxLayout::}{addWidget()} function. @@ -233,20 +215,14 @@ \c{mainLayout} is a QVBoxLayout that contains \c{queryLayout} and a QTableView arranged vertically. - \raw HTML - - -
- \endraw - \snippet tutorials/widgets/nestedlayouts/main.cpp first part - \snippet tutorials/widgets/nestedlayouts/main.cpp last part - \raw HTML - - \endraw - \inlineimage widgets-tutorial-nestedlayouts.png - \raw HTML -
- \endraw + \div {qt-code} + \table + \row + \o \snippet tutorials/widgets/nestedlayouts/main.cpp first part + \snippet tutorials/widgets/nestedlayouts/main.cpp last part + \o \inlineimage widgets-tutorial-nestedlayouts.png + \endtable + \enddiv Note that we call the \c{mainLayout}'s \l{QBoxLayout::}{addLayout()} function to insert the \c{queryLayout} above the \c{resultView} table. -- cgit v0.12 From 6374bc9790310b85299aab251d817aa2e5360d55 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 6 Jan 2011 15:17:49 +0100 Subject: Re-organized the elements page. Fixed misplaced elements. Task-number: QTBUG-16071 --- doc/src/declarative/elements.qdoc | 269 ++++++++++++++++++++++---------------- 1 file changed, 156 insertions(+), 113 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index eaa6a82..7b1ca94 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -29,118 +29,161 @@ \page qdeclarativeelements.html \target elements \title QML Elements - \brief A dictionary of standard QML elements. - - This is a dictionary of all standard QML elements made available - in the Qt Declarative module. - - To see the QML elements listed by functional area, see the - \l{Groups Of Related QML Elements} page. - - \table - \header \o {2,1} \bold {Basic Visual Items} - \row \o \l {Item} \o Basic item element inherited by all visual items in QML - \row \o \l {Rectangle} \o Basic visual rectangle element - \row \o \l {Gradient} \o Defines a gradient between two or more colors - \row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} - \row \o \l {Image} \o Allows the use of bitmaps to a scene - \row \o \l {BorderImage} (Item-specific) \o Defines an image as a border - \row \o \l {AnimatedImage} \o For playing animations stored as a series of frames - \row \o \l {Text} \o Allows the use of formatted text in a scene - \row \o \l {TextInput} \o Displays an editable line of text - \row \o \l {IntValidator} \o Validator for integer values - \row \o \l {DoubleValidator} \o Validator for non-integer values - \row \o \l {RegExpValidator} \o Validator for string regular expressions - \row \o \l {TextEdit} \o Displays multiple lines of editable formatted text - - \header \o {2,1} \bold {Basic Interaction Items} - \row \o \l {MouseArea} \o Handles mouse interactions - \row \o \l {FocusScope} \o For keyboard focus handling - \row \o \l {Flickable} \o Provides a surface that can be "flicked" - \row \o \l {Flipable} \o Provides a surface that produces flipping effects - \row \o \l {GestureArea} (experimental) \o Enables simple gesture handling - - \header \o {2,1} \bold {States} - \row \o \l {State} \o Defines sets of configurations of objects and properties - \row \o \l {PropertyChanges} \o Describes property changes within a state - \row \o \l {StateGroup} \o Contains a set of states and state transitions - \row \o \l {StateChangeScript} \o Allows script binding in a state - \row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change - \row \o \l {AnchorChanges} \o Change the anchors of an item in a state - - \header \o {2,1} \bold {Animation and Transitions} - \row \o \l {Behavior} \o Specifies a default animation for property changes - \row \o \l {SequentialAnimation} \o Runs animations sequentially - \row \o \l {ParallelAnimation} \o Runs animations in parallel - \row \o \l {PropertyAnimation} \o Animates property changes - \row \o \l {NumberAnimation} \o Animates properties of type qreal - \row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d - \row \o \l {ColorAnimation} \o Animates color changes - \row \o \l {RotationAnimation} \o Animates rotations - \row \o \l {ParentAnimation} \o Animates parent changes - \row \o \l {AnchorAnimation} \o Animates anchor changes - \row \o \l {PauseAnimation} \o Pauses an animation - \row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value - \row \o \l {SpringAnimation} \o Allows a property to track a value in a spring-like motion - \row \o \l {PropertyAction} \o Sets immediate property changes during animation - \row \o \l {ScriptAction} \o Runs scripts during an animation - \row \o \l {Transition} \o Animates transitions during state changes - - \header \o {2,1} \bold {Working with Data} - \row \o \l {Binding} \o Binds any value to any property - \row \o \l {ListModel} \o Defines a list of data - \row \o \l {ListElement} \o Defines a data item in a \l {ListModel} - \row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate - \row \o \l {VisualDataModel} \o Encapsulates a model and a delegate - \row \o \l {Package} \o Collection that enables sharing of items within different views - \row \o \l {XmlListModel} \o Specifies a model using XPath expressions - \row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} - - \header \o {2,1} \bold {Views} - \row \o \l {ListView} \o Provides a list visualization of a model - \row \o \l {GridView} \o Provides a grid visualization of a model - \row \o \l {PathView} \o Visualizes a model's contents along a path - \row \o \l {Path} \o Defines a path used by \l {PathView} - \row \o \l {PathLine} \o Defines a line in \l {Path} - \row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} - \row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} - \row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} - \row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} - \row \o \l {WebView} \o Allows the addition of web content to a canvas - - \header \o {2,1} \bold {Positioners} - \row \o \l {Column} \o Arranges its children vertically - \row \o \l {Row} \o Arranges its children horizontally - \row \o \l {Grid} \o Positions its children in a grid - \row \o \l {Flow} \o Positions its children with wrapping support - - \header \o {2,1} \bold {Utility} - \row \o \l {Connections} \o Explicitly connects signals and signal handlers - \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 - \row \o \l {SystemPalette} \o Provides access to the Qt palettes - \row \o \l {FontLoader} \o Loads fonts by name or URL - \row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts - - \header \o {2,1} \bold {Transforms} - \row \o \l {Scale} \o Assigns item scaling behaviors - \row \o \l {Rotation} \o Assigns item rotation behaviors - \row \o \l {Translate} \o Assigns item translation behaviors - - \header \o {2,1} \bold {Effects} - \row \o \l {Particles} (experimental) \o Generates and animates particles - \row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} - \row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} - \row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} - \endtable - - - + \brief A listing of standard QML elements. + +These are the functionally grouped lists of QML elements. + +Elements are declared with the their name and two curly braces. Elements may +be nested in elements, thereby creating a parent-child relationship between the +two elements. + +To see the QML elements listed by functional area, see the +\l{Groups Of Related QML Elements} page. + +\section1 Basic QML Elements +\list +\o \l {Item} - Basic item element inherited by QML elements +\o \l {Component} - Encapsulates QML elements during importing +\o \l {QML:QtObject} {QtObject} - Basic element containing only the objectName property +\endlist + +\section1 Graphical Elements +\list +\o \l {Rectangle} - A rectangle element +\o \l {Image} - For incorporating bitmaps into a scene +\o \l {BorderImage} - Allows the use of images as borders +\o \l {AnimatedImage} - For playing animations stored in a series of frames +\o \l {Gradient} - For defining a color gradient +\o \l {GradientStop} - Used to define a color within a \l {Gradient} +\o \l {SystemPalette} - Provides access to the Qt palettes +\endlist + +\section1 Text Handling Elements +\list +\o \l {Text} - For inserting formatted text into a scene +\o \l {TextInput} - Captures user key input +\o \l {TextEdit} - Displays multiple lines of editable formatted text +\o \l {IntValidator} - Validates values as integers +\o \l {DoubleValidator} - Validates real values +\o \l {RegExpValidator} - Validator for string regular expressions +\o \l {FontLoader} - Loads fonts by name or URL +\endlist + +\section1 Mouse and Interaction Area Elements +\list +\o \l {MouseArea} - Sets up an area for mouse interaction +\o \l {FocusScope} - Element that mediate keyboard focus changes +\o \l {Flickable} - Provides a surface that can be "flicked" +\o \l {Flipable} - Provides a surface that produces "flipping" effects +\o \l {GestureArea} - Enables simple gesture handling +\endlist + +\section1 Positioners and Repeater Elements +\list +\o \l {Column} - Arranges its children vertically +\o \l {Row} - Arranges its children horizontally +\o \l {Grid} - Positions its children in a grid +\o \l {Flow} - Positions its children with wrapping support +\o \l {Repeater} - Uses a model to create multiples of components +\endlist + +\section1 Transformation Elements +\list +\o \l {Scale} - Assigns item scaling behaviors +\o \l {Rotation} - Assigns item rotation behaviors +\o \l {Translate} - Assigns item translation behaviors +\endlist + +\section1 States +\list +\o \l {State} - Defines sets of configurations of objects and properties +\o \l {PropertyChanges} - Describes property changes within a state +\o \l {StateGroup} - Contains a set of states and state transitions +\o \l {StateChangeScript} - Allows script binding in a state +\o \l {ParentChange} - Re-parent an Item in a state change +\o \l {AnchorChanges} - Change the anchors of an item in a state +\endlist + +\section1 Animation and Transitions +\list +\o \l {Transition} - Animates transitions during state changes +\o \l {SequentialAnimation} - Runs animations sequentially +\o \l {ParallelAnimation} - Runs animations in parallel +\o \l {Behavior} - Specifies a default animation for property changes +\o \l {PropertyAction} - Sets immediate property changes during animation +\o \l {PauseAnimation} - Introduces a pause in an animation +\o \l {SmoothedAnimation} - Allows a property to smoothly track a value +\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion +\o \l {ScriptAction} - Runs scripts during an animation +\endlist + +Elements that animate properties based on data types +\list +\o \l {PropertyAnimation} - Animates property changes +\o \l {NumberAnimation} - Animates properties of type qreal +\o \l {Vector3dAnimation} - Animates properties of type QVector3d +\o \l {ColorAnimation} - Animates color changes +\o \l {RotationAnimation} - Animates rotations +\o \l {ParentAnimation} - Animates parent changes +\o \l {AnchorAnimation} - Animates anchor changes +\endlist + +\section1 Models and Data Handling +\list +\o \l {ListModel} - Defines a list of data +\o \l {ListElement} - Defines a data item in a \l {ListModel} +\o \l {VisualItemModel} - Contains items that already defines its own visual delegate +\o \l {VisualDataModel} - Encapsulates a model and a delegate +\o \l {XmlListModel} - Specifies a model using XPath expressions +\o \l {XmlRole} - Specifies a role for an \l {XmlListModel} +\o \l {Binding} - Binds any value to any property +\o \l {Package} - Collection that enables sharing of items within different views +\endlist + +\section1 Views +\list +\o \l {ListView} - Provides a list visualization of a model +\o \l {GridView} - Provides a grid visualization of a model +\o \l {WebView} - Allows the addition of web content to a canvas +\o \l {PathView} - Visualizes a model's contents along a path. See \l {Path Definition}{Path Elements} for more information. +\endlist + +\section1 Add-On Elements +These elements are not included in QML by default. Their respective QML bindings +should first be obtained. +\list +\o \l{QtWebKit QML Module} +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins} +\endlist + +\section1 Path Definition +\list +\o \l {Path} - Defines a path used by \l {PathView} +\o \l {PathLine} - Defines a line in \l {Path} +\o \l {PathQuad} - Defines a quadratic Bezier curve in a \l {Path} +\o \l {PathCubic} - Defines a cubic Bezier curve in a \l {Path} +\o \l {PathAttribute} - Allows the setting of attributes along a \l {Path} +\o \l {PathPercent} - Modifies the item distribution along a \l {Path} +\endlist + +\section1 Utility +\list +\o \l {Connections} - Explicitly connects signals and signal handlers +\o \l {Timer} - Provides timed triggers +\o \l {QML:Qt} {Qt} - The QML global Qt object provides useful enums and functions from Qt. +\o \l {WorkerScript} - Enables the use of threads in QML +\o \l {Loader} - Controls the loading of items or components +\o \l {LayoutItem} - Allows declarative UI elements inside Qt's Graphics View layouts +\endlist + +\section1 Graphical Effects +\list +\o \l {Particles} - Generates and animates particles +\o \l {ParticleMotionLinear} - Adds linear motion behavior to \l {Particles} +\o \l {ParticleMotionGravity} - Adds gravitational motion to \l {Particles} +\o \l {ParticleMotionWander} - Adds varied motions to \l {Particles} +\endlist + */ @@ -148,7 +191,7 @@ \group qml-groups \title Groups Of Related QML Elements - \brief If you know what kind of QML element you want (Basic Visual, + \brief If you know what kind of QML element you want (Basic Visual, Interaction, Animation, etc), look here. This is a list of functional groups of QML elements. -- cgit v0.12 From f9400e81d6e817eb16651e01bb3710cf8562c926 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 7 Jan 2011 08:32:24 +0100 Subject: qdoc: Replaced many raw-html cases with \div {something}. --- doc/src/template/style/style.css | 92 ++++++++++++++++++++++++++++++++++++-- src/corelib/global/qnamespace.qdoc | 90 +++++++------------------------------ tools/qdoc3/atom.cpp | 7 +-- tools/qdoc3/atom.h | 40 ++++++++--------- tools/qdoc3/ditaxmlgenerator.cpp | 4 +- tools/qdoc3/doc.cpp | 50 +++++++++++++++------ tools/qdoc3/htmlgenerator.cpp | 16 ++++--- 7 files changed, 178 insertions(+), 121 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 4005a8a..5f60199 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -198,6 +198,92 @@ clear: right } + #color-white + { + background: #ffffff; + color: #000000; + } + #color-black + { + background: #000000; + color: #ffffff; + } + #color-red + { + background: #ff0000; + color: #000000; + } + #color-darkRed + { + background: #800000; + color: #ffffff; + } + #color-green + { + background: #00ff00; + color: #000000; + } + #color-darkGreen + { + background: #008000; + color: #ffffff; + } + #color-blue + { + background: #0000ff; + color: #ffffff; + } + #color-darkBlue + { + background: #000080; + color: #ffffff; + } + #color-cyan + { + background: #00ffff; + color: #000000; + } + #color-darkCyan + { + background: #008080; + color: #ffffff; + } + #color-magenta + { + background: #ff00ff; + color: #000000; + } + #color-darkMagenta + { + background: #800080; + color: #ffffff; + } + #color-yellow + { + background: #ffff00; + color: #000000; + } + #color-darkYellow + { + background: #808000; + color: #ffffff; + } + #color-gray + { + background: #a0a0a4; + color: #000000; + } + #color-darkGray + { + background: #808080; + color: #ffffff; + } + #color-lightGray + { + background: #c0c0c0; + color: #000000; + } + span.comment { color: #008B00; @@ -526,7 +612,7 @@ background: url(../images/page.png) no-repeat 100% -60px; overflow: hidden; } - .navTop{ + .navTop{ float:right; display:block; padding-right:15px; @@ -1590,11 +1676,11 @@ word-wrap:break-word; } - .creator .wrap .content ol li { + .creator .wrap .content ol li { background:none; font: inherit; padding-left: 0px; - } + } .creator .wrap .content .descr ol li { margin-left: 45px; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6b1aa17..060b979 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -231,81 +231,25 @@ /*! \enum Qt::GlobalColor - \raw HTML - - \endraw - Qt's predefined QColor objects: - \value white \raw HTML - White (#ffffff) - \endraw - \value black \raw HTML - Black (#000000) - \endraw - \value red \raw HTML - Red (#ff0000) - \endraw - \value darkRed \raw HTML - Dark red (#800000) - \endraw - \value green \raw HTML - Green (#00ff00) - \endraw - \value darkGreen \raw HTML - Dark green (#008000) - \endraw - \value blue \raw HTML - Blue (#0000ff) - \endraw - \value darkBlue \raw HTML - Dark blue (#000080) - \endraw - \value cyan \raw HTML - Cyan (#00ffff) - \endraw - \value darkCyan \raw HTML - Dark cyan (#008080) - \endraw - \value magenta \raw HTML - Magenta (#ff00ff) - \endraw - \value darkMagenta \raw HTML - Dark magenta (#800080) - \endraw - \value yellow \raw HTML - Yellow (#ffff00) - \endraw - \value darkYellow \raw HTML - Dark yellow (#808000) - \endraw - \value gray \raw HTML - Gray (#a0a0a4) - \endraw - \value darkGray \raw HTML - Dark gray (#808080) - \endraw - \value lightGray \raw HTML - Light gray (#c0c0c0) - \endraw + \value white \div {id="color-white"} White (#ffffff) \enddiv + \value black \div {id="color-black"} Black (#000000) \enddiv + \value red \div {id="color-red"} Red (#ff0000) \enddiv + \value darkRed \div {id="color-darkRed"} Dark red (#800000) \enddiv + \value green \div {id="color-green"} Green (#00ff00) \enddiv + \value darkGreen \div {id="color-darkGreen"} Dark green (#008000) \enddiv + \value blue \div {id="color-blue"} Blue (#0000ff) \enddiv + \value darkBlue \div {id="color-darkBlue"} Dark blue (#000080) \enddiv + \value cyan \div {id="color-cyan"} Cyan (#00ffff) \enddiv + \value darkCyan \div {id="color-darkCyan"} Dark cyan (#008080) \enddiv + \value magenta \div {id="color-magenta"} Magenta (#ff00ff) \enddiv + \value darkMagenta \div {id="color-darkMagenta"} Dark magenta (#800080) \enddiv + \value yellow \div {id="color-yellow"} Yellow (#ffff00) \enddiv + \value darkYellow \div {id="color-darkYellow"} Dark yellow (#808000) \enddiv + \value gray \div {id="color-gray"} Gray (#a0a0a4) \enddiv + \value darkGray \div {id="color-darkGray"} Dark gray (#808080) \enddiv + \value lightGray \div {id="color-lightGray"} Light gray (#c0c0c0) \enddiv \value transparent a transparent black value (i.e., QColor(0, 0, 0, 0)) \value color0 0 pixel value (for bitmaps) \value color1 1 pixel value (for bitmaps) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 301244d..ef5b6c8 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -107,7 +107,8 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand - \value Div + \value DivLeft + \value DivRight \value EndQmlText \value FormatElse \value FormatEndif @@ -180,8 +181,8 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, - { "Div", Atom::Div }, - { "EndDiv", Atom::EndDiv }, + { "DivLeft", Atom::DivLeft }, + { "DivRight", Atom::DivRight }, #ifdef QDOC_QML { "EndQmlText", Atom::EndQmlText }, #endif diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index a20e057..739d8e3 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -72,15 +72,15 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, - Div, + DivLeft, // 16 + DivRight, // 17 #ifdef QDOC_QML - EndDiv, EndQmlText, #endif FootnoteLeft, - FootnoteRight, + FootnoteRight, // 20 FormatElse, - FormatEndif, // 20 + FormatEndif, FormatIf, FormattingLeft, FormattingRight, @@ -88,30 +88,30 @@ class Atom GuidLink, Image, ImageText, - InlineImage, + InlineImage, // 30 LegaleseLeft, - LegaleseRight, // 30 + LegaleseRight, LineBreak, Link, LinkNode, ListLeft, ListItemNumber, - ListTagLeft, // 36 - ListTagRight, // 37 - ListItemLeft, // 38 - ListItemRight, // 39 - ListRight, // 40 + ListTagLeft, // 38 + ListTagRight, // 39 + ListItemLeft, // 40 + ListItemRight, // 41 + ListRight, // 42 Nop, - ParaLeft, - ParaRight, + ParaLeft, // 44 + ParaRight, // 45 #ifdef QDOC_QML Qml, QmlText, #endif QuotationLeft, QuotationRight, - RawString, - SectionLeft, // 49 + RawString, // 50 + SectionLeft, // 51 SectionRight, SectionHeadingLeft, SectionHeadingRight, @@ -120,9 +120,9 @@ class Atom SinceList, SnippetCommand, SnippetIdentifier, - SnippetLocation, - String, // 59 - TableLeft, // 60 + SnippetLocation, // 60 + String, // 61 + TableLeft, // 62 TableRight, TableHeaderLeft, TableHeaderRight, @@ -130,8 +130,8 @@ class Atom TableRowRight, TableItemLeft, TableItemRight, - TableOfContents, - Target, // 69 + TableOfContents, // 70 + Target, // 71 UnhandledFormat, UnknownCommand, Last = UnknownCommand diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 1595f72..f9c8cc5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -752,12 +752,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; - case Atom::Div: + case Atom::DivLeft: xmlWriter().writeStartElement("sectiondiv"); if (!atom->string().isEmpty()) xmlWriter().writeAttribute("outputclass", atom->string()); break; - case Atom::EndDiv: + case Atom::DivRight: xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index ce9e30d..4873d8b 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -368,8 +369,8 @@ class DocParser void appendToCode(const QString &code); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, - Atom::Type rightType = Atom::ParaRight, - const QString& string = ""); + Atom::Type rightType = Atom::ParaRight, + const QString& string = ""); void leavePara(); void leaveValue(); void leaveValueList(); @@ -559,11 +560,26 @@ void DocParser::parse(const QString& source, break; #endif case CMD_DIV: - leavePara(); x = getArgument(true); - append(Atom::Div, x); - openedCommands.push(cmd); - enterPara(); + leavePara(); + enterPara(Atom::DivLeft, Atom::DivRight,x); +#if 0 + if (x.contains('=')) { + leavePara(); + enterPara(Atom::DivLeft, Atom::DivRight,x); + } + else { + leavePara(); + append(Atom::DivLeft, x); + openedCommands.push(cmd); + enterPara(); + } +#endif + break; + case CMD_ENDDIV: + leavePara(); + // append(Atom::DivRight); + // closeCommand(cmd); break; case CMD_CODELINE: { @@ -632,11 +648,6 @@ void DocParser::parse(const QString& source, case CMD_ENDCODE: closeCommand(cmd); break; - case CMD_ENDDIV: - leavePara(); - append(Atom::EndDiv); - closeCommand(cmd); - break; #ifdef QDOC_QML case CMD_ENDQML: closeCommand(cmd); @@ -1806,8 +1817,18 @@ void DocParser::parseAlso() } } +//static bool debug = false; + void DocParser::append(Atom::Type type, const QString &string) { +#if 0 + if (type == Atom::DivLeft) + debug = true; + if (debug) + qDebug() << type << string; + if (type == Atom::DivRight) + debug = false; +#endif Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML if (((lastType == Atom::Code) || (lastType == Atom::Code)) && @@ -1865,15 +1886,16 @@ void DocParser::enterPara(Atom::Type leftType, const QString& string) { if (paraState == OutsidePara) { - if (priv->text.lastAtom()->type() != Atom::ListItemLeft) + if ((priv->text.lastAtom()->type() != Atom::ListItemLeft) && + (priv->text.lastAtom()->type() != Atom::DivLeft)) { leaveValueList(); + } append(leftType, string); indexStartedPara = false; pendingParaLeftType = leftType; pendingParaRightType = rightType; pendingParaString = string; - if ( - leftType == Atom::SectionHeadingLeft) { + if (leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; } else { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 948a7d6..1ddc0b9 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -511,13 +511,20 @@ int HtmlGenerator::generateAtom(const Atom *atom, << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "\n"; break; - case Atom::Div: + case Atom::DivLeft: out() << "string().isEmpty()) - out() << " class=\"" << atom->string() << "\">"; + if (!atom->string().isEmpty()) { + if (atom->string().contains('=')) + out() << " " << atom->string() << ">"; + else + out() << " class=\"" << atom->string() << "\">"; + } else out() << ">"; break; + case Atom::DivRight: + out() << "
"; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1136,9 +1143,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "\\" << protectEnc(atom->string()) << ""; break; - case Atom::EndDiv: - out() << "
"; - break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: -- cgit v0.12 From e4d86f23f4c1b9a5f960c0cb912256375e1c771d Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 7 Jan 2011 15:00:39 +0100 Subject: Added content and snippet code to Basic Elements overview page. Task-number: QTBUG-16071 --- doc/src/declarative/basicelements.qdoc | 97 ++++++++++++++++++++-- .../declarative/focus/focusscopewidget.qml | 2 + .../declarative/focus/myfocusscopewidget.qml | 4 +- doc/src/snippets/declarative/focus/mywidget.qml | 2 +- 4 files changed, 97 insertions(+), 8 deletions(-) diff --git a/doc/src/declarative/basicelements.qdoc b/doc/src/declarative/basicelements.qdoc index d0c16b6..4253e4c 100644 --- a/doc/src/declarative/basicelements.qdoc +++ b/doc/src/declarative/basicelements.qdoc @@ -26,12 +26,97 @@ ****************************************************************************/ /*! - \page qmlbasicelements.html - \ingroup qml-features - \contentspage QML Features - \previouspage {QML Basic Types}{Data Types} - \nextpage {Using QML Positioner and Repeater Items}{Component Layouts} +\page qmlbasicelements.html +\ingroup qml-features +\contentspage QML Features +\previouspage QML Syntax +\nextpage {QML Basic Types}{Data Types} - \title QML Basic Elements +\title QML Basic Elements +QML's basic elements allow the easy inclusion of objects into the +scene. + +\section1 Basic Elements +This is a list of some of the elements readily available for users. +\list +\o \l {Item} +\o \l {Rectangle} +\o \l {Image} +\o \l {Text} +\o \l {TextInput} +\o \l {TextEdit} +\o \l {FocusScope} +\o \l {Component} +\o \l {MouseArea} +\endlist + +For a complete list of QML elements, please visit the \l {QML Elements} page. + +\section1 Properties and Qt Declarative Module + +When using QML elements, keep in mind that elements may possess properties that +other elements also possess. This is because QML and its underlying engine is +implemented in C++ using Qt. More importantly, the chain of property inheritance +is directly due to QML's use of the \l {Qt Declarative Module} and Qt's +\l {Meta-Object System}{meta-object} and \l {The Property System}{property} systems. For example, visual elements that have C++ implementation are sublcasses of +\l {QDeclarativeItem}. As a result, elements such as \l {Rectangle} and +\l {Text} elements inherit properties such as \c clip and \c smooth. + +\section1 Item Element + +Many QML elements inherit \l Item properties. \c Item possesses important properties +such as \c focus, \c children, and dimension properties such as \c width and +\c height. Although \c Item has physical properties, it is not a visual element. +Using \c Item as the top-level QML element (as the screen) will not produce a +visual result, use the \l {Rectangle} element instead. Use the \c Item to create +opacity effects, such as when creating an invisible container to hold other +components. + +\section1 Rectangle Element + +The \l Rectangle element is the basic visual element, for displaying different +types of items onto the screen. The \c Rectangle is customizable and utilizes +other elements such as \l Gradient and \l BorderImage for displaying advanced +customized graphics. + +\section1 Image Element + +To insert an image into a QML scene, merely declare an \l Image element. The +\c Image element can load images in formats supported by Qt. + +\section1 Text Elements + +The \l Text and \l TextEdit elements display formatted text onto the screen. +\c TextEdit features multi-line editing while the \l TextInput element is for +single line text input. + +\section1 Using Elements as the Top-Level Component + +For creating components (or displaying a simple scene), there are different +elements that could be used as the top-level component. To display a simple scene, +a \l Rectangle as the top-level component may suffice. \l Rectangle, +\l FocusScope, \l Component, \l {QML:QtObject} {QtObject}, \l Item, are some of +the commonly used elements as the top-level component. + +When importing components, the top-level component is important because the +top-level component's properties are the only properties exposed to the parent. + +For example, a \c Button component may be implemented using different elements as +its top-level component. When this component is loaded into another QML scene, +the component will retain the top-level component's properties. If a non-visual +component is the top-level component, the visual properties should be aliased to +the top-level to display the component properly. + +A component implemented using a \c Rectangle as the top-level component: +\snippet doc/src/snippets/declarative/focus/mywidget.qml document + +A component that uses a \c FocusScope as the top-level component: +\snippet doc/src/snippets/declarative/focus/myfocusscopewidget.qml document +Note that the visual properties need to be passed to the parent. The +\l {Keyboard Focus in QML}{focus} article provides more details about the +\c FocusScope element. + +For more information on how to build upon QML elements, see the +\l{Importing Reusable Components} document. */ diff --git a/doc/src/snippets/declarative/focus/focusscopewidget.qml b/doc/src/snippets/declarative/focus/focusscopewidget.qml index 48e5750..3e35ec5 100644 --- a/doc/src/snippets/declarative/focus/focusscopewidget.qml +++ b/doc/src/snippets/declarative/focus/focusscopewidget.qml @@ -37,6 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [focusscope window] @@ -59,3 +60,4 @@ Rectangle { } //! [focusscope window] +//! [document] diff --git a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml index 231ae3a..cec4462 100644 --- a/doc/src/snippets/declarative/focus/myfocusscopewidget.qml +++ b/doc/src/snippets/declarative/focus/myfocusscopewidget.qml @@ -37,12 +37,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [widget in focusscope] FocusScope { - //FocusScope needs to bind to visual properties of the children + //FocusScope needs to bind to visual properties of the Rectangle property alias color: rectangle.color x: rectangle.x; y: rectangle.y width: rectangle.width; height: rectangle.height @@ -64,3 +65,4 @@ FocusScope { } } //! [widget in focusscope] +//! [document] diff --git a/doc/src/snippets/declarative/focus/mywidget.qml b/doc/src/snippets/declarative/focus/mywidget.qml index bea723d..e0b22a1 100644 --- a/doc/src/snippets/declarative/focus/mywidget.qml +++ b/doc/src/snippets/declarative/focus/mywidget.qml @@ -37,10 +37,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [document] import QtQuick 1.0 //! [mywidget] -//MyWidget code Rectangle { id: widget color: "lightsteelblue"; width: 175; height: 25; radius: 10; smooth: true -- cgit v0.12 From de01273493d6380ec8eaa2cc801dbe8939788d00 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 12 Jan 2011 09:28:22 +0100 Subject: qdoc: Replaced many raw-html cases with \div {something}. Only 27 raw-html uses remaining. --- tools/qdoc3/ditaxmlgenerator.cpp | 1665 +++++++++++++++++++------------------- tools/qdoc3/ditaxmlgenerator.h | 151 +++- tools/qdoc3/generator.cpp | 1 + 3 files changed, 981 insertions(+), 836 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index f9c8cc5..e99af42 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -66,226 +66,6 @@ bool DitaXmlGenerator::inSection = false; bool DitaXmlGenerator::inDetailedDescription = false; bool DitaXmlGenerator::inLegaleseText = false; -#define cxxapi_d_xref Doc::alias("cxxapi-d-xref") -#define cxxclass Doc::alias("cxxclass") -#define cxxdefine Doc::alias("cxxdefine") -#define cxxenumeration Doc::alias("cxxenumeration") -#define cxxfile Doc::alias("cxxfile") -#define cxxfunction Doc::alias("cxxfunction") -#define cxxstruct Doc::alias("cxxstruct") -#define cxxtypedef Doc::alias("cxxtypedef") -#define cxxunion Doc::alias("cxxunion") -#define cxxvariable Doc::alias("cxxvariable") - -#define CXXAPIMAP Doc::alias("cxxAPIMap") -#define CXXCLASSREF Doc::alias("cxxClassRef") -#define CXXDEFINEREF Doc::alias("cxxDefineRef") -#define CXXENUMERATIONREF Doc::alias("cxxEnumerationRef") -#define CXXFILEREF Doc::alias("cxxFileRef") -#define CXXFUNCTIONREF Doc::alias("cxxFunctionRef") -#define CXXSTRUCTREF Doc::alias("cxxStructRef") -#define CXXTYPDEFREF Doc::alias("cxxTypedefRef") -#define CXXUNIONREF Doc::alias("cxxUnionRef") -#define CXXVARIABLEREF Doc::alias("cxxVariableRef") - -#define CXXCLASS Doc::alias("cxxClass") -#define CXXCLASSABSTRACT Doc::alias("cxxClassAbstract") -#define CXXCLASSACCESSSPECIFIER Doc::alias("cxxClassAccessSpecifier") -#define CXXCLASSAPIITEMLOCATION Doc::alias("cxxClassAPIItemLocation") -#define CXXCLASSBASECLASS Doc::alias("cxxClassBaseClass") -#define CXXCLASSBASECLASSSTRUCT Doc::alias("cxxClassBaseStruct") -#define CXXCLASSBASEUNION Doc::alias("cxxClassBaseUnion") -#define CXXCLASSDECLARATIONFILE Doc::alias("cxxClassDeclarationFile") -#define CXXCLASSDECLARATIONFILELINE Doc::alias("cxxClassDeclarationFileLine") -#define CXXCLASSDEFINITION Doc::alias("cxxClassDefinition") -#define CXXCLASSDEFINITIONFILE Doc::alias("cxxClassDefinitionFile") -#define CXXCLASSDEFINITIONFILEEND Doc::alias("cxxClassDefinitionFileLineEnd") -#define CXXCLASSDEFINITIONFILESTART Doc::alias("cxxClassDefinitionFileLineStart") -#define CXXCLASSDERIVATION Doc::alias("cxxClassDerivation") -#define CXXCLASSDERIVATIONACCESSSPECIFIER Doc::alias("cxxClassDerivationAccessSpecifier") -#define CXXCLASSDERIVATIONS Doc::alias("cxxClassDerivations") -#define CXXCLASSDERIVATIONVIRTUAL Doc::alias("cxxClassDerivationVirtual") -#define CXXCLASSDETAIL Doc::alias("cxxClassDetail") -#define CXXCLASSENUMERATIONINHERITED Doc::alias("cxxClassEnumerationInherited") -#define CXXCLASSENUMERATORINHERITED Doc::alias("cxxClassEnumeratorInherited") -#define CXXCLASSFUNCTIONINHERITED Doc::alias("cxxClassFunctionInherited") -#define CXXCLASSINHERITS Doc::alias("cxxClassInherits") -#define CXXCLASSINHERITSDETAIL Doc::alias("cxxClassInheritsDetail") -#define CXXCLASSNESTED Doc::alias("cxxClassNested") -#define CXXCLASSNESTEDCLASS Doc::alias("cxxClassNestedClass") -#define CXXCLASSNESTEDDETAIL Doc::alias("cxxClassNestedDetail") -#define CXXCLASSNESTEDSTRUCT Doc::alias("cxxClassNestedStruct") -#define CXXCLASSNESTEDUNION Doc::alias("cxxClassNestedUnion") -#define CXXCLASSTEMPLATEPARAMETER Doc::alias("cxxClassTemplateParameter") -#define CXXCLASSTEMPLATEPARAMETERS Doc::alias("cxxClassTemplateParameters") -#define CXXCLASSTEMPLATEPARAMETERTYPE Doc::alias("cxxClassTemplateParameterType") -#define CXXCLASSVARIABLEINHERITED Doc::alias("cxxClassVariableInherited") - -#define CXXDEFINE Doc::alias("cxxDefine") -#define CXXDEFINEACCESSSPECIFIER Doc::alias("cxxDefineAccessSpecifier") -#define CXXDEFINEAPIITEMLOCATION Doc::alias("cxxDefineAPIItemLocation") -#define CXXDEFINEDECLARATIONFILE Doc::alias("cxxDefineDeclarationFile") -#define CXXDEFINEDECLARATIONFILELINE Doc::alias("cxxDefineDeclarationFileLine") -#define CXXDEFINEDEFINITION Doc::alias("cxxDefineDefinition") -#define CXXDEFINEDETAIL Doc::alias("cxxDefineDetail") -#define CXXDEFINENAMELOOKUP Doc::alias("cxxDefineNameLookup") -#define CXXDEFINEPARAMETER Doc::alias("cxxDefineParameter") -#define CXXDEFINEPARAMETERDECLARATIONNAME Doc::alias("cxxDefineParameterDeclarationName") -#define CXXDEFINEPARAMETERS Doc::alias("cxxDefineParameters") -#define CXXDEFINEPROTOTYPE Doc::alias("cxxDefinePrototype") -#define CXXDEFINEREIMPLEMENTED Doc::alias("cxxDefineReimplemented") - -#define CXXENUMERATION Doc::alias("cxxEnumeration") -#define CXXENUMERATIONACCESSSPECIFIER Doc::alias("cxxEnumerationAccessSpecifier") -#define CXXENUMERATIONAPIITEMLOCATION Doc::alias("cxxEnumerationAPIItemLocation") -#define CXXENUMERATIONDECLARATIONFILE Doc::alias("cxxEnumerationDeclarationFile") -#define CXXENUMERATIONDECLARATIONFILELINE Doc::alias("cxxEnumerationDeclarationFileLine") -#define CXXENUMERATIONDEFINITION Doc::alias("cxxEnumerationDefinition") -#define CXXENUMERATIONDEFINITIONFILE Doc::alias("cxxEnumerationDefinitionFile") -#define CXXENUMERATIONDEFINITIONFILELINEEND Doc::alias("cxxEnumerationDefinitionFileLineEnd") -#define CXXENUMERATIONDEFINITIONFILELINESTART Doc::alias("cxxEnumerationDefinitionFileLineStart") -#define CXXENUMERATIONDETAIL Doc::alias("cxxEnumerationDetail") -#define CXXENUMERATIONNAMELOOKUP Doc::alias("cxxEnumerationNameLookup") -#define CXXENUMERATIONPROTOTYPE Doc::alias("cxxEnumerationPrototype") -#define CXXENUMERATIONREIMPLEMENTED Doc::alias("cxxEnumerationReimplemented") -#define CXXENUMERATIONSCOPEDNAME Doc::alias("cxxEnumerationScopedName") -#define CXXENUMERATOR Doc::alias("cxxEnumerator") -#define CXXENUMERATORAPIITEMLOCATION Doc::alias("cxxEnumeratorAPIItemLocation") -#define CXXENUMERATORDECLARATIONFILE Doc::alias("cxxEnumeratorDeclarationFile") -#define CXXENUMERATORDECLARATIONFILELINE Doc::alias("cxxEnumeratorDeclarationFileLine") -#define CXXENUMERATORINITIALISER Doc::alias("cxxEnumeratorInitialiser") -#define CXXENUMERATORNAMELOOKUP Doc::alias("cxxEnumeratorNameLookup") -#define CXXENUMERATORPROTOTYPE Doc::alias("cxxEnumeratorPrototype") -#define CXXENUMERATORS Doc::alias("cxxEnumerators") -#define CXXENUMERATORSCOPEDNAME Doc::alias("cxxEnumeratorScopedName") - -#define CXXFILE_INFO_TYPES Doc::alias("cxxFile-info-types") -#define CXXFILE_TYPES_DEFAULT Doc::alias("cxxFile-types-default") -#define CXXFILE Doc::alias("cxxFile") -#define CXXFILEAPIITMELOCATION Doc::alias("cxxFileAPIItemLocation") -#define CXXFILEDECLARATIONFILE Doc::alias("cxxFileDeclarationFile") - -#define CXXFUNCTION Doc::alias("cxxFunction") -#define CXXFUNCTIONACCESSSPECIFIER Doc::alias("cxxFunctionAccessSpecifier") -#define CXXFUNCTIONAPIITEMLOCATION Doc::alias("cxxFunctionAPIItemLocation") -#define CXXFUNCTIONCONST Doc::alias("cxxFunctionConst") -#define CXXFUNCTIONCONSTRUCTOR Doc::alias("cxxFunctionConstructor") -#define CXXFUNCTIONDECLARATIONFILE Doc::alias("cxxFunctionDeclarationFile") -#define CXXFUNCTIONDECLARATIONFILELINE Doc::alias("cxxFunctionDeclarationFileLine") -#define CXXFUNCTIONDECLAREDTYPE Doc::alias("cxxFunctionDeclaredType") -#define CXXFUNCTIONDEFINITION Doc::alias("cxxFunctionDefinition") -#define CXXFUNCTIONDEFINITIONFILE Doc::alias("cxxFunctionDefinitionFile") -#define CXXFUNCTIONDEFINITIONFILELINEEND Doc::alias("cxxFunctionDefinitionFileLineEnd") -#define CXXFUNCTIONDEFINITIONFILELINESTART Doc::alias("cxxFunctionDefinitionFileLineStart") -#define CXXFUNCTIONDESTRUCTOR Doc::alias("cxxFunctionDestructor") -#define CXXFUNCTIONDETAIL Doc::alias("cxxFunctionDetail") -#define CXXFUNCTIONEXPLICIT Doc::alias("cxxFunctionExplicit") -#define CXXFUNCTIONINLINE Doc::alias("cxxFunctionInline") -#define CXXFUNCTIONNAMELOOKUP Doc::alias("cxxFunctionNameLookup") -#define CXXFUNCTIONPARAMETER Doc::alias("cxxFunctionParameter") -#define CXXFUNCTIONPARAMETERDECLARATIONNAME Doc::alias("cxxFunctionParameterDeclarationName") -#define CXXFUNCTIONPARAMETERDECLAREDTYPE Doc::alias("cxxFunctionParameterDeclaredType") -#define CXXFUNCTIONPARAMETERDEFAULTVALUE Doc::alias("cxxFunctionParameterDefaultValue") -#define CXXFUNCTIONPARAMETERDEFINITIONNAME Doc::alias("cxxFunctionParameterDefinitionName") -#define CXXFUNCTIONPARAMETERS Doc::alias("cxxFunctionParameters") -#define CXXFUNCTIONPROTOTYPE Doc::alias("cxxFunctionPrototype") -#define CXXFUNCTIONPUREVIRTUAL Doc::alias("cxxFunctionPureVirtual") -#define CXXFUNCTIONREIMPLEMENTED Doc::alias("cxxFunctionReimplemented") -#define CXXFUNCTIONRETURNTYPE Doc::alias("cxxFunctionReturnType") -#define CXXFUNCTIONSCOPEDNAME Doc::alias("cxxFunctionScopedName") -#define CXXFUNCTIONSTORAGECLASSSPECIFIEREXTERN Doc::alias("cxxFunctionStorageClassSpecifierExtern") -#define CXXFUNCTIONSTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxFunctionStorageClassSpecifierMutable") -#define CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxFunctionStorageClassSpecifierStatic") -#define CXXFUNCTIONTEMPLATEPARAMETER Doc::alias("cxxFunctionTemplateParameter") -#define CXXFUNCTIONTEMPLATEPARAMETERS Doc::alias("cxxFunctionTemplateParameters") -#define CXXFUNCTIONTEMPLATEPARAMETERTYPE Doc::alias("cxxFunctionTemplateParameterType") -#define CXXFUNCTIONVIRTUAL Doc::alias("cxxFunctionVirtual") -#define CXXFUNCTIONVOLATILE Doc::alias("cxxFunctionVolatile") - -#define CXXSTRUCT Doc::alias("cxxStruct") -#define CXXSTRUCTABSTRACT Doc::alias("cxxStructAbstract") -#define CXXSTRUCTACCESSSPECIFIER Doc::alias("cxxStructAccessSpecifier") -#define CXXSTRUCTAPIITEMLOCATION Doc::alias("cxxStructAPIItemLocation") -#define CXXSTRUCTBASECLASS Doc::alias("cxxStructBaseClass") -#define CXXSTRUCTBASESTRUCT Doc::alias("cxxStructBaseStruct") -#define CXXSTRUCTBASEUNION Doc::alias("cxxStructBaseUnion") -#define CXXSTRUCTDECLARATIONFILE Doc::alias("cxxStructDeclarationFile") -#define CXXSTRUCTDECLARATIONFILELINE Doc::alias("cxxStructDeclarationFileLine") -#define CXXSTRUCTDEFINITION Doc::alias("cxxStructDefinition") -#define CXXSTRUCTDEFINITIONFILE Doc::alias("cxxStructDefinitionFile") -#define CXXSTRUCTDEFINITIONFILELINEEND Doc::alias("cxxStructDefinitionFileLineEnd") -#define CXXSTRUCTDEFINITIONFILELINESTART Doc::alias("cxxStructDefinitionFileLineStart") -#define CXXSTRUCTDERIVATION Doc::alias("cxxStructDerivation") -#define CXXSTRUCTDERIVATIONACCESSSPECIFIER Doc::alias("cxxStructDerivationAccessSpecifier") -#define CXXSTRUCTDERIVATIONS Doc::alias("cxxStructDerivations") -#define CXXSTRUCTDERIVATIONVIRTUAL Doc::alias("cxxStructDerivationVirtual") -#define CXXSTRUCTDETAIL Doc::alias("cxxStructDetail") -#define CXXSTRUCTENUMERATIONINHERITED Doc::alias("cxxStructEnumerationInherited") -#define CXXSTRUCTENUMERATORINHERITED Doc::alias("cxxStructEnumeratorInherited") -#define CXXSTRUCTFUNCTIONINHERITED Doc::alias("cxxStructFunctionInherited") -#define CXXSTRUCTINHERITS Doc::alias("cxxStructInherits") -#define CXXSTRUCTINHERITSDETAIL Doc::alias("cxxStructInheritsDetail") -#define CXXSTRUCTNESTED Doc::alias("cxxStructNested") -#define CXXSTRUCTNESTEDCLASS Doc::alias("cxxStructNestedClass") -#define CXXSTRUCTNESTEDDETAIL Doc::alias("cxxStructNestedDetail") -#define CXXSTRUCTNESTEDSTRUCT Doc::alias("cxxStructNestedStruct") -#define CXXSTRUCTNESTEDUNION Doc::alias("cxxStructNestedUnion") -#define CXXSTRUCTTEMPLATEPARAMETER Doc::alias("cxxStructTemplateParameter") -#define CXXSTRUCTTEMPLATEPARAMETERS Doc::alias("cxxStructTemplateParameters") -#define CXXSTRUCTTEMPLATEPARAMETERTYPE Doc::alias("cxxStructTemplateParameterType") -#define CXXSTRUCTVARIABLEINHERITED Doc::alias("cxxStructVariableInherited") - -#define CXXTYPEDEF Doc::alias("cxxTypedef") -#define CXXTYPEDEFACCESSSPECIFIER Doc::alias("cxxTypedefAccessSpecifier") -#define CXXTYPEDEFAPIITEMLOCATION Doc::alias("cxxTypedefAPIItemLocation") -#define CXXTYPEDEFDECLARATIONFILE Doc::alias("cxxTypedefDeclarationFile") -#define CXXTYPEDEFDECLARATIONFILELINE Doc::alias("cxxTypedefDeclarationFileLine") -#define CXXTYPEDEFDECLAREDTYPE Doc::alias("cxxTypedefDeclaredType") -#define CXXTYPEDEFDEFINITION Doc::alias("cxxTypedefDefinition") -#define CXXTYPEDEFDETAIL Doc::alias("cxxTypedefDetail") -#define CXXTYPEDEFNAMELOOKUP Doc::alias("cxxTypedefNameLookup") -#define CXXTYPEDEFPROTOTYPE Doc::alias("cxxTypedefPrototype") -#define CXXTYPEDEFREIMPLEMENTED Doc::alias("cxxTypedefReimplemented") -#define CXXTYPEDEFSCOPEDNAME Doc::alias("cxxTypedefScopedName") - -#define CXXUNION Doc::alias("cxxUnion") -#define CXXUNIONABSTRACT Doc::alias("cxxUnionAbstract") -#define CXXUNIONACCESSSPECIFIER Doc::alias("cxxUnionAccessSpecifier") -#define CXXUNIONAPIITEMLOCATION Doc::alias("cxxUnionAPIItemLocation") -#define CXXUNIONDECLARATIONFILE Doc::alias("cxxUnionDeclarationFile") -#define CXXUNIONDECLARATIONFILELINE Doc::alias("cxxUnionDeclarationFileLine") -#define CXXUNIONDEFINITION Doc::alias("cxxUnionDefinition") -#define CXXUNIONDEFINITIONFILE Doc::alias("cxxUnionDefinitionFile") -#define CXXUNIONDEFINITIONFILELINEEND Doc::alias("cxxUnionDefinitionFileLineEnd") -#define CXXUNIONDEFINITIONFILELINESTART Doc::alias("cxxUnionDefinitionFileLineStart") -#define CXXUNIONDETAIL Doc::alias("cxxUnionDetail") -#define CXXUNIONNESTED Doc::alias("cxxUnionNested") -#define CXXUNIONNESTEDCLASS Doc::alias("cxxUnionNestedClass") -#define CXXUNIONNESTEDDETAIL Doc::alias("cxxUnionNestedDetail") -#define CXXUNIONNESTEDSTRUCT Doc::alias("cxxUnionNestedStruct") -#define CXXUNIONNESTEDUNION Doc::alias("cxxUnionNestedUnion") -#define CXXUNIONTEMPLATEPARAMETER Doc::alias("cxxUnionTemplateParameter") -#define CXXUNIONTEMPLATEPARAMETERS Doc::alias("cxxUnionTemplateParameters") -#define CXXUNIONTEMPLATEPARAMETERTYPE Doc::alias("cxxUnionTemplateParameterType") - -#define CXXVARIABLE Doc::alias("cxxVariable") -#define CXXVARIABLEACCESSSPECIFIER Doc::alias("cxxVariableAccessSpecifier") -#define CXXVARIABLEAPIITEMLOCATION Doc::alias("cxxVariableAPIItemLocation") -#define CXXVARIABLECONST Doc::alias("cxxVariableConst") -#define CXXVARIABLEDECLARATIONFILE Doc::alias("cxxVariableDeclarationFile") -#define CXXVARIABLEDECLARATIONFILELINE Doc::alias("cxxVariableDeclarationFileLine") -#define CXXVARIABLEDECLAREDTYPE Doc::alias("cxxVariableDeclaredType") -#define CXXVARIABLEDEFINITION Doc::alias("cxxVariableDefinition") -#define CXXVARIABLEDETAIL Doc::alias("cxxVariableDetail") -#define CXXVARIABLENAMELOOKUP Doc::alias("cxxVariableNameLookup") -#define CXXVARIABLEPROTOTYPE Doc::alias("cxxVariablePrototype") -#define CXXVARIABLEREIMPLEMENTED Doc::alias("cxxVariableReimplemented") -#define CXXVARIABLESCOPEDNAME Doc::alias("cxxVariableScopedName") -#define CXXVARIABLESTORAGECLASSSPECIFIEREXTERN Doc::alias("cxxVariableStorageClassSpecifierExtern") -#define CXXVARIABLESTORAGECLASSSPECIFIERMUTABLE Doc::alias("cxxVariableStorageClassSpecifierMutable") -#define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxVariableStorageClassSpecifierStatic") -#define CXXVARIABLEVOLATILE Doc::alias("cxxVariableVolatile") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -305,6 +85,156 @@ QString DitaXmlGenerator::sinceTitles[] = "" }; +/* + The strings in this array must appear in the same order as + the values in enum DitaXmlGenerator::DitaTag. + */ +QString DitaXmlGenerator::ditaTags[] = + { + "alt", + "apiDesc", + "APIMap", + "apiName", + "b", + "body", + "bodydiv", + "codeblock", + "comment", + "cxxAPIMap", + "cxxClass", + "cxxClassAbstract", + "cxxClassAccessSpecifier", + "cxxClassAPIItemLocation", + "cxxClassBaseClass", + "cxxClassDeclarationFile", + "cxxClassDeclarationFileLine", + "cxxClassDefinition", + "cxxClassDerivation", + "cxxClassDerivationAccessSpecifier", + "cxxClassDerivations", + "cxxClassDetail", + "cxxClassNested", + "cxxClassNestedClass", + "cxxClassNestedDetail", + "cxxDefine", + "cxxDefineAccessSpecifier", + "cxxDefineAPIItemLocation", + "cxxDefineDeclarationFile", + "cxxDefineDeclarationFileLine", + "cxxDefineDefinition", + "cxxDefineDetail", + "cxxDefineNameLookup", + "cxxDefineParameter", + "cxxDefineParameterDeclarationName", + "cxxDefineParameters", + "cxxDefinePrototype", + "cxxDefineReimplemented", + "cxxEnumeration", + "cxxEnumerationAccessSpecifier", + "cxxEnumerationAPIItemLocation", + "cxxEnumerationDeclarationFile", + "cxxEnumerationDeclarationFileLine", + "cxxEnumerationDefinition", + "cxxEnumerationDefinitionFile", + "cxxEnumerationDefinitionFileLineStart", + "cxxEnumerationDefinitionFileLineEnd", + "cxxEnumerationDetail", + "cxxEnumerationNameLookup", + "cxxEnumerationPrototype", + "cxxEnumerationScopedName", + "cxxEnumerator", + "cxxEnumeratorInitialiser", + "cxxEnumeratorNameLookup", + "cxxEnumeratorPrototype", + "cxxEnumerators", + "cxxEnumeratorScopedName", + "cxxFunction", + "cxxFunctionAccessSpecifier", + "cxxFunctionAPIItemLocation", + "cxxFunctionConst", + "cxxFunctionConstructor", + "cxxFunctionDeclarationFile", + "cxxFunctionDeclarationFileLine", + "cxxFunctionDeclaredType", + "cxxFunctionDefinition", + "cxxFunctionDestructor", + "cxxFunctionDetail", + "cxxFunctionNameLookup", + "cxxFunctionParameter", + "cxxFunctionParameterDeclarationName", + "cxxFunctionParameterDeclaredType", + "cxxFunctionParameterDefaultValue", + "cxxFunctionParameters", + "cxxFunctionPrototype", + "cxxFunctionPureVirtual", + "cxxFunctionReimplemented", + "cxxFunctionScopedName", + "cxxFunctionStorageClassSpecifierStatic", + "cxxFunctionVirtual", + "cxxTypedef", + "cxxTypedefAccessSpecifier", + "cxxTypedefAPIItemLocation", + "cxxTypedefDeclarationFile", + "cxxTypedefDeclarationFileLine", + "cxxTypedefDefinition", + "cxxTypedefDetail", + "cxxTypedefNameLookup", + "cxxTypedefScopedName", + "cxxVariable", + "cxxVariableAccessSpecifier", + "cxxVariableAPIItemLocation", + "cxxVariableDeclarationFile", + "cxxVariableDeclarationFileLine", + "cxxVariableDeclaredType", + "cxxVariableDefinition", + "cxxVariableDetail", + "cxxVariableNameLookup", + "cxxVariablePrototype", + "cxxVariableReimplemented", + "cxxVariableScopedName", + "cxxVariableStorageClassSpecifierStatic", + "dd", + "dl", + "dlentry", + "dt", + "entry", + "fig", + "i", + "image", + "li", + "link", + "linktext", + "lq", + "ol", + "p", + "parameter", + "pre", + "related-links", + "row", + "section", + "sectiondiv", + "shortdesc", + "simpletable", + "stentry", + "sthead", + "strow", + "sub", + "sup", + "table", + "tbody", + "tgroup", + "thead", + "title", + "topic", + "topicmeta", + "topicref", + "tt", + "ul", + "u", + "xref", + "" + }; + static bool showBrokenLinks = false; /*! @@ -330,11 +260,11 @@ void DitaXmlGenerator::addLink(const QString& href, const QStringRef& text) { if (!href.isEmpty()) { - xmlWriter().writeStartElement("xref"); + writeStartTag(DT_xref); // formathtml xmlWriter().writeAttribute("href", href); writeCharacters(text.toString()); - xmlWriter().writeEndElement(); // + writeEndTag(); // } else { writeCharacters(text.toString()); @@ -342,6 +272,35 @@ void DitaXmlGenerator::addLink(const QString& href, } /*! + Push \a t onto the dita tag stack and write the appropriate + start tag to the DITA XML file. + */ +void DitaXmlGenerator::writeStartTag(DitaTag t) +{ + xmlWriter().writeStartElement(ditaTags[t]); + tagStack.push(t); +} + +/*! + Pop the current DITA tag off the stack, and write the + appropriate end tag to the DITA XML file. + */ +void DitaXmlGenerator::writeEndTag() +{ + tagStack.pop(); + xmlWriter().writeEndElement(); +} + +/*! + Return the current DITA element tag, the one + on top of the stack. + */ +DitaXmlGenerator::DitaTag DitaXmlGenerator::currentTag() +{ + return tagStack.top(); +} + +/*! The default constructor. */ DitaXmlGenerator::DitaXmlGenerator() @@ -380,29 +339,9 @@ DitaXmlGenerator::~DitaXmlGenerator() */ void DitaXmlGenerator::initializeGenerator(const Config &config) { - static const struct { - const char *key; - const char *tag; - } defaults[] = { - { ATOM_FORMATTING_BOLD, "b" }, - { ATOM_FORMATTING_INDEX, "\n" + +HTML.postpostheader = " \n" \ "
\n" \ "
\n" \ - "
\n" \ - "
\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - " Search index:
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - " \n" \ - "
\n" \ - " Close \n" \ - "

All | API | Articles | Examples

\n" \ - "

 results:

\n" \ - "
    \n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "

\n" \ - " API Lookup

\n" \ - "
\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "

\n" \ - " Qt Topics

\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "

\n" \ - " Examples

\n" \ - "
\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
    \n" \ - "
  • Home
  • \n" \ - " \n" - -HTML.postpostheader = "
\n" \ - "
\n" \ - "
\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "
\n" + "
\n" HTML.footer = "" \ - "
\n" \ - " [+] Documentation Feedback
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - " \n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

\n" \ - "

\n" \ - " All other trademarks are property of their respective owners. Privacy Policy

\n" \ - "
\n" \ - "

\n" \ - " Licensees holding valid Qt Commercial licenses may use this document 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.

\n" \ - "

\n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

\n" \ "
\n" \ - "
\n" \ - "
X
\n" \ - "
\n" \ - "

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the Qt Bug Tracker.

\n" \ - "

\n" \ - "

\n" \ - "
\n" \ - "
\n" \ - "
\n" \ - "
\n" + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "

\n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.\n" \ + "

\n" \ + "

\n" \ + " All other trademarks are property of their respective owners. Privacy Policy\n" \ + "

\n" \ + "
\n" \ + "

\n" \ + " Licensees holding valid Qt Commercial licenses may use this document 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.\n" \ + "

\n" \ + "

\n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.\n" \ + "

\n" \ + "
\n" \ + "
\n" \ + "
\n" # This stuff is used by the Qt 4.7 doc format. scriptdirs = ../../../doc/src/template/scripts @@ -219,16 +100,3 @@ styles.HTML = style.css \ style_ie7.css \ style_ie8.css -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -- cgit v0.12 From 4a6304e814d27e0c6588a0d6979bb1faa1603b4d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 31 Jan 2011 14:10:59 +0100 Subject: qdoc: Fixed numerous broken links in the qdoc manual. --- tools/qdoc3/doc/qdoc-manual.qdoc | 1480 +++++++++++++++++++------------------- 1 file changed, 740 insertions(+), 740 deletions(-) diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 9939cce..51ada06 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -94,7 +94,7 @@ \list I \o \section2 \l {QDoc Commands} - \l {QDoc Commands - Alphabetical List}{A complete alphabetical + \l {QDoc Commands - Alphabetical List} {A complete alphabetical list}. There are two main categories of commands for QDoc: markup @@ -109,25 +109,25 @@ \list \o \l {Markup Commands} \list - \o \l {Text Formatting Commands}{Text Formatting} \span {class="newStuff"} {(new commands)} - \o \l {Document Structuring Commands}{Document Structuring} - \o \l {Verbatim Code Commands}{Verbatim Code} - \o \l {Quoting External Code Commands}{Quoting External Code} - \o \l {Linking Commands}{Linking} - \o \l {Graphic Commands}{Graphic} - \o \l {Container Commands}{Container} - \o \l {Document Contents Commands}{Document Contents} - \o \l {Miscellaneous Commands}{Miscellaneous} + \o \l {Text Formatting Commands} {Text Formatting} \span {class="newStuff"} {(new commands)} + \o \l {Document Structuring Commands} {Document Structuring} + \o \l {Verbatim Code Commands} {Verbatim Code} + \o \l {Quoting External Code Commands} {Quoting External Code} + \o \l {Linking Commands} {Linking} + \o \l {Graphic Commands} {Graphic} + \o \l {Container Commands} {Container} + \o \l {Document Contents Commands} {Document Contents} + \o \l {Miscellaneous Commands} {Miscellaneous} \endlist \o \l {Topical Commands} \o \l {Contextual Commands} \list - \o \l {Navigation Commands}{Navigation} - \o \l {Status Commands}{Status} - \o \l {Thread Support Commands}{Thread Support} - \o \l {Relating Commands}{Relating} - \o \l {Grouping Commands}{Grouping} - \o \l {Title Commands}{Title} + \o \l {Navigation Commands} {Navigation} + \o \l {Status Commands} {Status} + \o \l {Thread Support Commands} {Thread Support} + \o \l {Relating Commands} {Relating} + \o \l {Grouping Commands} {Grouping} + \o \l {Title Commands} {Title} \endlist \endlist \endlist @@ -207,68 +207,68 @@ \section1 Alphabetical List - \l {04-qdoc-commands-textformatting.html#backslash}{\\\\}, - \l {04-qdoc-commands-textformatting.html#a}{\\a}, - \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract}, - \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode}, - \l {04-qdoc-commands-textformatting.html#bold}{\\bold}, - \l {11-qdoc-commands-documentcontents.html#brief}{\\brief}, - \l {04-qdoc-commands-textformatting.html#c}{\\c}, - \l {09-qdoc-commands-graphic.html#caption}{\\caption}, - \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter}, - \l {06-qdoc-commands-verbatimcode.html#code}{\\code}, - \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline}, - \l {04-qdoc-commands-textformatting.html#div}{\\div} \span {class="newStuff"} {(new)}, - \l {07-0-qdoc-commands-quoting.html#dots}{\\dots}, - \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else}, - \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif}, - \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire}, - \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote}, - \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist}, - \l {10-qdoc-commands-container.html#header}{\\header}, - \l {04-qdoc-commands-textformatting.html#i}{\\i}, - \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if}, - \l {09-qdoc-commands-graphic.html#image}{\\image}, - \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include}, - \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage}, - \l {08-qdoc-commands-linking.html#keyword}{\\keyword}, - \l {08-qdoc-commands-linking.html#l}{\\l}, - \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese}, - \l {10-qdoc-commands-container.html#list}{\\list}, - \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta}, - \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode}, - \l {10-qdoc-commands-container.html#o}{\\o}, - \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode}, - \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit}, - \l {05-qdoc-commands-documentstructuring.html#part}{\\part}, - \l {07-0-qdoc-commands-quoting.html#printline}{\\printline}, - \l {07-0-qdoc-commands-quoting.html#printto}{\\printto}, - \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil}, - \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation}, - \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile}, - \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile}, - \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw} \span {class="newStuff"} {(avoid)}, - \l {10-qdoc-commands-container.html#row}{\\row}, - \l {08-qdoc-commands-linking.html#sa}{\\sa}, - \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1}, - \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2}, - \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3}, - \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4}, - \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline}, - \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto}, - \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil}, - \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet}, - \l {04-qdoc-commands-textformatting.html#span}{\\span} \span {class="newStuff"} {(new)}, - \l {04-qdoc-commands-textformatting.html#sub}{\\sub}, - \l {04-qdoc-commands-textformatting.html#sup}{\\sup}, - \l {10-qdoc-commands-container.html#table}{\\table}, + \l {04-qdoc-commands-textformatting.html#backslash} {\\\\}, + \l {04-qdoc-commands-textformatting.html#a} {\\a}, + \l {11-qdoc-commands-documentcontents.html#abstract} {\\abstract}, + \l {06-qdoc-commands-verbatimcode.html#badcode} {\\badcode}, + \l {04-qdoc-commands-textformatting.html#bold} {\\bold}, + \l {11-qdoc-commands-documentcontents.html#brief-command} {\\brief}, + \l {04-qdoc-commands-textformatting.html#c} {\\c}, + \l {09-qdoc-commands-graphic.html#caption} {\\caption}, + \l {05-qdoc-commands-documentstructuring.html#chapter} {\\chapter}, + \l {06-qdoc-commands-verbatimcode.html#code-command} {\\code}, + \l {07-0-qdoc-commands-quoting.html#codeline} {\\codeline}, + \l {04-qdoc-commands-textformatting.html#div} {\\div} \span {class="newStuff"} {(new)}, + \l {07-0-qdoc-commands-quoting.html#dots} {\\dots}, + \l {12-0-qdoc-commands-miscellaneous.html#else} {\\else}, + \l {12-0-qdoc-commands-miscellaneous.html#endif} {\\endif}, + \l {12-0-qdoc-commands-miscellaneous.html#expire} {\\expire}, + \l {11-qdoc-commands-documentcontents.html#footnote} {\\footnote}, + \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}, + \l {10-qdoc-commands-container.html#header} {\\header}, + \l {04-qdoc-commands-textformatting.html#i} {\\i}, + \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}, + \l {09-qdoc-commands-graphic.html#image} {\\image}, + \l {12-0-qdoc-commands-miscellaneous.html#include} {\\include}, + \l {09-qdoc-commands-graphic.html#inlineimage-command} {\\inlineimage}, + \l {08-qdoc-commands-linking.html#keyword} {\\keyword}, + \l {08-qdoc-commands-linking.html#l} {\\l}, + \l {11-qdoc-commands-documentcontents.html#legalese} {\\legalese}, + \l {10-qdoc-commands-container.html#list} {\\list}, + \l {12-0-qdoc-commands-miscellaneous.html#meta} {\\meta}, + \l {06-qdoc-commands-verbatimcode.html#newcode} {\\newcode}, + \l {10-qdoc-commands-container.html#o} {\\o}, + \l {06-qdoc-commands-verbatimcode.html#oldcode} {\\oldcode}, + \l {12-0-qdoc-commands-miscellaneous.html#omit} {\\omit}, + \l {05-qdoc-commands-documentstructuring.html#part} {\\part}, + \l {07-0-qdoc-commands-quoting.html#printline} {\\printline}, + \l {07-0-qdoc-commands-quoting.html#printto} {\\printto}, + \l {07-0-qdoc-commands-quoting.html#printuntil} {\\printuntil}, + \l {11-qdoc-commands-documentcontents.html#quotation} {\\quotation}, + \l {07-0-qdoc-commands-quoting.html#quotefile-command} {\\quotefile}, + \l {07-0-qdoc-commands-quoting.html#quotefromfile-command} {\\quotefromfile}, + \l {12-0-qdoc-commands-miscellaneous.html#raw} {\\raw} \span {class="newStuff"} {(avoid)}, + \l {10-qdoc-commands-container.html#row} {\\row}, + \l {08-qdoc-commands-linking.html#sa} {\\sa}, + \l {05-qdoc-commands-documentstructuring.html#sectionOne} {\\section1}, + \l {05-qdoc-commands-documentstructuring.html#sectionTwo} {\\section2}, + \l {05-qdoc-commands-documentstructuring.html#sectionThree} {\\section3}, + \l {05-qdoc-commands-documentstructuring.html#sectionFour} {\\section4}, + \l {07-0-qdoc-commands-quoting.html#skipline} {\\skipline}, + \l {07-0-qdoc-commands-quoting.html#skipto} {\\skipto}, + \l {07-0-qdoc-commands-quoting.html#skipuntil} {\\skipuntil}, + \l {07-0-qdoc-commands-quoting.html#snippet} {\\snippet}, + \l {04-qdoc-commands-textformatting.html#span} {\\span} \span {class="newStuff"} {(new)}, + \l {04-qdoc-commands-textformatting.html#sub} {\\sub}, + \l {04-qdoc-commands-textformatting.html#sup} {\\sup}, + \l {10-qdoc-commands-container.html#table} {\\table}, \l {11-qdoc-commands-documentcontents.html#tableofcontents} {\\tableofcontents}, - \l {08-qdoc-commands-linking.html#target}{\\target}, - \l {04-qdoc-commands-textformatting.html#tt}{\\tt}, - \l {04-qdoc-commands-textformatting.html#underline}{\\underline}, - \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\unicode}, - \l {11-qdoc-commands-documentcontents.html#warning}{\\warning} + \l {08-qdoc-commands-linking.html#target} {\\target}, + \l {04-qdoc-commands-textformatting.html#tt} {\\tt}, + \l {04-qdoc-commands-textformatting.html#underline} {\\underline}, + \l {12-0-qdoc-commands-miscellaneous.html#raw} {\\unicode}, + \l {11-qdoc-commands-documentcontents.html#warning} {\\warning} \section1 Categories \list @@ -298,17 +298,17 @@ \section1 Alphabetical List - \l {04-qdoc-commands-textformatting.html#backslash}{\\\\}, - \l {04-qdoc-commands-textformatting.html#a}{\\a}, - \l {04-qdoc-commands-textformatting.html#bold}{\\bold}, - \l {04-qdoc-commands-textformatting.html#c}{\\c}, - \l {04-qdoc-commands-textformatting.html#div}{\\div} \span {class="newStuff"} {(new)}, - \l {04-qdoc-commands-textformatting.html#i}{\\i}, - \l {04-qdoc-commands-textformatting.html#span}{\\span} \span {class="newStuff"} {(new)}, - \l {04-qdoc-commands-textformatting.html#sub}{\\sub}, - \l {04-qdoc-commands-textformatting.html#sup}{\\sup}, - \l {04-qdoc-commands-textformatting.html#tt}{\\tt}, - \l {04-qdoc-commands-textformatting.html#underline}{\\underline} + \l {04-qdoc-commands-textformatting.html#backslash} {\\\\}, + \l {04-qdoc-commands-textformatting.html#a} {\\a}, + \l {04-qdoc-commands-textformatting.html#bold} {\\bold}, + \l {04-qdoc-commands-textformatting.html#c} {\\c}, + \l {04-qdoc-commands-textformatting.html#div} {\\div} \span {class="newStuff"} {(new)}, + \l {04-qdoc-commands-textformatting.html#i} {\\i}, + \l {04-qdoc-commands-textformatting.html#span} {\\span} \span {class="newStuff"} {(new)}, + \l {04-qdoc-commands-textformatting.html#sub} {\\sub}, + \l {04-qdoc-commands-textformatting.html#sup} {\\sup}, + \l {04-qdoc-commands-textformatting.html#tt} {\\tt}, + \l {04-qdoc-commands-textformatting.html#underline} {\\underline} \section1 Command Descriptions @@ -344,7 +344,7 @@ \endquotation However, if you want your text to appear in a typewriter - font as well, you can use the \l {c}{\\c} command instead, + font as well, you can use the \l {c} {\\c} command instead, which accepts and renders the backslash as any other character. For example: @@ -409,7 +409,7 @@ \endquotation The \\a command follows the same conventions as the \l - {i}{\\i} command for \l {argument}{punctuation, parentheses + {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. However, a parameter is always a single word, so braces are rarely necessary. And for the same reason, parentheses seldom @@ -441,15 +441,15 @@ \endquotation The \\c command follows the same conventions as the \l - {i}{\\i} command for \l {argument}{punctuation, parentheses + {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. The \\c command accepts the special character \c \ within its argument, i.e. it renders it as a normal character. So if you want to use nested commands, you must use the \l - {tt}{teletype (\\tt)} command instead. + {tt} {teletype (\\tt)} command instead. - See also \l {tt}{\\tt} and \l {code}{\\code}. + See also \l {tt} {\\tt} and \l {code-command} {\\code}. \row \o \bold \\div \span {class="newStuff"} {(new)} \target div @@ -530,12 +530,12 @@ \enddiv \div {class="section sectionlist"} \list - \o \l{Getting Started Guides}{Getting started} - \o \l{Installation}{Installation} - \o \l{how-to-learn-qt.html}{How to learn Qt} - \o \l{tutorials.html}{Tutorials} - \o \l{Qt Examples}{Examples} - \o \l{qt4-7-intro.html}{What's new in Qt 4.7} + \o \l{Getting Started Guides} {Getting started} + \o \l{Installation} {Installation} + \o \l{how-to-learn-qt.html} {How to learn Qt} + \o \l{tutorials.html} {Tutorials} + \o \l{Qt Examples} {Examples} + \o \l{qt4-7-intro.html} {What's new in Qt 4.7} \endlist \enddiv \enddiv @@ -562,12 +562,12 @@ \enddiv \div {class="section sectionlist"} \list - \o \l{Getting Started Guides}{Getting started} - \o \l{Installation}{Installation} - \o \l{how-to-learn-qt.html}{How to learn Qt} - \o \l{tutorials.html}{Tutorials} - \o \l{Qt Examples}{Examples} - \o \l{qt4-7-intro.html}{What's new in Qt 4.7} + \o \l{Getting Started Guides} {Getting started} + \o \l{Installation} {Installation} + \o \l{how-to-learn-qt.html} {How to learn Qt} + \o \l{tutorials.html} {Tutorials} + \o \l{Qt Examples} {Examples} + \o \l{qt4-7-intro.html} {What's new in Qt 4.7} \endlist \enddiv \enddiv @@ -620,7 +620,7 @@ Your DITA XML publishing program must recognize the values of the \e outputclass attribute. - See also \l {span}{\\span}. + See also \l {span} {\\span}. \row \o \bold \\span \span {class="newStuff"} {(new)} \target span @@ -672,7 +672,7 @@ \note The \bold span command does not cause a new paragraph to be started. - See also \l {div}{\\div}. + See also \l {div} {\\div}. \row \o \bold \\tt \target tt @@ -680,9 +680,9 @@ user-defined classes and C++ keywords like \c int, \c for, etc.} - The \\tt command behaves just like the \l {c}{\\c} command, - except that \\tt parses QDoc commands (like \l {i}{\\i}, \l - {bold}{\\bold} and \l {underline}{\\underline}) contained + The \\tt command behaves just like the \l {c} {\\c} command, + except that \\tt parses QDoc commands (like \l {i} {\\i}, \l + {bold} {\\bold} and \l {underline} {\\underline}) contained within its argument. The command renders its argument using a monospace @@ -707,10 +707,10 @@ \endquotation The \\tt command follows the same conventions as the \l - {i}{\\i} command for \l {argument}{punctuation, parentheses + {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. - See also \l {c}{\\c}. + See also \l {c} {\\c}. \row \o \bold \\bold \target bold @@ -733,8 +733,8 @@ the \\bold command}. \endquotation - The command follows the same conventions as the \l {i}{\\i} - command for \l {argument}{punctuation, parentheses and use + The command follows the same conventions as the \l {i} {\\i} + command for \l {argument} {punctuation, parentheses and use of braces} for the argument. \row @@ -743,7 +743,7 @@ \warning This is preliminary functionality. For more information, see the \l - {26-qdoc-commands-compatibility.html#i-versus-e}{compatibility} + {26-qdoc-commands-compatibility.html#i-versus-e} {compatibility} section. \target argument @@ -864,7 +864,7 @@ \endquotation The \\sub command follows the same conventions as the \l - {i}{\\i} command for \l {argument}{punctuation, parentheses + {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. \row @@ -895,7 +895,7 @@ \endquotation The \\sup command follows the same conventions as the \l - {i}{\\i} command for \l {argument}{punctuation, parentheses + {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. \row @@ -921,7 +921,7 @@ \endquotation The \\underline command follows the same conventions as the - \l {i}{\\i} command for \l {argument}{punctuation, + \l {i} {\\i} command for \l {argument} {punctuation, parentheses and use of braces} for the argument. \endtable */ @@ -942,12 +942,12 @@ \section1 Alphabetical List - \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter}, - \l {05-qdoc-commands-documentstructuring.html#part}{\\part}, - \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1}, - \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2}, - \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3}, - \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4} + \l {05-qdoc-commands-documentstructuring.html#chapter} {\\chapter}, + \l {05-qdoc-commands-documentstructuring.html#part} {\\part}, + \l {05-qdoc-commands-documentstructuring.html#sectionOne} {\\section1}, + \l {05-qdoc-commands-documentstructuring.html#sectionTwo} {\\section2}, + \l {05-qdoc-commands-documentstructuring.html#sectionThree} {\\section3}, + \l {05-qdoc-commands-documentstructuring.html#sectionFour} {\\section4} \section1 Command Descriptions @@ -1175,34 +1175,34 @@ \o \bold {The \\chapter command is intended for use in larger documents, and divides the document into chapters.} - See \l{part}{\\part} for an explanation of the various + See \l{part} {\\part} for an explanation of the various section units, command argument and rendering. \row \o \bold \\section1 \target sectionOne \o \bold {The \\section1 command starts a new section.} - See \l{part}{\\part} for an explanation of the various + See \l{part} {\\part} for an explanation of the various section units, command argument and rendering. \row \o \bold \\section2 \target sectionTwo \o \bold {The \\section2 command starts a new section.} - See \l{part}{\\part} for an explanation of the various + See \l{part} {\\part} for an explanation of the various section units, command argument and rendering. \row \o \bold \\section3 \target sectionThree \o \bold {The \\section3 command starts a new section.} - See \l{part}{\\part} for an explanation of the various + See \l{part} {\\part} for an explanation of the various section units, command argument and rendering. \row \o \bold \\section4 \target sectionFour \o \bold {The \\section4 command starts a new section.} - See \l{part}{\\part} for an explanation of the various + See \l{part} {\\part} for an explanation of the various section units, command argument and rendering. \endtable @@ -1221,8 +1221,8 @@ typewriter font and the standard indentation. \bold{Note:} Although all of these commands can be used to present - C++ code, the \l{07-0-qdoc-commands-quoting.html#snippet}{\\snippet} - and \l{07-0-qdoc-commands-quoting.html#codeline}{\\codeline} commands + C++ code, the \l{07-0-qdoc-commands-quoting.html#snippet} {\\snippet} + and \l{07-0-qdoc-commands-quoting.html#codeline} {\\codeline} commands should be used in preference to the others when presenting valid code. This allows auxilliary tools for Qt language bindings to substitute the relevant code snippets in @@ -1230,10 +1230,10 @@ \section1 Alphabetical List - \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode}, - \l {06-qdoc-commands-verbatimcode.html#code}{\\code}, - \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode}, - \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode} + \l {06-qdoc-commands-verbatimcode.html#badcode} {\\badcode}, + \l {06-qdoc-commands-verbatimcode.html#code-command} {\\code}, + \l {06-qdoc-commands-verbatimcode.html#newcode} {\\newcode}, + \l {06-qdoc-commands-verbatimcode.html#oldcode} {\\oldcode} \section1 Command Descriptions @@ -1243,26 +1243,26 @@ \o Description \row - \o \bold \\code \target code + \o \bold \\code \target code-command \o \bold {The \\code command and the corresponding \\endcode command delimit a piece of verbatim code.} - Whereas the \l {c}{\\c} command can be used for short code + Whereas the \l {c} {\\c} command can be used for short code fragments within a sentence, the \\code command is for longer code snippets and renders the code verbatim in a separate paragraph using a typewriter font and the standard indentation. - When processing any of the \\code, \l {badcode}{\\badcode}, - \l {newcode}{\\newcode} and \l {oldcode}{\\oldcode} + When processing any of the \\code, \l {badcode} {\\badcode}, + \l {newcode} {\\newcode} and \l {oldcode} {\\oldcode} commands, QDoc basically removes all indentation that is common for the verbatim code blocks within a \c{/}\c{*!} ... \c{*}\c{/} comment before it adds the standard indentation. For that reason the recommended style is to use 8 spaces for the verbatim code contained within these commands (note that this doesn't apply to externally - quoted code using the \l {quotefromfile}{\\quotefromfile} - or \l {quotefile}{\\quotefile} command). + quoted code using the \l {quotefromfile-command} {\\quotefromfile} + or \l {quotefile-command} {\\quotefile} command). For example: @@ -1299,13 +1299,13 @@ You need to type the code manually between the \\code and \\endcode commands. If you want to include code snippets from a particular file, use the \l - {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile} + {07-0-qdoc-commands-quoting.html#quotefromfile-command} {\\quotefromfile} command instead. - See also \l {c}{\\c}, \l - {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile}, - \l {badcode}{\\badcode}, \l {newcode}{\\newcode} and \l - {oldcode}{\\oldcode}. + See also \l {c} {\\c}, \l + {07-0-qdoc-commands-quoting.html#quotefromfile-command} {\\quotefromfile}, + \l {badcode} {\\badcode}, \l {newcode} {\\newcode} and \l + {oldcode} {\\oldcode}. \row \o \bold \\badcode \target badcode @@ -1313,11 +1313,11 @@ \\endcode command delimit a piece of code that doesn't compile or is wrong for some other reason.} - The \\badcode command is similar the \l {code}{\\code} + The \\badcode command is similar the \l {code-command} {\\code} command, but renders the code using a grey font instead of black (the default). - Like the \l {code}{\\code} command, it renders its code on + Like the \l {code-command} {\\code} command, it renders its code on a new line in the documentation using a typewriter font and the standard indentation. For example: @@ -1361,8 +1361,8 @@ \\badcode... \\endcode, and the special character '\\' is accepted and rendered like the rest of the code. - See also \l {code}{\\code}, \l {newcode}{\\newcode} and \l - {oldcode}{\\oldcode}. + See also \l {code-command} {\\code}, \l {newcode} {\\newcode} and \l + {oldcode} {\\oldcode}. \row \o \bold \\newcode \target newcode @@ -1372,12 +1372,12 @@ The \\newcode command, and its companion the \\oldcode command, is a convenience combination of the \l - {code}{\\code} and \l {badcode}{\\badcode} commands: The + {code-command} {\\code} and \l {badcode} {\\badcode} commands: The combination provides a text relating the two code snippets to each other. The command requires a preceding \\oldcode statement. - Like the \l {code}{\\code} and \l {badcode}{\\badcode} + Like the \l {code-command} {\\code} and \l {badcode} {\\badcode} commands, the \\newcode command renders its code on a new line in the documentation using a typewriter font and the standard indentation. For example: @@ -1418,7 +1418,7 @@ \\newcode statement; otherwise QDoc fails to parse the command and emits a warning.} - See also \l {newcode}{\\newcode} and \l {badcode}{\\badcode}. + See also \l {newcode} {\\newcode} and \l {badcode} {\\badcode}. \endtable */ @@ -1437,7 +1437,7 @@ chunk. \bold{Note:} Although all of these commands can be used to present - C++ code, the \l{#snippet}{\\snippet} and \l{#codeline}{\\codeline} + C++ code, the \l{#snippet} {\\snippet} and \l{#codeline} {\\codeline} commands should be used in preference to the others when presenting valid code. This allows auxilliary tools for Qt language bindings to substitute the relevant code snippets in @@ -1445,17 +1445,17 @@ \section1 Alphabetical List - \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline}, - \l {07-0-qdoc-commands-quoting.html#dots}{\\dots}, - \l {07-0-qdoc-commands-quoting.html#printline}{\\printline}, - \l {07-0-qdoc-commands-quoting.html#printto}{\\printto}, - \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil}, - \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile}, - \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile}, - \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline}, - \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto}, - \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil}, - \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet} + \l {07-0-qdoc-commands-quoting.html#codeline} {\\codeline}, + \l {07-0-qdoc-commands-quoting.html#dots} {\\dots}, + \l {07-0-qdoc-commands-quoting.html#printline} {\\printline}, + \l {07-0-qdoc-commands-quoting.html#printto} {\\printto}, + \l {07-0-qdoc-commands-quoting.html#printuntil} {\\printuntil}, + \l {07-0-qdoc-commands-quoting.html#quotefile-command} {\\quotefile}, + \l {07-0-qdoc-commands-quoting.html#quotefromfile-command} {\\quotefromfile}, + \l {07-0-qdoc-commands-quoting.html#skipline} {\\skipline}, + \l {07-0-qdoc-commands-quoting.html#skipto} {\\skipto}, + \l {07-0-qdoc-commands-quoting.html#skipuntil} {\\skipuntil}, + \l {07-0-qdoc-commands-quoting.html#snippet} {\\snippet} \section1 Command Descriptions @@ -1465,7 +1465,7 @@ \o Description \row - \o \bold \\quotefile \target quotefile + \o \bold \\quotefile \target quotefile-command \o \bold {The \\quotefile command expands to the complete contents of the file given as argument.} @@ -1502,14 +1502,14 @@ \endquotation \warning If you use the \l {QDoc - Compatibility}{compat.qdocconf} file this command is called + Compatibility} {compat.qdocconf} file this command is called \\include. - See also \l {quotefromfile}{\\quotefromfile} and \l - {code}{\\code}. + See also \l {quotefromfile-command} {\\quotefromfile} and + \l {code-command} {\\code}. \row - \o \bold \\quotefromfile \target quotefromfile + \o \bold \\quotefromfile \target quotefromfile-command \o \bold {The \\quotefromfile command opens the file given as argument for quoting.} @@ -1519,9 +1519,9 @@ The command is intended for use when quoting parts from file with the walkthrough commands: \l - {printline}{\\printline}, \l {printto}{\\printto}, \l - {printuntil}{\\printuntil}, \l {skipline}{\\skipline}, \l - {skipto}{\\skipto}, \l {skipuntil}{\\skipuntil}. This + {printline} {\\printline}, \l {printto} {\\printto}, \l + {printuntil} {\\printuntil}, \l {skipline} {\\skipline}, \l + {skipto} {\\skipto}, \l {skipuntil} {\\skipuntil}. This enables you to quote specific portions of a file. For example: @@ -1571,10 +1571,10 @@ ... \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) QDoc remembers which file it's quoting, and the current - position within that file (see \l {file}{\\printline} for + position within that file (see \l {file} {\\printline} for more information). There is no need to "close" the file. Earlier we called this command \\quotefile. For more @@ -1582,8 +1582,8 @@ {26-qdoc-commands-compatibility.html#quotefromfile-versus-quotefile} {compatibility} section. - See also \l {quotefile}{\\quotefile}, \l {code}{\\code} and - \l {dots}{\\dots}. + See also \l {quotefile-command} {\\quotefile}, \l + {code-command} {\\code} and \l {dots} {\\dots}. \row \o \bold \\printline \target printline @@ -1657,15 +1657,15 @@ The main function... \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) \target file QDoc reads the file sequentially. To move the current position forward you can use either of the \l - {skipline}{\\skip...} commands. To move the current + {skipline} {\\skip...} commands. To move the current position backward, you can use the \l - {quotefromfile}{\\quotefromfile} command again. + {quotefromfile-command} {\\quotefromfile} command again. \target substring @@ -1704,7 +1704,7 @@ application. \endquotation - (\l {widgets/scribble}{The complete example file...}) + (\l {widgets/scribble} {The complete example file...}) The regular expression \c /^\}/ makes QDoc print until the first '}' character occurring at the beginning of the line @@ -1717,8 +1717,8 @@ regular expression cannot be located, i.e. if the source code has changed. - See also \l {printto}{\\printto} and \l - {printuntil}{\\printuntil}. + See also \l {printto} {\\printto} and \l + {printuntil} {\\printuntil}. \row \o \bold \\printto \target printto @@ -1729,8 +1729,8 @@ The command considers the rest of the line as part of its argument, make sure to follow the substring with a line break. The command also follows the same conventions for \l - {file}{positioning} and \l {substring}{argument} as the \l - {printline}{\\printline} command. + {file} {positioning} and \l {substring} {argument} as the \l + {printline} {\\printline} command. The lines from the source file are rendered in a separate paragraph, using a typewriter font and the standard @@ -1765,10 +1765,10 @@ and \c argv parameters... \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) - See also \l {printline}{\\printline} and \l - {printuntil}{\\printuntil}. + See also \l {printline} {\\printline} and \l + {printuntil} {\\printuntil}. \row \o \bold \\printuntil \target printuntil @@ -1779,8 +1779,8 @@ The command considers the rest of the line as part of its argument, make sure to follow the substring with a line break. The command also follows the same conventions for \l - {file}{positioning} and \l {substring}{argument} as the \l - {printline}{\\printline} command. + {file} {positioning} and \l {substring} {argument} as the \l + {printline} {\\printline} command. The lines from the source file are rendered in a separate paragraph, using a typewriter font and the standard @@ -1814,16 +1814,16 @@ \printuntil hello First we create a \l - {http://qt.nokia.com/doc/4.0/qapplication}{QApplication} + {http://qt.nokia.com/doc/4.0/qapplication} {QApplication} object using the \c argc and \c argv parameters, then we create a \l - {http://qt.nokia.com/doc/4.0/qpushbutton}{QPushButton}. + {http://qt.nokia.com/doc/4.0/qpushbutton} {QPushButton}. \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) - See also \l {printline}{\\printline} and \l - {printto}{\\printto}. + See also \l {printline} {\\printline} and \l + {printto} {\\printto}. \row \o \bold \\skipline \target skipline @@ -1832,15 +1832,15 @@ Doc reads the file sequentially, and the \\skipline command is used to move the current position (omitting a line of - the source file). See the remark about \l {file}{file + the source file). See the remark about \l {file} {file positioning} above. The command considers the rest of the line as part of its argument, make sure to follow the substring with a line break. The command also follows the same conventions for \l - {substring}{argument} as the \l {printline}{\\printline} + {substring} {argument} as the \l {printline} {\\printline} command, and it is used in conjunction with the \l - {quotefromfile}{\\quotefromfile} command. For example: + {quotefromfile-command} {\\quotefromfile} command. For example: \code / *! @@ -1876,10 +1876,10 @@ that contains its definition. \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) - See also \l {skipto}{\\skipto}, \l - {skipuntil}{\\skipuntil} and \l {dots}{\\dots}. + See also \l {skipto} {\\skipto}, \l + {skipuntil} {\\skipuntil} and \l {dots} {\\dots}. \row \o \bold \\skipto \target skipto @@ -1890,16 +1890,16 @@ QDoc reads the file sequentially, and the \\skipto command is used to move the current position (omitting one or several lines of the source file). See the remark about \l - {file}{file positioning} above. + {file} {file positioning} above. The command considers the rest of the line as part of its argument, make sure to follow the substring with a line break. The command also follows the same conventions for \l - {substring}{argument} as the \l {printline}{\\printline} + {substring} {argument} as the \l {printline} {\\printline} command, and it is used in conjunction with the \l - {quotefromfile}{\\quotefromfile} command. For example: + {quotefromfile-command} {\\quotefromfile} command. For example: \code / *! @@ -1934,10 +1934,10 @@ reasonable size ... \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) - See also \l {skipline}{\\skipline}, \l - {skipuntil}{\\skipuntil} and \l {dots}{\\dots}. + See also \l {skipline} {\\skipline}, \l + {skipuntil} {\\skipuntil} and \l {dots} {\\dots}. \row \o \bold \\skipuntil \target skipuntil @@ -1948,16 +1948,16 @@ QDoc reads the file sequentially, and the \\skipuntil command is used to move the current position (omitting one or several lines of the source file). See the remark about - \l {file}{file positioning} above. + \l {file} {file positioning} above. The command considers the rest of the line as part of its argument, make sure to follow the substring with a line break. The command also follows the same conventions for \l - {substring}{argument} as the \l {printline}{\\printline} + {substring} {argument} as the \l {printline} {\\printline} command, and it is used in conjunction with the \l - {quotefromfile}{\\quotefromfile} command. For example: + {quotefromfile-command} {\\quotefromfile} command. For example: \code / *! @@ -1991,10 +1991,10 @@ will return when the application exits... \endquotation - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) - See also \l {skipline}{\\skipline}, \l {skipto}{\\skipto} - and \l {dots}{\\dots}. + See also \l {skipline} {\\skipline}, \l {skipto} {\\skipto} + and \l {dots} {\\dots}. \row \o \bold \\dots \target dots @@ -2002,7 +2002,7 @@ source file have been omitted when quoting a file.} The command is used in conjunction with the \l - {quotefromfile}{\\quotefromfile} command, and should be + {quotefromfile-command} {\\quotefromfile} command, and should be stated on its own line. The dots are rendered on a new line, using a typewriter font. For example: @@ -2026,7 +2026,7 @@ \skipuntil exec \printline } - (\l {Example File}{The complete example file...}) + (\l {Example File} {The complete example file...}) The default indentation is 4 spaces, but this can be adjusted using the command's optional argument. For @@ -2050,8 +2050,8 @@ \dots 12 \dots 16 - See also \l {skipline}{\\skipline}, \l - {skipto}{\\skipto} and \l {skipuntil}{\\skipuntil}. + See also \l {skipline} {\\skipline}, \l + {skipto} {\\skipto} and \l {skipuntil} {\\skipuntil}. \row \o \bold \\snippet \target snippet @@ -2119,10 +2119,10 @@ \section1 Alphabetical List - \l {08-qdoc-commands-linking.html#keyword}{\\keyword}, - \l {08-qdoc-commands-linking.html#l}{\\l}, - \l {08-qdoc-commands-linking.html#sa}{\\sa}, - \l {08-qdoc-commands-linking.html#target}{\\target} + \l {08-qdoc-commands-linking.html#keyword} {\\keyword}, + \l {08-qdoc-commands-linking.html#l} {\\l}, + \l {08-qdoc-commands-linking.html#sa} {\\sa}, + \l {08-qdoc-commands-linking.html#target} {\\target} \section1 Command Descriptions @@ -2138,7 +2138,7 @@ The command's general syntax is \code - \l {link target}{link text} + \l {link target} {link text} \endcode For example: @@ -2173,7 +2173,7 @@ ... Regexps are built up from expressions, quantifiers, and - \l {assertions}{assertions}. + \l {assertions} {assertions}. * / \endcode @@ -2195,24 +2195,24 @@ \endcode For the one-parameter version the braces can often - be omitted. See the \l {i}{\\i} command for the \l - {argument}{argument conventions}. + be omitted. See the \l {i} {\\i} command for the \l + {argument} {argument conventions}. The \\l command supports several kinds of links: \list - \o \c {\l QWidget} - a defined \l {class}{\\class} + \o \c {\l QWidget} - a defined \l {class-command} {\\class} \o \c {\l QWidget::sizeHint()} - a defined member - function (\l {fn}{\\fn}) - \o \c {\l } - a defined \l {headerfile}{\\headerfile} + function (\l {fn} {\\fn}) + \o \c {\l } - a defined \l {headerfile} {\\headerfile} \o \c {\l widgets/wiggly} - a defined - \l {example-command}{\\example} - \o \c {\l {QWidget Class Reference}} - a defined \l {title}{\\title} - \o \c {\l {Introduction}}- a defined \l{part}{\\part}, - \l{chapter}{\\chapter} or \l {sectionOne}{\\section...} - \o \c {\l fontmatching} - a defined \l {target}{\\target} - \o \c {\l {Shared Classes}} - a defined \l {keyword}{\\keyword} - \o \c {\l network.html} - a defined \l {page}{\\page} + \l {example-command} {\\example} + \o \c {\l {QWidget Class Reference}} - a defined \l {title} {\\title} + \o \c {\l {Introduction}}- a defined \l{part} {\\part}, + \l{chapter} {\\chapter} or \l {sectionOne} {\\section...} + \o \c {\l fontmatching} - a defined \l {target} {\\target} + \o \c {\l {Shared Classes}} - a defined \l {keyword} {\\keyword} + \o \c {\l network.html} - a defined \l {page} {\\page} \o \c {\l http://www.trolltech.com/} - a URL \endlist @@ -2226,11 +2226,11 @@ can use the following syntax: \list - \o \c {\l {QWidget::}{sizeHint()}} + \o \c {\l {QWidget::} {sizeHint()}} \endlist - See also \l {sa}{\\sa}, \l {target}{\\target} and \l - {keyword}{\\keyword}. + See also \l {sa} {\\sa}, \l {target} {\\target} and \l + {keyword} {\\keyword}. \row \o \bold \\sa \target sa @@ -2264,7 +2264,7 @@ \endlist The \\sa command supports the same kind - of links as the \l {l}{\\l} command. For example: + of links as the \l {l} {\\l} command. For example: \code / *! @@ -2288,18 +2288,18 @@ Appends the actions \i actions to this widget's list of actions. - See also \l {QWidget::removeAction()}{removeAction()}, - \l QMenu, and \l {QWidget::addAction()}{addAction()}. + See also \l {QWidget::removeAction()} {removeAction()}, + \l QMenu, and \l {QWidget::addAction()} {addAction()}. \endquotation - See also \l {l}{\\l}, \l {target}{\\target} and \l - {keyword}{\\keyword}. + See also \l {l} {\\l}, \l {target} {\\target} and \l + {keyword} {\\keyword}. \row \o \bold \\target \target target \o \bold {The \\target command defines an explicit point in the - documentation that you can later link to using the \l {l}{\\l} - and \l {sa}{\\sa} commands.} + documentation that you can later link to using the \l {l} {\\l} + and \l {sa} {\\sa} commands.} The command considers the rest of the line as part of its argument, make sure to follow the target name with a line @@ -2339,21 +2339,21 @@ If the target name does't contain any spaces, the brackets can be omitted as well. - See also \l {l}{\\l}, \l {sa}{\\sa} and \l - {keyword}{\\keyword}. + See also \l {l} {\\l}, \l {sa} {\\sa} and \l + {keyword} {\\keyword}. \row \o \bold \\keyword \target keyword \o \bold {The \\keyword command defines an explicit point in the - documentation that you can later link to using the \l {l}{\\l} - and \l {sa}{\\sa} commands.} + documentation that you can later link to using the \l {l} {\\l} + and \l {sa} {\\sa} commands.} Keywords must be unique within the entire set of documentation processed in on QDoc run. The command considers the rest of the line as part of its argument, make sure to follow the keyword with a line break. - The \\keyword command is similar to \l {target}{\\target}, + The \\keyword command is similar to \l {target} {\\target}, but stronger. A keyword can be referenced from anywhere using a simple syntax. For example: @@ -2396,8 +2396,8 @@ If the keyword does't contain any spaces, the brackets can be omitted as well. - See also \l {l}{\\l}, \l {sa}{\\sa} and \l - {target}{\\target}. + See also \l {l} {\\l}, \l {sa} {\\sa} and \l + {target} {\\target}. \endtable */ @@ -2415,9 +2415,9 @@ \section1 Alphabetical List - \l {09-qdoc-commands-graphic.html#caption}{\\caption}, - \l {09-qdoc-commands-graphic.html#image}{\\image}, - \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage} + \l {09-qdoc-commands-graphic.html#caption} {\\caption}, + \l {09-qdoc-commands-graphic.html#image} {\\image}, + \l {09-qdoc-commands-graphic.html#inlineimage-command} {\\inlineimage} \section1 Command Descriptions @@ -2476,11 +2476,11 @@ variants. It is also available for embedded devices. \endquotation - See also \l {inlineimage}{\\inlineimage} and \l - {caption}{\\caption}. + See also \l {inlineimage-command} {\\inlineimage} and \l + {caption} {\\caption}. \row - \o \bold \\inlineimage \target inlineimage + \o \bold \\inlineimage \target inlineimage-command \o \bold {The \\inlineimage command expands to the image specified by its argument; the image is rendered inline with the rest of the text.} @@ -2585,20 +2585,20 @@ to derive maximum benefit from the course. \endquotation - See also \l {image}{\\image} and \l {caption}{\\caption}. + See also \l {image} {\\image} and \l {caption} {\\caption}. \row \o \bold \\caption \target caption \o \bold {The \\caption command provides a caption for an image.} The command follows the same conventions for parentheses and use - of braces for its \l argument as the \l {i}{\\i} command. + of braces for its \l argument as the \l {i} {\\i} command. \warning This is preliminary functionality. The command is not fully implemented. - See also \l {image}{\\image} and \l - {inlineimage}{\\inlineimage} + See also \l {image} {\\image} and \l + {inlineimage-command} {\\inlineimage} \endtable */ @@ -2618,13 +2618,13 @@ \section1 Alphabetical List - \l {10-qdoc-commands-container.html#header}{\\header}, - \l {10-qdoc-commands-container.html#list}{\\list}, - \l {10-qdoc-commands-container.html#o}{\\o}, - \l {10-qdoc-commands-container.html#omitvalue}{\\omitvalue}, - \l {10-qdoc-commands-container.html#row}{\\row}, - \l {10-qdoc-commands-container.html#table}{\\table}, - \l {10-qdoc-commands-container.html#value}{\\value} + \l {10-qdoc-commands-container.html#header} {\\header}, + \l {10-qdoc-commands-container.html#list} {\\list}, + \l {10-qdoc-commands-container.html#o} {\\o}, + \l {10-qdoc-commands-container.html#omitvalue-command} {\\omitvalue}, + \l {10-qdoc-commands-container.html#row} {\\row}, + \l {10-qdoc-commands-container.html#table} {\\table}, + \l {10-qdoc-commands-container.html#value-command} {\\value} \section1 Command Descriptions @@ -2656,9 +2656,9 @@ the table will be centered in the generated documentation. A table can contain headers, rows and columns. A row starts - with a \l {row}{\\row} command and consists of cells, which - starts with a \l {o}{\\o} command. There is also a \l - {header}{\\header} command which is a special kind of row + with a \l {row} {\\row} command and consists of cells, which + starts with a \l {o} {\\o} command. There is also a \l + {header} {\\header} command which is a special kind of row with a special formatting. For example: \code @@ -2775,7 +2775,7 @@ \endraw - See also \l {header}{\\header}, \l {row}{\\row} and \l {o}{\\o}. + See also \l {header} {\\header}, \l {row} {\\row} and \l {o} {\\o}. \row \o \bold \\header \target header @@ -2784,7 +2784,7 @@ The command can only be used within the \l{table} {\\table...\\endtable} commands. A header can contain - several cells. A cell is created with the \l {o}{\\o} + several cells. A cell is created with the \l {o} {\\o} command. A header cell's text is centered within the table cell and @@ -2825,7 +2825,7 @@ \endraw - See also \l {table}{\\table}, \l {row}{\\row} and \l {o}{\\o}. + See also \l {table} {\\table}, \l {row} {\\row} and \l {o} {\\o}. \row \o \bold \\row \target row @@ -2834,7 +2834,7 @@ The command can only be used within the \l{table} {\\table...\\endtable} commands. A row can contain - several cells. A cell is created with the \l {o}{\\o} + several cells. A cell is created with the \l {o} {\\o} command. The background cell color of each row alternate between two @@ -2907,11 +2907,11 @@ \endraw - See also \l {table}{\\table}, \l {header}{\\header} and \l - {o}{\\o}. + See also \l {table} {\\table}, \l {header} {\\header} and \l + {o} {\\o}. \row - \o \bold \\value \target value + \o \bold \\value \target value-command \o \bold {The \\value command starts the documentation of a C++ enum item}. @@ -2921,21 +2921,21 @@ rendered within a table. The documentation will be located in the associated class, - header file or namespace documentation. See the \l - {enum}{\\enum} documentation for an example. + header file or namespace documentation. See the \l {enum-command} + {\\enum} documentation for an example. - See also \l {enum}{\\enum} and \l {omitvalue}{\\omitvalue}. + See also \l {enum-command} {\\enum} and \l {omitvalue-command} {\\omitvalue}. \row - \o \bold \\omitvalue \target omitvalue + \o \bold \\omitvalue \target omitvalue-command \o \bold {The \\omitvalue command excludes a C++ enum item from the documentation}. The command's only argument is the name of the enum item - that will be omitted. See the \l {enum}{\\enum} + that will be omitted. See the \l {enum-command} {\\enum} documentation for an example. - See also \l {enum}{\\enum} and \l {value}{\\value}. + See also \l {enum-command} {\\enum} and \l {value-command} {\\value}. \row \o \bold \\list \target list @@ -2943,7 +2943,7 @@ command delimit a list of items.} You need to create each list item explicitly using the \l - {o}{\\o} command. A list can contain one or more items; it + {o} {\\o} command. A list can contain one or more items; it can also be nested. For example: \code @@ -3064,26 +3064,26 @@ \o Tutorial and Examples \endlist - See also \l {o}{\\o}. + See also \l {o} {\\o}. \row \o \bold \\o \target o \o \bold {The \\o command announce a table or list item.} - Earlier we used the \l {i}{\\i} command for this purpose. For more + Earlier we used the \l {i} {\\i} command for this purpose. For more information see the \l - {26-qdoc-commands-compatibility.html#o-versus-i}{compatibility} + {26-qdoc-commands-compatibility.html#o-versus-i} {compatibility} section. The command can only be used within the \l{table} - {\\table...\\endtable} or \l{list}{\\list... \\endlist} + {\\table...\\endtable} or \l{list} {\\list... \\endlist} commands. It considers everything until the next occurrence of the \\o command, or the currently applicable \l - {table}{\\endtable} or \l {list}{\\endlist} command, as its - argument. For examples, see \l {table}{\\table} and \l - {list}{\\list}. + {table} {\\endtable} or \l {list} {\\endlist} command, as its + argument. For examples, see \l {table} {\\table} and \l + {list} {\\list}. If the command is used within a table, you can in addition specify how many rows or columns the item should span. For @@ -3138,8 +3138,8 @@ If not specified, the item will span one column and one row. - See also \l {table}{\\table}, \l {header}{\\header}, - \l {list}{\\list} and \l {o}{\\o}. + See also \l {table} {\\table}, \l {header} {\\header}, + \l {list} {\\list} and \l {o} {\\o}. \endtable */ @@ -3157,14 +3157,14 @@ \section1 Alphabetical List - \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract}, - \l {11-qdoc-commands-documentcontents.html#brief}{\\brief}, - \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote}, - \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese}, + \l {11-qdoc-commands-documentcontents.html#abstract} {\\abstract}, + \l {11-qdoc-commands-documentcontents.html#brief-command} {\\brief}, + \l {11-qdoc-commands-documentcontents.html#footnote} {\\footnote}, + \l {11-qdoc-commands-documentcontents.html#legalese} {\\legalese}, \l {11-qdoc-commands-documentcontents.html#tableofcontents} {\\tableofcontents}, - \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation}, - \l {11-qdoc-commands-documentcontents.html#warning}{\\warning} + \l {11-qdoc-commands-documentcontents.html#quotation} {\\quotation}, + \l {11-qdoc-commands-documentcontents.html#warning} {\\warning} \section1 Command Descriptions @@ -3441,18 +3441,18 @@ chapter or section. \row - \o \bold \\brief \target brief + \o \bold \\brief \target brief-command \o \bold {The \\brief command introduces a one-sentence description of a class, namespace, header file, property or variable.} The brief text is used to introduce the documentation of the associated object, and in lists generated using the \l - {generatelist}{\\generatelist} command. + {generatelist-command} {\\generatelist} command. The \\brief command can be used in two significant - different ways: \l {brief class}{One for classes, - namespaces and header files}, and \l {brief property}{one + different ways: \l {brief class} {One for classes, + namespaces and header files}, and \l {brief property} {one for properties and variables}. \target brief property @@ -3519,8 +3519,8 @@ \endlist See also \l - {QWidget::frameGeometry()}{frameGeometry()}, \l - {QWidget::rect()}{rect()}, ... + {QWidget::frameGeometry()} {frameGeometry()}, \l + {QWidget::rect()} {rect()}, ... \endquotation \target brief class @@ -3569,7 +3569,7 @@ The PreviewWindow class is a custom widget displaying the names of its currently set window flags in a - read-only text editor. \l {preview window}{More...} + read-only text editor. \l {preview window} {More...} \raw HTML

Properties

@@ -3585,8 +3585,8 @@ \endraw \list - \o \l {constructor}{PreviewWindow}(QWidget *parent = 0) - \o void \l {function}{setWindowFlags}(Qt::WindowFlags flags) + \o \l {constructor} {PreviewWindow}(QWidget *parent = 0) + \o void \l {function} {setWindowFlags}(Qt::WindowFlags flags) \endlist \list @@ -3628,7 +3628,7 @@ The PreviewWindow class inherits QWidget. The widget displays the names of its window flags set with the \l - {function}{setWindowFlags()} function. It is also + {function} {setWindowFlags()} function. It is also provided with a QPushButton that closes the window. ... @@ -3687,8 +3687,8 @@ * / \endcode - See also \l{property}{\\property}, \l{class}{\\class}, - \l{namespace}{\\namespace} and \l{headerfile}{\\headerfile}. + See also \l{property} {\\property}, \l{class-command} {\\class}, + \l{namespace} {\\namespace} and \l{headerfile} {\\headerfile}. \row \o \bold \\legalese \target legalese @@ -3704,7 +3704,7 @@ Later the documentation identified by the \\legalese command can be accumulated into a list using the \l - {generatelist}{\\generatelist} command with the \c legalese + {generatelist-command} {\\generatelist} command with the \c legalese argument. This is useful to generate an overview of all the licenses associated with the source code. @@ -3827,16 +3827,16 @@ \section1 Alphabetical List - \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else}, - \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif}, - \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire}, - \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist}, - \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if}, - \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include}, - \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta}, - \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit}, - \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw} \span {class="newStuff"} {(avoid)}, - \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\unicode} + \l {12-0-qdoc-commands-miscellaneous.html#else} {\\else}, + \l {12-0-qdoc-commands-miscellaneous.html#endif} {\\endif}, + \l {12-0-qdoc-commands-miscellaneous.html#expire} {\\expire}, + \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}, + \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}, + \l {12-0-qdoc-commands-miscellaneous.html#include} {\\include}, + \l {12-0-qdoc-commands-miscellaneous.html#meta} {\\meta}, + \l {12-0-qdoc-commands-miscellaneous.html#omit} {\\omit}, + \l {12-0-qdoc-commands-miscellaneous.html#raw} {\\raw} \span {class="newStuff"} {(avoid)}, + \l {12-0-qdoc-commands-miscellaneous.html#raw} {\\unicode} \section1 Command Descriptions @@ -3879,7 +3879,7 @@ \endquotation \row - \o \bold \\generatelist \target generatelist + \o \bold \\generatelist \target generatelist-command \o \bold {The \\generatelist command expands to a list of various documentation or links to documentation.} @@ -3950,8 +3950,8 @@ \endquotation A class is identified within the documentation by the - the \l {class}{\\class} command, and the descriptions - are based on the argument of the \l {brief}{\\brief} + the \l {class-command} {\\class} command, and the descriptions + are based on the argument of the \l {brief-command} {\\brief} commands in the class documentation. \target list example @@ -4005,7 +4005,7 @@ \endquotation A class is identified within the documentation by the - the \l {class}{\\class} command. + the \l {class-command} {\\class} command. \o \c classesbymodule @@ -4035,14 +4035,14 @@ a link to the class's reference documentation. The generated table is rendered similarily to the one - generated when using the \l {table example}{\c + generated when using the \l {table example} {\c annotatedclasses} argument. For the basic classes in Qt, a class's module is determined by its location, i.e. its directory. However, for extensions, like ActiveQt and Qt Designer, a class is related to a module with the \l - {inmodule}{\\inmodule} command. + {inmodule} {\\inmodule} command. \o \c classesbyedition @@ -4073,10 +4073,10 @@ The \c compatclasses argument provides a complete and alphabetical list of the support classes. A support class is identified within the documentation by the \l - {compat}{\\compat} command. Each class name is a link to + {compat} {\\compat} command. Each class name is a link to the class's reference documentation. The list is rendered similarily to the list generated by the \l - {list example}{\c classes} argument. + {list example} {\c classes} argument. \warning The \c classesbymodule argument will at some point replace the this argument. @@ -4112,7 +4112,7 @@ The \c legalese argument provides a complete list of all the licenses. The licenses are identified within the - documentation using the \l {legalese}{\\legalese} + documentation using the \l {legalese} {\\legalese} command. For example: @@ -4173,10 +4173,10 @@ alphabetical list of the main classes. Each class name is a link to the class's reference documentation. A class is related to the group of main classes by using - the \l {mainclass}{\\mainclass} command. + the \l {mainclass-command} {\\mainclass} command. The list is rendered similarily to the list generated by - the \l {list example}{\c classes} argument. + the \l {list example} {\c classes} argument. \o \c overviews @@ -4185,10 +4185,10 @@ entry is a link to the respective documentation page. The list includes pages declared using commands like \l - {page}{\\page} and \l {group}{\\group}. The list omits + {page} {\\page} and \l {group-command} {\\group}. The list omits examples and classes, and only lists the first page of documentation that contains two or more pages using - commands like \l {nextpage}{\\nextpage}. + commands like \l {nextpage} {\\nextpage}. For example: @@ -4245,14 +4245,14 @@ \o \c related The \c related argument is used in combination with the - \l {group}{\\group} command to list all the overviews + \l {group-command} {\\group} command to list all the overviews related to the given group. Each list entry is a link to the respective documentation page. \o \c relatedinline The \c related argument is used in combination with the - \l {group}{\\group} command to collect all documentation + \l {group-command} {\\group} command to collect all documentation related to the given group. The various documentation snippets are copied directly into the group page. @@ -4263,13 +4263,13 @@ service's reference documentation. A service is identified within the documentation by the - \l {service}{\\service} command. + \l {service} {\\service} command. \endlist \row - \o \bold \\if \target if + \o \bold \\if \target if-command \o \bold {The \\if command and the corresponding \\endif command enclose parts of a QDoc comment that only will be included if the condition specified by the command's argument is true.} @@ -4282,7 +4282,7 @@ \if defined(opensourceedition) \bold{Note:} This edition is for the development of - \l{Qt Open Source Edition}{Free and Open Source} + \l{Qt Open Source Edition} {Free and Open Source} software only; see \l{Qt Commercial Editions}. \endif @@ -4291,7 +4291,7 @@ This QDoc comment will only be rendered if the \c opensourceedition preprocessor symbol is defined, and - specified in the \l {definesvariable}{defines} variable in + specified in the \l {definesvariable} {defines} variable in the configuration file to make QDoc process the code within #ifdef and #endif: @@ -4301,31 +4301,31 @@ You can also define the preprocessor symbol manually on the command line. For more information see the documentation of - the \l {definesvariable}{defines} variable. + the \l {definesvariable} {defines} variable. - See also \l{endif}{\\endif}, \l{else}{\\else}, \l - {definesvariable}{defines} and \l falsehoods. + See also \l{endif} {\\endif}, \l{else} {\\else}, \l + {definesvariable} {defines} and \l falsehoods. \row \o \bold \\endif \target endif \o \bold {The \\endif command and the corresponding \\if command enclose parts of a QDoc comment that will be included if - the condition specified by the \l {if}{\\if} command's + the condition specified by the \l {if-command} {\\if} command's argument is true.} For more information, see the documentation of the \l - {if}{\\if} command. + {if-command} {\\if} command. - See also \l{if}{\\if}, \l{else}{\\else}, \l - {definesvariable}{defines} and \l falsehoods. + See also \l{if-command} {\\if}, \l{else} {\\else}, \l + {definesvariable} {defines} and \l falsehoods. \row \o \bold \\else \target else \o \bold {The \\else command specifies an alternative if the - condition in the \l {if}{\\if} command is false.} + condition in the \l {if-command} {\\if} command is false.} The \\else command can only be used within \l - {if}{\\if...\\endif} commands, but is useful when there is + {if-command} {\\if...\\endif} commands, but is useful when there is only two alternatives. For example: \code @@ -4413,8 +4413,8 @@ GCC 3.2+ and MSVC 7.) \endquotation - See also \l{if}{\\if}, \l{endif}{\\endif}, \l - {definesvariable}{defines} and \l falsehoods. + See also \l{if-command} {\\if}, \l{endif} {\\endif}, \l + {definesvariable} {defines} and \l falsehoods. \row \o \bold \\include \target include @@ -4623,16 +4623,16 @@ color styles in your style.css file. Then you can write: \code - \tt {\span {id="color-blue"}{Blue(#0000ff)}}, - \tt {\span {id="color-darkBlue"}{dark blue(#000080)}} and - \tt {\span {id="color-cyan"}{cyan(#00ffff)}}. + \tt {\span {id="color-blue"} {Blue(#0000ff)}}, + \tt {\span {id="color-darkBlue"} {dark blue(#000080)}} and + \tt {\span {id="color-cyan"} {cyan(#00ffff)}}. \endcode ...which is rendered again as: - \tt {\span {id="color-blue"}{Blue(#0000ff)}}, - \tt {\span {id="color-darkBlue"}{dark blue(#000080)}} and - \tt {\span {id="color-cyan"}{cyan(#00ffff)}}. + \tt {\span {id="color-blue"} {Blue(#0000ff)}}, + \tt {\span {id="color-darkBlue"} {dark blue(#000080)}} and + \tt {\span {id="color-cyan"} {cyan(#00ffff)}}. \row \o \bold \\unicode \target unicode @@ -4708,21 +4708,21 @@ \section1 Alphabetical List - \l {13-qdoc-commands-topical.html#class}{\\class}, - \l {13-qdoc-commands-topical.html#enum}{\\enum}, - \l {13-qdoc-commands-topical.html#example-command}{\\example}, - \l {13-qdoc-commands-topical.html#externalpage}{\\externalpage}, - \l {13-qdoc-commands-topical.html#fn}{\\fn}, - \l {13-qdoc-commands-topical.html#group}{\\group}, - \l {13-qdoc-commands-topical.html#headerfile}{\\headerfile}, - \l {13-qdoc-commands-topical.html#macro}{\\macro}, - \l {13-qdoc-commands-topical.html#module}{\\module}, - \l {13-qdoc-commands-topical.html#namespace}{\\namespace}, - \l {13-qdoc-commands-topical.html#page}{\\page}, - \l {13-qdoc-commands-topical.html#property}{\\property}, - \l {13-qdoc-commands-topical.html#service}{\\service}, - \l {13-qdoc-commands-topical.html#typedef}{\\typedef}, - \l {13-qdoc-commands-topical.html#variable}{\\variable}, + \l {13-qdoc-commands-topical.html#class-command} {\\class}, + \l {13-qdoc-commands-topical.html#enum-command} {\\enum}, + \l {13-qdoc-commands-topical.html#example-command} {\\example}, + \l {13-qdoc-commands-topical.html#externalpage} {\\externalpage}, + \l {13-qdoc-commands-topical.html#fn} {\\fn}, + \l {13-qdoc-commands-topical.html#group-command} {\\group}, + \l {13-qdoc-commands-topical.html#headerfile} {\\headerfile}, + \l {13-qdoc-commands-topical.html#macro} {\\macro}, + \l {13-qdoc-commands-topical.html#module} {\\module}, + \l {13-qdoc-commands-topical.html#namespace} {\\namespace}, + \l {13-qdoc-commands-topical.html#page} {\\page}, + \l {13-qdoc-commands-topical.html#property} {\\property}, + \l {13-qdoc-commands-topical.html#service} {\\service}, + \l {13-qdoc-commands-topical.html#typedef} {\\typedef}, + \l {13-qdoc-commands-topical.html#variable} {\\variable}, \section1 General Description @@ -4744,7 +4744,7 @@ \endcode Functions is a special case, the argument's naming convention for - the \l {fn}{\\fn} command is that of the function's definition + the \l {fn} {\\fn} command is that of the function's definition outside the class definition. For example: \code @@ -4787,12 +4787,12 @@ \o Description \row - \o \bold \\class \target class + \o \bold \\class \target class-command \o \bold {The \\class command tells QDoc that a class is part of the public API, and lets you enter a detailed description.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument, and supports nested classes, for example: @@ -4821,9 +4821,9 @@ and slots with empty documentation. The command is typically accompanied with a \l - {brief}{\\brief} command, a \l {mainclass}{\\mainclass} - command, an \l {ingroup}{\\ingroup} command and a \l - {sa}{\\sa} command. For example: + {brief-command} {\\brief} command, a \l {mainclass-command} {\\mainclass} + command, an \l {ingroup-command} {\\ingroup} command and a \l + {sa} {\\sa} command. For example: \code / *! @@ -4837,7 +4837,7 @@ The PreviewWindow class inherits QWidget. The widget displays the names of its window flags set with the \l - {function}{setWindowFlags()} function. It is also + {function} {setWindowFlags()} function. It is also provided with a QPushButton that closes the window. ... @@ -4855,7 +4855,7 @@ The PreviewWindow class is a custom widget displaying the names of its currently set window flags in a - read-only text editor. \l {preview window}{More...} + read-only text editor. \l {preview window} {More...} \raw HTML

Properties

@@ -4871,8 +4871,8 @@ \endraw \list - \o \l {constructor}{PreviewWindow}(QWidget *parent = 0) - \o void \l {function}{setWindowFlags}(Qt::WindowFlags flags) + \o \l {constructor} {PreviewWindow}(QWidget *parent = 0) + \o void \l {function} {setWindowFlags}(Qt::WindowFlags flags) \endlist \list @@ -4915,7 +4915,7 @@ The PreviewWindow class inherits QWidget. The widget displays the names of its window flags set with the \l - {function}{setWindowFlags()} function. It is also + {function} {setWindowFlags()} function. It is also provided with a QPushButton that closes the window. ... @@ -4949,16 +4949,16 @@ \endquotation \row - \o \bold \\enum \target enum + \o \bold \\enum \target enum-command \o \bold {The \\enum command allows you to document a C++ enum.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. - The enum items are documented using the \l {value}{\\value} + The enum items are documented using the \l {value-command} {\\value} command. If an item isn't documented, QDoc will emit a warning. This can be avoided using the \l - {omitvalue}{\\omitvalue} command excluding an item from the + {omitvalue-command} {\\omitvalue} command excluding an item from the documentation. The enum documentation will be located in the associated class, header file or namespace documentation. @@ -5049,14 +5049,14 @@ in qt.html. - See also \l {value}{\\value} and \l {omitvalue}{\\omitvalue}. + See also \l {value-command} {\\value} and \l {omitvalue-command} {\\omitvalue}. \row \o \bold \\example \target example-command \o \bold {The \\example command allows you to document an example.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. In particular the command's argument is the example's path relative to the paths listed in the \l exampledirs configuration @@ -5111,7 +5111,7 @@ \o \bold \\fn \target fn \o \bold {The \\fn command allows you to document a function.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. In particular it is important that the return type of the function, whether it is \c const or not and the complete set of @@ -5153,30 +5153,30 @@ \a area; otherwise returns false. \endquotation - See also \l {overload}{\\overload}. + See also \l {overload} {\\overload}. \row - \o \bold \\group \target group + \o \bold \\group \target group-command \o \bold {The \\group command creates a separate page that lists the classes belonging to the group specified by the command's argument.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. The \\group - command is typically followed by a \l {title}{\\title} + command is typically followed by a \l {title} {\\title} command and a short introduction to the group. The generated HTML documentation for the specified group is put in \i{group}.html. A class can be related to a group by using the \l - {ingroup}{\\ingroup} command. In addition, overviews can be + {ingroup-command} {\\ingroup} command. In addition, overviews can be related to a group using the same command, but these must be listed explicitly using the \l - {generatelist}{\\generatelist} command (see example below). + {generatelist-command} {\\generatelist} command (see example below). Each class is listed with a link to the class reference page and a brief description based on the classes' \l - {brief}{\\brief} texts. For example: + {brief-command} {\\brief} texts. For example: \code / *! @@ -5234,7 +5234,7 @@ Note that overviews related to the given group, must be listed explicitly using the \l - {generatelist}{\\generatelist} command with the \c related + {generatelist-command} {\\generatelist} command with the \c related argument. For example: \code @@ -5251,21 +5251,21 @@ * / \endcode - See also \l {ingroup}{\\ingroup} and \l - {generatelist}{\\generatelist}. + See also \l {ingroup-command} {\\ingroup} and \l + {generatelist-command} {\\generatelist}. \row \o \bold \\headerfile \target headerfile \o \bold {The \\headerfile command allows you to document global functions, types and macros declared in a header file.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument, and the generated HTML documentation for the specified header file is put in \i{headerfilename}.html. A function, type or macro can be associated with a - headerfile using the \l {relates}{\\relates} command. + headerfile using the \l {relates-command} {\\relates} command. If the referenced header file doesn't exist, the \\headerfile command will still create a documentation page @@ -5330,7 +5330,7 @@ \o \bold \\macro \target macro \o \bold {The \\macro command allows you to document a C++ macro.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. QDoc recognizes three different macro syntax: function-like @@ -5338,7 +5338,7 @@ Q_PROPERTY() and macros without parentheses like Q_OBJECT. The \\macro command must be followed by a \l - {relates}{\\relates} command which attaches the + {relates-command} {\\relates} command which attaches the documentation to that of a related class, header file. or namespace. Otherwise the documentation will be lost. @@ -5448,17 +5448,17 @@ classes belonging to the module specified by the command's argument.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. A class can be related to a module using the \l - {inmodule}{\\inmodule} command. + {inmodule} {\\inmodule} command. The \\module command is typically followed by the \l - {title}{\\title} and \l {brief}{\\brief} commands. Each + {title} {\\title} and \l {brief-command} {\\brief} commands. Each class is listed with a link to the class reference page and a brief description based on the classes' \l - {brief}{\\brief} texts. + {brief-command} {\\brief} texts. For example: @@ -5489,7 +5489,7 @@ The QtNetwork module offers classes that allow you to write TCP/IP clients and servers.\l {module - details}{More...} + details} {More...} \raw HTML

@@ -5545,19 +5545,19 @@ in qtnetwork.html. - See also \l {inmodule}{\\inmodule} + See also \l {inmodule} {\\inmodule} \row \o \bold \\namespace \target namespace \o \bold {The \\namespace command allows you to document a C++ namespace.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. QDoc will generate the same additional links and documentation for all the members of the namespace as it - does for \l {framework}{classes}. The documentation for + does for \l {framework} {classes}. The documentation for the specified namespace is put in \i {namespace}.html. @@ -5616,10 +5616,10 @@ \o \bold {The \\page command allows you to create a stand-alone documentation page.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. - The page's title can be set using the \l {title}{\\title} + The page's title can be set using the \l {title} {\\title} command. For example: \code @@ -5652,7 +5652,7 @@ \o \bold {The \\externalpage command gives a title to an external URL.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. For example: @@ -5679,7 +5679,7 @@ \quotation The broad scope of the \l - {http://www.trolltech.com/products/embedded/index.html}{Qtopia + {http://www.trolltech.com/products/embedded/index.html} {Qtopia Core} API enables it to be used across a wide variety of development projects. \endquotation @@ -5691,7 +5691,7 @@ \code / *! The broad scope of the \l - {http://www.trolltech.com/products/embedded/index.html}{Qtopia + {http://www.trolltech.com/products/embedded/index.html} {Qtopia Core} API enables it to be used across a wide variety of development projects. * / @@ -5706,7 +5706,7 @@ \o \bold {The \\property command allows you to document a Qt property.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. A property is defined using the Q_PROPERTY() macro. The @@ -5725,12 +5725,12 @@ property. The \\property command is typically accompanied with a \l - {brief}{\\brief} command. In the case of a property, the - \l {brief}{\\brief} command's argument is a sentence - fragment that will be included in a one-sentence - description of the property generated by QDoc. The command - follows the same rules for the \l {brief - property}{description} as the \l {variable}{\\variable} + {brief-command} {\\brief} command. In the case of a + property, the \l {brief-command} {\\brief} command's + argument is a sentence fragment that will be included in a + one-sentence description of the property generated by + QDoc. The command follows the same rules for the \l {brief + property} {description} as the \l {variable} {\\variable} command. For example: @@ -5797,8 +5797,8 @@ \o \bold { int width () const} \endlist - See also \l{QWidget::geometry}{geometry}, - \l{QWidget::height}{height}, and \l{QWidget::size}{size}. + See also \l{QWidget::geometry} {geometry}, + \l{QWidget::height} {height}, and \l{QWidget::size} {size}. \endquotation in qwidget.html. @@ -5824,21 +5824,21 @@ } \endcode - See also \l {class}{\\class} and \l - {generatelist}{\\generatelist}. + See also \l {class-command} {\\class} and \l + {generatelist-command} {\\generatelist}. \row \o \bold \\typedef \target typedef \o \bold {The \\typedef command allows you to document a C++ type definition.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. The documentation will be located in the associated class, header file or namespace documentation. When documenting a global type definition, the \\typedef command must be - accompanied with a \l {relates}{\\relates} command. For + accompanied with a \l {relates-command} {\\relates} command. For example: \code @@ -5926,15 +5926,15 @@ \o \bold {The \\variable command allows you to document a member variable or a constant.} - The command follows \l {topical argument}{the general + The command follows \l {topical argument} {the general topical command convention} for the argument. The \\variable command is typically followed by a \l - {brief}{\\brief} command; QDoc will generate the - documentation for the variable based on the brief + {brief-command} {\\brief} command; QDoc will generate the + documentation for the variable based on the brief-command description. The command follows the same rules for the \l - {brief property}{description} as the \l - {property}{\\property} command. + {brief property} {description} as the \l {property} + {\\property} command. The documentation will be located in the in the associated class, header file or namespace documentation. @@ -6011,8 +6011,8 @@ The default type for tree widget items. - See also \l {QTreeWidgetItem::UserType}{UserType} and - \l {QTreeWidgetItem::type()}{type()}. + See also \l {QTreeWidgetItem::UserType} {UserType} and + \l {QTreeWidgetItem::type()} {type()}. \raw HTML

@@ -6023,8 +6023,8 @@ The minimum value for custom types. Values below UserType are reserved by Qt. - See also \l {QTreeWidgetItem::Type}{Type} and - \l{QTreeWidgetItem::type()}{type()}. + See also \l {QTreeWidgetItem::Type} {Type} and + \l{QTreeWidgetItem::type()} {type()}. \endquotation @@ -6048,25 +6048,25 @@ \section1 Alphabetical List - \l {16-qdoc-commands-status.html#compat}{\\compat}, - \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage}, - \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage}, - \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup}, - \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule}, - \l {16-qdoc-commands-status.html#internal}{\\internal}, - \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass}, - \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage}, - \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant}, - \l {16-qdoc-commands-status.html#obsolete}{\\obsolete}, - \l {18-qdoc-commands-relating.html#overload}{\\overload}, - \l {16-qdoc-commands-status.html#preliminary}{\\preliminary}, - \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage}, - \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant}, - \l {18-qdoc-commands-relating.html#reimp}{\\reimp}, - \l {18-qdoc-commands-relating.html#relates}{\\relates}, - \l {15-qdoc-commands-navigation.html#startpage}{\\startpage}, - \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe}, - \l {20-qdoc-commands-title.html#title}{\\title} + \l {16-qdoc-commands-status.html#compat} {\\compat}, + \l {15-qdoc-commands-navigation.html#contentspage} {\\contentspage}, + \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage}, + \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}, + \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule}, + \l {16-qdoc-commands-status.html#internal} {\\internal}, + \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}, + \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage}, + \l {17-qdoc-commands-thread.html#nonreentrant} {\\nonreentrant}, + \l {16-qdoc-commands-status.html#obsolete} {\\obsolete}, + \l {18-qdoc-commands-relating.html#overload} {\\overload}, + \l {16-qdoc-commands-status.html#preliminary} {\\preliminary}, + \l {15-qdoc-commands-navigation.html#previouspage} {\\previouspage}, + \l {17-qdoc-commands-thread.html#reentrant} {\\reentrant}, + \l {18-qdoc-commands-relating.html#reimp} {\\reimp}, + \l {18-qdoc-commands-relating.html#relates-command} {\\relates}, + \l {15-qdoc-commands-navigation.html#startpage} {\\startpage}, + \l {17-qdoc-commands-thread.html#threadsafe} {\\threadsafe}, + \l {20-qdoc-commands-title.html#title} {\\title} \section1 Categories \list @@ -6094,11 +6094,11 @@ \section1 Alphabetical List - \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage}, - \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage}, - \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage}, - \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage}, - \l {15-qdoc-commands-navigation.html#startpage}{\\startpage} + \l {15-qdoc-commands-navigation.html#contentspage} {\\contentspage}, + \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage}, + \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage}, + \l {15-qdoc-commands-navigation.html#previouspage} {\\previouspage}, + \l {15-qdoc-commands-navigation.html#startpage} {\\startpage} \section1 General Description @@ -6108,7 +6108,7 @@ \code / *! \page basicqt.html - \contentspage {Basic Qt}{Contents} + \contentspage {Basic Qt} {Contents} \nextpage Getting Started \indexpage Index @@ -6132,7 +6132,7 @@ / *! \page gettingstarted.html \previouspage Basic Qt - \contentspage {Basic Qt}{Contents} + \contentspage {Basic Qt} {Contents} \nextpage Creating Dialogs \indexpage Index @@ -6148,7 +6148,7 @@ / *! \page creatingdialogs.html \previouspage Getting Started - \contentspage {Basic Qt}{Contents} + \contentspage {Basic Qt} {Contents} \indexpage Index \startpage Basic Qt @@ -6212,8 +6212,8 @@ in creatingdialogs.html. - In addition, the \l {indexpage}{\\indexpage} and \l - {startpage}{\\startpage} commands specifies links to the page's + In addition, the \l {indexpage} {\\indexpage} and \l + {startpage} {\\startpage} commands specifies links to the page's index page and start page. These links are used by browsers and search engines. @@ -6263,7 +6263,7 @@ page to the next page in an ordered series of documents}. The command follows the same syntax and argument convention - as the \l {previouspage}{\\previouspage} command. + as the \l {previouspage} {\\previouspage} command. For an example, see the \l {General Description} section. @@ -6289,7 +6289,7 @@ page to a contents page}. The command follows the same syntax and argument convention - as the \l {previouspage}{\\previouspage} command. + as the \l {previouspage} {\\previouspage} command. For an example, see the \l {General Description} section. @@ -6328,11 +6328,11 @@ \section1 Alphabetical List - \l {16-qdoc-commands-status.html#compat}{\\compat}, - \l {16-qdoc-commands-status.html#internal}{\\internal}, - \l {16-qdoc-commands-status.html#obsolete}{\\obsolete}, - \l {16-qdoc-commands-status.html#preliminary}{\\preliminary}, - \l {16-qdoc-commands-status.html#since}{\\since} + \l {16-qdoc-commands-status.html#compat} {\\compat}, + \l {16-qdoc-commands-status.html#internal} {\\internal}, + \l {16-qdoc-commands-status.html#obsolete} {\\obsolete}, + \l {16-qdoc-commands-status.html#preliminary} {\\preliminary}, + \l {16-qdoc-commands-status.html#since} {\\since} \section1 Command Description @@ -6483,7 +6483,7 @@ library.} It is provided to keep old source code working. We strongly advise against using it in new code. See the \l - {http://qt.nokia.com/doc/4.0/porting4.html}{Porting + {http://qt.nokia.com/doc/4.0/porting4.html} {Porting Guide} for more information. \endquotation @@ -6602,18 +6602,18 @@ ... See also \l - {QStyle::standardIconImplementation()}{standardIconImplementation()} - and \l {QStyle::standardPixmap()}{standardPixmap()}. + {QStyle::standardIconImplementation()} {standardIconImplementation()} + and \l {QStyle::standardPixmap()} {standardPixmap()}. \endquotation QDoc generates the "Qt" reference from the \l - {25-qdoc-configuration-derivedprojects.html#project}{\c + {25-qdoc-configuration-derivedprojects.html#project} {\c project} configuration variable. For that reason this reference will change according to the current documentation project. See also \l - {25-qdoc-configuration-derivedprojects.html#project}{\c + {25-qdoc-configuration-derivedprojects.html#project} {\c project}. \endtable @@ -6632,9 +6632,9 @@ \section1 Alphabetical List - \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant}, - \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant}, - \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe} + \l {17-qdoc-commands-thread.html#nonreentrant} {\\nonreentrant}, + \l {17-qdoc-commands-thread.html#reentrant} {\\reentrant}, + \l {17-qdoc-commands-thread.html#threadsafe} {\\threadsafe} \section1 General Description @@ -6654,10 +6654,10 @@ invocation references shared data. When a class is declared \c reentrant or \c threadsafe, using the - \l {reentrant}{\\reentrant} and \l {threadsafe}{\\threadsafe} + \l {reentrant} {\\reentrant} and \l {threadsafe} {\\threadsafe} commands respectively, functions in the referenced class can be declared \c nonreentrant, using the \l - {nonreentrant}{\\nonreentrant} command, excluding the functions + {nonreentrant} {\\nonreentrant} command, excluding the functions from the general view. For example: @@ -6715,8 +6715,8 @@ \endcode \bold {Note:} All the functions in this class are \l - {threads.html#reentrant}{reentrant}, except \l - {QLocale::setDefault()}{setDefault()}. + {threads.html#reentrant} {reentrant}, except \l + {QLocale::setDefault()} {setDefault()}. ... @@ -6742,8 +6742,8 @@ \warning This function is not reentrant. - See also \l {QLocale::system()}{system()} and \l - {QLocale::c()}{c()}. + See also \l {QLocale::system()} {system()} and \l + {QLocale::c()} {c()}. ... \endquotation @@ -6751,7 +6751,7 @@ As shown above, QDoc generates a notification when a class is declared reentrant, and lists the exceptions (the declared nonreentrant functions). A link to the general documentation on \l - {threads.html#reentrant}{reentrancy and thread-safety} is + {threads.html#reentrant} {reentrancy and thread-safety} is included. In addition a warning, "\bold Warning: This function is not reentrant.", is generated in the nonreentrant functions' documentation. @@ -6760,7 +6760,7 @@ is declared threadsafe. For more information see the general documentation on \l - {threads.html#reentrant}{reentrancy and thread-safety}. + {threads.html#reentrant} {reentrancy and thread-safety}. \section1 Command Descriptions @@ -6780,11 +6780,11 @@ The generated documentation resulting from using the \\threadsafe command is similar to the result of using the - \l {reentrant}{\\reentrant} command. For an example, see + \l {reentrant} {\\reentrant} command. For an example, see the \l {General Description} section. - See also \l{reentrant}{\\reentrant} and - \l{nonreentrant}{\\nonreentrant}. + See also \l{reentrant} {\\reentrant} and + \l{nonreentrant} {\\nonreentrant}. \row \o \bold \\reentrant \target reentrant @@ -6797,8 +6797,8 @@ For an example, see the \l {General Description} section. - See also \l{nonreentrant}{\\nonreentrant} and - \l{threadsafe}{\\threadsafe}. + See also \l{nonreentrant} {\\nonreentrant} and + \l{threadsafe} {\\threadsafe}. \row \o \bold \\nonreentrant \target nonreentrant @@ -6810,8 +6810,8 @@ For an example, see the \l {General Description} section. - See also \l{reentrant}{\\reentrant} and - \l{threadsafe}{\\threadsafe}. + See also \l{reentrant} {\\reentrant} and + \l{threadsafe} {\\threadsafe}. \endtable */ @@ -6831,9 +6831,9 @@ \section1 Alphabetical List - \l {18-qdoc-commands-relating.html#overload}{\\overload}, - \l {18-qdoc-commands-relating.html#reimp}{\\reimp}, - \l {18-qdoc-commands-relating.html#relates}{\\relates}, + \l {18-qdoc-commands-relating.html#overload} {\\overload}, + \l {18-qdoc-commands-relating.html#reimp} {\\reimp}, + \l {18-qdoc-commands-relating.html#relates-command} {\\relates}, \section1 Command Descriptions @@ -6893,7 +6893,7 @@

\endraw - This function overloads \l {http://qt.nokia.com/doc/4.0/qwidget.html#addAction}{addAction()} + This function overloads \l {http://qt.nokia.com/doc/4.0/qwidget.html#addAction} {addAction()} This convenience function creates a new action with an \i icon and some \i text. The function adds the newly @@ -6946,7 +6946,7 @@ documentation. \row - \o \bold \\relates \target relates + \o \bold \\relates \target relates-command \o \bold {The \\relates command attaches the documentation of a global function to that of a related class or header file.} @@ -6990,9 +6990,9 @@ \section1 Alphabetical List - \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup}, - \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule}, - \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass}, + \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}, + \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule}, + \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}, \section1 Command Descriptions @@ -7002,7 +7002,7 @@ \o Description \row - \o \bold \\mainclass \target mainclass + \o \bold \\mainclass \target mainclass-command \o \bold {The \\mainclass command relates the documented class to a group called mainclasses.} @@ -7025,15 +7025,15 @@ will ensure that the QWidget class is included in the \c mainclasses group, which means, for example, that the class will appear on the list created by calling the \l - {generatelist}{\\generatelist} command with the \c + {generatelist-command} {\\generatelist} command with the \c mainclasses argument: \l http://qt.nokia.com/doc/4.0/mainclasses.html - See also \l {generatelist}{\\generatelist}. + See also \l {generatelist-command} {\\generatelist}. \row - \o \bold \\ingroup \target ingroup + \o \bold \\ingroup \target ingroup-command \o \bold {The \\ingroup command indicates that the given overview or documented class belongs to a certain group of @@ -7059,15 +7059,15 @@ will ensure that the QDir class is included in the \c io group, which means, for example, that QDir will appear on - the list created by calling the \l {group}{\\group} command + the list created by calling the \l {group-command} {\\group} command with the \c io argument. Note that to list overviews that are related to a given group, you must generate the list exlicitly by using the \l - {generatelist}{\\generatelist} command with the \c related + {generatelist-command} {\\generatelist} command with the \c related argument. - See also \l {group}{\\group}. + See also \l {group-command} {\\group}. \row \o \bold \\inmodule \target inmodule \o \bold {The \\inmodule command relates the documented class @@ -7093,11 +7093,11 @@ will ensure that the QDesignerTaskMenuExtension class is included in the \c QtDesigner module, which means, for example, that the class will appear on the list created by - calling the \l {generatelist}{\\generatelist} command with + calling the \l {generatelist-command} {\\generatelist} command with the \c {{classesbymodule QtDesigner}} argument. - See also \l {module}{\\module} and \l - {generatelist}{\\generatelist}. + See also \l {module} {\\module} and \l + {generatelist-command} {\\generatelist}. \endtable */ @@ -7116,8 +7116,8 @@ \section1 Alphabetical List - \l {20-qdoc-commands-title.html#title}{\\title}, - \l {20-qdoc-commands-title.html#subtitle}{\\subtitle} + \l {20-qdoc-commands-title.html#title} {\\title}, + \l {20-qdoc-commands-title.html#subtitle} {\\subtitle} \section1 Command Descriptions @@ -7162,7 +7162,7 @@ ... \endquotation - See also \l {subtitle}{\\subtitle}. + See also \l {subtitle} {\\subtitle}. \row \o \bold \\subtitle \target subtitle @@ -7201,7 +7201,7 @@ ... \endquotation - See also \l {title}{\\title}. + See also \l {title} {\\title}. \endtable */ @@ -7286,45 +7286,45 @@ \section2 Alphabetical List - \l {22-qdoc-configuration-generalvariables.html#alias}{alias}, + \l {22-qdoc-configuration-generalvariables.html#alias} {alias}, \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives} {Cpp.ignoredirectives}, \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretoken} {Cpp.ignoretokens}, - \l {22-qdoc-configuration-generalvariables.html#definesvariable}{defines}, - \l {22-qdoc-configuration-generalvariables.html#edition}{edition}, - \l {22-qdoc-configuration-generalvariables.html#exampledirs}{exampledirs}, - \l {22-qdoc-configuration-generalvariables.html#examples}{examples}, + \l {22-qdoc-configuration-generalvariables.html#definesvariable} {defines}, + \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, + \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, + \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#extraimages}{extraimages}, - \l {22-qdoc-configuration-generalvariables.html#falsehoods}{falsehoods}, - \l {22-qdoc-configuration-generalvariables.html#headerdirs}{headerdirs}, - \l {22-qdoc-configuration-generalvariables.html#headers}{headers}, + \l {22-qdoc-configuration-generalvariables.html#extraimages} {extraimages}, + \l {22-qdoc-configuration-generalvariables.html#falsehoods} {falsehoods}, + \l {22-qdoc-configuration-generalvariables.html#headerdirs} {headerdirs}, + \l {22-qdoc-configuration-generalvariables.html#headers} {headers}, \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions} {headers.fileextensions}, - \l {24-qdoc-configuration-htmlvariables.html#HTML.footer}{HTML.footer}, + \l {24-qdoc-configuration-htmlvariables.html#HTML.footer} {HTML.footer}, \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader} {HTML.postheader}, - \l {24-qdoc-configuration-htmlvariables.html#HTML.style}{HTML.style}, - \l {22-qdoc-configuration-generalvariables.html#imagedirs}{imagedirs}, - \l {22-qdoc-configuration-generalvariables.html#images}{images}, + \l {24-qdoc-configuration-htmlvariables.html#HTML.style} {HTML.style}, + \l {22-qdoc-configuration-generalvariables.html#imagedirs} {imagedirs}, + \l {22-qdoc-configuration-generalvariables.html#images} {images}, \l {22-qdoc-configuration-generalvariables.html#images.fileextensions} {images.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#language}{language}, - \l {22-qdoc-configuration-generalvariables.html#macro}{macro}, - \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, + \l {22-qdoc-configuration-generalvariables.html#language} {language}, + \l {22-qdoc-configuration-generalvariables.html#macro} {macro}, + \l {22-qdoc-configuration-generalvariables.html#outputdir} {outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, - \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, - \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, - \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, + \l {22-qdoc-configuration-generalvariables.html#slow} {slow}, + \l {22-qdoc-configuration-generalvariables.html#sourcedirs} {sourcedirs}, + \l {22-qdoc-configuration-generalvariables.html#sources} {sources}, \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions} {sources.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#spurious}{spurious}, - \l {22-qdoc-configuration-generalvariables.html#tabsize}{tabsize}, - \l {22-qdoc-configuration-generalvariables.html#version}{version}, - \l {22-qdoc-configuration-generalvariables.html#versionsym}{versionsym} + \l {22-qdoc-configuration-generalvariables.html#spurious} {spurious}, + \l {22-qdoc-configuration-generalvariables.html#tabsize} {tabsize}, + \l {22-qdoc-configuration-generalvariables.html#version} {version}, + \l {22-qdoc-configuration-generalvariables.html#versionsym} {versionsym} \section2 Categories @@ -7378,40 +7378,40 @@ \section1 Alphabetical List - \l {22-qdoc-configuration-generalvariables.html#alias}{alias}, - \l {22-qdoc-configuration-generalvariables.html#codeindent}{codeindent}, - \l {22-qdoc-configuration-generalvariables.html#definesvariable}{defines}, - \l {22-qdoc-configuration-generalvariables.html#edition}{edition}, - \l {22-qdoc-configuration-generalvariables.html#exampledirs}{exampledirs}, - \l {22-qdoc-configuration-generalvariables.html#examples}{examples}, + \l {22-qdoc-configuration-generalvariables.html#alias} {alias}, + \l {22-qdoc-configuration-generalvariables.html#codeindent} {codeindent}, + \l {22-qdoc-configuration-generalvariables.html#definesvariable} {defines}, + \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, + \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, + \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#extraimages}{extraimages}, - \l {22-qdoc-configuration-generalvariables.html#falsehoods}{falsehoods}, - \l {22-qdoc-configuration-generalvariables.html#generateindex}{generateindex}, - \l {22-qdoc-configuration-generalvariables.html#headerdirs}{headerdirs}, - \l {22-qdoc-configuration-generalvariables.html#headers}{headers}, + \l {22-qdoc-configuration-generalvariables.html#extraimages} {extraimages}, + \l {22-qdoc-configuration-generalvariables.html#falsehoods} {falsehoods}, + \l {22-qdoc-configuration-generalvariables.html#generateindex} {generateindex}, + \l {22-qdoc-configuration-generalvariables.html#headerdirs} {headerdirs}, + \l {22-qdoc-configuration-generalvariables.html#headers} {headers}, \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions} {headers.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#imagedirs}{imagedirs}, - \l {22-qdoc-configuration-generalvariables.html#images}{images}, + \l {22-qdoc-configuration-generalvariables.html#imagedirs} {imagedirs}, + \l {22-qdoc-configuration-generalvariables.html#images} {images}, \l {22-qdoc-configuration-generalvariables.html#images.fileextensions} {images.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#language}{language}, - \l {22-qdoc-configuration-generalvariables.html#macro}{macro}, - \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, + \l {22-qdoc-configuration-generalvariables.html#language} {language}, + \l {22-qdoc-configuration-generalvariables.html#macro} {macro}, + \l {22-qdoc-configuration-generalvariables.html#outputdir} {outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, - \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, - \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, - \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, + \l {22-qdoc-configuration-generalvariables.html#slow} {slow}, + \l {22-qdoc-configuration-generalvariables.html#sourcedirs} {sourcedirs}, + \l {22-qdoc-configuration-generalvariables.html#sources} {sources}, \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions} {sources.fileextensions}, - \l {22-qdoc-configuration-generalvariables.html#spurious}{spurious}, - \l {22-qdoc-configuration-generalvariables.html#tabsize}{tabsize}, - \l {22-qdoc-configuration-generalvariables.html#tagfile}{tagfile}, - \l {22-qdoc-configuration-generalvariables.html#version}{version}, - \l {22-qdoc-configuration-generalvariables.html#versionsym}{versionsym} + \l {22-qdoc-configuration-generalvariables.html#spurious} {spurious}, + \l {22-qdoc-configuration-generalvariables.html#tabsize} {tabsize}, + \l {22-qdoc-configuration-generalvariables.html#tagfile} {tagfile}, + \l {22-qdoc-configuration-generalvariables.html#version} {version}, + \l {22-qdoc-configuration-generalvariables.html#versionsym} {versionsym} \section1 Variable Descriptions @@ -7438,7 +7438,7 @@ The \c alias variable is often used for compatibility reasons; for more information see the \l {QDoc - Compatibility}{compatibility section}. + Compatibility} {compatibility section}. See also \l macro. @@ -7450,7 +7450,7 @@ QDoc originally used a hard-coded value of four spaces for code indentation to ensure that code snippets could be easily distinguished from surrounding text. Since we can use - \l{HTML Specific Configuration Variables#HTML.stylesheets}{stylesheets} to + \l{HTML Specific Configuration Variables#HTML.stylesheets} {stylesheets} to adjust the appearance of certain types of HTML elements, this level of indentation is not always required. @@ -7460,7 +7460,7 @@ symbols that QDoc will recognize and respond to.} When a preprocessor symbol is specified using the \c - defines variable, you can also use the \l {if}{\\if} + defines variable, you can also use the \l {if-command} {\\if} command to enclose documentation that only will be included if the preprocessor symbol is defined. @@ -7508,7 +7508,7 @@ consoleedition preprocessor symbol is defined when QDoc processes the source files defined in the qt.qdocconf file. - See also \l falsehoods and \l {if}{\\if}. + See also \l falsehoods and \l {if-command} {\\if}. \row \o \bold edition \target edition @@ -7533,7 +7533,7 @@ In the above examples, the \c Console edition only includes the contents of four modules. Only the classes from these modules will be used when the - \l{Miscellaneous Commands#generatelist}{generatelist} command + \l{Miscellaneous Commands#generatelist-command} {generatelist} command is used to generate a list of classes for this edition: \code @@ -7545,12 +7545,12 @@ \o \bold {The \c exampledirs variable specifies the directories containing the source code of the example files.} - The \l {examples}{\c examples} and \c exampledirs variables - are used by the \l {quotefromfile}{\\quotefromfile}, \l - {quotefile}{\\quotefile} and \l {example}{\\example} - commands. If both the \l {examples}{\c examples} and \c + The \l {examples} {\c examples} and \c exampledirs variables + are used by the \l {quotefromfile-command} {\\quotefromfile}, \l + {quotefile-command} {\\quotefile} and \l {example} {\\example} + commands. If both the \l {examples} {\c examples} and \c exampledirs variables are defined, QDoc will search in - both, first in \l {examples}{\c examples} then in \c + both, first in \l {examples} {\c examples} then in \c exampledirs. QDoc will search through the directories in the specified @@ -7576,7 +7576,7 @@ \endcode QDoc will then see if there exists a file called \c - calculator.cpp listed as a value in the \l {examples}{\c + calculator.cpp listed as a value in the \l {examples} {\c examples} variable. If it doesn't, it will search in the \c exampledirs variable, and first see if there exists a file called @@ -7600,22 +7600,22 @@ \o \bold examples \target examples \o \bold {The \c examples variable allows you to specify individual example files in addition to those located in the directories - specified by the \l {exampledirs}{\c exampledirs} variable.} + specified by the \l {exampledirs} {\c exampledirs} variable.} - The \c examples and \l {exampledirs}{\c exampledirs} + The \c examples and \l {exampledirs} {\c exampledirs} variables are used by the \l - {quotefromfile}{\\quotefromfile}, \l - {quotefile}{\\quotefile} and \l {example}{\\example} - commands. If both the \c examples and \l {exampledirs}{\c + {quotefromfile-command} {\\quotefromfile}, \l + {quotefile-command} {\\quotefile} and \l {example} {\\example} + commands. If both the \c examples and \l {exampledirs} {\c exampledirs} variables are defined, QDoc will search in - both, first in \c examples then in \l {exampledirs}{\c + both, first in \c examples then in \l {exampledirs} {\c exampledirs}. QDoc will search through the values listed for the \c examples variable, in the specified order, and accept the first one it finds. - For an extensive example, see the \l {exampledirs}{\c + For an extensive example, see the \l {exampledirs} {\c exampledirs} command. But note that if you know the file is listed in the \c examples variable, you don't need to specify its path: @@ -7652,7 +7652,7 @@ QDoc will not recognize images used within HTML (or any other markup language). If we want the images to be copied - from the directories specified by \l {imagedirs}{\c + from the directories specified by \l {imagedirs} {\c imagedirs} (the images in question must be located in these directories) to the output directory, we must specify the images using the \c extraimages variable. @@ -7739,29 +7739,29 @@ \endcode When executed, the first QDoc will do is to read through - the headers specified in the \l {headers}{\c headers} + the headers specified in the \l {headers} {\c headers} variable, and the ones located in the directories specified in the \c headerdir variable (including all subdirectories), building an internal structure of the classes and their functions. Then it will read through the sources specified in the \l - {sources}{\c sources}, and the ones located in the - directories specified in the \l {sourcedirs}{\c sourcedirs} + {sources} {\c sources}, and the ones located in the + directories specified in the \l {sourcedirs} {\c sourcedirs} varible (including all subdirectories), merging the documentation with the structure it retrieved from the header files. If both the \c headers and \c headerdirs variables are - defined, QDoc will read through both, first \l {headers}{\c + defined, QDoc will read through both, first \l {headers} {\c headers} then \c headerdirs. In the specified directories, QDoc will only read the files with the fileextensions specified in the \l - {headers.fileextensions}{\c headers.fileextensions} + {headers.fileextensions} {\c headers.fileextensions} variable. The default extensions are *.ch, *.h, *.h++, *.hh, *.hpp and *.hxx". The files specified by \l - {headers}{\c headers} will be read independent of their + {headers} {\c headers} will be read independent of their fileextensions. See also \l headers and \l headers.fileextensions. @@ -7770,7 +7770,7 @@ \o \bold headers \target headers \o \bold {The \c headers variable allows you to specify individual header files in addition to those located in the directories - specified by the \l {headerdirs}{\c headerdirs} variable.} + specified by the \l {headerdirs} {\c headerdirs} variable.} For example: @@ -7780,9 +7780,9 @@ \endcode When processing the \c headers variable, QDoc behaves in the - same way as it does when processing the \l {headerdirs}{\c + same way as it does when processing the \l {headerdirs} {\c headerdirs} variable. For more information, see the \l - {headerdirs}{\c headerdirs} variable. + {headerdirs} {\c headerdirs} variable. See also \l headerdirs. @@ -7792,7 +7792,7 @@ extension used by the headers.} When processing the header files specified in the \l - {headerdirs}{\c headerdirs} variable, QDoc will only read + {headerdirs} {\c headerdirs} variable, QDoc will only read the files with the fileextensions specified in the \c headers.fileextensions variable. In this way QDoc avoid spending time reading irrelevant files. @@ -7817,11 +7817,11 @@ \o \bold {The \c imagedirs variable specifies the directories containing the images used in the documentation.} - The \l {images}{\c images} and \c imagedirs variables are - used by the \l {image}{\\image} and \l - {inlineimage}{\\inlineimage} commands. If both the \l - {images}{\c images} and \c imagedirs variables are defined, - QDoc will search in both, first in \l {images}{\c images} + The \l {images} {\c images} and \c imagedirs variables are + used by the \l {image} {\\image} and \l + {inlineimage-command} {\\inlineimage} commands. If both the \l + {images} {\c images} and \c imagedirs variables are defined, + QDoc will search in both, first in \l {images} {\c images} then in \c imagedirs. QDoc will search through the directories in the specified @@ -7860,13 +7860,13 @@ \endcode You can filter the images in an image directory using the - \l {images.fileextensions}{\c images.fileextensions} + \l {images.fileextensions} {\c images.fileextensions} variable. The general idea behind the \l - {images.fileextensions}{\c images.fileextensions} variable + {images.fileextensions} {\c images.fileextensions} variable is to enable different image format for different output format. - \warning The \l {images.fileextensions}{\c + \warning The \l {images.fileextensions} {\c images.fileextensions} variable's functionality is preliminay since QDoc at this point only support HTML. @@ -7876,7 +7876,7 @@ \o \bold images \target images \o \bold {The \c images variable allows you to specify individual image files in addition to those located in the directories - specified by the \l {imagedirs}{\c imagedirs} variable.} + specified by the \l {imagedirs} {\c imagedirs} variable.} For example: @@ -7885,9 +7885,9 @@ \endcode When processing the \c images variable, QDoc behaves in the - same way as it does when processing the \l {imagedirs}{\c + same way as it does when processing the \l {imagedirs} {\c imagedirs} variable. For more information, see the \l - {imagedirs}{\c imagedirs} variable. + {imagedirs} {\c imagedirs} variable. See also \l imagedirs and \l images.fileextensions. @@ -7908,8 +7908,8 @@ images.fileextensions.LOUT = *.eps \endcode - Then, when processing the \l {image}{\\image} and \l - {inlineimage}{\\inlineimage} commands, QDoc will only + Then, when processing the \l {image} {\\image} and \l + {inlineimage-command} {\\inlineimage} commands, QDoc will only search for files with extensions specified in the output format's associated image extension variable. @@ -7982,8 +7982,8 @@ it generates, using the \c lang and \c xml:lang attributes. See also \l sourceencoding, \l outputencoding, - \l{http://www.w3.org/TR/xhtml1/#C_7}{C.7. The lang and xml:lang Attributes} and - \l{http://www.w3.org/TR/i18n-html-tech-lang/#ri20040429.113217290}{Best Practice 13: Using Hans and Hant codes}. + \l{http://www.w3.org/TR/xhtml1/#C_7} {C.7. The lang and xml:lang Attributes} and + \l{http://www.w3.org/TR/i18n-html-tech-lang/#ri20040429.113217290} {Best Practice 13: Using Hans and Hant codes}. \row \o \bold outputdir \target outputdir @@ -8085,28 +8085,28 @@ \endcode When executed, the first QDoc will do is to read through - the headers specified in the \l {header}{\c header} + the headers specified in the \l {header} {\c header} variable, and the ones located in the directories specified in the \c headerdir variable (including all subdirectories), building an internal structure of the classes and their functions. Then it will read through the sources specified in the \l - {sources}{\c sources}, and the ones located in the - directories specified in the \l {sourcedirs}{\c sourcedirs} + {sources} {\c sources}, and the ones located in the + directories specified in the \l {sourcedirs} {\c sourcedirs} varible (including all subdirectories), merging the documentation with the structure it retrieved from the header files. If both the \c sources and \c sourcedirs variables are - defined, QDoc will read through both, first \l {sources}{\c + defined, QDoc will read through both, first \l {sources} {\c sources} then \c sourcedirs. In the specified directories, QDoc will only read the files with the fileextensions specified in the \l - {sources.fileextensions}{\c sources.fileextensions} + {sources.fileextensions} {\c sources.fileextensions} variable. The default extensions are *.c++, *.cc, *.cpp and - *.cxx. The files specified by \l {sources}{\c sources} will + *.cxx. The files specified by \l {sources} {\c sources} will be read independent of their fileextensions. See also \l sources and \l sources.fileextensions. @@ -8139,7 +8139,7 @@ \o \bold sources \target sources \o \bold {The \c sources variable allows you to specify individual source files in addition to those located in the - directories specified by the \l {sourcedir}{\c sourcedir} + directories specified by the \l {sourcedir} {\c sourcedir} variable.} For example: @@ -8150,9 +8150,9 @@ \endcode When processing the \c sources variable, QDoc behaves in the - same way as it does when processing the \l {sourcedirs}{\c + same way as it does when processing the \l {sourcedirs} {\c sourcedirs} variable. For more information, see the \l - {sourcedirs}{\c sourcedirs} variable. + {sourcedirs} {\c sourcedirs} variable. See also \l sourcedirs. @@ -8162,7 +8162,7 @@ files within a source directory.} When processing the source files specified in the \l - {sourcedirs}{\c sourcedirs} variable, QDoc will only read + {sourcedirs} {\c sourcedirs} variable, QDoc will only read the files with the fileextensions specified in the \c sources.fileextensions variable. In this way QDoc avoid spending time reading irrelevant files. @@ -8271,7 +8271,7 @@ \warning The \\version command's functionality is not fully implemented; currently it only works within raw HTML code. - See also \l {version}{\\version}. + See also \l {version} {\\version}. \endtable */ @@ -8498,11 +8498,11 @@ \section1 Alphabetical List - \l {24-qdoc-configuration-htmlvariables.html#HTML.footer}{HTML.footer}, + \l {24-qdoc-configuration-htmlvariables.html#HTML.footer} {HTML.footer}, \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader} {HTML.postheader}, - \l {24-qdoc-configuration-htmlvariables.html#HTML.style}{HTML.style}, - \l {24-qdoc-configuration-htmlvariables.html#HTML.stylesheets}{HTML.stylesheets} + \l {24-qdoc-configuration-htmlvariables.html#HTML.style} {HTML.style}, + \l {24-qdoc-configuration-htmlvariables.html#HTML.stylesheets} {HTML.stylesheets} \section1 Variable Descriptions @@ -8535,7 +8535,7 @@ The complete variable entry in \l qt.qdocconf provides the standard footer of the \l - {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference + {http://qt.nokia.com/doc/4.0/index.html} {Qt Reference Documentation}. \row @@ -8564,7 +8564,7 @@ The complete variable entry in \l qt.qdocconf provides the standard header of the \l - {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference + {http://qt.nokia.com/doc/4.0/index.html} {Qt Reference Documentation}. \row @@ -8590,7 +8590,7 @@ \endcode provides the HTML style for the \l - {http://qt.nokia.com/doc/4.0/index.html}{Qt Reference + {http://qt.nokia.com/doc/4.0/index.html} {Qt Reference Documentation}. \row @@ -8633,10 +8633,10 @@ \section2 Alphabetical List - \l{25-qdoc-configuration-derivedprojects.html#description}{description}, - \l{25-qdoc-configuration-derivedprojects.html#indexes}{indexes}, - \l{25-qdoc-configuration-derivedprojects.html#project}{project}, - \l{25-qdoc-configuration-derivedprojects.html#url}{url} + \l{25-qdoc-configuration-derivedprojects.html#description} {description}, + \l{25-qdoc-configuration-derivedprojects.html#indexes} {indexes}, + \l{25-qdoc-configuration-derivedprojects.html#project} {project}, + \l{25-qdoc-configuration-derivedprojects.html#url} {url} \section2 Variable Descriptions @@ -8803,16 +8803,16 @@ A compat.qdocconf file is a separate \c .qdocconf file which you can include in your main configuration file. It typically contains the mapping between old and new commands using the \l alias and \l - {22-qdoc-configuration-generalvariables.html#macro}{macro} + {22-qdoc-configuration-generalvariables.html#macro} {macro} configuration variables. \section1 Qt Compatibility In Qt's documentation there still exist occurrences of old - commands, and the Qt \l {qt.qdocconf}{configuration file} needs to + commands, and the Qt \l {qt.qdocconf} {configuration file} needs to include the compat.qdocconf file tailored for Qt. For more detailed information about the commands creating compatibility - issues, see the \l {Command Comments}{command comments}. + issues, see the \l {Command Comments} {command comments}. \section2 Qt's current compat.qdocconf file @@ -8836,7 +8836,7 @@ \\e command name. \bold {We still need to use the \\e command to render in - italic in new documentation for \l {reason}{compatibility + italic in new documentation for \l {reason} {compatibility reasons}}. \row @@ -8850,7 +8850,7 @@ \bold {We still need to use the \\input command to include plain text in new documentation for \l - {reason}{compatibility reasons}}. + {reason} {compatibility reasons}}. \row \o \\quotefile \target quotefile-versus-include @@ -8863,7 +8863,7 @@ \bold {We still need to use the \\include command to quote the entire contents of a source file in new documentation - for \l {reason}{compatibility reasons}}. + for \l {reason} {compatibility reasons}}. \row \o \\quotefromfile \target quotefromfile-versus-quotefile @@ -8873,7 +8873,7 @@ that command to quote an entire file, we introduce the new \\quotefromfile command to quote from file. - \bold {Use \l {quotefromfile}{\\quotefromfile} to quote + \bold {Use \l {quotefromfile-command} {\\quotefromfile} to quote parts from a source file in new documentation}. \row @@ -8884,7 +8884,7 @@ in italic instead, we introduce the new \\o command for this purpose. - \bold {Use \l {o}{\\o} to indicate list and table items in + \bold {Use \l {o} {\\o} to indicate list and table items in new documentation}. \row @@ -8893,7 +8893,7 @@ \o These commands are equivalent, and represent a simple name change. - \bold {Use \l {quotation}{\\quotation} in new + \bold {Use \l {quotation} {\\quotation} in new documentation}. \row @@ -8902,7 +8902,7 @@ \o These commands are equivalent, and represent a simple name change. - \bold {Use \l {image}{\\image} in new documentation}. + \bold {Use \l {image} {\\image} in new documentation}. \endtable */ @@ -8916,104 +8916,104 @@ \list - \o \l {04-qdoc-commands-textformatting.html#a}{\\a} - \o \l {11-qdoc-commands-documentcontents.html#abstract}{\\abstract} - \o \l {06-qdoc-commands-verbatimcode.html#badcode}{\\badcode} - \o \l {04-qdoc-commands-textformatting.html#bold}{\\bold} - \o \l {11-qdoc-commands-documentcontents.html#brief}{\\brief} - \o \l {04-qdoc-commands-textformatting.html#c}{\\c} - \o \l {09-qdoc-commands-graphic.html#caption}{\\caption} - \o \l {05-qdoc-commands-documentstructuring.html#chapter}{\\chapter} - \o \l {13-qdoc-commands-topical.html#class}{\\class} - \o \l {06-qdoc-commands-verbatimcode.html#code}{\\code} - \o \l {07-0-qdoc-commands-quoting.html#codeline}{\\codeline}, - \o \l {16-qdoc-commands-status.html#compat}{\\compat} - \o \l {15-qdoc-commands-navigation.html#contentspage}{\\contentspage} - \o \l {04-qdoc-commands-textformatting.html#div}{\\div} \span {class="newStuff"} {(new)} - \o \l {07-0-qdoc-commands-quoting.html#dots}{\\dots} - \o \l {12-0-qdoc-commands-miscellaneous.html#else}{\\else} - \o \l {12-0-qdoc-commands-miscellaneous.html#endif}{\\endif} - \o \l {13-qdoc-commands-topical.html#enum}{\\enum} - \o \l {13-qdoc-commands-topical.html#example-command}{\\example} - \o \l {12-0-qdoc-commands-miscellaneous.html#expire}{\\expire} - \o \l {13-qdoc-commands-topical.html#externalpage}{\\externalpage} - \o \l {13-qdoc-commands-topical.html#fn}{\\fn} - \o \l {11-qdoc-commands-documentcontents.html#footnote}{\\footnote} - \o \l {12-0-qdoc-commands-miscellaneous.html#generatelist}{\\generatelist} - \o \l {13-qdoc-commands-topical.html#group}{\\group} - \o \l {10-qdoc-commands-container.html#header}{\\header} - \o \l {13-qdoc-commands-topical.html#headerfile}{\\headerfile} - \o \l {04-qdoc-commands-textformatting.html#i}{\\i} - \o \l {12-0-qdoc-commands-miscellaneous.html#if}{\\if} - \o \l {09-qdoc-commands-graphic.html#image}{\\image} - \o \l {12-0-qdoc-commands-miscellaneous.html#include}{\\include} - \o \l {15-qdoc-commands-navigation.html#indexpage}{\\indexpage} - \o \l {19-qdoc-commands-grouping.html#ingroup}{\\ingroup} - \o \l {19-qdoc-commands-grouping.html#inmodule}{\\inmodule} - \o \l {09-qdoc-commands-graphic.html#inlineimage}{\\inlineimage} - \o \l {16-qdoc-commands-status.html#internal}{\\internal} - \o \l {08-qdoc-commands-linking.html#keyword}{\\keyword} - \o \l {08-qdoc-commands-linking.html#l}{\\l} - \o \l {11-qdoc-commands-documentcontents.html#legalese}{\\legalese} - \o \l {10-qdoc-commands-container.html#list}{\\list} - \o \l {13-qdoc-commands-topical.html#macro}{\\macro} - \o \l {19-qdoc-commands-grouping.html#mainclass}{\\mainclass} - \o \l {12-0-qdoc-commands-miscellaneous.html#meta}{\\meta} - \o \l {13-qdoc-commands-topical.html#module}{\\module} - \o \l {13-qdoc-commands-topical.html#namespace}{\\namespace} - \o \l {15-qdoc-commands-navigation.html#nextpage}{\\nextpage} - \o \l {06-qdoc-commands-verbatimcode.html#newcode}{\\newcode} - \o \l {17-qdoc-commands-thread.html#nonreentrant}{\\nonreentrant} - \o \l {10-qdoc-commands-container.html#o}{\\o} - \o \l {16-qdoc-commands-status.html#obsolete}{\\obsolete} - \o \l {06-qdoc-commands-verbatimcode.html#oldcode}{\\oldcode} - \o \l {12-0-qdoc-commands-miscellaneous.html#omit}{\\omit} - \o \l {10-qdoc-commands-container.html#omitvalue}{\\omitvalue} - \o \l {18-qdoc-commands-relating.html#overload}{\\overload} - \o \l {13-qdoc-commands-topical.html#page}{\\page} - \o \l {05-qdoc-commands-documentstructuring.html#part}{\\part} - \o \l {16-qdoc-commands-status.html#preliminary}{\\preliminary} - \o \l {15-qdoc-commands-navigation.html#previouspage}{\\previouspage} - \o \l {07-0-qdoc-commands-quoting.html#printline}{\\printline} - \o \l {07-0-qdoc-commands-quoting.html#printto}{\\printto} - \o \l {07-0-qdoc-commands-quoting.html#printuntil}{\\printuntil} - \o \l {13-qdoc-commands-topical.html#property}{\\property} - \o \l {11-qdoc-commands-documentcontents.html#quotation}{\\quotation} - \o \l {07-0-qdoc-commands-quoting.html#quotefile}{\\quotefile} - \o \l {07-0-qdoc-commands-quoting.html#quotefromfile}{\\quotefromfile} - \o \l {12-0-qdoc-commands-miscellaneous.html#raw}{\\raw} \span {class="newStuff"} {(avoid)} - \o \l {17-qdoc-commands-thread.html#reentrant}{\\reentrant} - \o \l {18-qdoc-commands-relating.html#reimp}{\\reimp} - \o \l {18-qdoc-commands-relating.html#relates}{\\relates} - \o \l {10-qdoc-commands-container.html#row}{\\row} - \o \l {08-qdoc-commands-linking.html#sa}{\\sa} - \o \l {05-qdoc-commands-documentstructuring.html#sectionOne}{\\section1} - \o \l {05-qdoc-commands-documentstructuring.html#sectionTwo}{\\section2} - \o \l {05-qdoc-commands-documentstructuring.html#sectionThree}{\\section3} - \o \l {05-qdoc-commands-documentstructuring.html#sectionFour}{\\section4} - \o \l {13-qdoc-commands-topical.html#service}{\\service} - \o \l {16-qdoc-commands-status.html#since}{\\since} - \o \l {07-0-qdoc-commands-quoting.html#skipline}{\\skipline} - \o \l {07-0-qdoc-commands-quoting.html#skipto}{\\skipto} - \o \l {07-0-qdoc-commands-quoting.html#skipuntil}{\\skipuntil} - \o \l {07-0-qdoc-commands-quoting.html#snippet}{\\snippet}, - \o \l {04-qdoc-commands-textformatting.html#span}{\\span} \span {class="newStuff"} {(new)} - \o \l {15-qdoc-commands-navigation.html#startpage}{\\startpage} - \o \l {04-qdoc-commands-textformatting.html#sub}{\\sub} - \o \l {20-qdoc-commands-title.html#subtitle}{\\subtitle} - \o \l {04-qdoc-commands-textformatting.html#sup}{\\sup} - \o \l {10-qdoc-commands-container.html#table}{\\table} + \o \l {04-qdoc-commands-textformatting.html#a} {\\a} + \o \l {11-qdoc-commands-documentcontents.html#abstract} {\\abstract} + \o \l {06-qdoc-commands-verbatimcode.html#badcode} {\\badcode} + \o \l {04-qdoc-commands-textformatting.html#bold} {\\bold} + \o \l {11-qdoc-commands-documentcontents.html#brief-command} {\\brief} + \o \l {04-qdoc-commands-textformatting.html#c} {\\c} + \o \l {09-qdoc-commands-graphic.html#caption} {\\caption} + \o \l {05-qdoc-commands-documentstructuring.html#chapter} {\\chapter} + \o \l {13-qdoc-commands-topical.html#class-command} {\\class} + \o \l {06-qdoc-commands-verbatimcode.html#code-command} {\\code} + \o \l {07-0-qdoc-commands-quoting.html#codeline} {\\codeline}, + \o \l {16-qdoc-commands-status.html#compat} {\\compat} + \o \l {15-qdoc-commands-navigation.html#contentspage} {\\contentspage} + \o \l {04-qdoc-commands-textformatting.html#div} {\\div} \span {class="newStuff"} {(new)} + \o \l {07-0-qdoc-commands-quoting.html#dots} {\\dots} + \o \l {12-0-qdoc-commands-miscellaneous.html#else} {\\else} + \o \l {12-0-qdoc-commands-miscellaneous.html#endif} {\\endif} + \o \l {13-qdoc-commands-topical.html#enum-command} {\\enum} + \o \l {13-qdoc-commands-topical.html#example-command} {\\example} + \o \l {12-0-qdoc-commands-miscellaneous.html#expire} {\\expire} + \o \l {13-qdoc-commands-topical.html#externalpage} {\\externalpage} + \o \l {13-qdoc-commands-topical.html#fn} {\\fn} + \o \l {11-qdoc-commands-documentcontents.html#footnote} {\\footnote} + \o \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist} + \o \l {13-qdoc-commands-topical.html#group-command} {\\group} + \o \l {10-qdoc-commands-container.html#header} {\\header} + \o \l {13-qdoc-commands-topical.html#headerfile} {\\headerfile} + \o \l {04-qdoc-commands-textformatting.html#i} {\\i} + \o \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} + \o \l {09-qdoc-commands-graphic.html#image} {\\image} + \o \l {12-0-qdoc-commands-miscellaneous.html#include} {\\include} + \o \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage} + \o \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup} + \o \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule} + \o \l {09-qdoc-commands-graphic.html#inlineimage-command} {\\inlineimage} + \o \l {16-qdoc-commands-status.html#internal} {\\internal} + \o \l {08-qdoc-commands-linking.html#keyword} {\\keyword} + \o \l {08-qdoc-commands-linking.html#l} {\\l} + \o \l {11-qdoc-commands-documentcontents.html#legalese} {\\legalese} + \o \l {10-qdoc-commands-container.html#list} {\\list} + \o \l {13-qdoc-commands-topical.html#macro} {\\macro} + \o \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass} + \o \l {12-0-qdoc-commands-miscellaneous.html#meta} {\\meta} + \o \l {13-qdoc-commands-topical.html#module} {\\module} + \o \l {13-qdoc-commands-topical.html#namespace} {\\namespace} + \o \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage} + \o \l {06-qdoc-commands-verbatimcode.html#newcode} {\\newcode} + \o \l {17-qdoc-commands-thread.html#nonreentrant} {\\nonreentrant} + \o \l {10-qdoc-commands-container.html#o} {\\o} + \o \l {16-qdoc-commands-status.html#obsolete} {\\obsolete} + \o \l {06-qdoc-commands-verbatimcode.html#oldcode} {\\oldcode} + \o \l {12-0-qdoc-commands-miscellaneous.html#omit} {\\omit} + \o \l {10-qdoc-commands-container.html#omitvalue-command} {\\omitvalue} + \o \l {18-qdoc-commands-relating.html#overload} {\\overload} + \o \l {13-qdoc-commands-topical.html#page} {\\page} + \o \l {05-qdoc-commands-documentstructuring.html#part} {\\part} + \o \l {16-qdoc-commands-status.html#preliminary} {\\preliminary} + \o \l {15-qdoc-commands-navigation.html#previouspage} {\\previouspage} + \o \l {07-0-qdoc-commands-quoting.html#printline} {\\printline} + \o \l {07-0-qdoc-commands-quoting.html#printto} {\\printto} + \o \l {07-0-qdoc-commands-quoting.html#printuntil} {\\printuntil} + \o \l {13-qdoc-commands-topical.html#property} {\\property} + \o \l {11-qdoc-commands-documentcontents.html#quotation} {\\quotation} + \o \l {07-0-qdoc-commands-quoting.html#quotefile-command} {\\quotefile} + \o \l {07-0-qdoc-commands-quoting.html#quotefromfile-command} {\\quotefromfile} + \o \l {12-0-qdoc-commands-miscellaneous.html#raw} {\\raw} \span {class="newStuff"} {(avoid)} + \o \l {17-qdoc-commands-thread.html#reentrant} {\\reentrant} + \o \l {18-qdoc-commands-relating.html#reimp} {\\reimp} + \o \l {18-qdoc-commands-relating.html#relates-command} {\\relates} + \o \l {10-qdoc-commands-container.html#row} {\\row} + \o \l {08-qdoc-commands-linking.html#sa} {\\sa} + \o \l {05-qdoc-commands-documentstructuring.html#sectionOne} {\\section1} + \o \l {05-qdoc-commands-documentstructuring.html#sectionTwo} {\\section2} + \o \l {05-qdoc-commands-documentstructuring.html#sectionThree} {\\section3} + \o \l {05-qdoc-commands-documentstructuring.html#sectionFour} {\\section4} + \o \l {13-qdoc-commands-topical.html#service} {\\service} + \o \l {16-qdoc-commands-status.html#since} {\\since} + \o \l {07-0-qdoc-commands-quoting.html#skipline} {\\skipline} + \o \l {07-0-qdoc-commands-quoting.html#skipto} {\\skipto} + \o \l {07-0-qdoc-commands-quoting.html#skipuntil} {\\skipuntil} + \o \l {07-0-qdoc-commands-quoting.html#snippet} {\\snippet}, + \o \l {04-qdoc-commands-textformatting.html#span} {\\span} \span {class="newStuff"} {(new)} + \o \l {15-qdoc-commands-navigation.html#startpage} {\\startpage} + \o \l {04-qdoc-commands-textformatting.html#sub} {\\sub} + \o \l {20-qdoc-commands-title.html#subtitle} {\\subtitle} + \o \l {04-qdoc-commands-textformatting.html#sup} {\\sup} + \o \l {10-qdoc-commands-container.html#table} {\\table} \o \l {11-qdoc-commands-documentcontents.html#tableofcontents} {\\tableofcontents} - \o \l {08-qdoc-commands-linking.html#target}{\\target} - \o \l {17-qdoc-commands-thread.html#threadsafe}{\\threadsafe} - \o \l {20-qdoc-commands-title.html#title}{\\title} - \o \l {04-qdoc-commands-textformatting.html#tt}{\\tt} - \o \l {13-qdoc-commands-topical.html#typedef}{\\typedef} - \o \l {04-qdoc-commands-textformatting.html#underline}{\\underline} - \o \l {13-qdoc-commands-topical.html#variable}{\\variable} - \o \l {10-qdoc-commands-container.html#value}{\\value} - \o \l {11-qdoc-commands-documentcontents.html#warning}{\\warning} + \o \l {08-qdoc-commands-linking.html#target} {\\target} + \o \l {17-qdoc-commands-thread.html#threadsafe} {\\threadsafe} + \o \l {20-qdoc-commands-title.html#title} {\\title} + \o \l {04-qdoc-commands-textformatting.html#tt} {\\tt} + \o \l {13-qdoc-commands-topical.html#typedef} {\\typedef} + \o \l {04-qdoc-commands-textformatting.html#underline} {\\underline} + \o \l {13-qdoc-commands-topical.html#variable} {\\variable} + \o \l {10-qdoc-commands-container.html#value-command} {\\value} + \o \l {11-qdoc-commands-documentcontents.html#warning} {\\warning} \endlist */ -- cgit v0.12 From 6bb1ae3cddce24a4d69198b38040afcb44cd4cd4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 31 Jan 2011 15:19:35 +0100 Subject: qdoc: Fixed numerous broken links in the qdoc manual. --- tools/qdoc3/doc/qdoc-manual.qdoc | 88 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 51ada06..dd65769 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -2207,7 +2207,7 @@ \o \c {\l } - a defined \l {headerfile} {\\headerfile} \o \c {\l widgets/wiggly} - a defined \l {example-command} {\\example} - \o \c {\l {QWidget Class Reference}} - a defined \l {title} {\\title} + \o \c {\l {QWidget Class Reference}} - a defined \l {title-command} {\\title} \o \c {\l {Introduction}}- a defined \l{part} {\\part}, \l{chapter} {\\chapter} or \l {sectionOne} {\\section...} \o \c {\l fontmatching} - a defined \l {target} {\\target} @@ -3452,10 +3452,10 @@ The \\brief command can be used in two significant different ways: \l {brief class} {One for classes, - namespaces and header files}, and \l {brief property} {one + namespaces and header files}, and \l {brief-property} {one for properties and variables}. - \target brief property + \target brief-property When the \\brief command is used to describe a property or a variable, the brief text must only be a sentence fragment @@ -4042,7 +4042,7 @@ determined by its location, i.e. its directory. However, for extensions, like ActiveQt and Qt Designer, a class is related to a module with the \l - {inmodule} {\\inmodule} command. + {inmodule-command} {\\inmodule} command. \o \c classesbyedition @@ -4291,7 +4291,7 @@ This QDoc comment will only be rendered if the \c opensourceedition preprocessor symbol is defined, and - specified in the \l {definesvariable} {defines} variable in + specified in the \l {defines-variable} {defines} variable in the configuration file to make QDoc process the code within #ifdef and #endif: @@ -4301,10 +4301,11 @@ You can also define the preprocessor symbol manually on the command line. For more information see the documentation of - the \l {definesvariable} {defines} variable. + the \l {defines-variable} {defines} variable. See also \l{endif} {\\endif}, \l{else} {\\else}, \l - {definesvariable} {defines} and \l falsehoods. + {defines-variable} {defines} and \l {falsehoods-variable} + {falsehoods}. \row \o \bold \\endif \target endif @@ -4317,7 +4318,7 @@ {if-command} {\\if} command. See also \l{if-command} {\\if}, \l{else} {\\else}, \l - {definesvariable} {defines} and \l falsehoods. + {defines-variable} {defines} and \l {falsehoods-variable} {falsehoods}. \row \o \bold \\else \target else @@ -4414,7 +4415,8 @@ \endquotation See also \l{if-command} {\\if}, \l{endif} {\\endif}, \l - {definesvariable} {defines} and \l falsehoods. + {defines-variable} {defines} and \l {falsehoods-variable} + {falsehoods}. \row \o \bold \\include \target include @@ -5163,7 +5165,7 @@ The command follows \l {topical argument} {the general topical command convention} for the argument. The \\group - command is typically followed by a \l {title} {\\title} + command is typically followed by a \l {title-command} {\\title} command and a short introduction to the group. The generated HTML documentation for the specified group is put in \i{group}.html. @@ -5436,7 +5438,7 @@ ... - See also \l {Meta-Object System}, \l {Signals and + See also \l {Meta-Object System}, \l {Signals & Slots} and \l {Qt's Property System}. \endquotation @@ -5452,13 +5454,13 @@ topical command convention} for the argument. A class can be related to a module using the \l - {inmodule} {\\inmodule} command. + {inmodule-command} {\\inmodule} command. The \\module command is typically followed by the \l - {title} {\\title} and \l {brief-command} {\\brief} commands. Each - class is listed with a link to the class reference page and - a brief description based on the classes' \l - {brief-command} {\\brief} texts. + {title-command} {\\title} and \l {brief-command} {\\brief} + commands. Each class is listed with a link to the class + reference page and a brief description based on the + classes' \l {brief-command} {\\brief} texts. For example: @@ -5545,7 +5547,7 @@ in qtnetwork.html. - See also \l {inmodule} {\\inmodule} + See also \l {inmodule-command} {\\inmodule} \row \o \bold \\namespace \target namespace @@ -5619,7 +5621,7 @@ The command follows \l {topical argument} {the general topical command convention} for the argument. - The page's title can be set using the \l {title} {\\title} + The page's title can be set using the \l {title-command} {\\title} command. For example: \code @@ -5729,9 +5731,9 @@ property, the \l {brief-command} {\\brief} command's argument is a sentence fragment that will be included in a one-sentence description of the property generated by - QDoc. The command follows the same rules for the \l {brief - property} {description} as the \l {variable} {\\variable} - command. + QDoc. The command follows the same rules for the + \l {brief-property} {description} as the \l {variable} + {\\variable} command. For example: @@ -5929,11 +5931,11 @@ The command follows \l {topical argument} {the general topical command convention} for the argument. - The \\variable command is typically followed by a \l - {brief-command} {\\brief} command; QDoc will generate the - documentation for the variable based on the brief-command - description. The command follows the same rules for the \l - {brief property} {description} as the \l {property} + The \\variable command is typically followed by a + \l {brief-command} {\\brief} command; QDoc will generate the + documentation for the variable based on the brief command + description. The command follows the same rules for the + \l {brief-property} {description} as the \l {property} {\\property} command. The documentation will be located in the in the associated @@ -6052,7 +6054,7 @@ \l {15-qdoc-commands-navigation.html#contentspage} {\\contentspage}, \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage}, \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}, - \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule}, + \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule}, \l {16-qdoc-commands-status.html#internal} {\\internal}, \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}, \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage}, @@ -6066,7 +6068,7 @@ \l {18-qdoc-commands-relating.html#relates-command} {\\relates}, \l {15-qdoc-commands-navigation.html#startpage} {\\startpage}, \l {17-qdoc-commands-thread.html#threadsafe} {\\threadsafe}, - \l {20-qdoc-commands-title.html#title} {\\title} + \l {20-qdoc-commands-title.html#title-command} {\\title} \section1 Categories \list @@ -6991,7 +6993,7 @@ \section1 Alphabetical List \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}, - \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule}, + \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule}, \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}, \section1 Command Descriptions @@ -7069,7 +7071,7 @@ See also \l {group-command} {\\group}. \row - \o \bold \\inmodule \target inmodule + \o \bold \\inmodule \target inmodule-command \o \bold {The \\inmodule command relates the documented class to the module specified by the command's argument.} @@ -7116,7 +7118,7 @@ \section1 Alphabetical List - \l {20-qdoc-commands-title.html#title} {\\title}, + \l {20-qdoc-commands-title.html#title-command} {\\title}, \l {20-qdoc-commands-title.html#subtitle} {\\subtitle} \section1 Command Descriptions @@ -7127,7 +7129,7 @@ \o Description \row - \o \bold \\title \target title + \o \bold \\title \target title-command \o \bold {The \\title command sets the title for a documentation page, or allows you to override it.} @@ -7137,7 +7139,7 @@ / *! \page signalandslots.html - \title Signals and Slots + \title Signals & Slots Signals and slots are used for communication between objects. The signals and slots mechanism is a central @@ -7201,7 +7203,7 @@ ... \endquotation - See also \l {title} {\\title}. + See also \l {title-command} {\\title}. \endtable */ @@ -7291,14 +7293,14 @@ {Cpp.ignoredirectives}, \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretoken} {Cpp.ignoretokens}, - \l {22-qdoc-configuration-generalvariables.html#definesvariable} {defines}, + \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}, \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, \l {22-qdoc-configuration-generalvariables.html#extraimages} {extraimages}, - \l {22-qdoc-configuration-generalvariables.html#falsehoods} {falsehoods}, + \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods}, \l {22-qdoc-configuration-generalvariables.html#headerdirs} {headerdirs}, \l {22-qdoc-configuration-generalvariables.html#headers} {headers}, \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions} @@ -7380,14 +7382,14 @@ \l {22-qdoc-configuration-generalvariables.html#alias} {alias}, \l {22-qdoc-configuration-generalvariables.html#codeindent} {codeindent}, - \l {22-qdoc-configuration-generalvariables.html#definesvariable} {defines}, + \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}, \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, \l {22-qdoc-configuration-generalvariables.html#extraimages} {extraimages}, - \l {22-qdoc-configuration-generalvariables.html#falsehoods} {falsehoods}, + \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods}, \l {22-qdoc-configuration-generalvariables.html#generateindex} {generateindex}, \l {22-qdoc-configuration-generalvariables.html#headerdirs} {headerdirs}, \l {22-qdoc-configuration-generalvariables.html#headers} {headers}, @@ -7455,7 +7457,7 @@ level of indentation is not always required. \row - \o \bold defines \target definesvariable + \o \bold defines \target defines-variable \o \bold {The \c defines variable specifies the C++ preprocessor symbols that QDoc will recognize and respond to.} @@ -7508,7 +7510,7 @@ consoleedition preprocessor symbol is defined when QDoc processes the source files defined in the qt.qdocconf file. - See also \l falsehoods and \l {if-command} {\\if}. + See also \l {falsehoods-variable} {falsehoods} and \l {if-command} {\\if}. \row \o \bold edition \target edition @@ -7672,7 +7674,7 @@ See also \l images and \l imagedirs. \row - \o \bold falsehoods \target falsehoods + \o \bold falsehoods \target falsehoods-variable \o \bold {The \c falsehoods variable defines the truth value of specified preprocessor symbols as false.} @@ -8949,7 +8951,7 @@ \o \l {12-0-qdoc-commands-miscellaneous.html#include} {\\include} \o \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage} \o \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup} - \o \l {19-qdoc-commands-grouping.html#inmodule} {\\inmodule} + \o \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule} \o \l {09-qdoc-commands-graphic.html#inlineimage-command} {\\inlineimage} \o \l {16-qdoc-commands-status.html#internal} {\\internal} \o \l {08-qdoc-commands-linking.html#keyword} {\\keyword} @@ -9007,7 +9009,7 @@ {\\tableofcontents} \o \l {08-qdoc-commands-linking.html#target} {\\target} \o \l {17-qdoc-commands-thread.html#threadsafe} {\\threadsafe} - \o \l {20-qdoc-commands-title.html#title} {\\title} + \o \l {20-qdoc-commands-title.html#title-command} {\\title} \o \l {04-qdoc-commands-textformatting.html#tt} {\\tt} \o \l {13-qdoc-commands-topical.html#typedef} {\\typedef} \o \l {04-qdoc-commands-textformatting.html#underline} {\\underline} -- cgit v0.12 From d543e008d7654c1642e4accafd6c670d514999f9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 1 Feb 2011 12:03:11 +0100 Subject: qdoc: Updated the qdoc manual. --- tools/qdoc3/doc/qdoc-manual.qdoc | 329 ++++++--------------------------------- tools/qdoc3/htmlgenerator.cpp | 4 + 2 files changed, 48 insertions(+), 285 deletions(-) diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index dd65769..533e730 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -1118,57 +1118,10 @@ \endquotation Each section level is a logical unit within the - document. Its title will appear on the table of contents - generated by the \l - {11-qdoc-commands-documentcontents.html#tableofcontents} - {\\tableofcontents} command. For example: - - \code - / *! - Contents: - - \tableofcontents - - ... - * / - \endcode - - will expand to - - \quotation - \raw HTML -

Contents:

- - - - ... - \endraw - \endquotation + document. Its title will appear in the table of contents + automatically generated by QDoc. The automatically + generated table of contents appears in the upper + righthand corner of the page. \row \o \bold \\chapter \target chapter @@ -3181,33 +3134,9 @@ The abstract section is rendered as an indented italicized paragraph. - \warning This is preliminary funcionality. The - command is not fully implemented. Currently, the abstract - section is rendered as a regular HTML paragraph. For - example: - - \code - / *! - \abstract - Qt by Trolltech is a C++ toolkit for cross-platform - GUI application development. Qt provides - single-source portability across Microsoft Windows, - Mac OS X, Linux, and all major commercial Unix - variants. It is also available for embedded - devices. - \endabstract - * / - \endcode - - will be rendered as - - \abstract - Qt by Trolltech is a C++ toolkit for cross-platform GUI - application development. Qt provides single-source - portability across Microsoft Windows, Mac OS X, Linux, - and all major commercial Unix variants. It is also - available for embedded devices. - \endabstract + \warning The \bold{\\abstract} and \bold{\\endabstract} commands + have not been implemented. The abstract section is rendered as a + regular HTML paragraph. \row \o \bold \\quotation \target quotation @@ -3258,187 +3187,19 @@ \o \bold {The \\footnote command and the corresponding \\endfootnote command delimit a footnote.} - The footnote follows the standard conventions, rendered at the - bottom of the page. + The footnote is rendered at the bottom of the page. - \warning This is preliminary funcionality. The - command is not fully implemented. - - For example: - - \code - / *! - In Qt 4 we have tried to simplify the constructors of - QObject/QWidget subclasses. This makes subclassing - easier, at the same time as it helps make the Qt - library more efficient. - - \footnote - Constructors no longer take a "const char *name" - parameter. If you want to specify a name for a QObject, - you must call QObject::setObjectName() after - construction. The object name is now a QString. - \endfootnote - - QWidget's WFlags data type has been split in two: - Qt::WindowFlags specifies low-level window flags (the - type of window and the frame style), whereas - Qt::WidgetAttribute specifies various higher-level - attributes about the widget (e.g., - WA_StaticContents). - * / - \endcode - - will be rendered as - - \quotation - In Qt 4 we have tried to simplify the constructors of - QObject/QWidget subclasses. This makes subclassing - easier, at the same time as it helps make the Qt - library more efficient. - - \footnote - Constructors no longer take a "const char *name" - parameter. If you want to specify a name for a QObject, - you must call QObject::setObjectName() after - construction. The object name is now a QString. - \endfootnote - - QWidget's WFlags data type has been split in two: - Qt::WindowFlags specifies low-level window flags (the - type of window and the frame style), whereas - Qt::WidgetAttribute specifies various higher-level - attributes about the widget (e.g., - WA_StaticContents). - \endquotation + \warning The \bold{\\footnote} and \bold{\\endfootnote} + commands have not been implemented. The footnote is + rendered as a regular HTML paragraph. \row \o \bold \\tableofcontents \target tableofcontents - \o \bold {The \\tableofcontents command generates a - table displaying the titles of the current documentation - unit's parts, chapters, sections, etc.} - - The command accepts a single optional argument: - - \code - \tableofcontents sectionN - \endcode - - where \c sectionN is the deepest section to include (by - default all sections are included). - - For example, it the documentation unit's structure looks - something like this: - - \quotation - \raw HTML - -

Basic Qt

-
-

This is the first part.

- - -

Getting Started

-
- This is the first part's first chapter.

- - -

Hello Qt

-
-

This is the first chapter's first section.

- - -

Making Connections

-
-

This is the first chapter's second section.

- - -

Using the Reference Documentation

-
-

This is the first chapter's third section.

- - -

Creating Dialogs

-
-

This is the first part's second chapter.

- - -

Subclassing QDialog

-
-

This is the second chapter's first section.

- - ... - - -

Intermediate Qt

-
-

This is the second part.

- - -

Layout Management

-
-

This is the second part's first chapter.

- - -

Basic Layouts

-
-

This is the first chapter's first section.

- - ... - - \endraw - \endquotation - - Then - - \code - / *! - Contents: - - \tableofcontents + \o \bold {The \\tableofcontents command has been disabled because QDoc + now generates a table of contents automatically.} - ... - * / - \endcode - - will expand to - - \quotation - \raw HTML -

Contents:

- - - - ... - \endraw - \endquotation - - Each table entry becomes a link to the corresponding part, - chapter or section. + The automatically generated table of contents appears in the upper + righthand corner of the page. \row \o \bold \\brief \target brief-command @@ -3888,7 +3649,7 @@ \code / *! \page classes.html - \title All Qt Classes (main index) + \title All Classes For a shorter list that only includes the most frequently used classes, see \l{Qt's Main Classes}. For @@ -3899,7 +3660,7 @@ * / \endcode - is used to generate \l {All Qt Classes (main index)}. + is used to generate \l {All Classes}. The command accepts the following arguments: @@ -4188,7 +3949,7 @@ {page} {\\page} and \l {group-command} {\\group}. The list omits examples and classes, and only lists the first page of documentation that contains two or more pages using - commands like \l {nextpage} {\\nextpage}. + commands like \l {nextpage-command} {\\nextpage}. For example: @@ -5061,15 +4822,15 @@ The command follows \l {topical argument} {the general topical command convention} for the argument. In particular the command's argument is the example's path relative to - the paths listed in the \l exampledirs configuration - variable. + the paths listed in the \l {exampledirs-variable} + {exampledirs} configuration variable. The documentation will be located in \i {path-to-example}.html, and QDoc will add a list of all the example files at the top of this documentation page. - For example, if \l exampledirs contain \c - $QTDIR/examples/widgets/imageviewer, then + For example, if \l {exampledirs-variable} {exampledirs} + contains \c $QTDIR/examples/widgets/imageviewer, then \code / *! @@ -6057,7 +5818,7 @@ \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule}, \l {16-qdoc-commands-status.html#internal} {\\internal}, \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}, - \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage}, + \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage}, \l {17-qdoc-commands-thread.html#nonreentrant} {\\nonreentrant}, \l {16-qdoc-commands-status.html#obsolete} {\\obsolete}, \l {18-qdoc-commands-relating.html#overload} {\\overload}, @@ -6098,7 +5859,7 @@ \l {15-qdoc-commands-navigation.html#contentspage} {\\contentspage}, \l {15-qdoc-commands-navigation.html#indexpage} {\\indexpage}, - \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage}, + \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage}, \l {15-qdoc-commands-navigation.html#previouspage} {\\previouspage}, \l {15-qdoc-commands-navigation.html#startpage} {\\startpage} @@ -6260,7 +6021,7 @@ Description} section. \row - \o \bold \\nextpage \target nextpage + \o \bold \\nextpage \target nextpage-command \o \bold {The \\nextpage command links the current page to the next page in an ordered series of documents}. @@ -7295,7 +7056,7 @@ {Cpp.ignoretokens}, \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}, \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, - \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, + \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs}, \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, @@ -7384,7 +7145,7 @@ \l {22-qdoc-configuration-generalvariables.html#codeindent} {codeindent}, \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}, \l {22-qdoc-configuration-generalvariables.html#edition} {edition}, - \l {22-qdoc-configuration-generalvariables.html#exampledirs} {exampledirs}, + \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs}, \l {22-qdoc-configuration-generalvariables.html#examples} {examples}, \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions} {examples.fileextensions}, @@ -7543,7 +7304,7 @@ \endcode \row - \o \bold exampledirs \target exampledirs + \o \bold exampledirs \target exampledirs-variable \o \bold {The \c exampledirs variable specifies the directories containing the source code of the example files.} @@ -7602,31 +7363,29 @@ \o \bold examples \target examples \o \bold {The \c examples variable allows you to specify individual example files in addition to those located in the directories - specified by the \l {exampledirs} {\c exampledirs} variable.} + specified by the \l {exampledirs-variable} {\c exampledirs} variable.} - The \c examples and \l {exampledirs} {\c exampledirs} - variables are used by the \l - {quotefromfile-command} {\\quotefromfile}, \l - {quotefile-command} {\\quotefile} and \l {example} {\\example} - commands. If both the \c examples and \l {exampledirs} {\c - exampledirs} variables are defined, QDoc will search in - both, first in \c examples then in \l {exampledirs} {\c - exampledirs}. + The \c examples and \l {exampledirs-variable} {\c exampledirs} + variables are used by the \l {quotefromfile-command} {\\quotefromfile}, + \l {quotefile-command} {\\quotefile} and \l {example} + {\\example} commands. If both the \c examples and \l {exampledirs-variable} + {\c exampledirs} variables are defined, QDoc will search in both, first in + \c examples then in \l {exampledirs-variable} {\c exampledirs}. - QDoc will search through the values listed for the \c - examples variable, in the specified order, and accept - the first one it finds. + QDoc will search through the values listed for the \c examples + variable, in the specified order, and accept the + first one it finds. - For an extensive example, see the \l {exampledirs} {\c - exampledirs} command. But note that if you know the file is - listed in the \c examples variable, you don't need to - specify its path: + For an extensive example, see the \l {exampledirs-variable} + {\c exampledirs} command. But note that if you know the file is + listed in the \c examples variable, you don't need to specify its + path: \code \quotefromfile calculator.cpp \endcode - See also \l exampledirs. + See also \l {exampledirs-variable} {exampledirs}. \row \o \bold examples.fileextensions \target examples.fileextensions @@ -8963,7 +8722,7 @@ \o \l {12-0-qdoc-commands-miscellaneous.html#meta} {\\meta} \o \l {13-qdoc-commands-topical.html#module} {\\module} \o \l {13-qdoc-commands-topical.html#namespace} {\\namespace} - \o \l {15-qdoc-commands-navigation.html#nextpage} {\\nextpage} + \o \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage} \o \l {06-qdoc-commands-verbatimcode.html#newcode} {\\newcode} \o \l {17-qdoc-commands-thread.html#nonreentrant} {\\nonreentrant} \o \l {10-qdoc-commands-container.html#o} {\\o} diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 1623ea8..63e43d2 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -410,6 +410,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, switch (atom->type()) { case Atom::AbstractLeft: + if (relative) + relative->doc().location().warning(tr("\abstract is not implemented.")); + else + Location::information(tr("\abstract is not implemented.")); break; case Atom::AbstractRight: break; -- cgit v0.12 From cad9d7f7ba1932944082811eb0525f05280e47d4 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 4 Feb 2011 16:40:22 +0100 Subject: Re-wrote QML Animation documentation and cleaned snippet code Removed unneeded snippets and added new snippet code. Task-number: QTBUG-16071 Reviewed-by: David Boddie --- doc/src/declarative/animation.qdoc | 376 ++++++++------------- .../snippets/declarative/animation-behavioral.qml | 61 ---- doc/src/snippets/declarative/animation-easing.qml | 51 --- .../snippets/declarative/animation-elements.qml | 66 ---- doc/src/snippets/declarative/animation-groups.qml | 104 ------ .../declarative/animation-propertyvaluesource.qml | 51 --- .../declarative/animation-signalhandler.qml | 55 --- .../snippets/declarative/animation-standalone.qml | 63 ---- .../snippets/declarative/animation-transitions.qml | 62 ---- doc/src/snippets/declarative/animation.qml | 227 +++++++++++++ 10 files changed, 367 insertions(+), 749 deletions(-) delete mode 100644 doc/src/snippets/declarative/animation-behavioral.qml delete mode 100644 doc/src/snippets/declarative/animation-easing.qml delete mode 100644 doc/src/snippets/declarative/animation-elements.qml delete mode 100644 doc/src/snippets/declarative/animation-groups.qml delete mode 100644 doc/src/snippets/declarative/animation-propertyvaluesource.qml delete mode 100644 doc/src/snippets/declarative/animation-signalhandler.qml delete mode 100644 doc/src/snippets/declarative/animation-standalone.qml delete mode 100644 doc/src/snippets/declarative/animation-transitions.qml create mode 100644 doc/src/snippets/declarative/animation.qml diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 26545ad..77900ee 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -33,227 +33,187 @@ \nextpage {QML Data Models}{Structuring Data with Models} \title QML Animation and Transitions - -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: - +\keyword qml-animation-elements +\section1 Animation and Transitions Elements \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} +\o \l {Transition} - Animates transitions during state changes +\o \l {SequentialAnimation} - Runs animations sequentially +\o \l {ParallelAnimation} - Runs animations in parallel +\o \l {Behavior} - Specifies a default animation for property changes +\o \l {PropertyAction} - Sets immediate property changes during animation +\o \l {PauseAnimation} - Introduces a pause in an animation +\o \l {SmoothedAnimation} - Allows a property to smoothly track a value +\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion +\o \l {ScriptAction} - Runs scripts during an animation \endlist -To support these different types of animation methods, QML provides several -methods for defining an animation. These are: - +\keyword qml-property-animation-elements +Elements that animate properties based on data types \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} +\o \l {PropertyAnimation} - Animates property changes +\o \l {NumberAnimation} - Animates properties of type qreal +\o \l {Vector3dAnimation} - Animates properties of type QVector3d +\o \l {ColorAnimation} - Animates color changes +\o \l {RotationAnimation} - Animates rotations +\o \l {ParentAnimation} - Animates parent changes +\o \l {AnchorAnimation} - Animates anchor 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. - - +\section1 Overview -\section2 Animations as Property Value Sources +In QML, animations are created by applying animation elements to property +values. Animation elements will interpolate property values to create smooth +transitions. As well, state transitions may assign animations to state changes. -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. +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. +\keyword qml-triggering-animations +\section1 Triggering Animations -\section2 Behavioral Animations +There are several ways of setting animation to an object. -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: +\keyword qml-direct-animation +\section2 Direct Property Animation -\snippet doc/src/snippets/declarative/animation-behavioral.qml 0 +To create an immediate movement or animated movement, set the property value +directly. This may be done in signal handlers or attached properties. -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. +\snippet doc/src/snippets/declarative/animation.qml direct property change -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. +However, to create more control, \e {property animations} apply smooth movements +by interpolating values between property value changes. Property animations +provide timing controls and allows different interpolations through +\l{qml-easing-animation}{easing curves}. -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. +\snippet doc/src/snippets/declarative/animation.qml property animation -See the \l {declarative/animation/behaviors}{Behaviors example} for a -demonstration of behavioral animations. +Specialized \l{qml-property-animation-elements}{property animation elements} +have more efficient implementations than the \l{PropertyAnimation} element. They +are for setting animations to different QML types such as \c int, \c color, and +rotations. Similarly, the \l{ParentAnimation} can animate parent changes. +See the \l {qml-controlling-animations}{Controlling Animations} section for more +information about the different animation properties. -\section2 Animations in a Signal Handler +\keyword qml-transition-animations +\section2 Transitions during State Changes -An animation can be created within a signal handler to be triggered when the -signal is received. For example: +\l{QML States}{States} are property configurations where a property may have different values to reflect different states. State changes introduce +abrupt property changes; animations smooth transitions to produce visually +appealing state changes. -\snippet doc/src/snippets/declarative/animation-signalhandler.qml 0 +The \l{Transition} element can contain +\l{qml-animation-elements}{animation elements} to interpolate property changes +caused by state changes. To assign the transition to an object, bind it to the +\c transitions property. -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. +A button might have two states, the \c pressed state when the user clicks on the +button and a \c released state when the user releases the button. We can assign +different property configurations for each state. A transition would animate the +change from the \c pressed state to the \c released state. Likewise, there would +be an animation during the change from the \c released state to the \c pressed +state. +\snippet doc/src/snippets/declarative/animation.qml transition animation -\section2 Standalone Animations +Binding the \c to and \c from properties to the state's name will assign that +particular transition to the state change. For simple or symmetric transitions, +setting the to \c to property to the wild card symbol, "\c{*}", denotes +that the transition applies to any state change. -Animations can also be created as ordinary QML objects that are not bound to -any particular objects and properties. Here is an example, using a -PropertyAnimation object. The animation is explicitly started when the -\l Rectangle is clicked: +\snippet doc/src/snippets/declarative/animation.qml wildcard animation -\snippet doc/src/snippets/declarative/animation-standalone.qml 0 +\section2 Default Animation as Behaviors -A standalone animation object 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.) +Default property animations are set using \e {behavior animations}. Animations +declared in \l {Behavior} elements apply to the property and animates any +property value changes. However, Behavior elements have an +\c enabled property to purposely enable or disable the behavior animations. -Standalone animations are useful when an animation is not targeted towards a -single object property and the animation should be explicitly started and -stopped. +A ball component might have a behavior animation assigned to its \c x, \c y, and +\c color properties. The behavior animation could be set up to simulate an +elastic effect. In effect, this behavior animation would apply the elastic +effect to the properties whenever the ball moves. +\snippet doc/src/snippets/declarative/animation.qml behavior animation -\section2 Transitions +There are several methods of assigning behavior animations to properties. The +\c{Behavior on } declaration is a convenient way of assigning a +behavior animation onto a property. -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: +See the \l {declarative/animation/behaviors}{Behaviors example} for a +demonstration of behavioral animations. -\snippet doc/src/snippets/declarative/animation-transitions.qml 0 +\section1 Playing Animations in Parallel or in Sequence -The PropertyChanges object in the \e moved state defines that when the -\l Rectangle is in this state, its position should be changed -to (50, 50). When the \l Rectangle changes to the \e moved state, the -\l Transition will be triggered, and the transition's \l PropertyAnimation will -animate the changes in the \c x and \c y properties to their new values. -The animation will not be applied at any time other than during the state -change. +Animations can run \e {in parallel} or \e {in sequence}. Parallel animations +will play a group of animations at the same time while sequential animations +play a group of animations in order: one after the other. Grouping animations in +\l{SequentialAnimation} and \{ParallelAnimation} will play the animations in +sequence or in parallel. -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. +A banner component may have several icons or slogans to display, one after the +other. The \c opacity property could transform to \c 1.0 denoting an opaque +object. Using the \l{SequentialAnimation} element, the opacity animations will +play after the preceding animation finishes. The \l{ParallelAnimation} element +will play the animations at the same time. -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. +\snippet doc/src/snippets/declarative/animation.qml sequential animation -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}. +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. -See the \l Transition documentation for more information. +The \l SequentialAnimation element is also useful for playing +\l{qml-transition-animations}{transition animations} because animations are +played in parallel inside transitions. +See the \l {declarative/animation/basics}{Animation basics example} for a +demonstration of creating and combining multiple animations in QML. -\section1 Animation Elements +\keyword qml-controlling-animations +\section1 Controlling Animations -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. +There are different methods to control animations. -All animation elements inherit from the \l Animation element. It is not +\section2 Animation Playback +All \l{qml-animation-elements}{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. - +essential properties and methods for animation elements. Animation elements have +\c{start()}, \c{stop()}, \c{resume()}, \c{pause()}, \c {restart()}, and +\c{complete()} -- all of these methods control the execution of animations. -\section2 Property Animation Elements +\keyword qml-easing-animation +\section2 Easing -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. +Easing curves define how the animation will interpolate between the start value +and the end value. Different easing curves might go beyond the defined range of +interpolation. The easing curves simplify the creation of animation effects such +as bounce effects, acceleration, deceleration, and cyclical animations. -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: +A QML object may have different easing curve for each property animation. There +are also different parameters to control the curve, some of which are exclusive +to a particular curve. For more information about the easing curves, visit the +\l {PropertyAnimation::easing.type}{easing} documentation. -\snippet doc/src/snippets/declarative/animation-elements.qml color +The \l{declarative/animation/easing}{easing example} visually demonstrates each +of the different easing types. -RotationAnimation allows a rotation's direction to be specified. The following -animates the rectangle's \l {Item::rotation} property: +\section2 Other Animation Elements -\snippet doc/src/snippets/declarative/animation-elements.qml rotation +In addition, QML provides several other elements useful for animation: -In addition, the following specialized animation elements are available: +\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 +These are specialized animation elements that animate different property types \list \o SmoothedAnimation: a specialized NumberAnimation that provides smooth changes in animation when the target value changes @@ -264,75 +224,19 @@ attributes such as \l {SpringAnimation::}{mass}, \o AnchorAnimation: used for animating an anchor change (see AnchorChanges) \endlist -See their respective documentation pages for more details. - - -\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-elements.qml color +\snippet doc/src/snippets/declarative/animation-propertyvaluesource.qml 0 +\snippet doc/src/snippets/declarative/animation-signalhandler.qml 0 +\snippet doc/src/snippets/declarative/animation-standalone.qml 0 +\snippet doc/src/snippets/declarative/animation-transitions.qml 0 \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. - -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-groups.qml 1 +\snippet doc/src/snippets/declarative/animation-groups.qml 0 +\image propanim.gif -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. - -See the \l {declarative/animation/basics}{Animation basics example} for a -demonstration of creating and combining multiple animations in QML. - - - -\section2 Other Animation Elements - -In addition, QML provides several other elements useful for animation: - -\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 - -See their respective documentation pages for more details. - -*/ diff --git a/doc/src/snippets/declarative/animation-behavioral.qml b/doc/src/snippets/declarative/animation-behavioral.qml deleted file mode 100644 index 93cf2fa..0000000 --- a/doc/src/snippets/declarative/animation-behavioral.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index 64ba44c..0000000 --- a/doc/src/snippets/declarative/animation-easing.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index d9bfc28..0000000 --- a/doc/src/snippets/declarative/animation-elements.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index f29ea48..0000000 --- a/doc/src/snippets/declarative/animation-groups.qml +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index 6f93967..0000000 --- a/doc/src/snippets/declarative/animation-propertyvaluesource.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index 416417f..0000000 --- a/doc/src/snippets/declarative/animation-signalhandler.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index 0bf3020..0000000 --- a/doc/src/snippets/declarative/animation-standalone.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 deleted file mode 100644 index 62bef23..0000000 --- a/doc/src/snippets/declarative/animation-transitions.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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 QtQuick 1.0 - -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 new file mode 100644 index 0000000..739d009 --- /dev/null +++ b/doc/src/snippets/declarative/animation.qml @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +import QtQuick 1.0 + + +//! [parent begin] +Rectangle { +//! [parent begin] + width: 200; height: 600 + id: screen + +Column { + spacing: 12 +//! [direct property change] +Rectangle { + id: blob + width: 75; height: 75 + color: "blue" + + MouseArea { + anchors.fill: parent + onClicked: blob.color = "green" + } +} +//! [direct property change] + +//! [property animation] +Rectangle { + id: flashingblob + width: 75; height: 75 + color: "blue" + opacity: 1.0 + + MouseArea { + anchors.fill: parent + onClicked: { + animateColor.start() + animateOpacity.start() + } + } + + PropertyAnimation {id: animateColor; target: flashingblob; properties: "color"; to: "green"; duration: 100} + + NumberAnimation { + id: animateOpacity + target: flashingblob + properties: "opacity" + from: 0.99 + to: 1.0 + loops: Animation.Infinite + easing {type: Easing.OutBack; overshoot: 500} + } +} +//! [property animation] + +//! [transition animation] +Rectangle { + width: 75; height: 75 + id: button + state: "RELEASED" + + MouseArea { + anchors.fill: parent + onPressed: button.state = "PRESSED" + onReleased: button.state = "RELEASED" + } + + states: [ + State { + name: "PRESSED" + PropertyChanges { target: button; color: "lightblue"} + }, + State { + name: "RELEASED" + PropertyChanges { target: button; color: "lightsteelblue"} + } + ] + + transitions: [ + Transition { + from: "PRESSED" + to: "RELEASED" + ColorAnimation { target: button; duration: 100} + }, + Transition { + from: "RELEASED" + to: "PRESSED" + ColorAnimation { target: button; duration: 100} + } + ] +} +//! [transition animation] + +Rectangle { + width: 75; height: 75 + id: wildcard + color: "green" +//! [wildcard animation] + transitions: + Transition { + to: "*" + ColorAnimation { target: button; duration: 100} + } +//! [wildcard animation] + + MouseArea { + anchors.fill: parent + onPressed: { + ball.x = 10 + ball.color = "red" + } + onReleased: { + ball.x = screen.width / 2 + ball.color = "salmon" + } + } +} + +//! [behavior animation] +Rectangle { + width: 75; height: 75; radius: width + id: ball + color: "salmon" + + Behavior on x { + NumberAnimation { + id: bouncebehavior + easing { + type: Easing.OutElastic + amplitude: 1.0 + period: 0.5 + } + } + } + Behavior on y { + animation: bouncebehavior + } + Behavior { + ColorAnimation { target: ball; duration: 100 } + } +} +//! [behavior animation] + +//! [sequential animation] +Rectangle { + id: banner + width: 150; height: 100; border.color: "black" + + Column { + anchors.centerIn: parent + Text { + id: code + text: "Code less." + opacity: 0.01 + } + Text { + id: create + text: "Create more." + opacity: 0.01 + } + Text { + id: deploy + text: "Deploy everywhere." + opacity: 0.01 + } + } + + MouseArea { + anchors.fill: parent + onPressed: playbanner.start() + } + + SequentialAnimation { + id: playbanner + running: false + NumberAnimation { target: code; property: "opacity"; to: 1.0; duration: 200} + NumberAnimation { target: create; property: "opacity"; to: 1.0; duration: 200} + NumberAnimation { target: deploy; property: "opacity"; to: 1.0; duration: 200} + } +} +//! [sequential animation] + +}//end of col +//! [parent end] +} +//! [parent end] + +//! [document] + -- cgit v0.12 From b7aa20e56b3ed45cf00d8a57696e6d8ac803f9b4 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 4 Feb 2011 16:42:30 +0100 Subject: Replaced old Qt logo with the new Qt logo. Reviewed-by: David Boddie --- doc/src/snippets/declarative/pics/qt.png | Bin 514 -> 2991 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/snippets/declarative/pics/qt.png b/doc/src/snippets/declarative/pics/qt.png index cbed1a9..4f68e16 100644 Binary files a/doc/src/snippets/declarative/pics/qt.png and b/doc/src/snippets/declarative/pics/qt.png differ -- cgit v0.12 From c9b5d8708f0c703122669938573eb575f03d6b78 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 7 Feb 2011 18:35:00 +0100 Subject: Rewrote Qt Quick documentation. Task number: QTBUG-16071 --- doc/src/declarative/animation.qdoc | 2 +- doc/src/declarative/basicelements.qdoc | 1 + doc/src/declarative/basictypes.qdoc | 4 +- doc/src/declarative/declarativeui.qdoc | 2 +- doc/src/declarative/mouseevents.qdoc | 76 ++++- doc/src/declarative/propertybinding.qdoc | 14 +- doc/src/declarative/qdeclarativedocument.qdoc | 50 +-- doc/src/declarative/qdeclarativemodels.qdoc | 3 +- doc/src/declarative/qdeclarativestates.qdoc | 229 ++++--------- doc/src/declarative/qmlevents.qdoc | 110 +++++- doc/src/declarative/qmlreusablecomponents.qdoc | 441 +------------------------ doc/src/declarative/qmlsyntax.qdoc | 2 +- doc/src/declarative/qmltexthandling.qdoc | 23 +- doc/src/declarative/qmlviews.qdoc | 27 +- 14 files changed, 335 insertions(+), 649 deletions(-) diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 77900ee..bd6813c 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -151,7 +151,7 @@ demonstration of behavioral animations. Animations can run \e {in parallel} or \e {in sequence}. Parallel animations will play a group of animations at the same time while sequential animations play a group of animations in order: one after the other. Grouping animations in -\l{SequentialAnimation} and \{ParallelAnimation} will play the animations in +\l{SequentialAnimation} and \l{ParallelAnimation} will play the animations in sequence or in parallel. A banner component may have several icons or slogans to display, one after the diff --git a/doc/src/declarative/basicelements.qdoc b/doc/src/declarative/basicelements.qdoc index 4253e4c..5997998 100644 --- a/doc/src/declarative/basicelements.qdoc +++ b/doc/src/declarative/basicelements.qdoc @@ -91,6 +91,7 @@ The \l Text and \l TextEdit elements display formatted text onto the screen. \c TextEdit features multi-line editing while the \l TextInput element is for single line text input. +\keyword qml-top-level-component \section1 Using Elements as the Top-Level Component For creating components (or displaying a simple scene), there are different diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 948bdef..1be648e 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -29,8 +29,8 @@ \page qdeclarativebasictypes.html \ingroup qml-features \contentspage QML Features - \previouspage {Property Binding} - \nextpage {QML Basic Elements}{Basic Elements} + \previouspage {QML Basic Elements} + \nextpage Property Binding \title QML Basic Types QML has a set of primitive types, as listed below, that are used throughout diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index ae11559..aa4006b 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -81,7 +81,7 @@ QML and the Qt Declarative Module separate the frontend UI logic from the backen \o \l{QML Basic Elements}{Basic Elements} \o \l{Using QML Positioner and Repeater Items}{Component Layouts} \o \l{Anchor-based Layout in QML}{Layouts using Anchors} -\o \l{Mouse Events} +\o \l{QML Mouse Events}{Mouse Events} \o \l{QML Text Handling and Validators}{Text Handling and Validators} \o \l{Keyboard Focus in QML}{Keyboard Focus} \o \l{Importing Reusable Components} diff --git a/doc/src/declarative/mouseevents.qdoc b/doc/src/declarative/mouseevents.qdoc index f6512a7..eed3a3a 100644 --- a/doc/src/declarative/mouseevents.qdoc +++ b/doc/src/declarative/mouseevents.qdoc @@ -35,9 +35,7 @@ \tableofcontents -\section1 Introduction - -\section1 Mouse Events +\section1 Mouse Elements \list \o \l{MouseArea} Element @@ -45,7 +43,77 @@ \endlist \section1 Mouse Event Handling -go over the slots and signals feature (without the C++) + +QML uses \l{QML Signal and Handler Event System}{signals and handlers} to +deliver mouse interactions. Specifically, the \l MouseArea and \l MouseEvent +elements provide QML components with signal handlers to accept mouse events +within a defined area. + +\section1 Defining a Mouse Area + +The \l MouseArea element receives events within a defined area. One quick way +to define this area is to anchor the \c MouseArea to its parent's area using the +\c anchors.fill property. If the parent is a \l Rectangle (or any \l Item +component), then the MouseArea will fill the area defined by the parent's +dimensions. Alternatively, an area smaller or larger than the parent is +definable. +\snippet doc/src/snippets/declarative/mouse.qml anchor fill + +\section1 Receiving Events + +The MouseArea element provides +\l{QML Signal and Handler Event System}{signals and handlers} to detect different +mouse events. The \l MouseArea element documentation describes these +gestures in greater detail. + +\list Mouse Gestures +\o canceled +\o clicked +\o doubleClicked +\o entered +\o exited +\o positionChanged +\o pressAndHold +\o pressed +\o released +\endlist + +These signals have signal handlers that are invoked when the signals are emitted. +\snippet doc/src/snippets/declarative/mouse.qml mouse handlers + +\section1 Enabling Gestures +Some mouse gestures and button clicks need to be enabled before they send or +receive events. Certain \l MouseArea and \l MouseEvent properties enable these +gestures. + +To listen to (or explicitly ignore) a certain mouse button, set the appropriate +mouse button to the \l {MouseArea::acceptedButtons}{acceptedButtons} property. + +Naturally, the mouse events, such as button presses and mouse positions, are +sent during a mouse click. For example, the \c containsMouse property will only +retrieve its correct value during a mouse press. The +\l {MouseArea::hoverEnabled}{hoverEnabled} will enable mouse events and +positioning even when there are no mouse button presses. Setting the +\c hoverEnabled property to \c true, in turn will enable the \c entered, +\c exited, and \c positionChanged signal and their respective signal handlers. + +Additionally, to disable the whole mouse area, set the \c MouseArea +element's \c enabled property to \c false. + +\section1 MouseEvent Object + +Signals and their handlers receive a \l MouseEvent object as a parameter. The +\c mouse object contain information about the mouse event. For example, the +mouse button that started the event is queried through the +\l {MouseEvent::button}{mouse.button} property. + +The \c MouseEvent object can also ignore a mouse event using its \c accepted +property. + +\section2 Accepting Further Signals +Many of the signals are sent multiple times to reflect various mouse events +such as double clicking. To facilitate the classification of mouse clicks, the +MouseEvent object has an \c accepted property to disable the event propagation. To learn more about QML's event system, please read the \l {QML Signal and Handler Event System} document. diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 27653bd..00ff650 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -35,9 +35,14 @@ \section1 Properties -A property is a value of a QML component that can be read and modified by other objects. -In QML, properties serve many purpose. Their main function is to bind to values. -Values may be a \l{QML Basic Types}{basic type}, or other QML elements. +QML components have \e properties that can be read and modified by other objects. +In QML, properties serve many purposes but their main function is to bind to +values. Values may be a \l{QML Basic Types}{basic type}, or other QML elements. + +The syntax for properties is: +\qml + [default] property [: defaultValue] +\endqml Elements already possess useful properties but, to create custom properties, precede the property name with the keyword \c property. @@ -48,7 +53,7 @@ precede the property name with the keyword \c property. \snippet doc/src/snippets/declarative/properties.qml parent end QML property rules coincide with many of JavaScript's property rules, for example, -properti names must begin with a lowercase letter. +property names must begin with a lowercase letter. \l {JavaScript Reserved Words}{JavaScript reserved words} are not valid property names. @@ -229,7 +234,6 @@ Accessing the aliasing property is similar to accessing a regular property. In addition, the optional \c default keyword indicates that the aliasing property is a \l{Default Properties}{default property}. -<<<<<<< HEAD \snippet doc/src/snippets/declarative/Button.qml property alias When importing the component as a \c Button, the \c buttonlabel is directly accessible through the \c label property. diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index b94e32e..f2147de 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -42,17 +42,17 @@ Here is a simple QML document: QML documents are always encoded in UTF-8 format. -A QML document always begins with one or more import statements. To prevent elements -introduced in later versions from affecting existing QML programs, the element types -available within a document are controlled by the imported QML \l {Modules}. That is, +A QML document always begins with one or more import statements. To prevent elements +introduced in later versions from affecting existing QML programs, the element types +available within a document are controlled by the imported QML \l {Modules}. That is, QML is a \e versioned language. -Syntactically a QML document is self contained; QML does \e not have a preprocessor that -modifies the document prior to presentation to the QML runtime. \c import statements -do not "include" code in the document, but instead instruct the QML runtime on how to -resolve type references found in the document. Any type reference present in a QML -document - such as \c Rectangle and \c ListView - including those made within an -\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the +Syntactically a QML document is self contained; QML does \e not have a preprocessor that +modifies the document prior to presentation to the QML runtime. \c import statements +do not "include" code in the document, but instead instruct the QML runtime on how to +resolve type references found in the document. Any type reference present in a QML +document - such as \c Rectangle and \c ListView - including those made within an +\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the 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! @@ -63,12 +63,12 @@ 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. +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 +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 (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: @@ -80,7 +80,7 @@ Each instance is created with a different value for its \c text property: \row \o \snippet doc/src/snippets/declarative/qml-documents/qmldocuments.qml document -\o +\o \qml import QtQuick 1.0 @@ -112,23 +112,23 @@ 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 -\l Component element, as can be seen in the first example above. Inline components share +components placed in separate files, documents may also +include \e inline components. Inline components are declared using the +\l Component element, as can be seen in the first example above. Inline components share all the characteristics of regular top-level components and use the same \c import list as their -containing QML document. Components are one of the most basic building blocks in QML, and are +containing QML document. Components are one of the most basic building blocks in QML, and are frequently used as "factories" by other elements. For example, the \l ListView element uses the \c delegate component as the template for instantiating list items - each list item is just a new instance of the component with the item specific data set appropriately. -Like other \l {QML Elements}, the \l Component element is an object and must be assigned to a +Like other \l {QML Elements}, the \l Component element is an object and must be assigned to a property. \l Component objects may also have an object id. In the first example on this page, -the inline component is added to the \l Rectangle's \c resources list, and then -\l {Property Binding} is used to assign the \l Component to the \l ListView's \c delegate +the inline component is added to the \l Rectangle's \c resources list, and then +\l {Property Binding} is used to assign the \l Component to the \l ListView's \c delegate property. While using property binding allows the \l Component object to be shared (for example, -if the QML document contained multiple \l ListView's with the same delegate), in this case the -\l Component could have been assigned directly to the \l ListView's \c delegate. The QML -language even contains a syntactic optimization when assigning directly to a component property +if the QML document contained multiple \l ListView's with the same delegate), in this case the +\l Component could have been assigned directly to the \l ListView's \c delegate. The QML +language even contains a syntactic optimization when assigning directly to a component property for this case where it will automatically insert the \l Component tag. These final two examples are behaviorally identical to the original document. diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 70228b1..2f9d418 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -78,6 +78,7 @@ The use of positioner items to arrange items from a model is covered in \l{Using QML Positioner and Repeater Items}. +\keyword qml-data-models \section1 QML Data Models \section2 ListModel @@ -154,7 +155,7 @@ Note that in the above example there is no delegate required. The items of the model itself provide the visual elements that will be positioned by the view. - +\keyword qml-c++-models \section1 C++ Data Models Models can be defined in C++ and then made available to QML. This is useful diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index 4089609..3f05c9b 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -34,194 +34,105 @@ \target qmlstates \title QML States -\section1 Overview +\section1 States Elements +\list +\o \l State +\o \l PropertyChanges +\o \l StateGroup +\o \l StateChangeScript +\o \l ParentChange +\o \l AnchorChanges +\endlist -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. +\section1 Overview -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. +Many user interface designs are \e state driven; interfaces have configurations +that differ depending on the current state. For example, a traffic signal will +configure its flags or lights depending on its state. While in the signal's +\c stop state, a red light will turn on while the yellow and the green lights +will turn off. In the \c caution state, the yellow light is on while the other +lights are turned off. -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, \e states are a set of property configurations defined in a \l State +element. Different configurations could, for example: \list \o Show some UI elements and hide others \o Present different available actions to the user -\o Start, stop or pause animations +\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" +\o Show a different view or screen \endlist -Changes between states can be animated using \l {Transitions}{transitions}, as -discussed further below. - -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 +All \l {Item}-based objects have a \c state property, and can specify additional +states by adding new \c State objects to the item's \l {Item::}{states} +property. Each state within a component has a unique \c name, an empty string +being the default. To change the current state of an item, set the \l {Item::}{state} property to the name of the state. -Non-Item objects can use states through the StateGroup element. - +Non-Item objects may use states through the \l StateGroup element. \section1 Creating States 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. -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: - -\snippet doc/src/snippets/declarative/propertyanimation.qml single state - -A \l State is not limited to performing modifications on property values. It -can also: - +A warning \c signal component may have two states, the \c NORMAL and the +\c CRITICAL state. Suppose that in the \c NORMAL state, the \c color of the +signal should be \c green and the warning \c flag is down. Meanwhile, in the +\c CRITICAL state, the \c color should be \c red and the flag is \c up. We may +model the states using the \c State element and the color and flag +configurations with the \c PropertyChanges element. +\snippet doc/src/snippets/declarative/states.qml signal states +The \l PropertyChanges element will change the values of object properties. +Objects are referenced through their \l {qml-id-property}{id}. Objects outside +the component are also referenced using the \c id property, exemplified by the +property change to the external \c flag object. + +Further, the state may change by assigning the \c state property with the +appropriate signal state. A state switch could be in a \l MouseArea element, +assigning a different state whenever the signal receives a mouse click. +\snippet doc/src/snippets/declarative/states.qml switch states + +The State element is not limited to performing modifications on property values. +It can also: \list -\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 +\o Run some script using \l StateChangeScript +\o Override an existing signal handler for an object using \l PropertyChanges +\o Re-parent an \l Item using \l ParentChange +\o Modify anchor values using \l AnchorChanges \endlist -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 - +Every \l Item based component has a \c state property and a \e{default state}. +The default state is the empty string (\c{""}) and contains all of an item's +initial property values. The default state is useful for managing property +values before state changes. Setting the \c state property to an empty string +will load the default state. -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. +\section1 The \c when Property -If the above example was modified to include the following \l Transition, the -movement of the \l Rectangle would be animated: +For convenience, the \l State element has a \c when property that can bind to +expressions to change the state whenever the bound expression evaluates to +\c true. The \c when property will revert the state back to the +\l {The Default State}{default state} when the expression evaluates to false. -\qml -Rectangle { - // ... +\snippet doc/src/snippets/declarative/states.qml when property +The \c bell component will change to the \c RINGING state whenever the +\c signal.state is \c CRITICAL. - MouseArea { - // Handle mouse events... - } - - states: [ - // States are defined here... - ] +\section1 Animating State Changes - transitions: [ - Transition { - NumberAnimation { properties: "x,y"; duration: 500 } - } - ] - } -\endqml +State changes induce abrupt value changes. The \l Transitions element allow +smoother changes during state changes. In transitions, animations and +interpolation behaviors are definable. The +\l {QML Animation and Transitions}{Animation and Transitions} article has more +information about creating state animations. -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 -milliseconds. +The \l {declarative/animation/states}{States and Transitions example} +demonstrates how to declare a basic set of states and apply animated +transitions between them. -See the \l Transitions documentation for more information. */ diff --git a/doc/src/declarative/qmlevents.qdoc b/doc/src/declarative/qmlevents.qdoc index 3c1c8df..8c2147a 100644 --- a/doc/src/declarative/qmlevents.qdoc +++ b/doc/src/declarative/qmlevents.qdoc @@ -1,6 +1,10 @@ /**************************************************************************** ** +<<<<<<< HEAD +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +======= ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +>>>>>>> d7a91cfe8683309883694fbbf508e5fc42d44165 ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -26,12 +30,106 @@ ****************************************************************************/ /*! - \page qmlevents.html - \ingroup qml-features - \contentspage QML Features - \previouspage {Integrating QML Code with Existing Qt UI Code} - \nextpage {Dynamic Object Management in QML}{Dynamic Object Management} +\page qmlevents.html +\ingroup qml-features +\contentspage QML Features +\previouspage {Integrating QML Code with Existing Qt UI Code} +\nextpage {Dynamic Object Management in QML}{Dynamic Object Management} - \title QML Signal and Handler Event System +\title QML Signal and Handler Event System + +\section1 Overview, structural information + +QML utilizes Qt's \l{The Meta-Object System}{meta-object} and +\l{Signals & Slots}{signals} systems. Signals and slots created using Qt in C++ +are inheritely valid in QML. + +\keyword qml-signals-and-handlers +\section1 Signals and Handlers + +Signals provide a way to notify other objects when an event has occurred. For +example, the MouseArea \c clicked signal notifies other objects that the mouse +has been clicked within the area. + +The syntax for defining a new signal is: + +\qml +signal [([ [, ...]])] +\endqml + +Attempting to declare two signals or methods with the same name in the same type +block is an error. However, a new signal may reuse the name of an existing +signal on the type. (This should be done with caution, as the existing signal +may be hidden and become inaccessible.) + +Here are various examples of signal declarations: +\snippet doc/src/snippets/declarative/events.qml parent begin +\snippet doc/src/snippets/declarative/events.qml signal declaration +\snippet doc/src/snippets/declarative/events.qml parent end + +If the signal has no parameters, the "\c{()}" brackets are optional. If +parameters are used, the parameter types must be declared, as for the \c string +and \c variant arguments of the \c perform signal. + +Adding a signal to an item automatically adds a \e{signal handler} as well. The +signal hander is named \c on, with the first letter of the signal in +uppercase. The previous signals have the following signal handlers: +\snippet doc/src/snippets/declarative/events.qml signal handler declaration + +Further, each QML properties have a \c{Changed} signal and its +corresponding \c{onChanged} signal handler. As a result, property +changes may notify other components for any changes. +\snippet doc/src/snippets/declarative/events.qml automatic signals + +To emit a signal, invoke it as a method. The signal handler binding is similar +to a property binding and it is invoked when the signal is emitted. Use the +defined argument names to access the respective arguments. +\snippet doc/src/snippets/declarative/events.qml signal emit +Note that the \c Component.onCompleted is an +\l{attached-signalhandlers}{attached signal handler}; it is invoked when the +\l Component initialization is complete. + +\keyword qml-connect-signals-to-method +\section2 Connecting Signals to Methods and Signals + +Signal objects have a \c connect() method to a connect a signal either to a +method or another signal. When a signal is connected to a method, the method is +automatically invoked whenever the signal is emitted. (In Qt terminology, the +method is a \e slot that is connected to the \e signal; all methods defined in +QML are created as \l{Signals & Slots}{Qt slots}.) This enables a signal +to be received by a method instead of a \l {Signal Handlers}{signal handler}. + +\snippet doc/src/snippets/declarative/events.qml connect method +The \c {connect()} method is appropriate when connecting a JavaScript method, +such as the \c {callee}'s\c answer method, to QML signals. + +The corresponding \c disconnect() method is for removing connected +signals. The following code removes the connection created in \c application.qml above: +\snippet doc/src/snippets/declarative/events.qml disconnect method + +\section3 Signal to Signal Connect + +By connecting signals to other signals, the \c connect() method can form different +signal chains. +\snippet doc/src/snippets/declarative/events.qml parent begin +\snippet doc/src/snippets/declarative/events.qml forward signal +\snippet doc/src/snippets/declarative/events.qml parent end + +Whenever the \l MouseArea \c clicked signal is emitted, the \c widgetClicked +signal will automatically be emitted as well. + +\code +output: + MouseArea clicked + Widget clicked +\endcode + +\section1 C++ additions + +Because QML uses Qt, a signal defined in C++ also works as a QML signal. The +signal may be emitted in QML code or called as a method. In addition, the QML +runtime automatically creates signal handlers for the C++ signals. For more +signal control, the \c connect() method and the \l Connect element may connect a +C++ to another signal or method. */ diff --git a/doc/src/declarative/qmlreusablecomponents.qdoc b/doc/src/declarative/qmlreusablecomponents.qdoc index 78865a1..0d02f4d 100644 --- a/doc/src/declarative/qmlreusablecomponents.qdoc +++ b/doc/src/declarative/qmlreusablecomponents.qdoc @@ -34,23 +34,24 @@ \title Importing Reusable Components -One of the key concepts in QML is the ability to define your own QML components that suit -the purposes of your application. The standard \l {QML Elements} provide the essential components -for creating a QML application; beyond these, you can write your own custom components that can -be created and reused, without the use of C++. - -Components are the building blocks of a QML project. When writing a QML application, whether -large or small, it is best to separate QML code into smaller components that perform specific -sets of operations, instead of creating mammoth QML files with large, combined functionality -that is more difficult to manage and may contain duplicated code. +A \e component is an instantiable QML definition, typically contained in a +\c .qml file. For instance, a Button \e component may be defined in +\c Button.qml. The QML runtime may instantiate this Button component to create +Button \e objects. Alternatively, a component may be defined inside a +\l Component element. +Moreover, the Button definition may also contain other components. A Button +component could use a Text element for its label and other components to +implement its functions. Compounding components to form new components +(and effectively new interfaces) is the emphasis in QML. \section1 Defining New Components -A component is a reusable type with a well-defined interface, built entirely in QML. -Any snippet of QML code can become a component, by placing the code in a file ".qml" where - is the new component name, beginning with an uppercase letter. These QML files automatically -become available as new QML element types to other QML components and applications in the same directory. +Any snippet of QML code may become a component, by placing the code in a QML +file (extension is \c .qml). An inline component definition may also reside in a +\l Component element. + +\snippet doc/src/snippets/declarative/reusablecomponents/Button.qml document For example, one of the simplest and most common components you can build in QML is a button-type component. Below, we implement this component as a \l Rectangle with a clickable @@ -80,418 +81,6 @@ filesystems. It is recommended the file name case matches the case of the QML co exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the QML component will be deployed. -To write a useful component, it is generally necessary to provide it with custom attributes that store and -communicate specific data. This is achieved by adding the following attributes to your components: - -\list -\o \bold Properties that can be accessed externally to modify an object (for example, \l Item has - \l {Item::}{width} and \l {Item::}{height} properties) and used in \l {Property Binding} -\o \bold Methods of JavaScript code can be invoked internally or externally (for example, - \l Animation has a \l {Animation::}{start()} method) -\o \bold Signals to notify other objects when an event has occurred (for example, MouseArea has a - \c clicked signal) -\endlist - -The following sections show how these attributes can be added to QML components. - - -\section1 Adding Properties - -A property is a value of a QML component that can be read and modified by other objects. For -example, a \l Rectangle component has \l {Item::}{width}, \l {Item::}{height} and \l -{Rectangle::}{color} properties. Significantly, properties be used with \l {Property Binding}, where -a property value is automatically updated using the value of another property. - -The syntax for defining a new property is: - -\code -[default] property [: defaultValue] -\endcode - -A \c property declaration can appear anywhere within a QML component definition, but it is customary -to place it at the top. A component cannot declare more than one property with the same name. (It is -possible to have a property name that is the same as an existing property in a type, but this is not -recommended as the existing property becomes hidden and inaccessible.) - -Below is an example. The \c ImageViewer component has defined a \c string type property named -\c currentImage, and its initial value is "default-image.png". This property is used to set the image -displayed in the child \l Image object. Another file, \c application.qml, can create -an \c ImageViewer object and read or modify the \c currentImage value: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/application.qml 0 -\endtable - -It is optional for a property to have a default value. The default value is a convenient shortcut, and is -behaviorally identical to doing it in two steps, like this: - -\qml -// Use default value -property int myProperty: 10 - -// Longer, but behaviorally identical -property int myProperty -myProperty: 10 -\endqml - - -\section2 Supported property types - -All QML properties are typed. The examples above show properties with \c int and \c string types; -notice that the type of the property must be declared. The type is used to determine the property -behavior, and how the property is defined in C++. - -A number of property types are supported by default. These are listed in the table below, -with their default values and the corresponding C++ type: - -\table -\header \o QML Type Name \o Default value \o C++ Type Name -\row \o int \o 0 \o int -\row \o bool \o \c false \o bool -\row \o double \o 0.0 \o double -\row \o real \o 0.0 \o double -\row \o string \o "" (empty string) \o QString -\row \o url \o "" (empty url) \o QUrl -\row \o color \o #000000 (black) \o QColor -\row \o date \o \c undefined \o QDateTime -\row \o variant \o \c undefined \o QVariant -\endtable - -QML object types can also be used as property types. This includes -\l {Defining new QML elements}{custom QML types} implemented in C++. Such properties are -defined like this: - -\qml -property Item itemProperty -property QtObject objectProperty -property MyCustomType customProperty -\endqml - -Such object-type properties default to an \c undefined value. - -\l{list}{List properties} are created with the \c list syntax, and default to an empty -list: - -\qml -property list listOfItems -\endqml - -Note that list properties cannot be modified like ordinary JavaScript -arrays. See the \l {list}{list type documentation} for details. - -For details about accessing and manipulating QML properties from C++, see \l {Using QML Bindings in C++ Applications}. - - -\section2 Property change signals - -Adding a \c property to an item automatically adds a \e {value changed} -signal handler to the item. To connect to this signal, use a \l {Signal Handlers}{signal handler} -named with the \c onChanged syntax, using upper case for the first letter of the -property name. - -For example, the following \c onMyNumberChanged signal handler is automatically called whenever the -\c myNumber property changes: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/property-signals.qml 0 - - -\section2 Default properties - -The optional \c default attribute for a property marks it as the \e {default property} -for a type. This allows other items to specify the default property's value -as child elements. For example, the \l Item element's default property is its -\l{Item::children}{children} property. This allows the children of an \l Item -to be set like this: - -\qml -Item { - Rectangle {} - Rectangle {} -} -\endqml - -If the \l{Item::children}{children} property was not the default property for -\l Item, its value would have to be set like this instead: - -\qml -Item { - children: [ - Rectangle {} - Rectangle {} - ] -} -\endqml - -See the \l{declarative/ui-components/tabwidget}{TabWidget} example for a -demonstration of using default properties. - -Specifying a default property overrides any existing default property (for -example, any default property inherited from a parent item). Using the -\c default attribute twice in the same type block is an error. - - -\section2 Property aliases - -Property aliases are a more advanced form of property declaration. Unlike a -property definition, which allocates a new, unique storage space for the -property, a property alias connects the newly declared property (called the -aliasing property) as a direct reference to an existing property (the aliased property). Read -operations on the aliasing property act as read operations on the aliased -property, and write operations on the aliasing property as write operations on -the aliased property. - -A property alias declaration looks a lot like an ordinary property definition: -\code - [default] property alias : -\endcode - -As the aliasing property has the same type as the aliased property, an explicit -type is omitted, and the special "alias" keyword is used. Instead of a default -value, a property alias includes a compulsory alias reference. The alias -reference is used to locate the aliased property. While similar to a property -binding, the alias reference syntax is highly restricted. - -An alias reference takes one of the following forms: -\code - . - -\endcode - -where must refer to an object id within the same component as the type -declaring the alias, and, optionally, refers to a property on that object. - -For example, below is a \c Button.qml component with a \c buttonText aliased property which is -connected to the child Text object's \c text property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias.qml 0 - -The following code would create a \c Button with a defined text string for the -child \l Text object: - -\qml -Button { buttonText: "This is a button" } -\endqml - -Here, modifying \c buttonText directly modifies the \c textItem.text value; it does not -change some other value that then updates \c textItem.text. - -In this case, the use of aliased properties is essential. If \c buttonText was not an alias, -changing its value would not actually change the displayed text at all, as -\l {Property Binding}{property bindings} are not bi-directional: the \c buttonText value would -change when \c textItem.text changes, but not the other way around. - -Aliased properties are also useful for allowing external objects to directly modify and -access child objects in a component. For example, here is a modified version of the \c ImageViewer -component shown \l {Adding Properties}{earlier} on this page. The \c currentImage property has -been changed to an alias to the child \l Image object: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/ImageViewer.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/properties/alias/application.qml 0 -\endtable - -Instead of being limited to setting the \l Image source, \c application.qml can now directly -access and modify the child \l Image object and its properties. - -Obviously, exposing child objects in this manner should be done with care, as it allows external -objects to modify them freely. However, this use of aliased properties can be quite useful in -particular situations, such as for the \l {declarative/ui-components/tabwidget}{TabWidget} -example, where new tab items are actually parented to a child object that displays the current tab. - - -\section3 Considerations for property aliases - -Aliases are only activated once the component specifying them is completed. The -most obvious consequence of this is that the component itself cannot generally -use the aliased property directly during creation. For example, this will not work: - -\code - // Does NOT work - property alias buttonText: textItem.text - buttonText: "Some text" // buttonText is not yet defined when this value is set -\endcode - -A second, much less significant, consequence of the delayed activation of -aliases is that an alias reference cannot refer to another aliasing property -declared within the same component. This will not work: - -\code - // Does NOT work - id: root - property alias buttonText: textItem.text - property alias buttonText2: root.buttonText -\endcode - -At the time the component is created, the \c buttonText value has not yet been assigned, -so \c root.buttonText would refer to an undefined value. (From outside the component, -however, aliasing properties appear as regular Qt properties and consequently can be -used in alias references.) - -It is possible for an aliased property to have the same name as an existing property. For example, -the following component has a \c color alias property, named the same as the built-in -\l {Rectangle::color} property: - -\snippet doc/src/snippets/declarative/qml-extending-types/properties/alias-override.qml 0 - -Any objects that use this component and refer to its \c color property will be -referring to the alias rather than the ordinary \l {Rectangle::color} property. Internally, -however, the rectangle can correctly set this property to "red" and refer to the actual defined -property rather than the alias. - - -\section1 Adding Methods - -A QML component can define methods of JavaScript code. These methods can be invoked -either internally or by other objects. - -The syntax for defining a method is: - -\code -function ([[, ...]]) { } -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two methods or signals with the -same name in the same type block is an error. However, a new method may reuse -the name of an existing method on the type. (This should be done with caution, -as the existing method may be hidden and become inaccessible.) - -Unlike \l{Adding Signals}{signals}, method parameter types do not have to be declared as they -default to the \c variant type. The body of the method is written in JavaScript and may access -the parameters by name. - -Here is an example of a component with a \c say() method that accepts a single \c text argument: - -\snippet doc/src/snippets/declarative/qml-extending-types/methods/app.qml 0 - -A method can be connected to a signal so that it is automatically invoked whenever the signal -is emitted. See \l {Connecting signals to methods and other signals} below. - -Also see \l {Integrating JavaScript} for more information on using JavaScript with QML. - - -\section1 Adding Signals - -Signals provide a way to notify other objects when an event has occurred. For example, the MouseArea -\c clicked signal notifies other objects that the mouse has been clicked within the area. - -The syntax for defining a new signal is: - -\code -signal [([ [, ...]])] -\endcode - -This declaration may appear anywhere within a type body, but it is customary to -include it at the top. Attempting to declare two signals or methods with the -same name in the same type block is an error. However, a new signal may reuse -the name of an existing signal on the type. (This should be done with caution, -as the existing signal may be hidden and become inaccessible.) - -Here are three examples of signal declarations: - -\code -Item { - signal clicked - signal hovered() - signal performAction(string action, variant actionArgument) -} -\endcode - -If the signal has no parameters, the "()" brackets are optional. If parameters are used, the -parameter types must be declared, as for the \c string and \c variant arguments for the \c -performAction signal above; the allowed parameter types are the same as those listed in the \l -{Adding Properties} section on this page. - -Adding a signal to an item automatically adds a \l {Signal Handlers}{signal handler} as well. -The signal hander is named \c on, with the first letter of the signal being upper -cased. The above example item would now have the following signal handlers: - -\list -\o onClicked -\o onHovered -\o onPerformAction -\endlist - -To emit a signal, simply invoke it in the same way as a method. Below left, when the \l MouseArea is -clicked, it emits the parent \c buttonClicked signal by invoking \c rect.buttonClicked(). The -signal is received by \c application.qml through an \c onButtonClicked signal handler: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/basic.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/no-parameters.qml 0 -\endtable - -If the signal has parameters, they are accessible by parameter name in the signal handler. -In the example below, \c buttonClicked is emitted with \c xPos and \c yPos parameters instead: - -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/Button.qml 0 -\o \snippet doc/src/snippets/declarative/qml-extending-types/signals/parameters.qml 0 -\endtable - - -\section2 Connecting signals to methods and other signals - -Signal objects have a \c connect() method that can be used to a connect a signal to a method or -another signal. When a signal is connected to a method, the method is automatically invoked -whenever the signal is emitted. (In Qt terminology, the method is a \e slot that is connected -to the \e signal; all methods defined in QML are created as Qt slots.) This enables a signal -to be received by a method instead of a \l {Signal Handlers}{signal handler}. - -For example, the \c application.qml above could be rewritten as: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectslots.qml 0 - -The \c myMethod() method will be called whenever the \c buttonClicked signal is received. - -In many cases it is sufficient to receive signals through signal handlers rather than using -the \c connect() function; the above example does not provide any improvements over using a -simple \c onButtonClicked handler. However, if you are \l{Dynamic Object Management in QML}{creating objects dynamically}, -or \l {Integrating JavaScript}{integrating JavaScript code}, then you will find the -\c connect() method useful. For example, the component below creates three \c Button -objects dynamically, and connects the \c buttonClicked signal of each object to the -\c myMethod() function: - -\snippet doc/src/snippets/declarative/qml-extending-types/signals/connectdynamic.qml 0 - -In the same way, you could connect a signal to methods defined in a dynamically -created object, or \l {Receiving QML Signals in JavaScript}{connect a signal to a JavaScript method}. - -There is also a corresponding \c disconnect() method for removing connected signals. The following -code removes the connection created in \c application.qml above: - -\qml -// application.qml -Item { - ... - - function removeSignal() { - button.clicked.disconnect(item.myMethod) - } -} -\endqml - - -\section3 Forwarding signals - -The \c connect() method can also connect a signal to other signals. This has the effect -of "forwarding" a signal: it is automatically emitted whenever the relevant signal is emitted. For -example, the MouseArea \c onClicked handler in \c Button.qml above could have been replaced with -a call to \c connect(): - -\qml -MouseArea { - anchors.fill: parent - Component.onCompleted: clicked.connect(item.buttonClicked) -} -\endqml - -Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will -automatically be emitted as well. +\section1 Loading a Component */ diff --git a/doc/src/declarative/qmlsyntax.qdoc b/doc/src/declarative/qmlsyntax.qdoc index 908b924..67d282a 100644 --- a/doc/src/declarative/qmlsyntax.qdoc +++ b/doc/src/declarative/qmlsyntax.qdoc @@ -30,7 +30,7 @@ \title QML Syntax \ingroup QML Features \previouspage QML Features -\nextpage Property Binding +\nextpage QML Basic Elements \contentspage QML Features \tableofcontents diff --git a/doc/src/declarative/qmltexthandling.qdoc b/doc/src/declarative/qmltexthandling.qdoc index c5a6bc9..e0d9b0f 100644 --- a/doc/src/declarative/qmltexthandling.qdoc +++ b/doc/src/declarative/qmltexthandling.qdoc @@ -35,8 +35,6 @@ \tableofcontents -\section1 Introduction - \section1 Text Elements \list @@ -52,4 +50,25 @@ \o \l{RegExpValidator} \endlist +\section1 Displaying Text in QML +QML provides several elements to display text onto the screen. The \l Text +element will display formatted text onto the screen, the \l TextEdit element +will place a multiline line edit onto the screen, and the \l TextInput will +place a single editable line field onto the screen. + +To learn more about their specific features and properties, visit their +respective element documentation. + +\section1 Validating Input Text +The \l {Validators}{validator} elements enforce the type and format of +\l TextInput objects. + +\snippet doc/src/snippets/declarative/texthandling.qml int validator +The validator elements bind to \c {TextInput}'s \c validator property. + +\snippet doc/src/snippets/declarative/texthandling.qml regexp validator +The regular expression in the snippet will only allow the inputted text to be +\c {fruit basket}. The \l {QRegExp} class has more information about Qt's +regular expressions. + */ diff --git a/doc/src/declarative/qmlviews.qdoc b/doc/src/declarative/qmlviews.qdoc index 3f74214..c207d9a 100644 --- a/doc/src/declarative/qmlviews.qdoc +++ b/doc/src/declarative/qmlviews.qdoc @@ -35,21 +35,8 @@ \section1 Introduction -Qt Quick contains a set of standard items that can be used to present data in a -number of different ways. For simple user interfaces, -\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used -in combination with -\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} -to obtain pieces of data and arrange them in a user interface. However, when -large quantities of data are involved, it is often better to use models with -the standard views since these contain many built-in display and navigation -features. - -\section1 Views - -Views are scrolling containers for collections of items. They are feature-rich, -supporting many of the use cases found in typical applications, and can be -customized to meet requirements on style and behavior. +Views are containers for collections of items. They are feature-rich and can be +customizable to meet style or behavior requirements. A set of standard views are provided in the basic set of Qt Quick graphical elements: @@ -58,13 +45,21 @@ graphical elements: \o \l{#ListView}{ListView} arranges items in a horizontal or vertical list \o \l{#GridView}{GridView} arranges items in a grid within the available space \o \l{#PathView}{PathView} arranges items on a path +\o \l{WebView}{WebView} - available from the Qt WebKit module. + \endlist Unlike these items, \l WebView is not a fully-featured view item, and needs to be combined with a \l Flickable item to create a view that performs like a Web browser. -\section2 ListView +\section1 Models + +Views display a \l{qml-data-models}{models} onto the screen. A model could be a simple list of \l{QML Data Models#An Integer}{integer} or a \l{qml-c++-models}{C++ models}. + +To assign a model to a view, bind the view's \c model property to a model. + +\section1 ListView \l ListView shows a classic list of items with horizontal or vertical placing of items. -- cgit v0.12 From 3e6d65fb2180c2a85db01d541c39f491ae63479d Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 7 Feb 2011 18:36:33 +0100 Subject: Fixed merge conflict in Copyright date. --- doc/src/declarative/qmlevents.qdoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/src/declarative/qmlevents.qdoc b/doc/src/declarative/qmlevents.qdoc index 8c2147a..277d811 100644 --- a/doc/src/declarative/qmlevents.qdoc +++ b/doc/src/declarative/qmlevents.qdoc @@ -1,10 +1,6 @@ /**************************************************************************** ** -<<<<<<< HEAD ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -======= -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ->>>>>>> d7a91cfe8683309883694fbbf508e5fc42d44165 ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -- cgit v0.12 From abd7455260d90120a11615526b483600774831b9 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 7 Feb 2011 19:17:18 +0100 Subject: Added the commit template to this repository --- .commit-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.commit-template b/.commit-template index 6e0e3a4..589ca89 100644 --- a/.commit-template +++ b/.commit-template @@ -5,6 +5,6 @@ # ---[ Fields ]-----------------[ uncomment and edit as applicable ]---| #Task-number: -Reviewed-by: pending +#Reviewed-by: # ==================================[ please wrap at 72 characters ]===| -- cgit v0.12 From 8f38531acc8139bcbee158458086ab012cb200b6 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 7 Feb 2011 19:19:14 +0100 Subject: Adding validator snippet. Task-number: QTBUG-16071 --- doc/src/snippets/declarative/texthandling.qml | 89 +++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 doc/src/snippets/declarative/texthandling.qml diff --git a/doc/src/snippets/declarative/texthandling.qml b/doc/src/snippets/declarative/texthandling.qml new file mode 100644 index 0000000..377bb8b --- /dev/null +++ b/doc/src/snippets/declarative/texthandling.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +import QtQuick 1.0 + + +//! [parent begin] +Rectangle { +//! [parent begin] + width: 300; height: 300 + id: screen + +Column { + anchors.centerIn:parent + +//! [int validator] +Column { + spacing: 10 + + Text { + text: "Enter a value from 0 to 2000" + } + TextInput { + focus: true + validator: IntValidator { bottom:0; top: 2000} + } +} +//! [int validator] + +//! [regexp validator] +Column { + spacing: 10 + + Text { + text: "Which basket?" + } + TextInput { + focus: true + validator: RegExpValidator { regExp: /fruit basket/ } + } +} +//! [regexp validator] + +//end of column +} + +//! [parent end] +} +//! [parent end] + +//! [document] + -- cgit v0.12 From b18e040ecb0ce6dea9c0d18f1c8a5542cd0e2881 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 8 Feb 2011 09:55:32 +0100 Subject: Changed states.qml snippet code Task-number: QTBUG-16071 --- doc/src/snippets/declarative/states.qml | 85 ++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 12 deletions(-) diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml index c3b7197..ab6b8d0 100644 --- a/doc/src/snippets/declarative/states.qml +++ b/doc/src/snippets/declarative/states.qml @@ -37,24 +37,85 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//![0] +//![document] import QtQuick 1.0 - + +//![parent begin] Rectangle { - id: myRect - width: 200; height: 200 - color: "red" +//![parent begin] + + id: screen + width: 400; height: 500 - MouseArea { - anchors.fill: parent - onClicked: myRect.state = 'moved' - } + +Rectangle { + id: flag +} +Column { + spacing: 15 +//![signal states] +Rectangle { + id: signal + width: 200; height: 200 + state: "NORMAL" states: [ State { - name: "moved" - PropertyChanges { target: myRect; x: 50; y: 50 } + name: "NORMAL" + PropertyChanges { target: signal; color: "green"} + PropertyChanges { target: flag; state: "FLAG_DOWN"} + }, + State { + name: "CRITICAL" + PropertyChanges { target: signal; color: "red"} + PropertyChanges { target: flag; state: "FLAG_UP"} } ] } -//![0] +//![signal states] + +//![switch states] +Rectangle { + id: signalswitch + width: 75; height: 75 + color: "blue" + + MouseArea { + anchors.fill: parent + onClicked: { + if (signal.state == "NORMAL") + signal.state = "CRITICAL" + else + signal.state = "NORMAL" + } + } +} +//![switch states] + +//![when property] +Rectangle { + id: bell + width: 75; height: 75 + color: "yellow" + + states: State { + name: "RINGING" + when: (signal.state == "CRITICAL") + PropertyChanges {target: speaker; play: "RING!"} + } +} +//![when property] + +Text { + id: speaker + property alias play: speaker.text + text: "NORMAL" +} + +} // end of row + +//![parent end] +} +//![parent end] + +//![document] -- cgit v0.12 From 21158b42fda8a144eb50381f62369e3b3558c83f Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 8 Feb 2011 12:39:36 +0100 Subject: Changed snippet code and edited event overview Task-number: QTBUG-16071 --- doc/src/declarative/qmlevents.qdoc | 22 ++--- doc/src/snippets/declarative/events.qml | 141 ++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 13 deletions(-) create mode 100644 doc/src/snippets/declarative/events.qml diff --git a/doc/src/declarative/qmlevents.qdoc b/doc/src/declarative/qmlevents.qdoc index 277d811..7d5e962 100644 --- a/doc/src/declarative/qmlevents.qdoc +++ b/doc/src/declarative/qmlevents.qdoc @@ -54,9 +54,7 @@ signal [([ [, ...]])] \endqml Attempting to declare two signals or methods with the same name in the same type -block is an error. However, a new signal may reuse the name of an existing -signal on the type. (This should be done with caution, as the existing signal -may be hidden and become inaccessible.) +block generates an error. However, a new signal may reuse the name of an existing signal on the type. (This should be done with caution, as the existing signal may be hidden and become inaccessible.) Here are various examples of signal declarations: \snippet doc/src/snippets/declarative/events.qml parent begin @@ -96,31 +94,29 @@ QML are created as \l{Signals & Slots}{Qt slots}.) This enables a signal to be received by a method instead of a \l {Signal Handlers}{signal handler}. \snippet doc/src/snippets/declarative/events.qml connect method -The \c {connect()} method is appropriate when connecting a JavaScript method, -such as the \c {callee}'s\c answer method, to QML signals. +The \c {connect()} method is appropriate when connecting a JavaScript method to +a signal. -The corresponding \c disconnect() method is for removing connected -signals. The following code removes the connection created in \c application.qml above: -\snippet doc/src/snippets/declarative/events.qml disconnect method +There is a corresponding \c disconnect() method for removing connected +signals. \section3 Signal to Signal Connect By connecting signals to other signals, the \c connect() method can form different signal chains. -\snippet doc/src/snippets/declarative/events.qml parent begin \snippet doc/src/snippets/declarative/events.qml forward signal -\snippet doc/src/snippets/declarative/events.qml parent end -Whenever the \l MouseArea \c clicked signal is emitted, the \c widgetClicked + +Whenever the \l MouseArea \c clicked signal is emitted, the \c send signal will automatically be emitted as well. \code output: MouseArea clicked - Widget clicked + Send clicked \endcode -\section1 C++ additions +\section1 C++ Additions Because QML uses Qt, a signal defined in C++ also works as a QML signal. The signal may be emitted in QML code or called as a method. In addition, the QML diff --git a/doc/src/snippets/declarative/events.qml b/doc/src/snippets/declarative/events.qml new file mode 100644 index 0000000..52fc2bc --- /dev/null +++ b/doc/src/snippets/declarative/events.qml @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//![document] +import QtQuick 1.0 + +//![parent begin] +Rectangle { +//![parent begin] + + id: screen + width: 400; height: 500 + +//! [signal declaration] + signal trigger + signal send (string notice) + signal perform (string task, variant object) +//! [signal declaration] + +//! [signal handler declaration] +onTrigger: console.log("trigger signal emitted") + +onSend: { + console.log("send signal emitted with notice: " + notice) +} + +onPerform: console.log("perform signal emitted") +//! [signal handler declaration] + +//! [automatic signals] +Rectangle { + id: sprite + width: 25; height: 25 + x: 50; y: 15 + + onXChanged: console.log("x property changed, emitted xChanged signal") + onYChanged: console.log("y property changed, emitted yChanged signal") +} +//! [automatic signals] + +//! [signal emit] +Rectangle { + id: messenger + + signal send( string person, string notice) + + onSend: { + console.log("For " + person + ", the notice is: " + notice) + } + + Component.onCompleted: messenger.send("Tom", "the door is ajar.") +} +//! [signal emit] + +//! [connect method] +Rectangle { + id: relay + + signal send( string person, string notice) + onSend: console.log("Send signal to: " + person + ", " + notice) + + Component.onCompleted: { + relay.send.connect(sendToPost) + relay.send.connect(sendToTelegraph) + relay.send.connect(sendToEmail) + relay.send("Tom", "Happy Birthday") + } + + function sendToPost(person, notice) { + console.log("Sending to post: " + person + ", " + notice) + } + function sendToTelegraph(person, notice) { + console.log("Sending to telegraph: " + person + ", " + notice) + } + function sendToEmail(person, notice) { + console.log("Sending to email: " + person + ", " + notice) + } +} +//! [connect method] + +//! [forward signal] +Rectangle { + id: forwarder + width: 100; height: 100 + + signal send() + onSend: console.log("Send clicked") + + MouseArea { + id: mousearea + anchors.fill: parent + onClicked: console.log("MouseArea clicked") + } + Component.onCompleted: { + mousearea.clicked.connect(send) + } +} +//! [forward signal] + +//! [connect method] +//![parent end] +} +//![parent end] + +//![document] -- cgit v0.12 From e442cb8e772eeebbe66ebc89a4d6a429d12f86cb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 8 Feb 2011 15:45:11 +0100 Subject: Doc: Ensured that code snippets have appropriate file names. This helps them to be marked up correctly in cases where code markers are available. --- doc/src/classes/phonon-api.qdoc | 42 +- doc/src/deployment/deployment-plugins.qdoc | 2 +- doc/src/deployment/deployment.qdoc | 24 +- doc/src/development/activeqt-dumpcpp.qdoc | 10 +- doc/src/development/assistant-manual.qdoc | 6 +- doc/src/development/debug.qdoc | 6 +- doc/src/development/designer-manual.qdoc | 18 +- doc/src/development/moc.qdoc | 18 +- doc/src/development/qmake-manual.qdoc | 316 +++--- doc/src/development/qtestlib.qdoc | 10 +- doc/src/examples/arrowpad.qdoc | 2 +- doc/src/examples/containerextension.qdoc | 2 +- doc/src/examples/customwidgetplugin.qdoc | 2 +- doc/src/examples/editabletreemodel.qdoc | 4 +- doc/src/examples/fancybrowser.qdoc | 4 +- doc/src/examples/icons.qdoc | 2 +- doc/src/examples/imageviewer.qdoc | 6 +- doc/src/examples/qtscriptcustomclass.qdoc | 12 +- doc/src/examples/simpledommodel.qdoc | 2 +- doc/src/examples/taskmenuextension.qdoc | 2 +- doc/src/examples/textfinder.qdoc | 2 +- doc/src/examples/trollprint.qdoc | 8 +- doc/src/examples/worldtimeclockplugin.qdoc | 2 +- doc/src/files-and-resources/resources.qdoc | 4 +- doc/src/frameworks-technologies/accessible.qdoc | 2 +- .../activeqt-container.qdoc | 4 +- .../frameworks-technologies/activeqt-server.qdoc | 36 +- doc/src/frameworks-technologies/containers.qdoc | 48 +- doc/src/frameworks-technologies/dbus-adaptors.qdoc | 26 +- doc/src/frameworks-technologies/graphicsview.qdoc | 14 +- .../frameworks-technologies/implicit-sharing.qdoc | 4 +- .../model-view-programming.qdoc | 16 +- doc/src/frameworks-technologies/phonon.qdoc | 2 +- doc/src/frameworks-technologies/plugins-howto.qdoc | 10 +- doc/src/frameworks-technologies/qthelp.qdoc | 2 +- doc/src/frameworks-technologies/richtext.qdoc | 14 +- doc/src/frameworks-technologies/unicode.qdoc | 8 +- doc/src/howtos/appicon.qdoc | 6 +- doc/src/howtos/unix-signal-handlers.qdoc | 10 +- doc/src/internationalization/i18n.qdoc | 24 +- doc/src/internationalization/linguist-manual.qdoc | 36 +- doc/src/ja_JP/development/qmake-manual.qdoc | 30 +- doc/src/ja_JP/development/qtestlib.qdoc | 4 +- doc/src/ja_JP/examples/arrowpad.qdoc | 2 +- doc/src/ja_JP/examples/trollprint.qdoc | 8 +- doc/src/modules.qdoc | 66 +- doc/src/objectmodel/objecttrees.qdoc | 4 +- doc/src/objectmodel/properties.qdoc | 16 +- doc/src/objectmodel/signalsandslots.qdoc | 2 +- doc/src/painting-and-printing/coordsys.qdoc | 12 +- doc/src/platforms/emb-performance.qdoc | 2 +- doc/src/platforms/emb-pointer.qdoc | 2 +- doc/src/platforms/mac-differences.qdoc | 4 +- doc/src/platforms/wince-customization.qdoc | 2 +- doc/src/porting/porting-qsa.qdoc | 28 +- doc/src/porting/porting4-canvas.qdoc | 20 +- doc/src/porting/porting4-designer.qdoc | 14 +- doc/src/porting/porting4-dnd.qdoc | 6 +- doc/src/porting/porting4.qdoc | 140 +-- doc/src/porting/qt3to4.qdoc | 2 +- doc/src/porting/qt4-accessibility.qdoc | 8 +- doc/src/porting/qt4-arthur.qdoc | 22 +- doc/src/porting/qt4-mainwindow.qdoc | 20 +- doc/src/porting/qt4-sql.qdoc | 4 +- doc/src/porting/qt4-styles.qdoc | 8 +- doc/src/porting/qt4-tulip.qdoc | 22 +- doc/src/qt4-intro.qdoc | 34 +- doc/src/scripting/qtscriptextensions.qdoc | 2 +- doc/src/scripting/scripting.qdoc | 174 ++-- doc/src/snippets/code/doc.src.qtscripttools.qdoc | 48 - doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp | 65 ++ .../snippets/code/doc_src_activeqt-dumpcpp.qdoc | 65 -- doc/src/snippets/code/doc_src_appicon.pro | 53 + doc/src/snippets/code/doc_src_appicon.qdoc | 14 - doc/src/snippets/code/doc_src_containers.cpp | 275 ++++++ doc/src/snippets/code/doc_src_containers.qdoc | 275 ------ doc/src/snippets/code/doc_src_coordsys.cpp | 87 ++ doc/src/snippets/code/doc_src_coordsys.qdoc | 87 -- doc/src/snippets/code/doc_src_debug.cpp | 64 ++ doc/src/snippets/code/doc_src_debug.qdoc | 64 -- doc/src/snippets/code/doc_src_deployment.cpp | 56 ++ doc/src/snippets/code/doc_src_deployment.pro | 87 ++ doc/src/snippets/code/doc_src_deployment.qdoc | 25 +- doc/src/snippets/code/doc_src_designer-manual.cpp | 112 +++ doc/src/snippets/code/doc_src_designer-manual.js | 43 + doc/src/snippets/code/doc_src_designer-manual.pro | 59 ++ doc/src/snippets/code/doc_src_designer-manual.qdoc | 138 --- doc/src/snippets/code/doc_src_dnd.cpp | 74 ++ doc/src/snippets/code/doc_src_dnd.qdoc | 74 -- doc/src/snippets/code/doc_src_emb-performance.cpp | 71 ++ doc/src/snippets/code/doc_src_emb-performance.qdoc | 33 - doc/src/snippets/code/doc_src_emb-pointer.pro | 46 + doc/src/snippets/code/doc_src_emb-pointer.qdoc | 10 - .../snippets/code/doc_src_examples_arrowpad.cpp | 43 + .../snippets/code/doc_src_examples_arrowpad.qdoc | 5 - .../code/doc_src_examples_containerextension.pro | 44 + .../code/doc_src_examples_containerextension.qdoc | 44 - .../code/doc_src_examples_customwidgetplugin.pro | 44 + .../code/doc_src_examples_customwidgetplugin.qdoc | 44 - .../code/doc_src_examples_editabletreemodel.cpp | 48 + .../code/doc_src_examples_editabletreemodel.qdoc | 48 - doc/src/snippets/code/doc_src_examples_icons.cpp | 44 + doc/src/snippets/code/doc_src_examples_icons.qdoc | 6 - .../snippets/code/doc_src_examples_imageviewer.cpp | 54 + .../code/doc_src_examples_imageviewer.qdoc | 16 - .../code/doc_src_examples_qtscriptcustomclass.cpp | 75 ++ .../code/doc_src_examples_qtscriptcustomclass.qdoc | 75 -- .../code/doc_src_examples_simpledommodel.cpp | 60 ++ .../code/doc_src_examples_simpledommodel.qdoc | 60 -- .../code/doc_src_examples_taskmenuextension.pro | 44 + .../code/doc_src_examples_taskmenuextension.qdoc | 44 - .../snippets/code/doc_src_examples_textfinder.pro | 46 + .../snippets/code/doc_src_examples_textfinder.qdoc | 46 - .../snippets/code/doc_src_examples_trollprint.cpp | 77 ++ .../snippets/code/doc_src_examples_trollprint.qdoc | 75 -- .../code/doc_src_examples_worldtimeclockplugin.pro | 44 + .../doc_src_examples_worldtimeclockplugin.qdoc | 44 - doc/src/snippets/code/doc_src_graphicsview.cpp | 117 +++ doc/src/snippets/code/doc_src_graphicsview.qdoc | 117 --- doc/src/snippets/code/doc_src_groups.cpp | 66 ++ doc/src/snippets/code/doc_src_groups.qdoc | 66 -- doc/src/snippets/code/doc_src_i18n.cpp | 175 ++++ doc/src/snippets/code/doc_src_i18n.qdoc | 137 --- doc/src/snippets/code/doc_src_layout.cpp | 166 ++++ doc/src/snippets/code/doc_src_layout.qdoc | 166 ---- doc/src/snippets/code/doc_src_linguist-manual.cpp | 157 +++ doc/src/snippets/code/doc_src_linguist-manual.pro | 62 ++ doc/src/snippets/code/doc_src_linguist-manual.qdoc | 144 --- doc/src/snippets/code/doc_src_mac-differences.cpp | 52 + doc/src/snippets/code/doc_src_mac-differences.pro | 43 + doc/src/snippets/code/doc_src_moc.cpp | 144 +++ doc/src/snippets/code/doc_src_moc.qdoc | 106 -- .../code/doc_src_model-view-programming.cpp | 76 ++ .../code/doc_src_model-view-programming.qdoc | 76 -- doc/src/snippets/code/doc_src_modules.pro | 43 + doc/src/snippets/code/doc_src_modules.qdoc | 43 - doc/src/snippets/code/doc_src_objecttrees.cpp | 60 ++ doc/src/snippets/code/doc_src_objecttrees.qdoc | 60 -- doc/src/snippets/code/doc_src_phonon-api.cpp | 264 +++++ doc/src/snippets/code/doc_src_phonon-api.qdoc | 264 ----- doc/src/snippets/code/doc_src_phonon.pro | 43 + doc/src/snippets/code/doc_src_phonon.qdoc | 53 - doc/src/snippets/code/doc_src_plugins-howto.qdoc | 63 -- doc/src/snippets/code/doc_src_porting-qsa.cpp | 89 ++ doc/src/snippets/code/doc_src_porting-qsa.js | 117 +++ doc/src/snippets/code/doc_src_porting-qsa.qdoc | 128 --- doc/src/snippets/code/doc_src_porting4-canvas.cpp | 156 +++ doc/src/snippets/code/doc_src_porting4-canvas.qdoc | 156 --- .../snippets/code/doc_src_porting4-designer.cpp | 173 ++++ .../snippets/code/doc_src_porting4-designer.pro | 43 + .../snippets/code/doc_src_porting4-designer.qdoc | 140 --- doc/src/snippets/code/doc_src_porting4.cpp | 513 ++++++++++ doc/src/snippets/code/doc_src_porting4.qdoc | 513 ---------- doc/src/snippets/code/doc_src_properties.cpp | 131 +++ doc/src/snippets/code/doc_src_properties.qdoc | 131 --- doc/src/snippets/code/doc_src_q3asciidict.cpp | 92 ++ doc/src/snippets/code/doc_src_q3asciidict.qdoc | 92 -- doc/src/snippets/code/doc_src_q3dict.cpp | 69 ++ doc/src/snippets/code/doc_src_q3dict.qdoc | 69 -- doc/src/snippets/code/doc_src_q3intdict.cpp | 91 ++ doc/src/snippets/code/doc_src_q3intdict.qdoc | 91 -- doc/src/snippets/code/doc_src_q3memarray.cpp | 108 ++ doc/src/snippets/code/doc_src_q3memarray.qdoc | 70 -- doc/src/snippets/code/doc_src_q3ptrdict.cpp | 106 ++ doc/src/snippets/code/doc_src_q3ptrdict.qdoc | 106 -- doc/src/snippets/code/doc_src_q3ptrlist.cpp | 122 +++ doc/src/snippets/code/doc_src_q3ptrlist.qdoc | 122 --- doc/src/snippets/code/doc_src_q3valuelist.cpp | 135 +++ doc/src/snippets/code/doc_src_q3valuelist.qdoc | 135 --- doc/src/snippets/code/doc_src_q3valuestack.cpp | 53 + doc/src/snippets/code/doc_src_q3valuestack.qdoc | 53 - doc/src/snippets/code/doc_src_q3valuevector.cpp | 125 +++ doc/src/snippets/code/doc_src_q3valuevector.qdoc | 125 --- doc/src/snippets/code/doc_src_qalgorithms.cpp | 354 +++++++ doc/src/snippets/code/doc_src_qalgorithms.qdoc | 354 ------- doc/src/snippets/code/doc_src_qaxcontainer.pro | 48 + doc/src/snippets/code/doc_src_qaxcontainer.qdoc | 48 - doc/src/snippets/code/doc_src_qaxserver.cpp | 218 +++++ doc/src/snippets/code/doc_src_qaxserver.pro | 64 ++ doc/src/snippets/code/doc_src_qaxserver.qdoc | 206 ---- doc/src/snippets/code/doc_src_qcache.cpp | 57 ++ doc/src/snippets/code/doc_src_qcache.qdoc | 57 -- doc/src/snippets/code/doc_src_qdbusadaptors.cpp | 293 ++++++ doc/src/snippets/code/doc_src_qdbusadaptors.qdoc | 293 ------ doc/src/snippets/code/doc_src_qiterator.cpp | 420 ++++++++ doc/src/snippets/code/doc_src_qiterator.qdoc | 420 -------- doc/src/snippets/code/doc_src_qmake-manual.cpp | 58 ++ doc/src/snippets/code/doc_src_qmake-manual.pro | 1013 +++++++++++++++++++ doc/src/snippets/code/doc_src_qmake-manual.qdoc | 1031 -------------------- doc/src/snippets/code/doc_src_qnamespace.cpp | 59 ++ doc/src/snippets/code/doc_src_qnamespace.qdoc | 21 - doc/src/snippets/code/doc_src_qpair.cpp | 55 ++ doc/src/snippets/code/doc_src_qpair.qdoc | 55 -- doc/src/snippets/code/doc_src_qplugin.cpp | 64 ++ doc/src/snippets/code/doc_src_qplugin.pro | 44 + doc/src/snippets/code/doc_src_qplugin.qdoc | 64 -- doc/src/snippets/code/doc_src_qset.cpp | 166 ++++ doc/src/snippets/code/doc_src_qset.qdoc | 166 ---- doc/src/snippets/code/doc_src_qsignalspy.cpp | 81 ++ doc/src/snippets/code/doc_src_qsignalspy.qdoc | 81 -- doc/src/snippets/code/doc_src_qt3support.cpp | 43 + doc/src/snippets/code/doc_src_qt3support.pro | 43 + doc/src/snippets/code/doc_src_qt3support.qdoc | 48 - doc/src/snippets/code/doc_src_qt3to4.cpp | 43 + .../snippets/code/doc_src_qt4-accessibility.cpp | 99 ++ .../snippets/code/doc_src_qt4-accessibility.qdoc | 99 -- doc/src/snippets/code/doc_src_qt4-arthur.cpp | 144 +++ doc/src/snippets/code/doc_src_qt4-arthur.qdoc | 144 --- doc/src/snippets/code/doc_src_qt4-intro.cpp | 106 ++ doc/src/snippets/code/doc_src_qt4-intro.pro | 73 ++ doc/src/snippets/code/doc_src_qt4-intro.qdoc | 141 --- doc/src/snippets/code/doc_src_qt4-mainwindow.cpp | 110 +++ doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc | 110 --- doc/src/snippets/code/doc_src_qt4-sql.cpp | 59 ++ doc/src/snippets/code/doc_src_qt4-sql.qdoc | 59 -- doc/src/snippets/code/doc_src_qt4-styles.cpp | 82 ++ doc/src/snippets/code/doc_src_qt4-styles.qdoc | 82 -- doc/src/snippets/code/doc_src_qt4-tulip.cpp | 140 +++ doc/src/snippets/code/doc_src_qt4-tulip.qdoc | 140 --- doc/src/snippets/code/doc_src_qtcore.cpp | 43 + doc/src/snippets/code/doc_src_qtcore.qdoc | 43 - doc/src/snippets/code/doc_src_qtdbus.cpp | 43 + doc/src/snippets/code/doc_src_qtdbus.pro | 43 + doc/src/snippets/code/doc_src_qtdbus.qdoc | 48 - doc/src/snippets/code/doc_src_qtdesigner.cpp | 328 +++++++ doc/src/snippets/code/doc_src_qtdesigner.pro | 43 + doc/src/snippets/code/doc_src_qtdesigner.qdoc | 333 ------- doc/src/snippets/code/doc_src_qtestevent.cpp | 51 + doc/src/snippets/code/doc_src_qtestevent.qdoc | 51 - doc/src/snippets/code/doc_src_qtestlib.cpp | 88 ++ doc/src/snippets/code/doc_src_qtestlib.pro | 43 + doc/src/snippets/code/doc_src_qtestlib.qdoc | 55 -- doc/src/snippets/code/doc_src_qtgui.pro | 43 + doc/src/snippets/code/doc_src_qtgui.qdoc | 43 - doc/src/snippets/code/doc_src_qthelp.cpp | 63 ++ doc/src/snippets/code/doc_src_qthelp.qdoc | 24 - doc/src/snippets/code/doc_src_qtmultimedia.cpp | 43 + doc/src/snippets/code/doc_src_qtmultimedia.pro | 43 + doc/src/snippets/code/doc_src_qtmultimedia.qdoc | 48 - doc/src/snippets/code/doc_src_qtnetwork.cpp | 43 + doc/src/snippets/code/doc_src_qtnetwork.pro | 43 + doc/src/snippets/code/doc_src_qtnetwork.qdoc | 48 - doc/src/snippets/code/doc_src_qtopengl.cpp | 43 + doc/src/snippets/code/doc_src_qtopengl.pro | 43 + doc/src/snippets/code/doc_src_qtopengl.qdoc | 48 - doc/src/snippets/code/doc_src_qtscript.cpp | 568 +++++++++++ doc/src/snippets/code/doc_src_qtscript.js | 444 +++++++++ doc/src/snippets/code/doc_src_qtscript.pro | 43 + doc/src/snippets/code/doc_src_qtscript.qdoc | 937 ------------------ .../snippets/code/doc_src_qtscriptextensions.js | 47 + .../snippets/code/doc_src_qtscriptextensions.qdoc | 47 - doc/src/snippets/code/doc_src_qtscripttools.cpp | 43 + doc/src/snippets/code/doc_src_qtsql.cpp | 43 + doc/src/snippets/code/doc_src_qtsql.pro | 43 + doc/src/snippets/code/doc_src_qtsql.qdoc | 48 - doc/src/snippets/code/doc_src_qtsvg.cpp | 43 + doc/src/snippets/code/doc_src_qtsvg.pro | 43 + doc/src/snippets/code/doc_src_qtsvg.qdoc | 48 - doc/src/snippets/code/doc_src_qttest.cpp | 43 + doc/src/snippets/code/doc_src_qttest.pro | 43 + doc/src/snippets/code/doc_src_qttest.qdoc | 48 - doc/src/snippets/code/doc_src_qtuiloader.cpp | 43 + doc/src/snippets/code/doc_src_qtuiloader.pro | 43 + doc/src/snippets/code/doc_src_qtuiloader.qdoc | 48 - doc/src/snippets/code/doc_src_qtxml.cpp | 43 + doc/src/snippets/code/doc_src_qtxml.pro | 43 + doc/src/snippets/code/doc_src_qtxml.qdoc | 15 - doc/src/snippets/code/doc_src_qtxmlpatterns.cpp | 44 + doc/src/snippets/code/doc_src_qtxmlpatterns.pro | 44 + doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc | 9 - doc/src/snippets/code/doc_src_qvarlengtharray.cpp | 78 ++ doc/src/snippets/code/doc_src_qvarlengtharray.qdoc | 78 -- doc/src/snippets/code/doc_src_resources.cpp | 54 + doc/src/snippets/code/doc_src_resources.qdoc | 16 - doc/src/snippets/code/doc_src_richtext.cpp | 85 ++ doc/src/snippets/code/doc_src_richtext.qdoc | 47 - doc/src/snippets/code/doc_src_sql-driver.cpp | 82 ++ doc/src/snippets/code/doc_src_sql-driver.qdoc | 44 - doc/src/snippets/code/doc_src_styles.cpp | 134 +++ doc/src/snippets/code/doc_src_styles.qdoc | 134 --- doc/src/snippets/code/doc_src_stylesheet.qdoc | 103 -- doc/src/snippets/code/doc_src_unicode.cpp | 58 ++ doc/src/snippets/code/doc_src_unicode.qdoc | 58 -- .../snippets/code/doc_src_unix-signal-handlers.cpp | 150 +++ .../code/doc_src_unix-signal-handlers.qdoc | 150 --- .../snippets/code/doc_src_wince-customization.cpp | 58 ++ .../snippets/code/doc_src_wince-customization.qdoc | 19 - doc/src/snippets/qtreeview-dnd/dragdropmodel.h | 11 - doc/src/sql-programming/sql-driver.qdoc | 12 +- doc/src/widgets-and-layouts/layout.qdoc | 16 +- doc/src/widgets-and-layouts/styles.qdoc | 14 +- doc/src/widgets-and-layouts/stylesheet.qdoc | 30 +- doc/src/windows-and-dialogs/mainwindow.qdoc | 8 +- src/corelib/global/qnamespace.qdoc | 2 +- src/corelib/plugin/qplugin.qdoc | 8 +- src/corelib/tools/qalgorithms.qdoc | 52 +- src/corelib/tools/qcache.qdoc | 6 +- src/corelib/tools/qiterator.qdoc | 80 +- src/corelib/tools/qpair.qdoc | 6 +- src/corelib/tools/qset.qdoc | 30 +- src/corelib/tools/qvarlengtharray.qdoc | 8 +- src/declarative/util/qdeclarativeconnections.cpp | 2 + src/qt3support/tools/q3asciidict.qdoc | 6 +- src/qt3support/tools/q3dict.qdoc | 4 +- src/qt3support/tools/q3intdict.qdoc | 6 +- src/qt3support/tools/q3memarray.qdoc | 8 +- src/qt3support/tools/q3ptrdict.qdoc | 6 +- src/qt3support/tools/q3ptrlist.qdoc | 10 +- src/qt3support/tools/q3valuelist.qdoc | 10 +- src/qt3support/tools/q3valuestack.qdoc | 2 +- src/qt3support/tools/q3valuevector.qdoc | 10 +- src/testlib/qsignalspy.qdoc | 10 +- src/testlib/qtestevent.qdoc | 2 +- tools/designer/src/lib/sdk/membersheet.qdoc | 8 +- tools/designer/src/lib/sdk/propertysheet.qdoc | 8 +- tools/designer/src/lib/sdk/taskmenu.qdoc | 6 +- tools/designer/src/lib/uilib/container.qdoc | 6 +- tools/designer/src/lib/uilib/customwidget.qdoc | 6 +- 318 files changed, 13556 insertions(+), 11688 deletions(-) delete mode 100644 doc/src/snippets/code/doc.src.qtscripttools.qdoc create mode 100644 doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp delete mode 100644 doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc create mode 100644 doc/src/snippets/code/doc_src_appicon.pro create mode 100644 doc/src/snippets/code/doc_src_containers.cpp delete mode 100644 doc/src/snippets/code/doc_src_containers.qdoc create mode 100644 doc/src/snippets/code/doc_src_coordsys.cpp delete mode 100644 doc/src/snippets/code/doc_src_coordsys.qdoc create mode 100644 doc/src/snippets/code/doc_src_debug.cpp delete mode 100644 doc/src/snippets/code/doc_src_debug.qdoc create mode 100644 doc/src/snippets/code/doc_src_deployment.cpp create mode 100644 doc/src/snippets/code/doc_src_deployment.pro create mode 100644 doc/src/snippets/code/doc_src_designer-manual.cpp create mode 100644 doc/src/snippets/code/doc_src_designer-manual.js create mode 100644 doc/src/snippets/code/doc_src_designer-manual.pro delete mode 100644 doc/src/snippets/code/doc_src_designer-manual.qdoc create mode 100644 doc/src/snippets/code/doc_src_dnd.cpp delete mode 100644 doc/src/snippets/code/doc_src_dnd.qdoc create mode 100644 doc/src/snippets/code/doc_src_emb-performance.cpp create mode 100644 doc/src/snippets/code/doc_src_emb-pointer.pro create mode 100644 doc/src/snippets/code/doc_src_examples_arrowpad.cpp create mode 100644 doc/src/snippets/code/doc_src_examples_containerextension.pro delete mode 100644 doc/src/snippets/code/doc_src_examples_containerextension.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro delete mode 100644 doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp delete mode 100644 doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_icons.cpp create mode 100644 doc/src/snippets/code/doc_src_examples_imageviewer.cpp create mode 100644 doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp delete mode 100644 doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_simpledommodel.cpp delete mode 100644 doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_taskmenuextension.pro delete mode 100644 doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_textfinder.pro delete mode 100644 doc/src/snippets/code/doc_src_examples_textfinder.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_trollprint.cpp delete mode 100644 doc/src/snippets/code/doc_src_examples_trollprint.qdoc create mode 100644 doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro delete mode 100644 doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc create mode 100644 doc/src/snippets/code/doc_src_graphicsview.cpp delete mode 100644 doc/src/snippets/code/doc_src_graphicsview.qdoc create mode 100644 doc/src/snippets/code/doc_src_groups.cpp delete mode 100644 doc/src/snippets/code/doc_src_groups.qdoc create mode 100644 doc/src/snippets/code/doc_src_i18n.cpp create mode 100644 doc/src/snippets/code/doc_src_layout.cpp delete mode 100644 doc/src/snippets/code/doc_src_layout.qdoc create mode 100644 doc/src/snippets/code/doc_src_linguist-manual.cpp create mode 100644 doc/src/snippets/code/doc_src_linguist-manual.pro create mode 100644 doc/src/snippets/code/doc_src_mac-differences.cpp create mode 100644 doc/src/snippets/code/doc_src_mac-differences.pro create mode 100644 doc/src/snippets/code/doc_src_moc.cpp create mode 100644 doc/src/snippets/code/doc_src_model-view-programming.cpp delete mode 100644 doc/src/snippets/code/doc_src_model-view-programming.qdoc create mode 100644 doc/src/snippets/code/doc_src_modules.pro delete mode 100644 doc/src/snippets/code/doc_src_modules.qdoc create mode 100644 doc/src/snippets/code/doc_src_objecttrees.cpp delete mode 100644 doc/src/snippets/code/doc_src_objecttrees.qdoc create mode 100644 doc/src/snippets/code/doc_src_phonon-api.cpp delete mode 100644 doc/src/snippets/code/doc_src_phonon-api.qdoc create mode 100644 doc/src/snippets/code/doc_src_phonon.pro delete mode 100644 doc/src/snippets/code/doc_src_phonon.qdoc create mode 100644 doc/src/snippets/code/doc_src_porting-qsa.cpp create mode 100644 doc/src/snippets/code/doc_src_porting-qsa.js create mode 100644 doc/src/snippets/code/doc_src_porting4-canvas.cpp delete mode 100644 doc/src/snippets/code/doc_src_porting4-canvas.qdoc create mode 100644 doc/src/snippets/code/doc_src_porting4-designer.cpp create mode 100644 doc/src/snippets/code/doc_src_porting4-designer.pro create mode 100644 doc/src/snippets/code/doc_src_porting4.cpp delete mode 100644 doc/src/snippets/code/doc_src_porting4.qdoc create mode 100644 doc/src/snippets/code/doc_src_properties.cpp delete mode 100644 doc/src/snippets/code/doc_src_properties.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3asciidict.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3asciidict.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3dict.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3dict.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3intdict.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3intdict.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3memarray.cpp create mode 100644 doc/src/snippets/code/doc_src_q3ptrdict.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3ptrdict.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3ptrlist.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3ptrlist.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3valuelist.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3valuelist.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3valuestack.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3valuestack.qdoc create mode 100644 doc/src/snippets/code/doc_src_q3valuevector.cpp delete mode 100644 doc/src/snippets/code/doc_src_q3valuevector.qdoc create mode 100644 doc/src/snippets/code/doc_src_qalgorithms.cpp delete mode 100644 doc/src/snippets/code/doc_src_qalgorithms.qdoc create mode 100644 doc/src/snippets/code/doc_src_qaxcontainer.pro delete mode 100644 doc/src/snippets/code/doc_src_qaxcontainer.qdoc create mode 100644 doc/src/snippets/code/doc_src_qaxserver.cpp create mode 100644 doc/src/snippets/code/doc_src_qaxserver.pro create mode 100644 doc/src/snippets/code/doc_src_qcache.cpp delete mode 100644 doc/src/snippets/code/doc_src_qcache.qdoc create mode 100644 doc/src/snippets/code/doc_src_qdbusadaptors.cpp delete mode 100644 doc/src/snippets/code/doc_src_qdbusadaptors.qdoc create mode 100644 doc/src/snippets/code/doc_src_qiterator.cpp delete mode 100644 doc/src/snippets/code/doc_src_qiterator.qdoc create mode 100644 doc/src/snippets/code/doc_src_qmake-manual.cpp create mode 100644 doc/src/snippets/code/doc_src_qmake-manual.pro delete mode 100644 doc/src/snippets/code/doc_src_qmake-manual.qdoc create mode 100644 doc/src/snippets/code/doc_src_qnamespace.cpp create mode 100644 doc/src/snippets/code/doc_src_qpair.cpp delete mode 100644 doc/src/snippets/code/doc_src_qpair.qdoc create mode 100644 doc/src/snippets/code/doc_src_qplugin.cpp create mode 100644 doc/src/snippets/code/doc_src_qplugin.pro delete mode 100644 doc/src/snippets/code/doc_src_qplugin.qdoc create mode 100644 doc/src/snippets/code/doc_src_qset.cpp delete mode 100644 doc/src/snippets/code/doc_src_qset.qdoc create mode 100644 doc/src/snippets/code/doc_src_qsignalspy.cpp delete mode 100644 doc/src/snippets/code/doc_src_qsignalspy.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt3support.cpp create mode 100644 doc/src/snippets/code/doc_src_qt3support.pro delete mode 100644 doc/src/snippets/code/doc_src_qt3support.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt3to4.cpp create mode 100644 doc/src/snippets/code/doc_src_qt4-accessibility.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-accessibility.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-arthur.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-arthur.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-intro.cpp create mode 100644 doc/src/snippets/code/doc_src_qt4-intro.pro delete mode 100644 doc/src/snippets/code/doc_src_qt4-intro.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-mainwindow.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-sql.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-sql.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-styles.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-styles.qdoc create mode 100644 doc/src/snippets/code/doc_src_qt4-tulip.cpp delete mode 100644 doc/src/snippets/code/doc_src_qt4-tulip.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtcore.cpp delete mode 100644 doc/src/snippets/code/doc_src_qtcore.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtdbus.cpp create mode 100644 doc/src/snippets/code/doc_src_qtdbus.pro delete mode 100644 doc/src/snippets/code/doc_src_qtdbus.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtdesigner.cpp create mode 100644 doc/src/snippets/code/doc_src_qtdesigner.pro delete mode 100644 doc/src/snippets/code/doc_src_qtdesigner.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtestevent.cpp delete mode 100644 doc/src/snippets/code/doc_src_qtestevent.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtestlib.cpp create mode 100644 doc/src/snippets/code/doc_src_qtestlib.pro create mode 100644 doc/src/snippets/code/doc_src_qtgui.pro delete mode 100644 doc/src/snippets/code/doc_src_qtgui.qdoc create mode 100644 doc/src/snippets/code/doc_src_qthelp.cpp create mode 100644 doc/src/snippets/code/doc_src_qtmultimedia.cpp create mode 100644 doc/src/snippets/code/doc_src_qtmultimedia.pro delete mode 100644 doc/src/snippets/code/doc_src_qtmultimedia.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtnetwork.cpp create mode 100644 doc/src/snippets/code/doc_src_qtnetwork.pro delete mode 100644 doc/src/snippets/code/doc_src_qtnetwork.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtopengl.cpp create mode 100644 doc/src/snippets/code/doc_src_qtopengl.pro delete mode 100644 doc/src/snippets/code/doc_src_qtopengl.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtscript.cpp create mode 100644 doc/src/snippets/code/doc_src_qtscript.js create mode 100644 doc/src/snippets/code/doc_src_qtscript.pro create mode 100644 doc/src/snippets/code/doc_src_qtscriptextensions.js delete mode 100644 doc/src/snippets/code/doc_src_qtscriptextensions.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtscripttools.cpp create mode 100644 doc/src/snippets/code/doc_src_qtsql.cpp create mode 100644 doc/src/snippets/code/doc_src_qtsql.pro delete mode 100644 doc/src/snippets/code/doc_src_qtsql.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtsvg.cpp create mode 100644 doc/src/snippets/code/doc_src_qtsvg.pro delete mode 100644 doc/src/snippets/code/doc_src_qtsvg.qdoc create mode 100644 doc/src/snippets/code/doc_src_qttest.cpp create mode 100644 doc/src/snippets/code/doc_src_qttest.pro delete mode 100644 doc/src/snippets/code/doc_src_qttest.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtuiloader.cpp create mode 100644 doc/src/snippets/code/doc_src_qtuiloader.pro delete mode 100644 doc/src/snippets/code/doc_src_qtuiloader.qdoc create mode 100644 doc/src/snippets/code/doc_src_qtxml.cpp create mode 100644 doc/src/snippets/code/doc_src_qtxml.pro create mode 100644 doc/src/snippets/code/doc_src_qtxmlpatterns.cpp create mode 100644 doc/src/snippets/code/doc_src_qtxmlpatterns.pro create mode 100644 doc/src/snippets/code/doc_src_qvarlengtharray.cpp delete mode 100644 doc/src/snippets/code/doc_src_qvarlengtharray.qdoc create mode 100644 doc/src/snippets/code/doc_src_resources.cpp create mode 100644 doc/src/snippets/code/doc_src_richtext.cpp create mode 100644 doc/src/snippets/code/doc_src_sql-driver.cpp create mode 100644 doc/src/snippets/code/doc_src_styles.cpp delete mode 100644 doc/src/snippets/code/doc_src_styles.qdoc create mode 100644 doc/src/snippets/code/doc_src_unicode.cpp delete mode 100644 doc/src/snippets/code/doc_src_unicode.qdoc create mode 100644 doc/src/snippets/code/doc_src_unix-signal-handlers.cpp delete mode 100644 doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc create mode 100644 doc/src/snippets/code/doc_src_wince-customization.cpp diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc index c9f7a66..95e20dd 100644 --- a/doc/src/classes/phonon-api.qdoc +++ b/doc/src/classes/phonon-api.qdoc @@ -691,11 +691,11 @@ Example where data is written repeatedly. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 0 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 0 Example where data is written once: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 1 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 1 \sa Phonon::MediaSource, Phonon::MediaObject @@ -811,7 +811,7 @@ The function is necessary for the case where a non-seekable MediaStream is played more than once. For a seekable stream the implementation can simply call - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 2 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 2 \sa writeData(), needData() */ @@ -1003,7 +1003,7 @@ send an URL or filename directly to the constructors of the \l{Phonon::}{MediaObject}. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 3 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 3 A MediaSource object cannot be reused for another multimedia source. It is possible to play the same source again, and also @@ -1382,7 +1382,7 @@ immediately after you call the play() function. A play and forget code example: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 4 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 4 \sa {Phonon Module}, MediaObject */ @@ -1471,7 +1471,7 @@ If you need low latency between calling play() and the sound actually starting to play on your output device you need to use MediaObject and be able to set the URL before calling play(). Note that - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 5 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 5 doesn't make a difference: the application should be idle between the load and play calls so that the backend can start preloading the media and fill audio buffers. @@ -1612,13 +1612,13 @@ queue; the new source is then removed from the queue. The queue can be altered at any time. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 7 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 7 You can also make use of the \l{Phonon::MediaObject::}{aboutToFinish()} signal, which is guaranteed to be emitted in time for altering the queue. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 8 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 8 When playback is finishing, i.e., when a media source has been played to the end and the queue is empty, several signals are @@ -1715,9 +1715,9 @@ \warning The back-end is free to choose a different tick interval close to what you asked for. This means that the following code \c may fail: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 9 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 9 On the other hand the following is guaranteed: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 10 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 10 \sa tick() */ @@ -1745,7 +1745,7 @@ media object gets a new source. Listen to the hasVideoChanged() signal instead. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 11 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 11 Returns \c true if the media contains video data; otherwise, returns \c false. @@ -1763,7 +1763,7 @@ media object gets a new media source. The hasVideoChanged() signal is emitted after this information is available. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 12 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 12 Returns \c true if the current media may be seeked; otherwise, returns \c false. @@ -1786,7 +1786,7 @@ A typical usage looks like this: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 13 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 13 */ /*! @@ -1867,7 +1867,7 @@ We show an example: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 14 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 14 \sa currentSource(), MediaSource */ @@ -2126,7 +2126,7 @@ You can use this signal to show a progress bar to the user when in BufferingState: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 15 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 15 Note that the \l{Phonon::}{BufferingState} is commonly used when waiting for data over a network connection, but this might not be @@ -2270,7 +2270,7 @@ happen if the user has requested a backend change. To connect to this signal do the following: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 16 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 16 \sa Notifier::capabilitiesChanged() */ @@ -2362,10 +2362,10 @@ An example use case would be to give the user a QComboBox to select the output device: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 17 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 17 And to retrieve the selected AudioOutputDevice: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 18 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 18 */ @@ -2565,7 +2565,7 @@ In order to use an effect, insert it into the path as follows: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 19 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 19 The effect will immediately begin applying it's transformations on the path. To stop it, remove the Effect from the path. @@ -3108,7 +3108,7 @@ The following code example shows how to create a path between two media nodes and insert an effect on that path. - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 20 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 20 \sa Phonon::MediaNode, Phonon::MediaObject, Phonon::AudioOutput, Phonon::VideoWidget, {Phonon Module} @@ -4085,7 +4085,7 @@ A typical example of usage follows below: - \snippet doc/src/snippets/code/doc_src_phonon-api.qdoc 21 + \snippet doc/src/snippets/code/doc_src_phonon-api.cpp 21 \sa {Phonon Module} */ diff --git a/doc/src/deployment/deployment-plugins.qdoc b/doc/src/deployment/deployment-plugins.qdoc index 12a3b0c..03685e5 100644 --- a/doc/src/deployment/deployment-plugins.qdoc +++ b/doc/src/deployment/deployment-plugins.qdoc @@ -104,7 +104,7 @@ plugins to be built in release mode, add the following line to the plugin's project file: - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 3 + \snippet doc/src/snippets/code/doc_src_plugins-howto.pro 3 This will ensure that the plugin is compatible with the version of the library used in the application. diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index bc80ed3..50f873f 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -336,7 +336,7 @@ are many ways to solve this: \list - + \o You can install the Qt libraries in one of the system library paths (e.g. \c /usr/lib on most systems). @@ -345,7 +345,7 @@ linker to look in this directory when starting your application. \o You can write a startup script for your application, where you - modify the dynamic linker configuration (e.g. adding your + modify the dynamic linker configuration (e.g., adding your application's directory to the \c LD_LIBRARY_PATH environment variable. \note If your application will be running with "Set user ID on execution," and if it will be owned by root, then @@ -375,7 +375,7 @@ \c plugins directory, or you can set the \c DESTDIR in the plugins' project files: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 8 + \snippet doc/src/snippets/code/doc_src_deployment.pro 8 An archive distributing all the Qt libraries, and all the plugins, required to run the \l {tools/plugandpaint}{Plug & Paint} @@ -422,7 +422,7 @@ application using QApplication::addLibraryPath() or QApplication::setLibraryPaths(). - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 9 + \snippet doc/src/snippets/code/doc_src_deployment.cpp 9 \section1 Application Dependencies @@ -718,7 +718,7 @@ using QApplication::addLibraryPath() or QApplication::setLibraryPaths(). - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 19 + \snippet doc/src/snippets/code/doc_src_deployment.cpp 19 One benefit of using plugins is that they can easily be made available to a whole family of applications. @@ -753,7 +753,7 @@ To use the options, add - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 21 + \snippet doc/src/snippets/code/doc_src_deployment.pro 21 to your .pro file. The \c embed_manifest_dll option is enabled by default. The \c embed_manifest_exe option is NOT enabled by default. @@ -965,7 +965,7 @@ command line application on Unix and Windows. You probably don't want to run it in a bundle: Add this to your application's .pro: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 26 + \snippet doc/src/snippets/code/doc_src_deployment.pro 26 This will tell \c qmake not to put the executable inside a bundle. Please refer to the \l{Deploying an Application on @@ -1249,7 +1249,7 @@ to look for the new plugins. After constructing the QApplication, we add the following code: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 49 + \snippet doc/src/snippets/code/doc_src_deployment.cpp 49 First, we tell the application to only look for plugins in this directory. In our case, this is what we want since we only want to @@ -1366,7 +1366,7 @@ variable to get \e{weak linking} to work for your application. You can add: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 51 + \snippet doc/src/snippets/code/doc_src_deployment.pro 51 to your .pro file, and qmake will take care of this for you. @@ -1416,7 +1416,7 @@ add both to the \c CONFIG line. PowerPC users also need an SDK. For example: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 53 + \snippet doc/src/snippets/code/doc_src_deployment.pro 53 Besides \c lipo, you can also check your binaries with the \c file(1) command line tool or the Finder. @@ -1513,12 +1513,12 @@ First, we will change the vendor statement to something more meaningful. The application vendor is visible to end-user during the installation. - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 56 + \snippet doc/src/snippets/code/doc_src_deployment.pro 56 Second we will tell the Symbian application installer that this application supports only S60 5.0 based devices: - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 57 + \snippet doc/src/snippets/code/doc_src_deployment.pro 57 You can find a list of platform and device indentification codes from \l {http://wiki.forum.nokia.com/index.php/S60_Platform_and_device_identification_codes}{Forum Nokia Wiki}. diff --git a/doc/src/development/activeqt-dumpcpp.qdoc b/doc/src/development/activeqt-dumpcpp.qdoc index 504b3b4..54581e1 100644 --- a/doc/src/development/activeqt-dumpcpp.qdoc +++ b/doc/src/development/activeqt-dumpcpp.qdoc @@ -83,24 +83,24 @@ as \c noncreatable) have a default constructor; this is typically a single class of type \c Application. - \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 0 + \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 0 All other classes can only be created by passing an IDispatch interface pointer to the constructor; those classes should however not be created explicitly. Instead, use the appropriate API of already created objects. - \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 1 + \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 1 All coclass wrappers also have one constructors taking an interface wrapper class for each interface implemented. - \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 2 + \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 2 You have to create coclasses to be able to connect to signals of the subobject. Note that the constructor deletes the interface object, so the following will cause a segmentation fault: - \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 3 + \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 3 If the return type is of a coclass or interface type declared in another type library you have to include the namespace header for that other type library @@ -115,7 +115,7 @@ In this case, create the correct wrapper class explicitly: - \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc 4 + \snippet doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp 4 You can of course use the IDispatch* returned directly, in which case you have to call \c Release() when finished with the interface. diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index 8d3c667..1ed99db 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -676,13 +676,13 @@ The following example shows how this can be done: - \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 2 + \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 2 Once \QA is running, you can send commands by using the stdin channel of the process. The code snippet below shows how to tell \QA to show a certain page in the documentation. - \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 3 + \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 3 Note that the trailing newline character is required to mark the end of the input. @@ -745,7 +745,7 @@ instead of one line for every command. The commands have to be separated by a semicolon, as shown in the following example: - \snippet doc/src/snippets/code/doc_src_assistant-manual.qdoc 4 + \snippet doc/src/snippets/code/doc_src_assistant-manual.cpp 4 \section1 Compatibility with Old Formats diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc index 044ad0d..1669b00 100644 --- a/doc/src/development/debug.qdoc +++ b/doc/src/development/debug.qdoc @@ -142,7 +142,7 @@ If you include the header file, the \c qDebug() function can also be used as an output stream. For example: - \snippet doc/src/snippets/code/doc_src_debug.qdoc 0 + \snippet doc/src/snippets/code/doc_src_debug.cpp 0 The Qt implementation of these functions prints the text to the \c stderr output under Unix/X11 and Mac OS X. With Windows, if it @@ -199,14 +199,14 @@ These macros are useful for detecting program errors, e.g. like this: - \snippet doc/src/snippets/code/doc_src_debug.qdoc 1 + \snippet doc/src/snippets/code/doc_src_debug.cpp 1 Q_ASSERT(), Q_ASSERT_X(), and Q_CHECK_PTR() expand to nothing if \c QT_NO_DEBUG is defined during compilation. For this reason, the arguments to these macro should not have any side-effects. Here is an incorrect usage of Q_CHECK_PTR(): - \snippet doc/src/snippets/code/doc_src_debug.qdoc 2 + \snippet doc/src/snippets/code/doc_src_debug.cpp 2 If this code is compiled with \c QT_NO_DEBUG defined, the code in the Q_CHECK_PTR() expression is not executed and \e alloc returns diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index 9a6220f..d347c0f 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -2044,7 +2044,7 @@ pixmap property in the property editor. project file, ensuring that the application is compiled and linked appropriately. - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 0 + \snippet doc/src/snippets/code/doc_src_designer-manual.pro 0 The QUiLoader class provides a form loader object to construct the user interface. This user interface can be retrieved from any QIODevice, e.g., @@ -2054,7 +2054,7 @@ pixmap property in the property editor. The QtUiTools module classes can be included using the following directive: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 1 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 1 The QUiLoader::load() function is invoked as shown in this code from the \l{Text Finder Example}{Text Finder} example: @@ -2126,7 +2126,7 @@ pixmap property in the property editor. \c setupUi() function to do this, so we only need to declare and implement a slot with a name that follows a standard convention: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 2 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 2 Using this convention, we can define and implement a slot that responds to mouse clicks on the \gui OK button: @@ -2588,7 +2588,7 @@ pixmap property in the property editor. plugins are also built in release mode. To do this, include the following declaration in the plugin's \c{.pro} file: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 3 + \snippet doc/src/snippets/code/doc_src_designer-manual.pro 3 If plugins are built in a mode that is incompatible with \QD, they will not be loaded and installed. For more information about plugins, see the @@ -2597,7 +2597,7 @@ pixmap property in the property editor. It is also necessary to ensure that the plugin is installed together with other \QD widget plugins: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 4 + \snippet doc/src/snippets/code/doc_src_designer-manual.pro 4 The \c $[QT_INSTALL_PLUGINS] variable is a placeholder to the location of the installed Qt plugins. You can configure \QD to look for plugins in @@ -2756,7 +2756,7 @@ pixmap property in the property editor. using the Q_INTERFACES() macro in the extension class's definition. For example: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 7 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 7 This enables \QD to use the qobject_cast() function to query for supported interfaces using a QObject pointer only. @@ -2791,13 +2791,13 @@ pixmap property in the property editor. You can either create a new QExtensionFactory and reimplement the QExtensionFactory::createExtension() function: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 8 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 8 or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to enable the factory to create your custom extension as well: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 9 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 9 \section2 Accessing Qt Designer's Extension Manager @@ -2809,7 +2809,7 @@ pixmap property in the property editor. an extension factory is typically made in the QDesignerCustomWidgetInterface::initialize() function: - \snippet doc/src/snippets/code/doc_src_designer-manual.qdoc 10 + \snippet doc/src/snippets/code/doc_src_designer-manual.cpp 10 The \c formEditor parameter in the QDesignerCustomWidgetInterface::initialize() function is a pointer to \QD's diff --git a/doc/src/development/moc.qdoc b/doc/src/development/moc.qdoc index fc0165b..5d524b2 100644 --- a/doc/src/development/moc.qdoc +++ b/doc/src/development/moc.qdoc @@ -136,7 +136,7 @@ This guarantees that make will run the moc before it compiles \c foo.cpp. You can then put - \snippet doc/src/snippets/code/doc_src_moc.qdoc 3 + \snippet doc/src/snippets/code/doc_src_moc.cpp 3 at the end of \c foo.cpp, where all the classes declared in that file are fully known. @@ -223,7 +223,7 @@ file. \c moc defines the preprocessor symbol \c Q_MOC_RUN. Any code surrounded by - \snippet doc/src/snippets/code/doc_src_moc.qdoc 4 + \snippet doc/src/snippets/code/doc_src_moc.cpp 4 is skipped by the \c moc. @@ -245,7 +245,7 @@ \c moc does not handle all of C++. The main problem is that class templates cannot have signals or slots. Here is an example: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 5 + \snippet doc/src/snippets/code/doc_src_moc.cpp 5 Another limitation is that moc does not expand macros, so you for example cannot use a macro to declare a signal/slot @@ -261,7 +261,7 @@ first inherited class is a subclass of QObject. Also, be sure that only the first inherited class is a QObject. - \snippet doc/src/snippets/code/doc_src_moc.qdoc 6 + \snippet doc/src/snippets/code/doc_src_moc.cpp 6 Virtual inheritance with QObject is \e not supported. @@ -271,11 +271,11 @@ signal or slot parameters, we think inheritance is a better alternative. Here is an example of illegal syntax: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 7 + \snippet doc/src/snippets/code/doc_src_moc.cpp 7 You can work around this restriction like this: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 8 + \snippet doc/src/snippets/code/doc_src_moc.cpp 8 It may sometimes be even better to replace the function pointer with inheritance and virtual functions. @@ -289,7 +289,7 @@ fully qualify the data types when declaring signals and slots, and when establishing connections. For example: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 9 + \snippet doc/src/snippets/code/doc_src_moc.cpp 9 \section2 Type Macros Cannot Be Used for Signal and Slot Parameters @@ -297,7 +297,7 @@ an argument will not work in signals and slots. Here is an illegal example: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 10 + \snippet doc/src/snippets/code/doc_src_moc.cpp 10 A macro without parameters will work. @@ -305,7 +305,7 @@ Here's an example of the offending construct: - \snippet doc/src/snippets/code/doc_src_moc.qdoc 11 + \snippet doc/src/snippets/code/doc_src_moc.cpp 11 \section2 Signal/Slot return types cannot be references diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 9a46ea8..da105e6 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -383,7 +383,7 @@ \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be invoked in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 0 Adding the \c build_all option to the \c CONFIG variable makes this rule the default when building the project, and installation targets will be @@ -426,7 +426,7 @@ build it as a multi-threaded application in \c debug mode, your project file will contain the following line: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 1 Note, that you must use "+=", not "=", or \l {qmake}{ \c qmake} will not be able to use Qt's configuration to determine the settings needed for your project. @@ -439,21 +439,21 @@ variable which can be used to declare the required extension modules. For example, we can enable the XML and network modules in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 2 Note that \c QT includes the \c core and \c gui modules by default, so the above declaration \e adds the network and XML modules to this default list. The following assignment \e omits the default modules, and will lead to errors when the application's source code is being compiled: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 3 If you want to build a project \e without the \c gui module, you need to exclude it with the "-=" operator. By default, \c QT contains both \c core and \c gui, so the following line will result in a minimal Qt project being built: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 4 The table below shows the options that can be used with the \c QT variable and the features that are associated with each of them: @@ -489,7 +489,7 @@ \l{http://www.freedesktop.org/wiki/Software_2fpkgconfig}{pkg-config}, such as the D-Bus and ogg libraries, with the following lines: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 5 More information about features can be found in the \l{qmake Advanced Usage#Adding New Configuration Features} @@ -509,7 +509,7 @@ For example, the following lines show how a library can be specified: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 6 The paths containing header files can also be specified in a similar way using the \l{qmake Variable Reference#INCLUDEPATH}{INCLUDEPATH} variable. @@ -517,7 +517,7 @@ For example, it is possible to add several paths to be searched for header files: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 7 */ /*! @@ -542,7 +542,7 @@ The syntax used to run \l {qmake}{ \c qmake} takes the following simple form: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 8 \l {qmake}{ \c qmake} supports two different modes of operation: In the default mode, \l {qmake}{ \c qmake} will use the description in a project file to generate a Makefile, @@ -641,7 +641,7 @@ \target MakefileMode \section2 Makefile Mode Options - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 9 In Makefile mode, \l {qmake}{ \c qmake} will generate a Makefile that is used to build the project. Additionally, the following options may be used in this mode to @@ -666,13 +666,13 @@ You may also pass \l {qmake}{ \c qmake} assignments on the command line; they will be processed before all of the files specified. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 10 This will generate a Makefile, from test.pro with Unix pathnames. However many of the specified options aren't necessary as they are the default. Therefore, the line can be simplified on Unix to: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 11 If you are certain you want your variables processed after the files specified, then you may pass the \c -after option. When this @@ -682,7 +682,7 @@ \target ProjectMode \section2 Project Mode Options - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 12 In project mode, \l {qmake}{ \c qmake} will generate a project file. Additionally, you may supply the following options in this mode: @@ -740,7 +740,7 @@ create a Makefile in a project directory with the following command line invocation: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 13 \section2 Using Frameworks @@ -753,13 +753,13 @@ \l{qmake Variable Reference#QMAKE_LFLAGS}{QMAKE_LFLAGS} variable, as shown in the following example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 14 The framework itself is linked in by appending the \c{-framework} options and the name of the framework to the \l{qmake Variable Reference#LIBS}{LIBS} variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 15 \section2 Creating Frameworks @@ -771,7 +771,7 @@ \c lib_bundle option to the \l{qmake Variable Reference#CONFIG}{CONFIG} variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 16 The data associated with the library is specified using the \l{qmake Variable Reference#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} @@ -779,7 +779,7 @@ bundle, and is often used to specify a collection of header files, as in the following example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 17 Here, the \c FRAMEWORK_HEADERS variable is a user-defined variable that is used to define the headers required to use a particular framework. @@ -807,7 +807,7 @@ following assignment causes \l {qmake}{ \c qmake} to generate build rules to create a universal binary for both PowerPC and x86 architectures: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 18 Additionally, developers using a PowerPC-based platform need to set the \l{qmake Variable Reference#QMAKE_MAC_SDK}{QMAKE_MAC_SDK} variable. @@ -822,7 +822,7 @@ by running \l {qmake}{ \c qmake} to generate an Xcode project from an existing \l {qmake}{ \c qmake} project files. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 19 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 19 Note that, if a project is later moved on the disk, \l {qmake}{ \c qmake} must be run again to process the project file and create a new Xcode project file. @@ -872,12 +872,12 @@ This can also be set using a command line option, for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 20 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 20 It is possible to recursively generate \c{.vcproj} files in subdirectories and a \c{.sln} file in the main directory, by typing: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 21 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 21 Each time you update the project file, you need to run \l {qmake}{ \c qmake} to generate an updated Visual Studio project. @@ -896,12 +896,12 @@ the following assignment to the \l{qmake Variable Reference#CONFIG} {CONFIG} variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 22 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 22 Also, the manifest embedding for DLLs can be removed with the following assignment to the \l{qmake Variable Reference#CONFIG}{CONFIG} variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 23 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 23 This is discussed in more detail in the \l{Deploying an Application on Windows#Visual Studio 2005 Onwards} @@ -922,7 +922,7 @@ To specify that static data support is desired, add this to the project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 129 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 129 The default value is zero. @@ -938,7 +938,7 @@ prevents the application from starting if that amount of memory is not available. The minimum and maximum values are separated by a space. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 130 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 130 The default values depend on the version of the Symbian SDK you're using, however, the Qt toolchain sets this to the maximum possible value and this @@ -954,7 +954,7 @@ Here is an example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 131 \section2 Unique identifiers @@ -964,7 +964,7 @@ There are four available types of IDs supported: \c UID2, \c UID3, \c SID, and \c VID. They are specified like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 132 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 132 If \c SID is not specified, it defaults to the same value as \c UID3. If \c UID3 is not specified, qmake will automatically generate a \c UID3 @@ -988,13 +988,13 @@ ability to list all files on the file system. Capabilities are defined in the project file like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 133 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 133 It is also possible to specify which capabilities \e not to have, by first specifying \c ALL and then list the unwanted capabilities with a minus in front of them, like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 134 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 134 For more information about capabilities, please refer to the Symbian SDK documentation. */ @@ -1098,7 +1098,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 152 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 152 This will add the specified statements to the \c prj_exports section of the generated \c bld.inf file. @@ -1108,7 +1108,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 143 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 143 Any rules you define will be added after automatically generated rules in each section. @@ -1157,7 +1157,7 @@ \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be invoked in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 24 When linking a library, \l {qmake}{ \c qmake} relies on the underlying platform to know what other libraries this library links against. However, if linking @@ -1192,7 +1192,7 @@ will be set for each of these mode, and you can test for this to perform build-specific tasks. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 25 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 25 As a result, it may be useful to define mode-specific variables, such as \l{#QMAKE_LFLAGS_RELEASE}{QMAKE_LFLAGS_RELEASE}, instead of general @@ -1319,7 +1319,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 26 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 26 \target DEFINES \section1 DEFINES @@ -1329,7 +1329,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 27 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 27 \target DEF_FILE \section1 DEF_FILE @@ -1363,7 +1363,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 28 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 28 This will upload all PNG images in \c path to the same directory your build target will be deployed to. @@ -1379,7 +1379,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 29 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 29 \note In Windows CE all linked Qt libraries will be deployed to the path specified by \c{myFiles.path}. On Symbian platform all libraries and executables @@ -1398,7 +1398,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 128 On the Symbian platform, generic PKG file content can also be specified with this variable. You can use either \c pkg_prerules or \c pkg_postrules to @@ -1414,7 +1414,7 @@ For example, to deploy DLL and add a new dependency: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 140 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 140 Please note that \c pkg_prerules can also replace default statements in pkg file. If no pkg_prerules is defined, qmake makes sure that PKG file @@ -1448,7 +1448,7 @@ targeted to only one of above files by appending listed rules suffix to the variable name: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 153 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 153 On the Symbian platform, the \c default_deployment item specifies default platform and package dependencies. Those dependencies can be @@ -1465,7 +1465,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 141 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 141 On the Symbian platform, a default deployment is generated for all application projects. You can modify the autogenerated default @@ -1479,7 +1479,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 154 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 154 This will entirely remove the default application deployment. @@ -1489,7 +1489,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 155 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 155 This will show a message box that gives user an option to cancel the installation and then automatically runs the application after @@ -1505,19 +1505,19 @@ Often the default is not optimal for displaying to end user. To set a better display name for these purposes, use \c{DEPLOYMENT.display_name} variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 156 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 156 On the Symbian platform, you can use \c{DEPLOYMENT.installer_header} variable to generate smart installer wrapper for your application. If you specify just UID of the installer package as the value, then installer package name and version will be autogenerated: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 146 If autogenerated values are not suitable, you can also specify the sis header yourself using this variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 147 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 147 \target DEPLOYMENT_PLUGIN \section1 DEPLOYMENT_PLUGIN @@ -1538,7 +1538,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 142 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 142 This will upload the jpeg imageformat plugin to the plugins directory on the Windows CE device. @@ -1550,7 +1550,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 30 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 30 \target DESTDIR_TARGET \section1 DESTDIR_TARGET @@ -1573,7 +1573,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 31 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 31 \target DSP_TEMPLATE \section1 DSP_TEMPLATE @@ -1593,7 +1593,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 32 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 32 If FORMS3 is defined in your project, then this variable must contain forms for uic, and not uic3. If CONFIG contains uic3, and FORMS3 is not @@ -1609,7 +1609,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 33 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 33 \target GUID \section1 GUID @@ -1635,7 +1635,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 34 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 34 See also \l{#SOURCES}{SOURCES}. @@ -1655,7 +1655,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 35 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 35 To specify a path containing spaces, quote the path using the technique mentioned in the \l{qmake Project Files#Whitespace}{qmake Project Files} @@ -1677,7 +1677,7 @@ build target will be installed, and the \c INSTALLS assignment adds the build target to the list of existing resources to be installed: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 36 Note that \l {qmake}{ \c qmake} will skip files that are executable. If you need to install executable files, you can unset the files' executable flags. @@ -1705,7 +1705,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 37 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 37 \target LIBS \section1 LIBS @@ -1719,7 +1719,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 38 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 38 To specify a path containing spaces, quote the path using the technique mentioned in the \l{qmake Project Files#Whitespace}{qmake Project Files} @@ -1749,7 +1749,7 @@ unique names before it is used. To change this behavior, add the \c no_lflags_merge option to the \c CONFIG variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 39 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 39 \target LITERAL_HASH \section1 LITERAL_HASH @@ -1791,7 +1791,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 137 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 137 This will add the specified statement to the end of the generated MMP file. @@ -1800,20 +1800,20 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 138 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 138 If you need to include a hash (\c{#}) character inside the \c MMP_RULES statement, it can be done with the variable \c LITERAL_HASH as follows: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 139 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 139 There is also a convenience function for adding conditional rules called \c{addMMPRules}. Suppose you need certain functionality to require different library depending on architecture. This can be specified with \c{addMMPRules} as follows: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 148 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 148 \note You should not use this variable to add MMP statements that are explicitly supported by their own variables, such as @@ -1828,7 +1828,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 40 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 40 \target OBJECTS \section1 OBJECTS @@ -1847,7 +1847,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 41 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 41 \target OBJMOC \section1 OBJMOC @@ -1937,7 +1937,7 @@ variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. Use the following instead: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 42 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 42 \target QMAKE_APP_OR_DLL \section1 QMAKE_APP_OR_DLL @@ -1967,7 +1967,7 @@ and \c path/to/header_two.h to a group containing information about the headers supplied with the framework: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 43 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 43 The last line adds the information about the headers to the collection of resources that will be installed with the library bundle. @@ -1989,7 +1989,7 @@ For example, the following definition will result in a framework with the \c{.myframework} extension: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 44 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 44 \e{This is used on Mac OS X only.} @@ -2116,7 +2116,7 @@ architecture specific options to each compiler in the Symbian build system. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 131 For more information, see \l{qmake Platform Notes#Compiler specific options}{qmake Platform Notes}. @@ -2795,7 +2795,7 @@ \c{-compress} options are used with particular values each time that \c rcc is invoked: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 45 \section1 QMAKE_RPATH @@ -2850,7 +2850,7 @@ It can be used to specify arguments to uic as well, such as additional plugin paths. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 46 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 46 \section1 QT @@ -2881,7 +2881,7 @@ exclude the \c gui value with the "-=" operator; the following line will result in a minimal Qt project being built: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 47 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 47 Note that adding the \c opengl option to the \c QT variable automatically causes the equivalent option to be added to the \c CONFIG variable. @@ -2928,7 +2928,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 48 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 48 \target REQUIRES \section1 REQUIRES @@ -2963,7 +2963,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 144 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 144 This will add the specified statement to the end of the \c APP_REGISTRATION_INFO resource struct in the generated registration resource file. @@ -2974,7 +2974,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 145 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 145 This example will install the application to MyFolder in the Symbian platform application shell. In addition it will make the application to @@ -3006,7 +3006,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 151 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 151 This example will define service information for a fictional service that requires an icon to be supplied via the \c opaque_data of the service information. @@ -3035,7 +3035,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 49 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 49 See also \l{#HEADERS}{HEADERS} @@ -3057,7 +3057,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 50 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 50 It is essential that the project file in each subdirectory has the same name as the subdirectory itself, so that \l {qmake}{ \c qmake}can find it. @@ -3068,7 +3068,7 @@ which they are specified, update the \l{#CONFIG}{CONFIG} variable to include the \c ordered option: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 51 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 51 It is possible to modify this default behavior of \c SUBDIRS by giving additional modifiers to \c SUBDIRS elements. Supported modifiers are: @@ -3092,11 +3092,11 @@ For example, define two subdirectories, both of which reside in a different directory than the \c SUBDIRS value, and one of the subdirectories must be built before the other: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 149 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 149 For example, define a subdirectory that is only build for emulator builds in Qt for Symbian: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 150 \target SYMBIAN_VERSION \section1 SYMBIAN_VERSION @@ -3112,7 +3112,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 52 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 52 The project file above would produce an executable named \c myapp on unix and 'myapp.exe' on windows. @@ -3142,7 +3142,7 @@ will refuse to run if the minimum size is not available when it starts. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 135 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 135 \target TARGET.EPOCSTACKSIZE \section1 TARGET.EPOCSTACKSIZE @@ -3151,7 +3151,7 @@ Specifies the maximum stack size of the application. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 136 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 136 \target TARGET.SID \section1 TARGET.SID @@ -3232,7 +3232,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 53 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 53 The template can be overridden by specifying a new template type with the \c -t command line option. This overrides the template type \e after the .pro @@ -3271,7 +3271,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 54 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 54 \target UI_HEADERS_DIR \section1 UI_HEADERS_DIR @@ -3281,7 +3281,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 55 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 55 \target UI_SOURCES_DIR \section1 UI_SOURCES_DIR @@ -3291,7 +3291,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 56 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 56 \target VERSION \section1 VERSION @@ -3302,7 +3302,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 57 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 57 \section1 VER_MAJ @@ -3350,7 +3350,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 58 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 58 \section1 _PRO_FILE_ @@ -3394,7 +3394,7 @@ Returns the basename of the file specified. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 59 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 59 \section1 CONFIG(config) [Conditional] @@ -3407,7 +3407,7 @@ mutually exclusive values) a second parameter can be used to specify a set of values to consider. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 60 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 60 Because release is considered the active setting (for feature parsing) it will be the CONFIG used to generate the build file. In the common @@ -3423,7 +3423,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 61 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 61 The contents of the scope are only processed if the \c drivers variable contains the value, \c network. If this is the case, the @@ -3456,7 +3456,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 62 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 62 \section1 eval(string) [Conditional] @@ -3481,7 +3481,7 @@ succeeds if any file matches the regular expression specified. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 63 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 63 Note that "/" can be used as a directory separator, regardless of the platform in use. @@ -3491,7 +3491,7 @@ Places all the values in \e variablename that match \e substr. \e substr may be a regular expression, and will be matched accordingly. - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 64 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 64 MY_VAR2 will contain '-Lone -Ltwo -Lthree -Lfour -Lfive', and MY_VAR3 will contains 'three two three'. @@ -3508,7 +3508,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 65 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 65 \section1 include(filename) [Conditional] @@ -3521,7 +3521,7 @@ You can check whether the file was included by using this function as the condition for a scope; for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 66 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 66 \section1 infile(filename, var, val) [Conditional] @@ -3539,7 +3539,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 67 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 67 \section1 join(variablename, glue, before, after) @@ -3563,7 +3563,7 @@ This function simply writes a message to the console. Unlike the \c error() function, this function allows processing to continue. - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 68 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 68 The above line causes "This is a message" to be written to the console. The use of quotation marks is optional. @@ -3574,7 +3574,7 @@ \l{qmake Advanced Usage}{in conjunction with a scope} to filter out messages during builds; for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 69 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 69 \section1 prompt(question) @@ -3598,7 +3598,7 @@ prints the message: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 70 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 70 \section1 sprintf(string, arguments...) @@ -3614,13 +3614,13 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 71 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 71 Alternatively, you can use this function to obtain stdout and stderr from the command, and assign it to a variable. For example, you can use this to interrogate information about the platform: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 72 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 72 \target unique \section1 unique(variablename) @@ -3628,7 +3628,7 @@ This will return a list of values in variable that are unique (that is with repetitive entries removed). For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 73 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 73 \section1 warning(string) @@ -3652,14 +3652,14 @@ \c set a variable in qmake once, and each time qmake is invoked this value can be queried. Use the following to set a property in qmake: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 74 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 74 The appropriate variable and value should be substituted for \c VARIABLE and \c VALUE. To retrieve this information back from qmake you can do: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 75 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 75 \note \c{qmake -query} will only list variables that you have previously set with \c{qmake -set VARIABLE VALUE}. @@ -3673,13 +3673,13 @@ variable if you prefix that version of \l {qmake}{ \c qmake}to \c VARIABLE, as in the following example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 76 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 76 \l {qmake}{ \c qmake}also has the notion of \c builtin properties, for example you can query the installation of Qt for this version of \l {qmake}{ \c qmake}with the \c QT_INSTALL_PREFIX property: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 77 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 77 These built-in properties cannot have a version prefixed to them as they are not versioned, and each version of \l {qmake}{ \c qmake}will have its own @@ -3695,7 +3695,7 @@ Finally, these values can be queried in a project file with a special notation such as: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 78 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 78 \target QMAKESPEC \section1 QMAKESPEC @@ -3731,7 +3731,7 @@ For example, a collection of documentation files can be described in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 79 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 79 The \c path member informs \l {qmake}{ \c qmake}that the files should be installed in \c /usr/local/program/doc (the path member), and the \c files member @@ -3742,7 +3742,7 @@ Once an install set has been fully described, you can append it to the install list with a line like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 80 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 80 \l {qmake}{ \c qmake}will ensure that the specified files are copied to the installation directory. If you require greater control over this process, you can also @@ -3750,7 +3750,7 @@ the following line tells \l {qmake}{ \c qmake}to execute a series of commands for this install set: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 81 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 81 The \c unix scope (see \l{qmake Advanced Usage#Scopes and Conditions}{Scopes and Conditions}) @@ -3766,7 +3766,7 @@ be copied for you. Currently, the only supported built-in install set is \c target: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 82 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 82 In the above lines, \l {qmake}{ \c qmake}knows what needs to be copied, and will handle the installation process automatically. @@ -3800,7 +3800,7 @@ The first step is to enable dependency tracking in the library itself. To do this you must tell \l {qmake}{ \c qmake}to save information about the library: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 83 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 83 This is only relevant to the \c lib template, and will be ignored for all others. When this option is enabled, \l {qmake}{ \c qmake}will create a file @@ -3816,7 +3816,7 @@ The second step in this process is to enable reading of this meta information in the applications that use the static library: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 84 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 84 When this is enabled, \l {qmake}{ \c qmake}will process all libraries linked to by the application and find their meta-information. \l {qmake}{ \c qmake}will use @@ -3843,7 +3843,7 @@ used for \l moc files can be redefined with the following assignment in a project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 85 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 85 The following variables can be used to redefine common file extensions recognized by \c qmake: @@ -3882,7 +3882,7 @@ API as found in other places in \c qmake. Objects are defined automatically by specifying their members; for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 86 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 86 The definitions above define a \l {qmake}{ \c qmake}target called \c mytarget, containing a Makefile target called \c{.buildfile} which in turn is generated with @@ -3893,7 +3893,7 @@ The final step is to instruct \l {qmake}{ \c qmake}that this object is a target to be built: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 87 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 87 This is all you need to do to actually build custom targets. Of course, you may want to tie one of these targets to the @@ -3947,7 +3947,7 @@ For convenience, there is also a method of customizing projects for new compilers or preprocessors: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 88 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 88 With the above definitions, you can use a drop-in replacement for moc if one is available. The commands is executed on all arguments given to the @@ -4099,21 +4099,21 @@ The \c = operator assigns a value to a variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 89 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 89 The above line sets the \c TARGET variable to \c myapp. This will overwrite any values previously set for \c TARGET with \c myapp. The \c += operator appends a new value to the list of values in a variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 90 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 90 The above line appends \c QT_DLL to the list of pre-processor defines to be put in the generated Makefile. The \c -= operator removes a value from the list of values in a variable: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 91 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 91 The above line removes \c QT_DLL from the list of pre-processor defines to be put in the generated Makefile. @@ -4122,7 +4122,7 @@ if it is not already present. This prevents values from being included many times in a variable. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 92 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 92 In the above line, \c QT_DLL will only be added to the list of pre-processor defines if it is not already defined. Note that the @@ -4133,7 +4133,7 @@ The \c ~= operator replaces any values that match a regular expression with the specified value: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 93 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 93 In the above line, any values in the list that start with \c QT_D or \c QT_T are replaced with \c QT. @@ -4141,7 +4141,7 @@ The \c $$ operator is used to extract the contents of a variable, and can be used to pass values between variables or supply them to functions: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 94 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 94 \target Scopes \section1 Scopes @@ -4195,7 +4195,7 @@ You may also use the \c : operator to perform single line conditional assignments; for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 95 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 95 The above line adds \c QT_DLL to the \c DEFINES variable only on the Windows platform. @@ -4213,7 +4213,7 @@ This allows you to write complex tests when combined with other scopes (separated by the \c : operator as above). For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 96 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 96 \section2 Configuration and Scopes @@ -4269,7 +4269,7 @@ use; \l {qmake}{ \c qmake}creates new variables with a given name when it encounters an assignment to that name. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 97 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 97 There are no restricitions on what you do to your own variables, as \c qmake will ignore them unless it needs to evaluate them when processing @@ -4278,19 +4278,19 @@ You can also assign the value of a current variable to another variable by prefixing $$ to the variable name. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 98 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 98 Now the MY_DEFINES variable contains what is in the DEFINES variable at this point in the project file. This is also equivalent to: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 99 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 99 The second notation allows you to append the contents of the variable to another value without separating the two with a space. For example, the following will ensure that the final executable will be given a name that includes the project template being used: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 100 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 100 Variables can be used to store the contents of environment variables. These can be evaluated at the time that \l {qmake}{ \c qmake}is run, or included @@ -4325,7 +4325,7 @@ For example, a \QD plugin can be installed alongside \QD's built-in plugins if the following declaration is made in its project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 101 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 101 \target VariableProcessingFunctions \section1 Variable Processing Functions @@ -4346,7 +4346,7 @@ contents of variables. These functions can be defined in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 102 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 102 The following example function takes a variable name as its only argument, extracts a list of values from the variable with the @@ -4415,7 +4415,7 @@ For example, consider the following assignment in a project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 103 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 103 With this addition to the \c CONFIG variable, \l {qmake}{ \c qmake}will search the locations listed above for the \c myfeatures.prf file after it has @@ -4492,7 +4492,7 @@ \section3 Example: \c stable.h - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 104 + \snippet doc/src/snippets/code/doc_src_qmake-manual.cpp 104 Note that a precompiled header file needs to separate C includes from C++ includes, since the precompiled header file for C files may not @@ -4504,7 +4504,7 @@ To make your project use PCH, you only need to define the \c PRECOMPILED_HEADER variable in your project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 105 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 105 \l {qmake}{ \c qmake}will handle the rest, to ensure the creation and use of the precompiled header file. You do not need to include the precompiled @@ -4516,7 +4516,7 @@ conditional blocks in your project file to add settings when using PCH. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 106 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 106 \section1 Notes on Possible Issues @@ -4525,7 +4525,7 @@ declarations may cause two different object files with the same name to be generated: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 107 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 107 To avoid potential conflicts like these, it is good practice to ensure that header files that will be precompiled are given distinctive names. @@ -4600,17 +4600,17 @@ Just start a new line with \c {SOURCES +=} and put hello.cpp after it. You should have something like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 108 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 108 We repeat this for each source file in the project, until we end up with the following: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 109 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 109 If you prefer to use a Make-like syntax, with all the files listed in one go you can use the newline escaping like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 110 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 110 Now that the source files are listed in the project file, the header files must be added. These are added in exactly the same way as source @@ -4620,7 +4620,7 @@ Once you have done this, your project file should look something like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 111 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 111 The target name is set automatically; it is the same as the project file, but with the suffix appropriate to the platform. For example, if @@ -4628,7 +4628,7 @@ on Windows and \c hello on Unix. If you want to use a different name you can set it in the project file: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 112 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 112 The final step is to set the \l{qmake Variable Reference#CONFIG}{CONFIG} variable. Since this is a Qt application, we need to put \c qt on the @@ -4638,19 +4638,19 @@ The finished project file should look like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 113 You can now use \l {qmake}{ \c qmake}to generate a Makefile for your application. On the command line, in your project's directory, type the following: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 114 Then type \c make or \c nmake depending on the compiler you use. For Visual Studio users, \l {qmake}{ \c qmake}can also generate \c .dsp or \c .vcproj files, for example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 115 \section1 Making an Application Debuggable @@ -4662,7 +4662,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 116 Use \l {qmake}{ \c qmake}as before to generate a Makefile and you will be able to obtain useful information about your application when running it in @@ -4682,7 +4682,7 @@ A simple scope that will add in the platform-dependent file for Windows looks like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 117 So if \l {qmake}{ \c qmake}is run on Windows, it will add \c hellowin.cpp to the list of source files. If \l {qmake}{ \c qmake}is run on any other platform, it @@ -4692,7 +4692,7 @@ When you have done that, your project file should now look something like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 118 Use \l {qmake}{ \c qmake}as before to generate a Makefile. @@ -4704,13 +4704,13 @@ works in the same way as scopes do. Simply replace the scope condition with the function. A check for a \c main.cpp file looks like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 119 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 119 The \c{!} symbol is used to negate the test; i.e. \c{exists( main.cpp )} is true if the file exists, and \c{!exists( main.cpp )} is true if the file doesn't exist. - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 120 Use \l {qmake}{ \c qmake}as before to generate a makefile. If you rename \c main.cpp temporarily, you will see the message and \l {qmake}{ \c qmake}will stop @@ -4729,12 +4729,12 @@ the other inside it. Put the settings to be processed inside the last scope, like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 121 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 121 Nested scopes can be joined together using colons, so the final project file looks like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 122 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 122 That's it! You have now completed the tutorial for \c qmake, and are ready to write project files for your development projects. @@ -4806,7 +4806,7 @@ need to specify any, \l {qmake}{ \c qmake}will add in the default ones needed. For instance, an example project file might look like this: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 123 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 123 For items that are single valued, e.g. the template or the destination directory, we use "="; but for multi-valued items we use "+=" to \e @@ -4892,7 +4892,7 @@ to allow the project to be built in both modes. This can be invoked in the following way: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 124 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 124 The \c build_all option can be added to the \c CONFIG variable in the project file to ensure that the project is built in both modes by default: @@ -4901,14 +4901,14 @@ This allows the Makefile to be processed using the default rule: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 125 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 125 \section2 Installing in Both Modes The \c build_all option also ensures that both versions of the target will be installed when the installation rule is invoked: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 126 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 126 It is possible to customize the names of the build targets depending on the target platform. For example, a library or plugin may be named using a @@ -4918,7 +4918,7 @@ Note: This was originally used in the customwidgetplugin.pro file, but is no longer needed there. \endomit - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 127 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 127 The default behavior in the above snippet is to modify the name used for the build target when building in debug mode. An \c else clause could be diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 8924bdb..44b682a 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -119,7 +119,7 @@ testfunction. Example: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 0 For more examples, refer to the \l{QTestLib Tutorial}. @@ -128,7 +128,7 @@ If you are using \c qmake as your build tool, just add the following to your project file: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtestlib.pro 1 If you are using other build tools, make sure that you add the location of the QTestLib header files to your include path (usually \c{include/QtTest} @@ -217,7 +217,7 @@ To create a benchmark, follow the instructions for creating a test and then add a QBENCHMARK macro to the test function that you want to benchmark. - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 12 The code inside the QBENCHMARK macro will be measured, and possibly also repeated several times in order to get an accurate measurement. This depends on the selected @@ -410,7 +410,7 @@ Then you need to implement the test function itself. The implementation could look like this: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 8 The \l QVERIFY() macro evaluates the expression passed as its argument. If the expression evaluates to true, the execution of @@ -475,7 +475,7 @@ test function. If we add more test data, the function might look like this: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 11 To prevent that the function ends up being cluttered by repetitive code, QTestLib supports adding test data to a test function. All diff --git a/doc/src/examples/arrowpad.qdoc b/doc/src/examples/arrowpad.qdoc index bb22f83..5e9cc9a 100644 --- a/doc/src/examples/arrowpad.qdoc +++ b/doc/src/examples/arrowpad.qdoc @@ -66,7 +66,7 @@ context: it is the context of the texts in the \c ArrowPad class. The \c Q_OBJECT macro defines \c tr(x) in \c ArrowPad like this: - \snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_arrowpad.cpp 0 Knowing which class each source text appears in enables \e {Qt Linguist} to group texts that are logically related together, e.g. diff --git a/doc/src/examples/containerextension.qdoc b/doc/src/examples/containerextension.qdoc index 818547c..57295de 100644 --- a/doc/src/examples/containerextension.qdoc +++ b/doc/src/examples/containerextension.qdoc @@ -138,7 +138,7 @@ target path for the project and adding it to the list of items to install: - \snippet doc/src/snippets/code/doc_src_examples_containerextension.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_containerextension.pro 0 The container extension is created as a library, and will be installed alongside the other \QD plugins when the project is diff --git a/doc/src/examples/customwidgetplugin.qdoc b/doc/src/examples/customwidgetplugin.qdoc index f972500..5b6aab6 100644 --- a/doc/src/examples/customwidgetplugin.qdoc +++ b/doc/src/examples/customwidgetplugin.qdoc @@ -89,7 +89,7 @@ target path for the project and adding it to the list of items to install: - \snippet doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro 0 The custom widget is created as a library, and will be installed alongside the other \QD plugins when the project is installed diff --git a/doc/src/examples/editabletreemodel.qdoc b/doc/src/examples/editabletreemodel.qdoc index 042b745..5edc91b 100644 --- a/doc/src/examples/editabletreemodel.qdoc +++ b/doc/src/examples/editabletreemodel.qdoc @@ -131,14 +131,14 @@ In the case shown in the diagram, the piece of information represented by \bold{a} can be obtained using the standard model/view API: - \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp 0 Since each items holds pieces of data for each column in a given row, there can be many model indexes that map to the same \c TreeItem object. For example, the information represented by \bold{b} can be obtained using the following code: - \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc 1 + \snippet doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp 1 The same underlying \c TreeItem would be accessed to obtain information for the other model indexes in the same row as \bold{b}. diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index b46903d..bc30988 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -26,8 +26,8 @@ ****************************************************************************/ /*! - \example webkit/fancybrowser - \title Fancy Browser Example + \example webkit/fancybrowser + \title Fancy Browser Example The Fancy Browser example shows how to use jQuery with QtWebKit to create a web browser with special effects and content diff --git a/doc/src/examples/icons.qdoc b/doc/src/examples/icons.qdoc index 4210859..1f959f9 100644 --- a/doc/src/examples/icons.qdoc +++ b/doc/src/examples/icons.qdoc @@ -278,7 +278,7 @@ If the application is built in debug mode, the \c Q_ASSERT() macro will expand to - \snippet doc/src/snippets/code/doc_src_examples_icons.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_icons.cpp 0 In release mode, the macro simply disappear. The mode can be set in the application's \c .pro file. One way to do so is to add an diff --git a/doc/src/examples/imageviewer.qdoc b/doc/src/examples/imageviewer.qdoc index 70f71c8..f1d02c3 100644 --- a/doc/src/examples/imageviewer.qdoc +++ b/doc/src/examples/imageviewer.qdoc @@ -149,7 +149,7 @@ \{QWidget::adjustSize()}{adjustSize()} to achieve this, which is essentially the same as - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 0 In the \c print() slot, we first make sure that an image has been loaded into the application: @@ -160,7 +160,7 @@ If the application is built in debug mode, the \c Q_ASSERT() macro will expand to - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 1 + \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 1 In release mode, the macro simply disappear. The mode can be set in the application's \c .pro file. One way to do so is to add an @@ -318,7 +318,7 @@ Whenever we zoom in or out, we need to adjust the scroll bars in consequence. It would have been tempting to simply call - \snippet doc/src/snippets/code/doc_src_examples_imageviewer.qdoc 4 + \snippet doc/src/snippets/code/doc_src_examples_imageviewer.cpp 4 but this would make the top-left corner the focal point, not the center. Therefore we need to take into account the scroll bar diff --git a/doc/src/examples/qtscriptcustomclass.qdoc b/doc/src/examples/qtscriptcustomclass.qdoc index f2b4f36..3ee6c95 100644 --- a/doc/src/examples/qtscriptcustomclass.qdoc +++ b/doc/src/examples/qtscriptcustomclass.qdoc @@ -46,7 +46,7 @@ scripting environment, \c{ByteArray} objects can be constructed like so: - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 0 \c{ByteArray} objects behave similar to normal \c{Array} objects. Every \c{ByteArray} object has a \c{length} property, that holds the length of the array. If a new value is assigned to the \c{length} @@ -55,22 +55,22 @@ Use normal array operations to read or write bytes in the array. The following code sets all the bytes of an array to a certain value: - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 1 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 1 When assigning a value to an array element, the value is truncated to eight bits: - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 2 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 2 Like normal \c{Array} objects, if the array index is greater than the current length of the array, the array is resized accordingly: - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 3 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 3 Property names that aren't valid array indexes are treated like normal object properties (again, the same is the case for normal \c{Array} objects); in other words, it's perfectly fine to do something like this: - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 4 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 4 The above assignment won't affect the contents of the array, but will rather assign a value to the object property named "foo". @@ -78,7 +78,7 @@ \c{ByteArray} objects have a set of methods: chop(), equals(), left(), mid(), toBase64() and so on. These map directly onto the corresponding methods in QByteArray. - \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc 5 + \snippet doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp 5 \section1 ByteArray Class Implementation diff --git a/doc/src/examples/simpledommodel.qdoc b/doc/src/examples/simpledommodel.qdoc index ea380bd..9b4d80e 100644 --- a/doc/src/examples/simpledommodel.qdoc +++ b/doc/src/examples/simpledommodel.qdoc @@ -53,7 +53,7 @@ snippet reads the contents of a file into a QDomDocument object and traverses the document, reading all the plain text that can be found: - \snippet doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_simpledommodel.cpp 0 In principle, the functions provided by QDomNode can be used to navigate from any given starting point in a document to the piece of data requested by another component. diff --git a/doc/src/examples/taskmenuextension.qdoc b/doc/src/examples/taskmenuextension.qdoc index 0200c2f..b557b8b 100644 --- a/doc/src/examples/taskmenuextension.qdoc +++ b/doc/src/examples/taskmenuextension.qdoc @@ -139,7 +139,7 @@ target path for the project and adding it to the list of items to install: - \snippet doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_taskmenuextension.pro 0 The task menu extension is created as a library, and will be installed alongside the other \QD plugins when the project is diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc index e92bb98..f5f41d7 100644 --- a/doc/src/examples/textfinder.qdoc +++ b/doc/src/examples/textfinder.qdoc @@ -70,7 +70,7 @@ QtUiTools module library. This is done in the \c{textfinder.pro} file that contains the following lines: - \snippet doc/src/snippets/code/doc_src_examples_textfinder.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_textfinder.pro 0 \section1 TextFinder Class Definition diff --git a/doc/src/examples/trollprint.qdoc b/doc/src/examples/trollprint.qdoc index 3a77a71..a93811e 100644 --- a/doc/src/examples/trollprint.qdoc +++ b/doc/src/examples/trollprint.qdoc @@ -132,12 +132,12 @@ second argument "two-sided" in the appropriate \c tr() calls to the first pair of radio buttons: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 0 and add the second argument "colors" in the appropriate \c tr() calls for the second pair of radio buttons: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 1 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 1 Now run \c lupdate and open \c trollprint_pt.ts with \e {Qt Linguist}. You should now see two changes. @@ -177,7 +177,7 @@ the translations. This can be achieved by using a \c TRANSLATOR comment in the source code: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 2 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 2 Try adding these comments to some source files, particularly to dialog classes, describing the navigation necessary to reach the @@ -192,7 +192,7 @@ correct. Comments that provide good navigation information can save them time: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 3 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 3 \section1 Troll Print 1.1 diff --git a/doc/src/examples/worldtimeclockplugin.qdoc b/doc/src/examples/worldtimeclockplugin.qdoc index 61a214c..8a17004 100644 --- a/doc/src/examples/worldtimeclockplugin.qdoc +++ b/doc/src/examples/worldtimeclockplugin.qdoc @@ -176,7 +176,7 @@ is searched by \QD. We do this by specifying a target path for the project and adding it to the list of items to install: - \snippet doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro 0 The custom widget is created as a library, and will be installed alongside the other \QD plugins when the project is installed diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc index ecf343d..35e6a90 100644 --- a/doc/src/files-and-resources/resources.qdoc +++ b/doc/src/files-and-resources/resources.qdoc @@ -130,7 +130,7 @@ In the application, this resource would be registered with code like this: - \snippet doc/src/snippets/code/doc_src_resources.qdoc 4 + \snippet doc/src/snippets/code/doc_src_resources.cpp 4 \section2 Compiled-In Resources @@ -205,7 +205,7 @@ Q_INIT_RESOURCE() with the base name of the \c .qrc file. For example: - \snippet doc/src/snippets/code/doc_src_resources.qdoc 5 + \snippet doc/src/snippets/code/doc_src_resources.cpp 5 Similarly, if you must unload a set of resources explicitly (because a plugin is being unloaded or the resources are not valid diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc index 1d15dbd..e7bf171 100644 --- a/doc/src/frameworks-technologies/accessible.qdoc +++ b/doc/src/frameworks-technologies/accessible.qdoc @@ -256,7 +256,7 @@ variable set to 1. For example, this is set in the following way with the bash shell: - \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc environment + \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp environment Accessibility features are built into Qt by default when the libraries are configured and built. diff --git a/doc/src/frameworks-technologies/activeqt-container.qdoc b/doc/src/frameworks-technologies/activeqt-container.qdoc index 436f375..862408b 100644 --- a/doc/src/frameworks-technologies/activeqt-container.qdoc +++ b/doc/src/frameworks-technologies/activeqt-container.qdoc @@ -67,7 +67,7 @@ To build Qt applications that can host COM objects and ActiveX controls link the application against the QAxContainer module by adding - \snippet doc/src/snippets/code/doc_src_qaxcontainer.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qaxcontainer.pro 0 to your application's \c .pro file. @@ -128,7 +128,7 @@ want to use, or integrate it into the build system by adding the type libraries to the \c TYPELIBS variable in your application's \c .pro file: - \snippet doc/src/snippets/code/doc_src_qaxcontainer.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qaxcontainer.pro 1 Note that \l dumpcpp might not be able to expose all APIs in the type library. diff --git a/doc/src/frameworks-technologies/activeqt-server.qdoc b/doc/src/frameworks-technologies/activeqt-server.qdoc index 9af2b65..77cacf8 100644 --- a/doc/src/frameworks-technologies/activeqt-server.qdoc +++ b/doc/src/frameworks-technologies/activeqt-server.qdoc @@ -60,10 +60,10 @@ An out-of-process executable server is generated from a \c .pro file like this: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qaxserver.pro 0 To build an in-process server, use a \c .pro file like this: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qaxserver.pro 1 The files \c qaxserver.rc and \c qaxserver.def are part of the framework and can be used from their usual location (specify a @@ -91,7 +91,7 @@ Additionally you can specify a version number using the \c VERSION variable, e.g. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qaxserver.pro 2 The version number specified will be used as the version of the type library and of the server when registering. @@ -186,12 +186,12 @@ or any existing QObject subclass. If the class is a subclass of QWidget, the COM object will be an ActiveX control. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 3 The Q_OBJECT macro is required to provide the meta object information about the widget to the ActiveQt framework. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 4 Use the Q_CLASSINFO() macro to specify the COM identifiers for the COM object. \c ClassID and \c InterfaceID are required, while \c EventsID is @@ -201,7 +201,7 @@ You can specify additional attributes for each of your classes; see \l{Class Information and Tuning} for details. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 5 Use the Q_PROPERTY() macro to declare properties for the ActiveX control. @@ -216,7 +216,7 @@ your implementation of QAxFactory::create. \endfootnote - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 6 The ActiveQt framework will expose properties and public slots as ActiveX properties and methods, and signals as ActiveX events, and convert between @@ -428,7 +428,7 @@ To make the properties bindable for the ActiveX client, use multiple inheritance from the QAxBindable class: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 7 When implementing the property write functions, use the QAxBindable class's requestPropertyChange() and propertyChanged() @@ -453,7 +453,7 @@ an implementation of a QAxFactory. The easist way to do this is to use a set of macros: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 8 This will export \c MyWidget and \c MyWidget2 as COM objects that can be created by COM clients, and will register \c MySubType as a type that can @@ -470,7 +470,7 @@ server. Use QAxFactory::isServer() to create and run a standard application interface, or to prevent a stand-alone execution: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 9 This is however not necessary as ActiveQt provides a default implementation of a main function. The default implemenation calls QAxFactory::startServer(), @@ -512,7 +512,7 @@ macro, the QAxFactory subclass had no appropriate constructor. Provide a public class constructor like - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 10 for your factory class. @@ -560,7 +560,7 @@ your installer process, resolve the \c DllRegisterServer symbol and call the function: - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 11 \section3 Distributing Servers over the Internet @@ -766,7 +766,7 @@ own API, and is available in the "Insert Objects" dialog of Microsoft Office applications. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 15 \section2 Developing Licensed Components @@ -782,7 +782,7 @@ To mark a Qt class as licensed specify a "LicenseKey" using the Q_CLASSINFO() macro. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 16 The key is required to be able to create an instance of \c MyLicensedControl on a machine that is not licensed itself. The licensed developer can now @@ -805,12 +805,12 @@ Create a new subclass of QAxAggregated and use multiple inheritance to subclass additional COM interface classes. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 17 Reimplement the QAxAggregated::queryInterface() function to support the additional COM interfaces. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 18 Since \c ISomeCOMInterface is a subclass of \c IUnknown you will have to implement the \c QueryInterface(), \c AddRef(), and \c @@ -820,7 +820,7 @@ returned by the QAxAggregated::controllingUnknown() function, e.g. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 19 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 19 Do not support the \c IUnknown interface itself in your \l{QAxAggregated::queryInterface()}{queryInterface()} @@ -833,5 +833,5 @@ QAxBindable::createAggregate() to return a new object of the QAxAggregated subclass. - \snippet doc/src/snippets/code/doc_src_qaxserver.qdoc 20 + \snippet doc/src/snippets/code/doc_src_qaxserver.cpp 20 */ diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc index 991588e..f28e5dc 100644 --- a/doc/src/frameworks-technologies/containers.qdoc +++ b/doc/src/frameworks-technologies/containers.qdoc @@ -205,7 +205,7 @@ Here's an example custom data type that meets the requirement of an assignable data type: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 0 + \snippet doc/src/snippets/code/doc_src_containers.cpp 0 If we don't provide a copy constructor or an assignment operator, C++ provides a default implementation that performs a @@ -306,7 +306,7 @@ Here's a typical loop for iterating through all the elements of a QList in order and printing them to the console: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 1 + \snippet doc/src/snippets/code/doc_src_containers.cpp 1 It works as follows: The QList to iterate over is passed to the QListIterator constructor. At that point, the iterator is located @@ -319,7 +319,7 @@ Here's how to iterate backward in a QList: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 2 + \snippet doc/src/snippets/code/doc_src_containers.cpp 2 The code is symmetric with iterating forward, except that we start by calling \l{QListIterator::toBack()}{toBack()} @@ -358,7 +358,7 @@ QMutableListIterator. Here's an example where we remove all odd numbers from a QList using QMutableListIterator: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 3 + \snippet doc/src/snippets/code/doc_src_containers.cpp 3 The next() call in the loop is made every time. It jumps over the next item in the list. The @@ -368,13 +368,13 @@ the iterator, so it is safe to continue using it. This works just as well when iterating backward: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 4 + \snippet doc/src/snippets/code/doc_src_containers.cpp 4 If we just want to modify the value of an existing item, we can use \l{QMutableListIterator::setValue()}{setValue()}. In the code below, we replace any value larger than 128 with 128: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 5 + \snippet doc/src/snippets/code/doc_src_containers.cpp 5 Just like \l{QMutableListIterator::remove()}{remove()}, \l{QMutableListIterator::setValue()}{setValue()} operates on the @@ -387,7 +387,7 @@ operations, we don't even need \l{QMutableListIterator::setValue()}{setValue()}: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 6 + \snippet doc/src/snippets/code/doc_src_containers.cpp 6 As mentioned above, QLinkedList's, QVector's, and QSet's iterator classes have exactly the same API as QList's. We will now turn to @@ -410,7 +410,7 @@ The following example removes all (capital, country) pairs where the capital's name ends with "City": - \snippet doc/src/snippets/code/doc_src_containers.qdoc 7 + \snippet doc/src/snippets/code/doc_src_containers.cpp 7 QMapIterator also provides a key() and a value() function that operate directly on the iterator and that return the key and @@ -418,7 +418,7 @@ example, the following code copies the contents of a QMap into a QHash: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 8 + \snippet doc/src/snippets/code/doc_src_containers.cpp 8 If we want to iterate through all the items with the same value, we can use \l{QMapIterator::findNext()}{findNext()} @@ -426,7 +426,7 @@ Here's an example where we remove all the items with a particular value: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 9 + \snippet doc/src/snippets/code/doc_src_containers.cpp 9 \section2 STL-Style Iterators @@ -473,7 +473,7 @@ Here's a typical loop for iterating through all the elements of a QList in order and converting them to lowercase: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 10 + \snippet doc/src/snippets/code/doc_src_containers.cpp 10 Unlike \l{Java-style iterators}, STL-style iterators point directly at items. The begin() function of a container returns an @@ -493,7 +493,7 @@ decrement the iterator \e before we access the item. This requires a \c while loop: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 11 + \snippet doc/src/snippets/code/doc_src_containers.cpp 11 In the code snippets so far, we used the unary \c * operator to retrieve the item (of type QString) stored at a certain iterator @@ -504,7 +504,7 @@ For read-only access, you can use const_iterator, constBegin(), and constEnd(). For example: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 12 + \snippet doc/src/snippets/code/doc_src_containers.cpp 12 The following table summarizes the STL-style iterators' API: @@ -536,7 +536,7 @@ value() function to retrieve the value. For example, here's how we would print all items in a QMap to the console: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 13 + \snippet doc/src/snippets/code/doc_src_containers.cpp 13 Thanks to \l{implicit sharing}, it is very inexpensive for a function to return a container per value. The Qt API contains @@ -545,7 +545,7 @@ using an STL iterator, you should always take a copy of the container and iterate over the copy. For example: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 14 + \snippet doc/src/snippets/code/doc_src_containers.cpp 14 This problem doesn't occur with functions that return a const or non-const reference to a container. @@ -567,35 +567,35 @@ statement. For example, here's how to use \c foreach to iterate over a QLinkedList: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 15 + \snippet doc/src/snippets/code/doc_src_containers.cpp 15 The \c foreach code is significantly shorter than the equivalent code that uses iterators: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 16 + \snippet doc/src/snippets/code/doc_src_containers.cpp 16 Unless the data type contains a comma (e.g., \c{QPair}), the variable used for iteration can be defined within the \c foreach statement: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 17 + \snippet doc/src/snippets/code/doc_src_containers.cpp 17 And like any other C++ loop construct, you can use braces around the body of a \c foreach loop, and you can use \c break to leave the loop: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 18 + \snippet doc/src/snippets/code/doc_src_containers.cpp 18 With QMap and QHash, \c foreach accesses the value component of the (key, value) pairs. If you want to iterate over both the keys and the values, you can use iterators (which are fastest), or you can write code like this: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 19 + \snippet doc/src/snippets/code/doc_src_containers.cpp 19 For a multi-valued map: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 20 + \snippet doc/src/snippets/code/doc_src_containers.cpp 20 Qt automatically takes a copy of the container when it enters a \c foreach loop. If you modify the container as you are @@ -611,12 +611,12 @@ In addition to \c foreach, Qt also provides a \c forever pseudo-keyword for infinite loops: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 21 + \snippet doc/src/snippets/code/doc_src_containers.cpp 21 If you're worried about namespace pollution, you can disable these macros by adding the following line to your \c .pro file: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 22 + \snippet doc/src/snippets/code/doc_src_containers.cpp 22 \section1 Other Container-Like Classes @@ -736,7 +736,7 @@ Consider the following code, which builds a QString from another QString: - \snippet doc/src/snippets/code/doc_src_containers.qdoc 23 + \snippet doc/src/snippets/code/doc_src_containers.cpp 23 We build the string \c out dynamically by appending one character to it at a time. Let's assume that we append 15000 characters to diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc index 7494f2d..82545db 100644 --- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc +++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc @@ -85,14 +85,14 @@ using an adaptor. A sample usage of QDBusAbstractAdaptor is as follows: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 0 The code above would create an interface that could be represented more or less in the following canonical representation: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 1 This adaptor could be used in the application's main function as follows - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 2 Break-down analysis: \tableofcontents @@ -100,7 +100,7 @@ \section1 The header The header of the example is: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 3 The code does the following: \list @@ -112,10 +112,10 @@ \section1 The properties The properties are declared as follows: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 4 And are implemented as follows: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 5 The code declares three properties: one of them is a read-write property called "caption" of string type. The other two are read-only, also of the string type. @@ -129,7 +129,7 @@ \section1 The constructor The constructor: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 6 The constructor does the following: \list @@ -149,7 +149,7 @@ \section1 Slots/methods The public slots in the example (which will be exported as D-Bus methods) are the following: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 7 This snippet of code defines 4 methods with different properties each: \list 1 @@ -176,7 +176,7 @@ \section1 Signals The signals in this example are defined as follows: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 8 However, signal definition isn't enough: signals have to be emitted. One simple way of emitting signals is to connect another signal to them, so that Qt's signal handling system chains them @@ -187,7 +187,7 @@ When simple signal-to-signal connection isn't enough, one can use a private slot do do some work. This is what was done for the mainWindowHasFocus signal: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 9 This private slot (which will not be exported as a method via D-Bus) was connected to the \c focusChanged signal in the adaptor's constructor. It is therefore able to shape the @@ -291,7 +291,7 @@ \l{QDBusMessage::setDelayedReply()}{QDBusMessage::setDelayedReply(true)} that the response will be sent later. - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 10 The use of \l{QDBusConnection::send()}{QDBusConnection::sessionBus().send(data->reply)} @@ -303,7 +303,7 @@ using the \c QDBusMessage object that was obtained. In our example, the reply code could be something as follows: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 11 As can be seen in the example, when a delayed reply is in place, the return value(s) from the slot will be ignored by QtDBus. They @@ -473,7 +473,7 @@ You can use this macro in your own adaptors by placing it before your method's return value (which must be "void") in the class declaration, as shown in the example: - \snippet doc/src/snippets/code/doc_src_qdbusadaptors.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qdbusadaptors.cpp 12 Its presence in the method implementation (outside the class declaration) is optional. diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc index f689446..1903df5 100644 --- a/doc/src/frameworks-technologies/graphicsview.qdoc +++ b/doc/src/frameworks-technologies/graphicsview.qdoc @@ -95,7 +95,7 @@ descending stacking order (i.e., the first returned item is topmost, and the last item is bottom-most). - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 0 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 0 QGraphicsScene's event propagation architecture schedules scene events for delivery to items, and also manages propagation between items. If @@ -126,7 +126,7 @@ enable OpenGL support, you can set a QGLWidget as the viewport by calling QGraphicsView::setViewport(). - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 1 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 1 The view receives input events from the keyboard and mouse, and translates these to scene events (converting the coordinates used @@ -333,7 +333,7 @@ Here is an example of how to implement zoom and rotate slots in a subclass of QGraphicsView: - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 2 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 2 The slots could be connected to \l{QToolButton}{QToolButtons} with \l{QAbstractButton::autoRepeat}{autoRepeat} enabled. @@ -353,7 +353,7 @@ a QPainter to either of the rendering functions. This example shows how to print the whole scene into a full page, using QPrinter. - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 3 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 3 The difference between the scene and view rendering functions is that one operates in scene coordinates, and the other in view coordinates. @@ -364,7 +364,7 @@ is to render the exact contents of the viewport using the provided painter. - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 4 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 4 When the source and target areas' sizes do not match, the source contents are stretched to fit into the target area. By passing a @@ -390,7 +390,7 @@ so in mousePressEvent() or mouseMoveEvent(), you can get the originating widget pointer from the event. For example: - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 5 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 5 To intercept drag and drop events for the scene, you reimplement QGraphicsScene::dragEnterEvent() and whichever event handlers your @@ -449,7 +449,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_graphicsview.qdoc 6 + \snippet doc/src/snippets/code/doc_src_graphicsview.cpp 6 \section2 Item Groups diff --git a/doc/src/frameworks-technologies/implicit-sharing.qdoc b/doc/src/frameworks-technologies/implicit-sharing.qdoc index 8938d9e..46567e9 100644 --- a/doc/src/frameworks-technologies/implicit-sharing.qdoc +++ b/doc/src/frameworks-technologies/implicit-sharing.qdoc @@ -109,7 +109,7 @@ data in all member functions that change the internal data. Code fragment: - \snippet doc/src/snippets/code/doc_src_groups.qdoc 0 + \snippet doc/src/snippets/code/doc_src_groups.cpp 0 \section1 List of Classes @@ -124,7 +124,7 @@ concern for the copying overhead. Example: - \snippet doc/src/snippets/code/doc_src_groups.qdoc 1 + \snippet doc/src/snippets/code/doc_src_groups.cpp 1 In this example, \c p1 and \c p2 share data until QPainter::begin() is called for \c p2, because painting a pixmap will modify it. diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 92067b9..58b51e5 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -32,7 +32,7 @@ /*! \page model-view-programming.html - \ingroup qt-basic-concepts + \ingroup qt-basic-concepts \title Model/View Programming \brief A guide to Qt's extensible model/view architecture. @@ -328,7 +328,7 @@ contain a pointer to the model that created them, and this prevents confusion when working with more than one model. - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 0 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 0 Model indexes provide \e temporary references to pieces of information, and can be used to retrieve or modify data via the model. Since models may @@ -355,7 +355,7 @@ item by specifying its row and column numbers to the model, and we receive an index that represents the item: - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 1 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 1 Models that provide interfaces to simple, single level data structures like lists and tables do not need any other information to be provided but, as @@ -371,7 +371,7 @@ index that refers to an item of data by passing the relevant row and column numbers to the model. - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 2 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 2 Top level items in a model are always referenced by specifying \c QModelIndex() as their parent item. This is discussed in the next @@ -392,7 +392,7 @@ about the item's parent. Outside the model, the only way to refer to an item is through a model index, so a parent model index must also be given: - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 3 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 3 \table \row \i \inlineimage modelview-treemodel.png @@ -403,12 +403,12 @@ Items "A" and "C" are represented as top-level siblings in the model: - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 4 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 4 Item "A" has a number of children. A model index for item "B" is obtained with the following code: - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 5 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 5 \endtable \section3 Item roles @@ -423,7 +423,7 @@ corresponding to the item, and by specifying a role to obtain the type of data we want: - \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 6 + \snippet doc/src/snippets/code/doc_src_model-view-programming.cpp 6 \table \row \i \inlineimage modelview-roles.png diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc index 1456eae6..9eb56ea 100644 --- a/doc/src/frameworks-technologies/phonon.qdoc +++ b/doc/src/frameworks-technologies/phonon.qdoc @@ -165,7 +165,7 @@ The \c .pro file for a project needs the following line to be added: - \snippet doc/src/snippets/code/doc_src_phonon.qdoc 0 + \snippet doc/src/snippets/code/doc_src_phonon.pro 0 Phonon comes with several widgets that provide functionality commonly associated with multimedia players - notably SeekSlider diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc index b332d57..15b1547 100644 --- a/doc/src/frameworks-technologies/plugins-howto.qdoc +++ b/doc/src/frameworks-technologies/plugins-howto.qdoc @@ -109,12 +109,12 @@ straightforward, here is the class definition (\c mystyleplugin.h): - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 0 + \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 0 Ensure that the class implementation is located in a \c .cpp file (including the class definition): - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 1 + \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 1 (Note that QStylePlugin is case insensitive, and the lower-case version of the key is used in our @@ -127,7 +127,7 @@ you might want to set a style explicitly in code. To apply a style, use code like this: - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 2 + \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 2 Some plugin classes require additional functions to be implemented. See the class documentation for details of the @@ -284,12 +284,12 @@ the required plugins to your build using \c QTPLUGIN. For example, in your \c main.cpp: - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 4 + \snippet doc/src/snippets/code/doc_src_plugins-howto.cpp 4 In the \c .pro file for your application, you need the following entry: - \snippet doc/src/snippets/code/doc_src_plugins-howto.qdoc 5 + \snippet doc/src/snippets/code/doc_src_plugins-howto.pro 5 It is also possible to create your own static plugins, by following these steps: diff --git a/doc/src/frameworks-technologies/qthelp.qdoc b/doc/src/frameworks-technologies/qthelp.qdoc index 42bc482..f4d75b6 100644 --- a/doc/src/frameworks-technologies/qthelp.qdoc +++ b/doc/src/frameworks-technologies/qthelp.qdoc @@ -218,7 +218,7 @@ we get the actual help contents by calling fileData() and display the document to the user. - \snippet doc/src/snippets/code/doc_src_qthelp.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qthelp.cpp 6 For further information on how to use the API, have a look at the QHelpEngine class reference. diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc index 089f84d..313cf46 100644 --- a/doc/src/frameworks-technologies/richtext.qdoc +++ b/doc/src/frameworks-technologies/richtext.qdoc @@ -145,11 +145,11 @@ Although QTextEdit makes it easy to display and edit rich text, documents can also be used independently of any editor widget, for example: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 0 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 0 Alternatively, they can be extracted from an existing editor: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 1 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 1 This flexibility enables applications to handle multiple rich text documents without the overhead of multiple editor widgets, or requiring @@ -728,24 +728,24 @@ A text editor widget can be constructed and used to display HTML in the following way: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 2 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 2 By default, the text editor contains a document with a root frame, inside which is an empty text block. This document can be obtained so that it can be modified directly by the application: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 3 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 3 The text editor's cursor may also be used to edit a document: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 4 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 4 Although a document can be edited using many cursors at once, a QTextEdit only displays a single cursor at a time. Therefore, if we want to update the editor to display a particular cursor or its selection, we need to set the editor's cursor after we have modified the document: - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 5 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 5 \section1 Selecting Text @@ -833,7 +833,7 @@ We give an example of the latter technique from the list. We assume that the text edit is visible. - \snippet doc/src/snippets/code/doc_src_richtext.qdoc 6 + \snippet doc/src/snippets/code/doc_src_richtext.cpp 6 \omit Ideas for other sections: diff --git a/doc/src/frameworks-technologies/unicode.qdoc b/doc/src/frameworks-technologies/unicode.qdoc index b4a9347..d2a6500 100644 --- a/doc/src/frameworks-technologies/unicode.qdoc +++ b/doc/src/frameworks-technologies/unicode.qdoc @@ -125,12 +125,12 @@ QString provides implicit casting from \c{const char *} so that things like - \snippet doc/src/snippets/code/doc_src_unicode.qdoc 0 + \snippet doc/src/snippets/code/doc_src_unicode.cpp 0 will work. There is also a function, QObject::tr(), that provides translation support, like this: - \snippet doc/src/snippets/code/doc_src_unicode.qdoc 1 + \snippet doc/src/snippets/code/doc_src_unicode.cpp 1 QObject::tr() maps from \c{const char *} to a Unicode string, and uses installable QTranslator objects to do the mapping. @@ -151,11 +151,11 @@ fast functions for mapping to and from them. For example, to open an application's icon one might do this: - \snippet doc/src/snippets/code/doc_src_unicode.qdoc 2 + \snippet doc/src/snippets/code/doc_src_unicode.cpp 2 or - \snippet doc/src/snippets/code/doc_src_unicode.qdoc 3 + \snippet doc/src/snippets/code/doc_src_unicode.cpp 3 Regarding output, Qt will do a best-effort conversion from Unicode to whatever encoding the system and fonts provide. diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc index 86934bc..6d86b22 100644 --- a/doc/src/howtos/appicon.qdoc +++ b/doc/src/howtos/appicon.qdoc @@ -62,7 +62,7 @@ Finally, assuming you are using \c qmake to generate your makefiles, add this line to your \c myapp.pro file: - \snippet doc/src/snippets/code/doc_src_appicon.qdoc 1 + \snippet doc/src/snippets/code/doc_src_appicon.pro 1 Regenerate your makefile and your application. The \c .exe file will now be represented with your icon in Explorer. @@ -96,7 +96,7 @@ if the name of your icon file is \c{myapp.icns}, and your project file is \c{myapp.pro}, add this line to \c{myapp.pro}: - \snippet doc/src/snippets/code/doc_src_appicon.qdoc 2 + \snippet doc/src/snippets/code/doc_src_appicon.pro 2 This will ensure that \c qmake puts your icons in the proper place and creates an \c{Info.plist} entry for the icon. @@ -213,6 +213,6 @@ icon file is \c{myapp.svg}, and your project file is \c{myapp.pro}, add this line to \c{myapp.pro}: - \snippet doc/src/snippets/code/doc_src_appicon.qdoc 5 + \snippet doc/src/snippets/code/doc_src_appicon.pro 5 */ diff --git a/doc/src/howtos/unix-signal-handlers.qdoc b/doc/src/howtos/unix-signal-handlers.qdoc index 2fa558e..20beb38 100644 --- a/doc/src/howtos/unix-signal-handlers.qdoc +++ b/doc/src/howtos/unix-signal-handlers.qdoc @@ -59,7 +59,7 @@ sigaction(2) man pages before plowing through the following code snippets. - \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 0 + \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 0 In the MyDaemon constructor, use the socketpair(2) function to initialize each file descriptor pair, and then create the @@ -68,24 +68,24 @@ appropriate slot function, which effectively converts the Unix signal to the QSocketNotifier::activated() signal. - \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 1 + \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 1 Somewhere else in your startup code, you install your Unix signal handlers with sigaction(2). - \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 2 + \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 2 In your Unix signal handlers, you write a byte to the \e write end of a socket pair and return. This will cause the corresponding QSocketNotifier to emit its activated() signal, which will in turn cause the appropriate Qt slot function to run. - \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 3 + \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 3 In the slot functions connected to the QSocketNotifier::activated() signals, you \e read the byte. Now you are safely back in Qt with your signal, and you can do all the Qt stuff you weren'tr allowed to do in the Unix signal handler. - \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 4 + \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.cpp 4 */ diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index e22f953..aa8c9c5 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -192,7 +192,7 @@ to achieve this is to use QObject::tr(). For example, assuming the \c LoginWidget is a subclass of QWidget: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 0 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 0 This accounts for 99% of the user-visible strings you're likely to write. @@ -202,7 +202,7 @@ appropriate class, or the QCoreApplication::translate() function directly: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 1 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 1 If you need to have translatable text completely outside a function, there are two macros to help: QT_TR_NOOP() @@ -212,11 +212,11 @@ Example of QT_TR_NOOP(): - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 2 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 2 Example of QT_TRANSLATE_NOOP(): - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 3 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 3 If you disable the \c{const char *} to QString automatic conversion by compiling your software with the macro \c @@ -244,13 +244,13 @@ The QString::arg() functions offer a simple means for substituting arguments: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 4 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 4 In some languages the order of arguments may need to change, and this can easily be achieved by changing the order of the % arguments. For example: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 5 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 5 produces the correct output in English and Norwegian: \snippet doc/src/snippets/code/doc_src_i18n.qdoc 6 @@ -325,7 +325,7 @@ Typically, your application's \c main() function will look like this: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 8 Note the use of QLibraryInfo::location() to locate the Qt translations. Developers should request the path to the translations at run-time by @@ -346,7 +346,7 @@ need to output Cyrillic in the ISO 8859-5 encoding. Code for this would be: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 9 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 9 For converting Unicode to local 8-bit encodings, a shortcut is available: the QString::toLocal8Bit() function returns such 8-bit @@ -360,7 +360,7 @@ demonstrated by this conversion from ISO 8859-5 Cyrillic to Unicode conversion: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 10 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 10 Ideally Unicode I/O should be used as this maximizes the portability of documents between users around the world, but in reality it is @@ -392,7 +392,7 @@ formats. Such localizations can be accomplished using appropriate tr() strings. - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 11 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 11 In the example, for the US we would leave the translation of "AMPM" as it is and thereby use the 12-hour clock branch; but in @@ -417,7 +417,7 @@ the text displayed by widgets using the \l{QObject::tr()}{tr()} function in the usual way. For example: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 12 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 12 All other change events should be passed on by calling the default implementation of the function. @@ -708,7 +708,7 @@ Typically, your application's \c main() function will look like this: - \snippet doc/src/snippets/code/doc_src_i18n.qdoc 8 + \snippet doc/src/snippets/code/doc_src_i18n.cpp 8 Note the use of QLibraryInfo::location() to locate the Qt translations. Developers should request the path to the translations at run-time by diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 1f413f9..460e10c 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -173,8 +173,8 @@ An example of a complete \c .pro file with four translation source files: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 0 - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 1 + \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 0 + \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 1 QTextCodec::setCodecForTr() makes it possible to choose a 8-bit encoding for literal strings that appear within \c tr() calls. @@ -186,14 +186,14 @@ application, \QL needs you to set the \c CODECFORTR entry in the \c .pro file as well. For example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 1 + \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 1 Also, if your compiler uses a different encoding for its runtime system as for its source code and you want to use non-ASCII characters in string literals, you will need to set the \c CODECFORSRC. For example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 2 + \snippet doc/src/snippets/code/doc_src_linguist-manual.pro 2 Microsoft Visual Studio 2005 .NET appears to be the only compiler for which this is necessary. However, if you want to write @@ -201,7 +201,7 @@ in your source files. You can still specify non-ASCII characters portably using escape sequences, for example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 3 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 3 \target lupdate manual \section1 lupdate @@ -1333,11 +1333,11 @@ User-visible strings are marked as translation targets by wrapping them in a \c tr() call, for example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 6 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 6 would become - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 7 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 7 All QObject subclasses that use the \c Q_OBJECT macro implement the \c tr() function. @@ -1346,11 +1346,11 @@ usually called as a member function of a QObject subclass, in other cases an explicit class name can be supplied, for example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 8 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 8 or - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 9 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 9 \section2 Distinguishing Between Identical Translatable Strings @@ -1364,11 +1364,11 @@ differ between the two. This is easily achieved using the two argument form of the \c tr() call, e.g. - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 10 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 10 and - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 11 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 11 Ctrl key accelerators are also translatable: @@ -1385,7 +1385,7 @@ solved by adding a comment using the keyword \e TRANSLATOR which describes the navigation steps to reach the text in question; e.g. - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 12 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 12 These comments are particularly useful for widget classes. @@ -1395,13 +1395,13 @@ write "plural-aware" internationalized applications. This overload has the following signature: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 17 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 17 Depending on the value of \c n, the \c tr() function will return a different translation, with the correct grammatical number for the target language. Also, any occurrence of \c %n is replaced with \c{n}'s value. For example: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 18 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 18 If a French translation is loaded, this will expand to "0 item remplac\unicode{233}", "1 item remplac\unicode{233}", "2 items @@ -1430,7 +1430,7 @@ comment at the beginning of the source files that use \c MyClass::tr(): - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 13 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 13 After the comment, all references to \c MyClass::tr() will be understood as meaning \c MyNamespace::MyClass::tr(). @@ -1443,7 +1443,7 @@ use either the tr() function of an appropriate class, or the QCoreApplication::translate() function directly: - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 14 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 14 \section3 Using QT_TR_NOOP() and QT_TRANSLATE_NOOP() @@ -1453,10 +1453,10 @@ The macros expand to just the text (without the context). Example of QT_TR_NOOP(): - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 15 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 15 Example of QT_TRANSLATE_NOOP(): - \snippet doc/src/snippets/code/doc_src_linguist-manual.qdoc 16 + \snippet doc/src/snippets/code/doc_src_linguist-manual.cpp 16 \section1 Tutorials diff --git a/doc/src/ja_JP/development/qmake-manual.qdoc b/doc/src/ja_JP/development/qmake-manual.qdoc index a6cfe3d..3b908f7 100644 --- a/doc/src/ja_JP/development/qmake-manual.qdoc +++ b/doc/src/ja_JP/development/qmake-manual.qdoc @@ -58,16 +58,16 @@ æ–°ã—ã„行を作りã€\c{SOURCES +=}ã€ç¶šã„㦠hello.cpp を入力ã—ã¾ã™ã€‚ ã¤ã¾ã‚Šã€ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 108 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 108 ã“れを以下ã®ã‚ˆã†ã«ãªã‚‹ã¾ã§ãƒ—ロジェクトã®å„ソースファイルã«å¯¾ã—ã¦è¡Œã„ã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 109 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 109 make ã«ä¼¼ãŸã‚·ãƒ³ã‚¿ãƒƒã‚¯ã‚¹ã‚’使ã„ãŸã„å ´åˆã¯ã€ 以下ã®ã‚ˆã†ã«æ”¹è¡Œã‚’エスケープã—ã¦ã™ã¹ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’ 1 è¡Œã«æ›¸ãã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 110 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 110 ソースファイルã®ä¸€è¦§ã‚’プロジェクトファイルã«è¿½åŠ ã—ã¾ã—ãŸã€‚ 次ã«ãƒ˜ãƒƒãƒ€ãƒ•ã‚¡ã‚¤ãƒ«ã‚’追加ã—ã¾ã™ã€‚ @@ -77,7 +77,7 @@ ã“れを終ãˆã‚‹ã¨ã€ãƒ—ロジェクトファイルã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚‹ã§ã—ょã†: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 111 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 111 ターゲットã®åå‰ã¯è‡ªå‹•çš„ã«è¨­å®šã•ã‚Œã€ プロジェクトファイルã¨åŒã˜åå‰ã«ãªã‚Šã¾ã™ã€‚ @@ -86,7 +86,7 @@ ターゲット㯠Windows ã§ã¯ \c hello.exe ã€Unix ã§ã¯ \c hello ã«ãªã‚Šã¾ã™ã€‚ プロジェクトファイルã§åˆ¥ã®åå‰ã‚’指定ã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 112 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 112 最後㫠\l{qmake Variable Reference#CONFIG}{CONFIG} 変数を設定ã—ã¾ã™ã€‚ ã“ã®ã‚¢ãƒ—リケーション㯠Qt アプリケーションãªã®ã§ \c CONFIG ã« @@ -96,19 +96,19 @@ 最終的ãªãƒ—ロジェクトファイルã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 113 \c qmake を使ã£ã¦ã€ã“ã®ã‚¢ãƒ—リケーションã®ãŸã‚ã® Makefile を生æˆã—ã¾ã™ã€‚ プロジェクトã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã‚³ãƒãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³ã«æ¬¡ã®ã‚ˆã†ã«å…¥åŠ›ã—ã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 114 ãã—ã¦ã€ä½¿ç”¨ã™ã‚‹ã‚³ãƒ³ãƒ‘イラã«ã‚ˆã£ã¦ \c make ã¾ãŸã¯ \c nmake を入力ã—ã¾ã™ã€‚ Visual Studio ユーザã®å ´åˆã€\c qmake ã¯ã€ä»¥ä¸‹ã®ã‚ˆã†ã« \c .dsp ファイルã¾ãŸã¯ \c .vcproj ファイルも作æˆã§ãã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 115 \section1 アプリケーションをデãƒãƒƒã‚°ã§ãるよã†ã«ã™ã‚‹ @@ -119,7 +119,7 @@ ãŸã¨ãˆã°: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 116 ç›´å‰ã®ä¾‹ã¨åŒæ§˜ã«ã€Makefile を生æˆã™ã‚‹ã«ã¯ \c qmake を使ã„ã¾ã™ã€‚ アプリケーションをデãƒãƒƒã‚°ç’°å¢ƒã§å®Ÿè¡Œã™ã‚‹éš›ã«å½¹ã«ç«‹ã¤æƒ…報を得られるよã†ã«ãªã‚Šã¾ã™ã€‚ @@ -137,7 +137,7 @@ Windows 用ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’追加ã™ã‚‹ã‚·ãƒ³ãƒ—ルãªã‚¹ã‚³ãƒ¼ãƒ—ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 117 \c qmake ㌠Windows 上ã§å®Ÿè¡Œã•ã‚Œã‚‹ã¨ã€ã‚½ãƒ¼ã‚¹ãƒ•ã‚¡ã‚¤ãƒ«ã®ãƒªã‚¹ãƒˆã« \c hellowin.cpp ãŒè¿½åŠ ã•ã‚Œã¾ã™ã€‚ @@ -146,7 +146,7 @@ ã“れを終ãˆã‚‹ã¨ã€ãƒ—ロジェクトファイルã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 118 ã“ã‚Œã¾ã§ã¨åŒæ§˜ã«ã€Makefile を生æˆã™ã‚‹ã«ã¯ \c qmake を使ã„ã¾ã™ã€‚ @@ -159,13 +159,13 @@ 使ã„æ–¹ã¯ã‚¹ã‚³ãƒ¼ãƒ—ã®æ¡ä»¶ã‚’ã“れらã®é–¢æ•°ã§ç½®ãæ›ãˆã‚‹ã ã‘ã§ã™ã€‚ \c main.cpp ファイルã®ç¢ºèªã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™ : - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 119 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 119 è¨˜å· \c{!} ã¯ãƒ†ã‚¹ãƒˆã‚’å¦å®šã—ã¾ã™ã€‚ ã¤ã¾ã‚Š \c{exists( main.cpp )} ã¯ãƒ•ã‚¡ã‚¤ãƒ«ãŒå­˜åœ¨ã™ã‚‹å ´åˆã«çœŸã«ãªã‚Šã€ \c{!exists( main.cpp )} ã¯ãƒ•ã‚¡ã‚¤ãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«çœŸã«ãªã‚Šã¾ã™ã€‚ - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 120 å‰ã¨åŒæ§˜ã«ã€\c qmake を実行ã—㦠Makefile を生æˆã—ã¾ã™ã€‚ 仮㫠\c main.cpp ã®åå‰ã‚’変更ã™ã‚‹ã¨ã€ä¸Šè¨˜ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãŒè¡¨ç¤ºã•ã‚Œã€ @@ -185,12 +185,12 @@ ã¾ãš 1 ã¤ã®ã‚¹ã‚³ãƒ¼ãƒ—を作æˆã—ã€ãã®ä¸­ã«ã‚‚ㆠ1 ã¤ã‚¹ã‚³ãƒ¼ãƒ—を作æˆã—ã¾ã™ã€‚ ãã—㦠2 ã¤ã®ã‚¹ã‚³ãƒ¼ãƒ—ã®ä¸­ã«è¨­å®šã‚’書ãã¾ã™ã€‚例ãˆã°: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 121 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 121 ãƒã‚¹ãƒˆã•ã‚ŒãŸã‚¹ã‚³ãƒ¼ãƒ—ã¯ã‚³ãƒ­ãƒ³ã‚’使ã£ã¦ã¤ãªãã“ã¨ãŒã§ãã¾ã™ã€‚ 最終的ãªãƒ—ロジェクトファイルã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 122 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 122 以上ã§ã™ã€‚\c qmake ã®ãƒãƒ¥ãƒ¼ãƒˆãƒªã‚¢ãƒ«ãŒçµ‚了ã—ã¾ã—ãŸã€‚ ãã‚Œã§ã¯ã€ã‚ãªãŸã®é–‹ç™ºãƒ—ロジェクトã®ãƒ—ロジェクトファイルを作æˆã—ã¦ã¿ã¾ã—ょã†ã€‚ diff --git a/doc/src/ja_JP/development/qtestlib.qdoc b/doc/src/ja_JP/development/qtestlib.qdoc index c1001dc..3ff1f36 100644 --- a/doc/src/ja_JP/development/qtestlib.qdoc +++ b/doc/src/ja_JP/development/qtestlib.qdoc @@ -71,7 +71,7 @@ 次ã«ã€ãƒ†ã‚¹ãƒˆé–¢æ•°ã‚’実装ã—ã¾ã™ã€‚実装ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 8 \l QVERIFY() ãƒã‚¯ãƒ­ã¯ã€å¼•æ•°ã¨ã—ã¦æ¸¡ã•ã‚Œã‚‹å¼ã‚’評価ã—ã¾ã™ã€‚ å¼ãŒçœŸã¨è©•ä¾¡ã•ã‚Œã‚‹ã¨ãƒ†ã‚¹ãƒˆé–¢æ•°ã®å®Ÿè¡ŒãŒç¶™ç¶šã•ã‚Œã¾ã™ã€‚ @@ -131,7 +131,7 @@ ã“ã‚Œã¾ã§ã¯ã€ãƒ†ã‚¹ãƒˆãƒ‡ãƒ¼ã‚¿ã‚’テスト関数ã«ãƒãƒ¼ãƒ‰ã‚³ãƒ¼ãƒ‰ã—ã¦ã„ã¾ã—ãŸã€‚ ã“ã®å ´åˆã€ãƒ†ã‚¹ãƒˆãƒ‡ãƒ¼ã‚¿ã‚’追加ã—ãŸé–¢æ•°ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ãªã‚Šã¾ã™: - \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qtestlib.cpp 11 関数ãŒç¹°ã‚Šè¿”ã—ã‚’è¡Œã†ã‚³ãƒ¼ãƒ‰ã«ã‚ˆã£ã¦åˆ†æ•£ã™ã‚‹ã®ã‚’防ããŸã‚ã«ã€ QTestLib ã¯ãƒ†ã‚¹ãƒˆãƒ‡ãƒ¼ã‚¿ã®ãƒ†ã‚¹ãƒˆé–¢æ•°ã¸ã®è¿½åŠ ã‚’サãƒãƒ¼ãƒˆã—ã¾ã™ã€‚ diff --git a/doc/src/ja_JP/examples/arrowpad.qdoc b/doc/src/ja_JP/examples/arrowpad.qdoc index 9085654..56f14a1 100644 --- a/doc/src/ja_JP/examples/arrowpad.qdoc +++ b/doc/src/ja_JP/examples/arrowpad.qdoc @@ -71,7 +71,7 @@ \c Q_OBJECT ã®ãƒã‚¯ãƒ­ã¯ã€ä»¥ä¸‹ã®å†…容㧠\c ArrowPad ã« \c tr(x) を定義ã—ã¾ã™: - \snippet doc/src/snippets/code/doc_src_examples_arrowpad.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_arrowpad.cpp 0 å„ソーステキストãŒè¡¨ç¤ºã•ã‚Œã‚‹ã‚¯ãƒ©ã‚¹ã‚’把æ¡ã—ã¦ãŠãã¨ã€ \e {Qt Linguist} ã§è«–ç†çš„ã«é–¢é€£ã®ã‚る文字列をグループ化ã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚ diff --git a/doc/src/ja_JP/examples/trollprint.qdoc b/doc/src/ja_JP/examples/trollprint.qdoc index dfe7eaa..ddc6880 100644 --- a/doc/src/ja_JP/examples/trollprint.qdoc +++ b/doc/src/ja_JP/examples/trollprint.qdoc @@ -136,12 +136,12 @@ 変更ã™ã¹ãè¡Œã¯4è¡Œã‚ã‚Šã¾ã™ã€‚ ラジオボタンã®æœ€åˆã®ãƒšã‚¢ã® \c tr() 呼ã³å‡ºã—ã«ã€2ã¤ç›®ã®å¼•æ•° "two-sided"(両é¢) ã‚’ã«è¿½åŠ ã—ã¾ã™: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 0 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 0 ãã—ã¦ã€ãƒ©ã‚¸ã‚ªãƒœã‚¿ãƒ³ã®2番目ã®ãƒšã‚¢ã® \c tr() 呼ã³å‡ºã—ã«ã€ 2ã¤ç›®ã®å¼•æ•° "colors"(色) を追加ã—ã¾ã™ã€‚ - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 1 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 1 ã“ã“ã§ã€\c lupdate を実行ã—ã€\e {Qt Linguist} 㧠\c trollprint_pt.ts ã‚’é–‹ãã¾ã™ã€‚2 ã¤ã®å¤‰æ›´å€‹æ‰€ãŒã‚ã‹ã‚‹ã¯ãšã§ã™ã€‚ @@ -184,7 +184,7 @@ ã“ã‚Œã¯ã€ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã§ \c TRANSLATOR コメントを使用ã—ã¦è¡Œã„ã¾ã™: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 2 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 2 一部ã®ã‚½ãƒ¼ã‚¹ãƒ•ã‚¡ã‚¤ãƒ«ã€ç‰¹ã«ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã‚¯ãƒ©ã‚¹ã®ã‚³ãƒ¡ãƒ³ãƒˆã« ダイアログã«åˆ°é”ã™ã‚‹ã¾ã§ã«å¿…è¦ãªæ“作を記述ã—ã¾ã™ã€‚ @@ -201,7 +201,7 @@ コメントã¯å½¹ç«‹ã¤ãƒŠãƒ“ゲーション情報をæä¾›ã™ã‚‹ãŸã‚〠翻訳ã«è¦ã™ã‚‹æ™‚間を節約ã§ãã¾ã™: - \snippet doc/src/snippets/code/doc_src_examples_trollprint.qdoc 3 + \snippet doc/src/snippets/code/doc_src_examples_trollprint.cpp 3 \section1 Troll Print 1.1 diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 38a7a8b..30b0f16 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -70,7 +70,7 @@ modules are included by default. To link only against QtCore, add the following line to your \c .pro file: - \snippet doc/src/snippets/code/doc_src_modules.qdoc 0 + \snippet doc/src/snippets/code/doc_src_modules.pro 0 On Windows, if you do not use \l qmake or other build tools such as CMake, you also need to link against @@ -91,7 +91,7 @@ All other Qt modules rely on this module. To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtcore.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtcore.cpp 0 */ @@ -105,7 +105,7 @@ To include the definitions of both modules' classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtgui.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtgui.pro 0 */ /*! @@ -118,12 +118,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtmultimedia.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtmultimedia.cpp 1 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtmultimedia.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtmultimedia.pro 0 The functionality provided by the \l{Phonon Module} is on a higher level and in many cases more suitable for application developers. @@ -140,12 +140,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtnetwork.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtnetwork.cpp 1 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtnetwork.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtnetwork.pro 0 */ /*! @@ -175,12 +175,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtopengl.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtopengl.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtopengl.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtopengl.pro 1 The Qt OpenGL module is implemented as a platform-independent Qt/C++ wrapper around the platform-dependent GLX (version 1.3 or later), @@ -266,11 +266,11 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtscript.pro 1 For detailed information on how to make your application scriptable with QtScript, see \l{Making Applications @@ -323,11 +323,11 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc.src.qtscripttools.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtscripttools.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc.src.qtscripttools.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtscripttools.pro 1 */ /*! @@ -338,12 +338,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtsql.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtsql.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtsql.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtsql.pro 1 See the \l{SQL Programming} guide for information about using this module in your applications. @@ -362,12 +362,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtsvg.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtsvg.pro 1 \section1 License Information @@ -412,12 +412,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtxml.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtxml.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtxml.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtxml.pro 1 Further XML support is provided by the \l{Qt Solutions} group who provide, for example, classes that support SOAP and MML with the @@ -437,12 +437,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtxmlpatterns.pro 1 \section1 Further Reading @@ -523,7 +523,7 @@ The following declaration in a \c qmake project file ensures that an application is compiled and linked appropriately: - \snippet doc/src/snippets/code/doc_src_phonon.qdoc 1 + \snippet doc/src/snippets/code/doc_src_phonon.pro 0 \section1 Qt Backends @@ -586,12 +586,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qt3support.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt3support.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qt3support.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt3support.pro 1 \note Since this module provides compatibility classes for diverse parts of the Qt 3 API, it has dependencies on the QtCore, @@ -615,12 +615,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 0 To link against the module, add this line to your \c qmake .pro file: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtdesigner.pro 1 */ /*! @@ -640,7 +640,7 @@ in a \c qmake project file to ensure that the application is compiled and linked appropriately. - \snippet doc/src/snippets/code/doc_src_qtuiloader.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtuiloader.pro 0 A form loader object, provided by the QUiLoader class, is used to construct the user interface. This user interface can @@ -652,7 +652,7 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qtuiloader.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtuiloader.cpp 1 \sa{Calculator Builder Example}, {World Time Clock Builder Example} */ @@ -672,7 +672,7 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qthelp.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qthelp.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: @@ -731,12 +731,12 @@ To include the definitions of the module's classes, use the following directive: - \snippet doc/src/snippets/code/doc_src_qttest.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qttest.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: - \snippet doc/src/snippets/code/doc_src_qttest.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qttest.pro 1 See the \l{QTestLib Manual} for a detailed introduction on how to use Qt's unit testing features with your applications. @@ -865,13 +865,13 @@ To use this module, use the following code in your application: - \snippet doc/src/snippets/code/doc_src_qtdbus.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtdbus.cpp 0 If you're using qmake to build your application, you can add this line to your .pro file to make it link against the QtDBus libraries: - \snippet doc/src/snippets/code/doc_src_qtdbus.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qtdbus.pro 1 \note The source code for this module is located in the \c{src/qdbus} directory. When installing Qt from source, this module is built when Qt's diff --git a/doc/src/objectmodel/objecttrees.qdoc b/doc/src/objectmodel/objecttrees.qdoc index ba677b9..cb63c17 100644 --- a/doc/src/objectmodel/objecttrees.qdoc +++ b/doc/src/objectmodel/objecttrees.qdoc @@ -77,7 +77,7 @@ behavior applies. Normally, the order of destruction still doesn't present a problem. Consider the following snippet: - \snippet doc/src/snippets/code/doc_src_objecttrees.qdoc 0 + \snippet doc/src/snippets/code/doc_src_objecttrees.cpp 0 The parent, \c window, and the child, \c quit, are both \l {QObject} {QObjects} because QPushButton inherits QWidget, and QWidget inherits @@ -91,7 +91,7 @@ But now consider what happens if we swap the order of construction, as shown in this second snippet: - \snippet doc/src/snippets/code/doc_src_objecttrees.qdoc 1 + \snippet doc/src/snippets/code/doc_src_objecttrees.cpp 1 In this case, the order of destruction causes a problem. The parent's destructor is called first because it was created last. It then calls diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc index 7d1ecec..77421c5 100644 --- a/doc/src/objectmodel/properties.qdoc +++ b/doc/src/objectmodel/properties.qdoc @@ -46,12 +46,12 @@ To declare a property, use the \l {Q_PROPERTY()} {Q_PROPERTY()} macro in a class that inherits QObject. - \snippet doc/src/snippets/code/doc_src_properties.qdoc 0 + \snippet doc/src/snippets/code/doc_src_properties.cpp 0 Here are some typical examples of property declarations taken from class QWidget. - \snippet doc/src/snippets/code/doc_src_properties.qdoc 1 + \snippet doc/src/snippets/code/doc_src_properties.cpp 1 A property behaves like a class data member, but it has additional features accessible through the \l {Meta-Object System}. @@ -131,7 +131,7 @@ be a user-defined type. In this example, class QDate is considered to be a user-defined type. - \snippet doc/src/snippets/code/doc_src_properties.qdoc 2 + \snippet doc/src/snippets/code/doc_src_properties.cpp 2 Because QDate is user-defined, you must include the \c{} header file with the property declaration. @@ -152,7 +152,7 @@ the code snippet below, the call to QAbstractButton::setDown() and the call to QObject::setProperty() both set property "down". - \snippet doc/src/snippets/code/doc_src_properties.qdoc 3 + \snippet doc/src/snippets/code/doc_src_properties.cpp 3 Accessing a property through its \c WRITE accessor is the better of the two, because it is faster and gives better diagnostics at @@ -162,7 +162,7 @@ can \e discover a class's properties at run time by querying its QObject, QMetaObject, and \l {QMetaProperty} {QMetaProperties}. - \snippet doc/src/snippets/code/doc_src_properties.qdoc 4 + \snippet doc/src/snippets/code/doc_src_properties.cpp 4 In the above snippet, QMetaObject::property() is used to get \l {QMetaProperty} {metadata} about each property defined in some @@ -189,7 +189,7 @@ for the \c READ and \c WRITE functions. The declaration of MyClass then might look like this: - \snippet doc/src/snippets/code/doc_src_properties.qdoc 5 + \snippet doc/src/snippets/code/doc_src_properties.cpp 5 The \c READ function is const and returns the property type. The \c WRITE function returns void and has exactly one parameter of @@ -200,7 +200,7 @@ QObject that is an instance of MyClass, we have two ways to set its priority property: - \snippet doc/src/snippets/code/doc_src_properties.qdoc 6 + \snippet doc/src/snippets/code/doc_src_properties.cpp 6 In the example, the enumeration type that is the property type is declared in MyClass and registered with the \l{Meta-Object System} @@ -262,7 +262,7 @@ Q_CLASSINFO(), that can be used to attach additional \e{name}--\e{value} pairs to a class's meta-object, for example: - \snippet doc/src/snippets/code/doc_src_properties.qdoc 7 + \snippet doc/src/snippets/code/doc_src_properties.cpp 7 Like other meta-data, class information is accessible at run-time through the meta-object; see QMetaObject::classInfo() for details. diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc index 4c018b5..8b52df5 100644 --- a/doc/src/objectmodel/signalsandslots.qdoc +++ b/doc/src/objectmodel/signalsandslots.qdoc @@ -440,7 +440,7 @@ You can even use both mechanisms in the same project. Just add the following line to your qmake project (.pro) file. - \snippet doc/src/snippets/code/doc_src_containers.qdoc 22 + \snippet doc/src/snippets/code/doc_src_containers.cpp 22 It tells Qt not to define the moc keywords \c{signals}, \c{slots}, and \c{emit}, because these names will be used by a 3rd party diff --git a/doc/src/painting-and-printing/coordsys.qdoc b/doc/src/painting-and-printing/coordsys.qdoc index 252159e..d0906d8 100644 --- a/doc/src/painting-and-printing/coordsys.qdoc +++ b/doc/src/painting-and-printing/coordsys.qdoc @@ -97,10 +97,10 @@ \row \o - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 0 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 0 \o - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 1 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 1 \endtable When rendering with a pen with an even number of pixels, the @@ -163,10 +163,10 @@ \row \o - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 2 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 2 \o - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 3 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 3 \endtable \section1 Transformations @@ -319,7 +319,7 @@ -50) to (50, 50) with (0, 0) in the center by calling the QPainter::setWindow() function: - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 4 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 4 Now, the logical coordinates (-50,-50) correspond to the paint device's physical coordinates (0, 0). Independent of the paint @@ -333,7 +333,7 @@ viewport and "window" maintain the same aspect ratio to prevent deformation: - \snippet doc/src/snippets/code/doc_src_coordsys.qdoc 5 + \snippet doc/src/snippets/code/doc_src_coordsys.cpp 5 If we make the logical coordinate system a square, we should also make the viewport a square using the QPainter::setViewport() diff --git a/doc/src/platforms/emb-performance.qdoc b/doc/src/platforms/emb-performance.qdoc index 1ae35bc..6c96921 100644 --- a/doc/src/platforms/emb-performance.qdoc +++ b/doc/src/platforms/emb-performance.qdoc @@ -103,7 +103,7 @@ operators. Improved memory allocation and performance may be gained by re-implementing these functions: - \snippet doc/src/snippets/code/doc_src_emb-performance.qdoc 1 + \snippet doc/src/snippets/code/doc_src_emb-performance.cpp 1 The example above shows the necessary code to switch to the plain C memory allocators. diff --git a/doc/src/platforms/emb-pointer.qdoc b/doc/src/platforms/emb-pointer.qdoc index b580077..941cba2 100644 --- a/doc/src/platforms/emb-pointer.qdoc +++ b/doc/src/platforms/emb-pointer.qdoc @@ -144,7 +144,7 @@ its headers using -L and -I options in the \c qmake.conf file in your \c mkspec. Also it can be helpful to add a -rpath-link: - \snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 7 + \snippet doc/src/snippets/code/doc_src_emb-pointer.pro 7 In order to use this mouse driver, tslib must also be correctly installed on the target machine. This includes providing a \c diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index 251e900..1f71270 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -99,7 +99,7 @@ If you use \c qmake and Makefiles, use the \c QMAKE_LFLAGS_SONAME setting: - \snippet doc/src/snippets/code/doc_src_mac-differences.qdoc 0 + \snippet doc/src/snippets/code/doc_src_mac-differences.pro 0 Alternatively, you can modify the install name using the install_name_tool(1) on the command line. See its manpage for more @@ -165,7 +165,7 @@ the bundle resides on the disk. The following code returns the path of the application bundle: - \snippet doc/src/snippets/code/doc_src_mac-differences.qdoc 1 + \snippet doc/src/snippets/code/doc_src_mac-differences.cpp 1 Note: When OS X is set to use Japanese, a bug causes this sequence to fail and return an empty string. Therefore, always test the diff --git a/doc/src/platforms/wince-customization.qdoc b/doc/src/platforms/wince-customization.qdoc index a59dd6f..49ba852 100644 --- a/doc/src/platforms/wince-customization.qdoc +++ b/doc/src/platforms/wince-customization.qdoc @@ -146,7 +146,7 @@ application that attempts to dynamically load the Qt for Windows CE libraries using \c LoadLibrary. The following code can be used for this: - \snippet doc/src/snippets/code/doc_src_wince-customization.qdoc 9 + \snippet doc/src/snippets/code/doc_src_wince-customization.cpp 9 Once you have compiled and deployed the application as well as the Qt libraries, start a remote debugger. The debugger will then print the diff --git a/doc/src/porting/porting-qsa.qdoc b/doc/src/porting/porting-qsa.qdoc index ea83e97..e831583 100644 --- a/doc/src/porting/porting-qsa.qdoc +++ b/doc/src/porting/porting-qsa.qdoc @@ -64,7 +64,7 @@ can have named properties. For instance to create an point object with the properties x and y one would write the following Qt Script code: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 0 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 0 The object \c point in this case is constructed as a plain object and we assign two properties, \c x and \c y, to it with the values 12 and @@ -73,17 +73,17 @@ global namespace of the script engine. Similarly, global functions are named properties of the global object; for example: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 1 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 1 An equivalent construction that illustrates that the function is a property of the global object is the following assignment: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 2 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 2 Since functions are objects, they can be assigned to objects as properties, becoming member functions: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 3 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 3 In the code above, we see the first subtle difference between QSA and Qt Script. In QSA one would write the point class like this: @@ -99,7 +99,7 @@ All the code above runs with QSA except the assignment of a function to \c{point.manhattanLength}, which we repeat here for clarity: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 5 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 5 This is because, in QSA, the value of \c this is decided based on the location of the declaration of the function it is used in. In the @@ -129,7 +129,7 @@ function with the newly created object as the \c this pointer. So, in a sense, it is equivalent to: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 8 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 8 This is similar to the manhattenLength() example above. Again, the main difference between QSA and Qt Script is that one has to @@ -149,7 +149,7 @@ one could write this in Qt Script as: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 10 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 10 In QSA, the member functions were part of the class declaration, and were therefore shared between all instances of a given class. @@ -173,7 +173,7 @@ To make the \c toString() function part of the prototype, we write code like this: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 11 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 11 Here, we made the \c toString() function part of the prototype so that, when we call \c{car.toString()} it will be resolved via the @@ -195,7 +195,7 @@ without any special members, but it is possible to replace this object with another prototype object. - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 13 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 13 In the code above, we have a constructor, \c{GasolineCar}, which calls the "base class" implementation of the constructor to @@ -223,7 +223,7 @@ as static members as properties of the constructor function. For example: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 15 + \snippet doc/src/snippets/code/doc_src_porting-qsa.js 15 Note that in QSA, static member variables were also accessible in instances of the given class. In Qt Script, with the approach @@ -374,7 +374,7 @@ the interpreter using their object names as the names of the variables. - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 16 + \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 16 The code above adds the button to the global namespace under the name "button". One obvious limitation here is that there is potential for @@ -382,7 +382,7 @@ provides a more flexible way of adding QObjects to the scripting environment. - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 17 + \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 17 In the code above we create a QPushButton and wrap it in a script value using the function, QScriptEngine::newQObject(). This gives us @@ -404,14 +404,14 @@ Below is listed some code from the filter example in the QSA package. - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 18 + \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 18 The equivalent in Qt Script is written in much the same way as constructors are written in scripts. We register a callback C++ function under the name "ImageSource" in the global namespace and return the QObject from this function: - \snippet doc/src/snippets/code/doc_src_porting-qsa.qdoc 19 + \snippet doc/src/snippets/code/doc_src_porting-qsa.cpp 19 In the Qt Script case we use the same approach that we use to expose a QObject, namely via QScriptEngine::newQObject(). This function also diff --git a/doc/src/porting/porting4-canvas.qdoc b/doc/src/porting/porting4-canvas.qdoc index 445f66d..1e20384 100644 --- a/doc/src/porting/porting4-canvas.qdoc +++ b/doc/src/porting/porting4-canvas.qdoc @@ -152,7 +152,7 @@ \row \o Q3Canvas::onCanvas() \o The is no equivalent to this function in Graphics View. However, you can combine QGraphicsScene::sceneRect() and QRectF::intersects(): - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 0 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 0 \row \o Q3Canvas::rect() \o The equivalent, QGraphicsScene::sceneRect(), returns a QRectF (double @@ -251,7 +251,7 @@ out the public tile API can then be declared as new members of this class. Here is one example of how to implement tile support: - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 1 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 1 Depending on how your scene uses tiles, you may be able to simplify this approach. In this example, we will try to mimic the behavior @@ -264,30 +264,30 @@ two-dimensional vector of ints to keep track of what tiles should be used at what parts of the scene. - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 2 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 2 In setTiles(), we store the pixmap and tile properties as members of the class. Then we resize the tiles vector to match the width and height of our tile grid. - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 3 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 3 The setTile() function updates the tiles index, and then updates the corresponding rect in the scene by calling tileRect(). - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 4 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 4 The first tileRect() function returns a QRect for the tile at position (x, y). - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 5 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 5 The second tileRect() function returns a QRect for a tile number. With these functions in place, we can implement the drawBackground() function. - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 6 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 6 In drawBackground(), we redraw all tiles that have been exposed by intersecting each tile rect with the exposed background @@ -522,7 +522,7 @@ For compatibility, you may want to shift the ellipse up and to the left to keep the ellipse centered. Example: - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 7 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 7 Note: QGraphicsEllipseItem uses QAbstractGraphicsShapeItem::pen() for outlines, whereas Q3CanvasEllipse did not use @@ -588,7 +588,7 @@ QPainterPath::moveTo() and QPainterPath::cubicTo(). Here is how you can convert a bezier curve Q3PointArray to a QPainterPath: - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 8 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 8 Note: QGraphicsPathItem uses QAbstractGraphicsShapeItem::pen() for outlines, whereas Q3CanvasSpline did not use @@ -653,7 +653,7 @@ functionality using Graphics View, you can load the images by using QDir: - \snippet doc/src/snippets/code/doc_src_porting4-canvas.qdoc 9 + \snippet doc/src/snippets/code/doc_src_porting4-canvas.cpp 9 \section2 Q3CanvasText diff --git a/doc/src/porting/porting4-designer.qdoc b/doc/src/porting/porting4-designer.qdoc index d84af3f..ef3e746 100644 --- a/doc/src/porting/porting4-designer.qdoc +++ b/doc/src/porting/porting4-designer.qdoc @@ -104,7 +104,7 @@ For example, here's the \c uic output for a simple \c helloworld.ui form (some details were removed for simplicity): - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 0 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 0 In this case, the main container was specified to be a QWidget (or any subclass of QWidget). Had we started with a QMainWindow @@ -116,7 +116,7 @@ an instance of the main container (a plain QWidget), and call \c setupUi(): - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 1 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 1 The second approach is to inherit from both the \c Ui::HelloWorld class and the main container, and to call \c setupUi() in the @@ -124,7 +124,7 @@ its subclasses, e.g. QDialog) must appear first in the base class list so that \l{moc} picks it up correctly. For example: - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 2 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 2 This second method is useful when porting Qt 3 forms to Qt 4. \c HelloWorldWidget is a class whose instance is the actual form @@ -212,7 +212,7 @@ them to the widgets in the form after calling \c setupUi(). For example: - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 5 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 5 A quick and dirty way to port forms containing custom signals and slots is to generate the code using \c uic3, rather than \c uic. Since @@ -233,7 +233,7 @@ \tt{\e{signalName}}, then this signal will be connected to the main container's slot. For example: - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 6 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 6 Because of the naming convention, \c setupUi() automatically connects \c pushButton's \c clicked() signal to \c @@ -257,14 +257,14 @@ Next, we add the resource file to our \c .pro file: - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 8 + \snippet doc/src/snippets/code/doc_src_porting4-designer.pro 8 When \c qmake is run, it will create the appropriate Makefile rules to call \c rcc on the resource file, and compile and link the result into the application. The icons may be accessed as follows: - \snippet doc/src/snippets/code/doc_src_porting4-designer.qdoc 9 + \snippet doc/src/snippets/code/doc_src_porting4-designer.cpp 9 In each case, the leading colon tells Qt to look for the file in the virtual file tree defined by the set of resource files diff --git a/doc/src/porting/porting4-dnd.qdoc b/doc/src/porting/porting4-dnd.qdoc index 92b9fc1..993b8d2 100644 --- a/doc/src/porting/porting4-dnd.qdoc +++ b/doc/src/porting/porting4-dnd.qdoc @@ -54,7 +54,7 @@ \l{Q3DragObject::}{drag()} function is called, and it receives no information about how the operation ended. - \snippet doc/src/snippets/code/doc_src_dnd.qdoc 0 + \snippet doc/src/snippets/code/doc_src_dnd.cpp 0 Similarly, in Qt 4, drag operations are also initiated when a QDrag object is constructed and its \l{QDrag::}{exec()} function is called. In contrast, @@ -94,7 +94,7 @@ indicating success or failure of these checks via the event's \l{QDragEnterEvent::}{accept()} function, as shown in this simple example: - \snippet doc/src/snippets/code/doc_src_dnd.qdoc 1 + \snippet doc/src/snippets/code/doc_src_dnd.cpp 1 In Qt 4, you can examine the MIME type describing the data to determine whether the widget should accept the event or, for common data types, you @@ -113,7 +113,7 @@ accept dropped data in the form of text or images might provide an implementation of \l{QWidget::}{dropEvent()} that looks like the following: - \snippet doc/src/snippets/code/doc_src_dnd.qdoc 2 + \snippet doc/src/snippets/code/doc_src_dnd.cpp 2 In Qt 4, the event is handled in a similar way: diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index 862d22b..ec2886b6 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -760,7 +760,7 @@ function. The solution is to reimplement QWidget::paintEvent() in your QAbstractButton subclass as follows: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 0 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 0 \table \header \o Q3Button function \o QAbstractButton equivalent @@ -860,11 +860,11 @@ \o QMemArray::at() returned a non-const reference, whereas the new QByteArray::at() returns a const value. Code like - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 1 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 1 will no longer compile. Instead, use QByteArray::operator[]: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 2 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 2 \o The QMemArray::contains(char) function has been renamed QByteArray::count(char). In addition, there now exists a @@ -935,11 +935,11 @@ function returns \c void and either adds it to the cache or deletes it right away. Old code like - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 3 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 3 becomes - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 4 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 4 \o The new QCache class \e always takes ownership of the items it stores (i.e. auto-delete is always on). If you use Q3Cache @@ -950,11 +950,11 @@ pointers, not the objects that the pointers refer to. For example, - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 5 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 5 becomes - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 6 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 6 An alternative is to stick to using Q3Cache. \endlist @@ -1051,7 +1051,7 @@ you can simply replace colorGroup() with palette(): - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 7 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 7 \section1 QColorDrag @@ -1089,7 +1089,7 @@ '\\0' issue is handled by having QByteArray allocate one extra byte that it always sets to '\\0'. For example: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 8 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 8 The Qt3Support library contains a class called Q3CString that inherits from the new QByteArray class and that @@ -1416,26 +1416,26 @@ \header \o Q3Dict idiom \o QMultiHash idiom \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 9 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 9 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 10 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 10 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 11 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 11 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 12 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 12 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 13 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 13 (also called from Q3Dict's destructor) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 14 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 14 In 99% of cases, the following idiom also works: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 15 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 15 However, it may lead to crashes if \c hash is referenced from the value type's destructor, because \c hash contains @@ -1471,11 +1471,11 @@ Be aware that QHashIterator has a different way of iterating than Q3DictIterator. A typical loop with Q3DictIterator looks like this: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 16 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 16 Here's the equivalent QHashIterator loop: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 17 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 17 See \l{Java-style iterators} for details. @@ -2377,7 +2377,7 @@ Use QObject::findChildren() (or qFindChildren() if you need MSVC 6 compatibility) instead of QObject::queryList(). For example: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 18 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 18 QObject::killTimers() has been removed because it was unsafe to use in subclass. (A subclass normally doesn't know whether the @@ -2712,48 +2712,48 @@ \header \o QPtrList idiom \o QList idiom \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 19 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 19 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 20 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 20 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 21 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 21 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 22 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 22 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 23 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 23 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 24 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 24 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 25 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 25 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 26 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 26 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 27 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 27 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 28 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 28 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 29 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 29 (removes the current item) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 30 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 30 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 31 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 31 (also called from QPtrList's destructor) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 32 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 32 In 99% of cases, the following idiom also works: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 33 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 33 However, it may lead to crashes if \c list is referenced from the value type's destructor, because \c list contains @@ -2790,11 +2790,11 @@ Be aware that QListIterator has a different way of iterating than QPtrList. A typical loop with QPtrList looks like this: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 34 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 34 Here's the equivalent QListIterator loop: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 35 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 35 Finally, QPtrListIterator must also be ported. There are no fewer than four iterator classes that can be used as a @@ -2821,11 +2821,11 @@ iterating than QPtrList. A typical loop with QPtrList looks like this: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 36 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 36 Here's the equivalent QListIterator loop: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 37 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 37 Finally, QPtrListStdIterator must also be ported. This is easy, because QList also provides STL-style iterators @@ -2864,26 +2864,26 @@ \header \o QPtrQueue idiom \o QQueue idiom \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 38 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 38 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 39 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 39 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 40 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 40 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 41 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 41 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 42 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 42 (also called from QPtrQueue's destructor) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 43 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 43 In 99% of cases, the following idiom also works: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 44 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 44 However, it may lead to crashes if \c queue is referenced from the value type's destructor, because \c queue contains @@ -2923,26 +2923,26 @@ \header \o QPtrStack idiom \o QStack idiom \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 45 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 45 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 46 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 46 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 47 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 47 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 48 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 48 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 49 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 49 (also called from QPtrStack's destructor) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 50 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 50 In 99% of cases, the following idiom also works: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 51 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 51 However, it may lead to crashes if \c stack is referenced from the value type's destructor, because \c stack contains @@ -3024,36 +3024,36 @@ \header \o QPtrVector idiom \o QVector idiom \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 52 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 52 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 53 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 53 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 54 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 54 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 55 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 55 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 56 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 56 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 57 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 57 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 58 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 58 \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 59 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 59 \row \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 60 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 60 (also called from QPtrVector's destructor) \o - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 61 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 61 In 99% of cases, the following idiom also works: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 62 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 62 However, it may lead to crashes if \c vect is referenced from the value type's destructor, because \c vect contains @@ -3193,7 +3193,7 @@ An easy way of porting to Qt 4 is to include this class into your project and to use it instead of \c QShared: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 63 If possible, we recommend that you use QSharedData and QSharedDataPointer instead. They provide thread-safe reference @@ -3217,11 +3217,11 @@ Previously, you would do the following with Q3SimpleRichText: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63a + \snippet doc/src/snippets/code/doc_src_porting4.cpp 63a However, with QTextDocument, you use the following code instead: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63b + \snippet doc/src/snippets/code/doc_src_porting4.cpp 63b See \l{Rich Text Processing} for an overview of the Qt 4 rich text classes. @@ -3233,7 +3233,7 @@ The slider's rect can now be retrieved using the code snippet below: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 63c + \snippet doc/src/snippets/code/doc_src_porting4.cpp 63c In addition, the direction of a vertical QSlider has changed, i.e. the bottom is now the minimum, and the top the maximum. You @@ -3454,7 +3454,7 @@ byte array; you should avoid taking a pointer to the data contained in temporary objects. - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 64 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 64 In the above example, the \c goodData pointer is valid for the lifetime of the \c asciiData byte array. If you need to keep a copy of the data @@ -3464,11 +3464,11 @@ \o QString::at() returned a non-const reference, whereas the new QString::at() returns a const value. Code like - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 65 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 65 will no longer compile. Instead, use QString::operator[]: - \snippet doc/src/snippets/code/doc_src_porting4.qdoc 66 + \snippet doc/src/snippets/code/doc_src_porting4.cpp 66 \o The QString::contains(\e x) function (where \e x is a character or a string) has been renamed QString::count(\e x). diff --git a/doc/src/porting/qt3to4.qdoc b/doc/src/porting/qt3to4.qdoc index 336601f..3c95b4c 100644 --- a/doc/src/porting/qt3to4.qdoc +++ b/doc/src/porting/qt3to4.qdoc @@ -122,7 +122,7 @@ In some cases, you might get compiler errors because of identifiers in the global namespace (e.g., \c CTRL). Adding - \snippet doc/src/snippets/code/doc_src_qt3to4.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt3to4.cpp 2 at the beginning of the source file that contains the indentifier solves the problem. diff --git a/doc/src/porting/qt4-accessibility.qdoc b/doc/src/porting/qt4-accessibility.qdoc index 6e56942..2d9e8c3 100644 --- a/doc/src/porting/qt4-accessibility.qdoc +++ b/doc/src/porting/qt4-accessibility.qdoc @@ -68,7 +68,7 @@ variable set to 1. For example, this is set in the following way with the bash shell: - \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc environment + \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp environment Accessibility features are built into Qt by default when the libraries are configured and built. @@ -132,17 +132,17 @@ information for a custom widget. We can use QAccessibleWidget as a base class and reimplement various functions: - \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 0 Here's how we would implement the \l{QAccessibleInterface::doAction()}{doAction()} function to call a function named click() on the wrapped MyWidget object when the user invokes the object's default action or "presses" it. - \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 1 To export the widget interface as a plugin, we must subclass QAccessibleFactory: - \snippet doc/src/snippets/code/doc_src_qt4-accessibility.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-accessibility.cpp 2 */ diff --git a/doc/src/porting/qt4-arthur.qdoc b/doc/src/porting/qt4-arthur.qdoc index 434aa29..460a048 100644 --- a/doc/src/porting/qt4-arthur.qdoc +++ b/doc/src/porting/qt4-arthur.qdoc @@ -119,7 +119,7 @@ Setting a linear gradient brush is done by creating a QLinearGradient object and setting it as a brush. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 0 The code shown above produces a pattern as show in the following pixmap: @@ -130,7 +130,7 @@ focal point. Setting a radial brush is done by creating a QRadialGradient object and setting it as a brush. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 1 The code shown above produces a pattern as shown in the following pixmap: @@ -141,7 +141,7 @@ angle. Setting a conical brush is done by creating a QConicalGradient object and setting it as a brush. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 2 The code shown above produces a pattern as shown in the following pixmap: @@ -156,7 +156,7 @@ transparent color, while 255 represents a fully opaque color. For example: - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 3 The code shown above produces the following output: @@ -180,7 +180,7 @@ provide the option of turning on anti-aliased edges when drawing graphics primitives. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 4 This produces the following output: @@ -221,7 +221,7 @@ first add a rectangle, which becomes a closed subpath. We then add two bezier curves, and finally draw the entire path. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 5 The code above produces the following output: @@ -236,18 +236,18 @@ painting to an off-screen pixmap then copying the pixmap to the screen. For example: - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 6 Since the double-buffering is handled by QWidget internally this now becomes: - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 7 Double-buffering is turned on by default, but can be turned off for individual widgets by setting the widget attribute Qt::WA_PaintOnScreen. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 8 \section2 Pen and Brush Transformation @@ -270,7 +270,7 @@ possible to specify both texture and gradient fills for both text and outlines. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 9 The code above produces the following output: @@ -290,7 +290,7 @@ Painting on an image is as simple as drawing on any other paint device. - \snippet doc/src/snippets/code/doc_src_qt4-arthur.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qt4-arthur.cpp 10 \section2 SVG Rendering Support diff --git a/doc/src/porting/qt4-mainwindow.qdoc b/doc/src/porting/qt4-mainwindow.qdoc index 1eff2c2..ebfbc8d 100644 --- a/doc/src/porting/qt4-mainwindow.qdoc +++ b/doc/src/porting/qt4-mainwindow.qdoc @@ -86,7 +86,7 @@ the first time it is called. You can also call QMainWindow::setMenuBar() to use a custom menu bar in the main window. - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 0 \dots \snippet examples/mainwindows/menus/mainwindow.cpp 5 \dots @@ -110,7 +110,7 @@ \snippet examples/mainwindows/sdi/mainwindow.cpp 0 \dots - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 1 In this example, the toolbar is restricted to the top and bottom toolbar areas of the main window, and is initially placed in the @@ -132,7 +132,7 @@ required, the default can be changed with the QMainWindow::setCorner() function: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 2 The following diagram shows the configuration produced by the above code. Note that the left and right dock widgets will occupy the top and bottom @@ -143,7 +143,7 @@ Once all of the main window components have been set up, the central widget is created and installed by using code similar to the following: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 3 The central widget can be any subclass of QWidget. @@ -217,17 +217,17 @@ constructed using the general QMenu class. Qt 3: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 4 Qt 4: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 5 Toolbars follow the same pattern as menus, with the new, more consistent behavior: Qt 3: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 6 Qt 4: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 7 The behavior of dock widgets is now configured through the member functions of QDockWidget. For example, compare the old and new ways @@ -235,7 +235,7 @@ main window. In Qt 3: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 8 In Qt 4: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 9 */ diff --git a/doc/src/porting/qt4-sql.qdoc b/doc/src/porting/qt4-sql.qdoc index bafaacb..2a5a206 100644 --- a/doc/src/porting/qt4-sql.qdoc +++ b/doc/src/porting/qt4-sql.qdoc @@ -104,12 +104,12 @@ The simplest way to present data from a database is to simply combine a QSqlQueryModel with a QTableView: - \snippet doc/src/snippets/code/doc_src_qt4-sql.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-sql.cpp 0 To present the contents of a single table, we can use QSqlTableModel instead: - \snippet doc/src/snippets/code/doc_src_qt4-sql.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-sql.cpp 1 In practice, it's common that we need to customize the rendering of a field in the database. In that case, we can create our own diff --git a/doc/src/porting/qt4-styles.qdoc b/doc/src/porting/qt4-styles.qdoc index 76b0b1c..7422f06 100644 --- a/doc/src/porting/qt4-styles.qdoc +++ b/doc/src/porting/qt4-styles.qdoc @@ -90,7 +90,7 @@ pointer type is correct. If the object isn't of the right type, qstyleoption_cast() returns 0. For example: - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 0 For performance reasons, there are few member functions and the access to the variables is direct. This "low-level" feel makes @@ -108,7 +108,7 @@ The following code snippet illustrates how to use QStyle to draw the focus rectangle from a custom widget's paintEvent(): - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 1 The next example shows how to derive from an existing style to customize the look of a graphical element: @@ -130,11 +130,11 @@ For example, here's the signature of the QStyle::drawControl() function in Qt 3: - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 2 Here's the signature of the same function in Qt 4: - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 3 In Qt 3, some of the information required to draw a graphical element was stored in a QStyleOption parameter, while the rest diff --git a/doc/src/porting/qt4-tulip.qdoc b/doc/src/porting/qt4-tulip.qdoc index 161c373..c78ff96 100644 --- a/doc/src/porting/qt4-tulip.qdoc +++ b/doc/src/porting/qt4-tulip.qdoc @@ -80,16 +80,16 @@ addition to the C++ language that is implemented using the standard C++ preprocessor. The syntax is: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 0 Example: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 1 The iterator variable can also be defined outside the loop. For example: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 2 Just like standard \c for loops, foreach supports braces, \c break, \c continue, and nested loops. Qt makes a copy of the @@ -124,25 +124,25 @@ Traversing a container using a Java-style iterator: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 3 Modifying items using a Java-style iterator: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 4 Removing items using a Java-style iterator: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 5 Iterating over items with a particular value using STL-style vs. Java-style iterators: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 6 Modifying and removing items using STL-style vs. Java-style iterators: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 7 The next group of examples show the API of the container classes themselves. The API is similar to the QTL classes of Qt 3, but is nicer @@ -151,16 +151,16 @@ Iterating over a QList using an index (which is fast even for large lists, because QList is implemented as an array-list): - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 8 Retrieving a value from a map, using a default value if the key doesn't exist: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 9 Getting all the values for a particular key in a QMultiMap or QMultiHash: - \snippet doc/src/snippets/code/doc_src_qt4-tulip.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qt4-tulip.cpp 10 \section1 Comparison with Qt 3 diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 3cabb1c..70a5167 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -276,11 +276,11 @@ link your application against QtCore and QtGui. To remove the dependency upon QtGui, add the line - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 0 to your .pro file. To enable the other libraries, add the line - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 1 Another change to the build system is that moc now understands preprocessor directives. qmake automatically passes the defines set @@ -290,21 +290,21 @@ To compile code that uses UI files, you will also need this line in the .pro file: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 2 \section1 Include Syntax The syntax for including Qt class definitions has become - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 3 For example: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 4 This is guaranteed to work for any public Qt class. The old syntax, - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 5 still works, but we encourage you to switch to the new syntax. @@ -318,7 +318,7 @@ To include the definitions for all the classes in a library, simply specify the name of that library. For example: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 6 \section1 Namespaces @@ -330,7 +330,7 @@ to access a constant that is part of the Qt namespace, prefix it with \c{Qt::} (e.g., \c{Qt::yellow}), or add the directive - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 7 at the top of your source files, after your \c #include directives. If you use the \c{using namespace} syntax you don't @@ -360,7 +360,7 @@ \list \o Code that used it looked confusing, for example: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 8 \c label1 is a QLabel that displays the text "Hello"; \c label2 is a QLabel with no text, with the object name @@ -370,7 +370,7 @@ they blindly followed Qt's convention and provided a "const char *name" in their subclasses's constructors. For example: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 9 \o The name parameter was in Qt since version 1, and it always was documented as: "It is not very useful in the current @@ -405,12 +405,12 @@ Here's the Qt 3 idiom to cast a type to a subtype: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 10 The Qt 4 idiom is both cleaner and safer, because typos will always result in compiler errors: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 11 \section1 QPointer @@ -421,7 +421,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 12 QPointer is more or less the same as the old QGuardedPtr class, except that it is now implemented in a much more lightweight manner @@ -461,7 +461,7 @@ To enable the Qt 3 support classes and functions, add the line - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 13 to your \c .pro file. @@ -469,18 +469,18 @@ in a compiler warning (e.g., "'find' is deprecated"). If you want to turn off that warning, add the line - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 14 to your \c .pro file. If you want to use compatibility functions but don't want to link against the Qt3Support library, add the line - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 15 or - \snippet doc/src/snippets/code/doc_src_qt4-intro.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qt4-intro.pro 16 to your \c .pro file, depending on whether you want compatibility function calls to generate compiler warnings or not. diff --git a/doc/src/scripting/qtscriptextensions.qdoc b/doc/src/scripting/qtscriptextensions.qdoc index 888cf73..431adb0 100644 --- a/doc/src/scripting/qtscriptextensions.qdoc +++ b/doc/src/scripting/qtscriptextensions.qdoc @@ -68,7 +68,7 @@ An example of a simple \c{__init__.js}: - \snippet doc/src/snippets/code/doc_src_qtscriptextensions.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtscriptextensions.js 0 QScriptEngine will look for a QScriptExtensionPlugin that provides the relevant extension by querying each plugin for its keys() diff --git a/doc/src/scripting/scripting.qdoc b/doc/src/scripting/scripting.qdoc index 79fed97..112af5c 100644 --- a/doc/src/scripting/scripting.qdoc +++ b/doc/src/scripting/scripting.qdoc @@ -144,7 +144,7 @@ script function. In the following example a script signal handler is defined that will handle the QLineEdit::textChanged() signal: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 47 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 47 The first two arguments to qScriptConnect() are the same as you would pass to QObject::connect() to establish a normal C++ @@ -155,7 +155,7 @@ ("slot") itself. The following example shows how the \c this argument can be put to use: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 48 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 48 We create two QLineEdit objects and define a single signal handler function. The connections use the same handler function, but the @@ -179,13 +179,13 @@ In this form of connection, the argument to \c{connect()} is the function to connect to the signal. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qtscript.js 2 The argument can be a Qt Script function, as in the above example, or it can be a QObject slot, as in the following example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qtscript.js 3 When the argument is a QObject slot, the argument types of the signal and slot do not necessarily have to be compatible; @@ -196,7 +196,7 @@ \c{disconnect()} function, passing the function to disconnect as argument: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qtscript.js 4 When a script function is invoked in response to a signal, the \c this object will be the Global Object. @@ -214,11 +214,11 @@ \c{clicked} signal; passing the form as the \c this object makes sense in such a case. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qtscript.js 5 To disconnect from the signal, pass the same arguments to \c{disconnect()}: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qtscript.js 6 \section3 Signal to Named Member Function Connections @@ -234,11 +234,11 @@ Note that the function is resolved when the connection is made, not when the signal is emitted. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qtscript.js 7 To disconnect from the signal, pass the same arguments to \c{disconnect()}: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qtscript.js 8 \section3 Error Handling @@ -247,14 +247,14 @@ You can obtain an error message from the resulting \c{Error} object. Example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qtscript.js 9 \section3 Emitting Signals from Scripts To emit a signal from script code, you simply invoke the signal function, passing the relevant arguments: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qtscript.js 10 It is currently not possible to define a new signal in a script; i.e., all signals must be defined by C++ classes. @@ -267,13 +267,13 @@ \c{myOverloadedSlot(int)} and \c{myOverloadedSlot(QString)}, the following script code will behave reasonably: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qtscript.js 11 You can specify a particular overload by using array-style property access with the \l{QMetaObject::normalizedSignature()}{normalized signature} of the C++ function as the property name: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qtscript.js 12 If the overloads have different number of arguments, QtScript will pick the overload with the argument count that best matches the @@ -291,11 +291,11 @@ property will automatically be invoked. For example, if your C++ class has a property declared as follows: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 13 then script code can do things like the following: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qtscript.js 14 \section2 Accessing Child QObjects @@ -306,12 +306,12 @@ \c{"okButton"}, you can access this object in script code through the expression - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qtscript.js 15 Since \c{objectName} is itself a Q_PROPERTY, you can manipulate the name in script code to, for example, rename an object: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qtscript.js 16 You can also use the functions \c{findChild()} and \c{findChildren()} to find children. These two functions behave identically to @@ -320,7 +320,7 @@ For example, we can use these functions to find objects using strings and regular expressions: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qtscript.js 17 You typically want to use \c{findChild()} when manipulating a form that uses nested layouts; that way the script is isolated from the @@ -367,7 +367,7 @@ For example, a constructor function that constructs QObjects only to be used in the script environment is a good candidate: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 18 \section3 Auto-Ownership @@ -638,7 +638,7 @@ For example, the following class definition enables scripting only for certain functions: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 19 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 19 In the example above, aNonScriptableFunction() is not declared as a slot, so it will not be available in QtScript. The other three @@ -649,7 +649,7 @@ It is possible to make any function script-invokable by specifying the \c{Q_INVOKABLE} modifier when declaring the function: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 20 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 20 Once declared with \c{Q_INVOKABLE}, the method can be invoked from QtScript code just as if it were a slot. Although such a method is @@ -662,14 +662,14 @@ In the previous example, if we wanted to get or set a property using QtScript we would have to write code like the following: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 21 + \snippet doc/src/snippets/code/doc_src_qtscript.js 21 Scripting languages often provide a property syntax to modify and retrieve properties (in our case the enabled state) of an object. Many script programmers would want to write the above code like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 22 + \snippet doc/src/snippets/code/doc_src_qtscript.js 22 To make this possible, you must define properties in the C++ QObject subclass. For example, the following \c MyObject class declaration @@ -677,7 +677,7 @@ \c{setEnabled(bool)} as its setter function and \c{isEnabled()} as its getter function: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 23 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 23 The only difference from the original code is the use of the macro \c{Q_PROPERTY}, which takes the type and name of the property, and @@ -688,7 +688,7 @@ declaring the property; by default, the \c{SCRIPTABLE} attribute is \c true. For example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 24 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 24 \section2 Reacting to C++ Objects Signals in Scripts @@ -703,14 +703,14 @@ regardless of whether the signal will be connected to a slot in C++ or in QtScript. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 25 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 25 The only change we have made to the code in the previous section is to declare a signals section with the relevant signal. Now, the script writer can define a function and connect to the object like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 26 + \snippet doc/src/snippets/code/doc_src_qtscript.js 26 \section2 Design of Application Objects @@ -752,7 +752,7 @@ still allowing pointers to your custom objects to flow seamlessly between C++ and scripts. Example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 43 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 43 \section1 Function Objects and Native Functions @@ -778,23 +778,23 @@ result. The following script defines a Qt Script object that has a toKelvin() function: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 90 + \snippet doc/src/snippets/code/doc_src_qtscript.js 90 The toKelvin() function takes a temperature in Kelvin as argument, and returns the temperature converted to Celsius. The following snippet shows how the toKelvin() function might be obtained and called from C++: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 91 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 91 If a script defines a global function, you can access the function as a property of QScriptEngine::globalObject(). For example, the following script defines a global function add(): - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 56 + \snippet doc/src/snippets/code/doc_src_qtscript.js 56 C++ code might call the add() function as follows: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 92 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 92 As already mentioned, functions are just values in Qt Script; a function by itself is not "tied to" a particular object. This is why you have to specify @@ -816,7 +816,7 @@ is invoked determines the \c this object when the function body is executed, as the following script example illustrates: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 49 + \snippet doc/src/snippets/code/doc_src_qtscript.js 49 An important thing to note is that in Qt Script, unlike C++ and Java, the \c this object is not part of the execution scope. This means that @@ -824,14 +824,14 @@ use the \c this keyword to access the object's properties. For example, the following script probably doesn't do what you want: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 50 + \snippet doc/src/snippets/code/doc_src_qtscript.js 50 You will get a reference error saying that 'a is not defined' or, worse, two totally unrelated global variables \c a and \c b will be used to perform the computation, if they exist. Instead, the script should look like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 51 + \snippet doc/src/snippets/code/doc_src_qtscript.js 51 Accidentally omitting the \c this keyword is a typical source of error for programmers who are used to the scoping rules of C++ and Java. @@ -844,7 +844,7 @@ your function as if it were a "normal" script function. Here is how the previous \c{getProperty()} function can be written in C++: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 52 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 52 Call QScriptEngine::newFunction() to wrap the function. This will produce a special type of function object that carries a pointer to @@ -905,7 +905,7 @@ script would normally define an \c{add()} function that takes two arguments, adds them together and returns the result: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 56 + \snippet doc/src/snippets/code/doc_src_qtscript.js 56 When a script function is defined with formal parameters, their names can be viewed as mere aliases of properties of the \c @@ -914,12 +914,12 @@ variable. This means that the \c{add()} function can equivalently be written like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 57 + \snippet doc/src/snippets/code/doc_src_qtscript.js 57 This latter form closely matches what a native implementation typically looks like: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 58 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 58 \section3 Checking the Number of Arguments @@ -930,13 +930,13 @@ really needs two arguments in order to do something useful. This can be expressed by the script definition as follows: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 59 + \snippet doc/src/snippets/code/doc_src_qtscript.js 59 This would result in an error being thrown if a script invokes \c{add()} with anything other than two arguments. The native function can be modified to perform the same check: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 62 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 62 \section3 Checking the Types of Arguments @@ -954,7 +954,7 @@ stricter semantics (namely, that it should only add numeric operands), the argument types can be tested: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 60 + \snippet doc/src/snippets/code/doc_src_qtscript.js 60 Then an invocation like \c{add("foo", new Array())} will cause an error to be thrown. @@ -962,12 +962,12 @@ The C++ version can call QScriptValue::isNumber() to perform similar tests: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 63 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 63 A less strict script implementation might settle for performing an explicit to-number conversion before applying the \c{+} operator: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 61 + \snippet doc/src/snippets/code/doc_src_qtscript.js 61 In a native implementation, this is equivalent to calling QScriptValue::toNumber() without performing any type test first, @@ -1000,21 +1000,21 @@ \c{concat("Qt", " ", "Script ", 101)} would return "Qt Script 101". A script definition of \c{concat()} might look like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 64 + \snippet doc/src/snippets/code/doc_src_qtscript.js 64 Here is an equivalent native implementation: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 65 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 65 A second use case for a variable number of arguments is to implement optional arguments. Here's how a script definition typically does it: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 66 + \snippet doc/src/snippets/code/doc_src_qtscript.js 66 And here's the native equivalent: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 67 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 67 A third use case for a variable number of arguments is to simulate C++ overloads. This involves checking the number of arguments and/or @@ -1043,7 +1043,7 @@ call to another function. In script code, this is what it typically looks like: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 68 + \snippet doc/src/snippets/code/doc_src_qtscript.js 68 For example, \c{foo(10, 20, 30)} would result in the \c{foo()} function executing the equivalent of \c{bar(10, 20, 30)}. This is useful if @@ -1054,7 +1054,7 @@ function that has the exact same "signature". In C++, the forwarding function might look like this: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 69 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 69 \o The arguments object can serve as input to a QScriptValueIterator, providing a generic way to iterate over the arguments. A debugger @@ -1072,7 +1072,7 @@ Some script functions are constructors; they are expected to initialize new objects. The following snippet is a small example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 75 + \snippet doc/src/snippets/code/doc_src_qtscript.js 75 There is nothing special about constructor functions. In fact, any script function can act as a constructor function (i.e., any function @@ -1118,7 +1118,7 @@ The following example implements a constructor function that always creates and initializes a new object: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 76 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 76 Given this constructor, scripts would be able to use either the expression \c{new Person("Bob")} or \c{Person("Bob")} to create a @@ -1154,7 +1154,7 @@ returns the function object being invoked. The following example shows how this might be used: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 55 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 55 \section2 Native Functions as Arguments to Functions @@ -1163,13 +1163,13 @@ naturally. As an example, here's a native comparison function that compares its two arguments numerically: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 53 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 53 The above function can be passed as argument to the standard \c{Array.prototype.sort} function to sort an array numerically, as the following C++ code illustrates: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 54 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 54 Note that, in this case, we are truly treating the native function object as a value \mdash i.e., we don't store it as a property of the @@ -1204,7 +1204,7 @@ itself. This technique is typically used in conjunction with QScriptEngine::pushContext(), as in the following example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 77 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 77 We create a temporary execution context, create a local variable for it, evaluate the script, and finally restore the old context. @@ -1227,7 +1227,7 @@ define a native combined getter/setter that transforms the value slightly: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 78 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 78 The example uses the internal data of the object to store and retrieve the transformed value. Alternatively, the property @@ -1240,12 +1240,12 @@ The following C++ code shows how an object property can be defined in terms of the native getter/setter: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 79 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 79 When the property is accessed, like in the following script, the getter/setter does its job behind the scenes: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 80 + \snippet doc/src/snippets/code/doc_src_qtscript.js 80 \note It is important that the setter function, not just the getter, returns the value of the property; i.e., the setter should \e{not} @@ -1266,7 +1266,7 @@ Property getters and setters can be defined and installed by script code as well, as in the following example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 81 + \snippet doc/src/snippets/code/doc_src_qtscript.js 81 Getters and setters can only be used to implement "a priori properties"; i.e., the technique can't be used to react to an access @@ -1342,7 +1342,7 @@ including the \c{hasOwnProperty()} function and \c{toString()} function: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 27 + \snippet doc/src/snippets/code/doc_src_qtscript.js 27 The \c{toString()} function itself is not defined in \c{o} (since we did not assign anything to \c{o.toString}), so instead the @@ -1382,7 +1382,7 @@ The following code defines a simple constructor function for a class called \c{Person}: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 28 + \snippet doc/src/snippets/code/doc_src_qtscript.js 28 Next, you want to set up \c{Person.prototype} as your prototype object; i.e., define the interface that should be common to all @@ -1397,19 +1397,19 @@ \c{Object.prototype}, to give your \c{Person} objects a more appropriate string representation: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 29 + \snippet doc/src/snippets/code/doc_src_qtscript.js 29 This resembles the process of reimplementing a virtual function in C++. Henceforth, when the property named \c{toString} is looked up in a \c{Person} object, it will be resolved in \c{Person.prototype}, not in \c{Object.prototype} as before: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 30 + \snippet doc/src/snippets/code/doc_src_qtscript.js 30 There are also some other interesting things we can learn about a \c{Person} object: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 31 + \snippet doc/src/snippets/code/doc_src_qtscript.js 31 The \c{hasOwnProperty()} function is not inherited from \c{Person.prototype}, but rather from \c{Object.prototype}, which is @@ -1426,13 +1426,13 @@ following example shows how one can create a subclass of \c{Person} called \c{Employee}: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 32 + \snippet doc/src/snippets/code/doc_src_qtscript.js 32 Again, you can use the \c{instanceof} to verify that the class relationship between \c{Employee} and \c{Person} has been correctly established: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 33 + \snippet doc/src/snippets/code/doc_src_qtscript.js 33 This shows that the prototype chain of \c{Employee} objects is the same as that of \c{Person} objects, but with \c{Employee.prototype} @@ -1477,25 +1477,25 @@ preceding section can be implemented in terms of the Qt Script API. We begin with the native constructor function: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 34 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 34 Here's the native equivalent of the \c{Person.prototype.toString} function we saw before: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 35 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 35 The \c{Person} class can then be initialized as follows: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 36 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 36 The implementation of the \c{Employee} subclass is similar. We use QScriptValue::call() to call the super-class (Person) constructor: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 37 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 37 The \c{Employee} class can then be initialized as follows: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 38 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 38 When implementing the prototype object of a class, you may want to use the QScriptable class, as it enables you to define the API of your @@ -1521,7 +1521,7 @@ modify the underlying C++ value, lets you modify the actual value contained in the script value (and not a copy of it). - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 39 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 39 \section2 Implementing Constructors for Value-based Types @@ -1529,7 +1529,7 @@ by wrapping a native factory function. For example, the following function implements a simple constructor for QPoint: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 44 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 44 In the above code we simplified things a bit, e.g. we didn't check the argument count to decide which QPoint C++ constructor to use. @@ -1564,16 +1564,16 @@ The following snippet shows a constructor function that constructs QXmlStreamReader objects that are stored using QSharedPointer: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 93 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 93 Prototype functions can use qscriptvalue_cast() to cast the \c this object to the proper type: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 94 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 94 The prototype and constructor objects are set up in the usual way: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 95 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 95 Scripts can now construct QXmlStreamReader objects by calling the \c XmlStreamReader constructor, and when the Qt Script object is @@ -1643,12 +1643,12 @@ somewhere else. The following code shows a custom print() that adds text to a QPlainTextEdit. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 45 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 45 The following code shows how the custom print() function may be initialized and used. - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 46 + \snippet doc/src/snippets/code/doc_src_qtscript.cpp 46 A pointer to the QPlainTextEdit is stored as an internal property of the script function itself, so that it can be retrieved when @@ -1680,7 +1680,7 @@ function. Essentially all that is necessary to achieve this is to use the qsTr() script function. Example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 82 + \snippet doc/src/snippets/code/doc_src_qtscript.js 82 This accounts for 99% of the user-visible strings you're likely to write. @@ -1689,7 +1689,7 @@ unique in your project, you should use the qsTranslate() function and pass a suitable context as the first argument. Example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 83 + \snippet doc/src/snippets/code/doc_src_qtscript.js 83 If you need to have translatable text completely outside a function, there are two functions to help: QT_TR_NOOP() and QT_TRANSLATE_NOOP(). They merely @@ -1698,18 +1698,18 @@ Example of QT_TR_NOOP(): - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 84 + \snippet doc/src/snippets/code/doc_src_qtscript.js 84 Example of QT_TRANSLATE_NOOP(): - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 85 + \snippet doc/src/snippets/code/doc_src_qtscript.js 85 \section2 Use String.prototype.arg() for Dynamic Text The String.prototype.arg() function (which is modeled after QString::arg()) offers a simple means for substituting arguments: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 86 + \snippet doc/src/snippets/code/doc_src_qtscript.js 86 \section2 Produce Translations @@ -1804,7 +1804,7 @@ This property has the QScriptValue::Undeletable flag set. For example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 40 + \snippet doc/src/snippets/code/doc_src_qtscript.js 40 \i \c{Object.prototype.__defineGetter__} \br This function installs a @@ -1814,7 +1814,7 @@ \c this object will be the object whose property is accessed. For example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 41 + \snippet doc/src/snippets/code/doc_src_qtscript.js 41 \i \c{Object.prototype.__defineSetter__} \br This function installs a @@ -1824,7 +1824,7 @@ \c this object will be the object whose property is accessed. For example: - \snippet doc/src/snippets/code/doc_src_qtscript.qdoc 42 + \snippet doc/src/snippets/code/doc_src_qtscript.js 42 \i \c{Function.prototype.connect} \br This function connects diff --git a/doc/src/snippets/code/doc.src.qtscripttools.qdoc b/doc/src/snippets/code/doc.src.qtscripttools.qdoc deleted file mode 100644 index 76840b3..0000000 --- a/doc/src/snippets/code/doc.src.qtscripttools.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] - #include -//! [0] - - -//! [1] - QT += scripttools -//! [1] diff --git a/doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp b/doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp new file mode 100644 index 0000000..0c29b1c --- /dev/null +++ b/doc/src/snippets/code/doc_src_activeqt-dumpcpp.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Outlook::Application *outlook = new Outlook::Application; +//! [0] + + +//! [1] +Outlook::_NameSpace *session = outlook->Session(); +//! [1] + + +//! [2] +Outlook::NameSpace *session = outlook->Session(); +//! [2] + + +//! [3] +Outlook::_NameSpace *tmp = outlook->Session(); +Outlook::NameSpace *session = new Outlook::NameSpace(tmp); +delete tmp; // or any other use of tmp: segfault +//! [3] + + +//! [4] +Outlook::NameSpace *session = new Outlook::NameSpace(outlook->Session()); +//! [4] diff --git a/doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc b/doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc deleted file mode 100644 index 0c29b1c..0000000 --- a/doc/src/snippets/code/doc_src_activeqt-dumpcpp.qdoc +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Outlook::Application *outlook = new Outlook::Application; -//! [0] - - -//! [1] -Outlook::_NameSpace *session = outlook->Session(); -//! [1] - - -//! [2] -Outlook::NameSpace *session = outlook->Session(); -//! [2] - - -//! [3] -Outlook::_NameSpace *tmp = outlook->Session(); -Outlook::NameSpace *session = new Outlook::NameSpace(tmp); -delete tmp; // or any other use of tmp: segfault -//! [3] - - -//! [4] -Outlook::NameSpace *session = new Outlook::NameSpace(outlook->Session()); -//! [4] diff --git a/doc/src/snippets/code/doc_src_appicon.pro b/doc/src/snippets/code/doc_src_appicon.pro new file mode 100644 index 0000000..176b458 --- /dev/null +++ b/doc/src/snippets/code/doc_src_appicon.pro @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +RC_FILE = myapp.rc +#! [1] + + +#! [2] +ICON = myapp.icns +#! [2] + + +#! [5] +ICON = myapp.svg +#! [5] diff --git a/doc/src/snippets/code/doc_src_appicon.qdoc b/doc/src/snippets/code/doc_src_appicon.qdoc index 06bf861..8dd30a4 100644 --- a/doc/src/snippets/code/doc_src_appicon.qdoc +++ b/doc/src/snippets/code/doc_src_appicon.qdoc @@ -43,16 +43,6 @@ IDI_ICON1 ICON DISCARDABLE "myappico.ico" //! [0] -//! [1] -RC_FILE = myapp.rc -//! [1] - - -//! [2] -ICON = myapp.icns -//! [2] - - //! [3] kde-config --path icon //! [3] @@ -61,7 +51,3 @@ kde-config --path icon //! [4] gnome-config --datadir //! [4] - -//! [5] -ICON = myapp.svg -//! [5] diff --git a/doc/src/snippets/code/doc_src_containers.cpp b/doc/src/snippets/code/doc_src_containers.cpp new file mode 100644 index 0000000..fa300f9 --- /dev/null +++ b/doc/src/snippets/code/doc_src_containers.cpp @@ -0,0 +1,275 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +class Employee +{ +public: + Employee() {} + Employee(const Employee &other); + + Employee &operator=(const Employee &other); + +private: + QString myName; + QDate myDateOfBirth; +}; +//! [0] + + +//! [1] +QList list; +list << "A" << "B" << "C" << "D"; + +QListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [1] + + +//! [2] +QListIterator i(list); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [2] + + +//! [3] +QMutableListIterator i(list); +while (i.hasNext()) { + if (i.next() % 2 != 0) + i.remove(); +} +//! [3] + + +//! [4] +QMutableListIterator i(list); +i.toBack(); +while (i.hasPrevious()) { + if (i.previous() % 2 != 0) + i.remove(); +} +//! [4] + + +//! [5] +QMutableListIterator i(list); +while (i.hasNext()) { + if (i.next() > 128) + i.setValue(128); +} +//! [5] + + +//! [6] +QMutableListIterator i(list); +while (i.hasNext()) + i.next() *= 2; +//! [6] + + +//! [7] +QMap map; +map.insert("Paris", "France"); +map.insert("Guatemala City", "Guatemala"); +map.insert("Mexico City", "Mexico"); +map.insert("Moscow", "Russia"); +... + +QMutableMapIterator i(map); +while (i.hasNext()) { + if (i.next().key().endsWith("City")) + i.remove(); +} +//! [7] + + +//! [8] +QMap map; +QHash hash; + +QMapIterator i(map); +while (i.hasNext()) { + i.next(); + hash.insert(i.key(), i.value()); +} +//! [8] + + +//! [9] +QMutableMapIterator i(map); +while (i.findNext(widget)) + i.remove(); +//! [9] + + +//! [10] +QList list; +list << "A" << "B" << "C" << "D"; + +QList::iterator i; +for (i = list.begin(); i != list.end(); ++i) + *i = (*i).toLower(); +//! [10] + + +//! [11] +QList list; +list << "A" << "B" << "C" << "D"; + +QList::iterator i = list.end(); +while (i != list.begin()) { + --i; + *i = (*i).toLower(); +} +//! [11] + + +//! [12] +QList::const_iterator i; +for (i = list.constBegin(); i != list.constEnd(); ++i) + qDebug() << *i; +//! [12] + + +//! [13] +QMap map; +... +QMap::const_iterator i; +for (i = map.constBegin(); i != map.constEnd(); ++i) + qDebug() << i.key() << ":" << i.value(); +//! [13] + + +//! [14] +// RIGHT +const QList sizes = splitter->sizes(); +QList::const_iterator i; +for (i = sizes.begin(); i != sizes.end(); ++i) + ... + +// WRONG +QList::const_iterator i; +for (i = splitter->sizes().begin(); + i != splitter->sizes().end(); ++i) + ... +//! [14] + + +//! [15] +QLinkedList list; +... +QString str; +foreach (str, list) + qDebug() << str; +//! [15] + + +//! [16] +QLinkedList list; +... +QLinkedListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [16] + + +//! [17] +QLinkedList list; +... +foreach (const QString &str, list) + qDebug() << str; +//! [17] + + +//! [18] +QLinkedList list; +... +foreach (const QString &str, list) { + if (str.isEmpty()) + break; + qDebug() << str; +} +//! [18] + + +//! [19] +QMap map; +... +foreach (const QString &str, map.keys()) + qDebug() << str << ":" << map.value(str); +//! [19] + + +//! [20] +QMultiMap map; +... +foreach (const QString &str, map.uniqueKeys()) { + foreach (int i, map.values(str)) + qDebug() << str << ":" << i; +} +//! [20] + + +//! [21] +forever { + ... +} +//! [21] + + +//! [22] +CONFIG += no_keywords +//! [22] + + +//! [23] +QString onlyLetters(const QString &in) +{ + QString out; + for (int j = 0; j < in.size(); ++j) { + if (in[j].isLetter()) + out += in[j]; + } + return out; +} +//! [23] diff --git a/doc/src/snippets/code/doc_src_containers.qdoc b/doc/src/snippets/code/doc_src_containers.qdoc deleted file mode 100644 index fa300f9..0000000 --- a/doc/src/snippets/code/doc_src_containers.qdoc +++ /dev/null @@ -1,275 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -class Employee -{ -public: - Employee() {} - Employee(const Employee &other); - - Employee &operator=(const Employee &other); - -private: - QString myName; - QDate myDateOfBirth; -}; -//! [0] - - -//! [1] -QList list; -list << "A" << "B" << "C" << "D"; - -QListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [1] - - -//! [2] -QListIterator i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [2] - - -//! [3] -QMutableListIterator i(list); -while (i.hasNext()) { - if (i.next() % 2 != 0) - i.remove(); -} -//! [3] - - -//! [4] -QMutableListIterator i(list); -i.toBack(); -while (i.hasPrevious()) { - if (i.previous() % 2 != 0) - i.remove(); -} -//! [4] - - -//! [5] -QMutableListIterator i(list); -while (i.hasNext()) { - if (i.next() > 128) - i.setValue(128); -} -//! [5] - - -//! [6] -QMutableListIterator i(list); -while (i.hasNext()) - i.next() *= 2; -//! [6] - - -//! [7] -QMap map; -map.insert("Paris", "France"); -map.insert("Guatemala City", "Guatemala"); -map.insert("Mexico City", "Mexico"); -map.insert("Moscow", "Russia"); -... - -QMutableMapIterator i(map); -while (i.hasNext()) { - if (i.next().key().endsWith("City")) - i.remove(); -} -//! [7] - - -//! [8] -QMap map; -QHash hash; - -QMapIterator i(map); -while (i.hasNext()) { - i.next(); - hash.insert(i.key(), i.value()); -} -//! [8] - - -//! [9] -QMutableMapIterator i(map); -while (i.findNext(widget)) - i.remove(); -//! [9] - - -//! [10] -QList list; -list << "A" << "B" << "C" << "D"; - -QList::iterator i; -for (i = list.begin(); i != list.end(); ++i) - *i = (*i).toLower(); -//! [10] - - -//! [11] -QList list; -list << "A" << "B" << "C" << "D"; - -QList::iterator i = list.end(); -while (i != list.begin()) { - --i; - *i = (*i).toLower(); -} -//! [11] - - -//! [12] -QList::const_iterator i; -for (i = list.constBegin(); i != list.constEnd(); ++i) - qDebug() << *i; -//! [12] - - -//! [13] -QMap map; -... -QMap::const_iterator i; -for (i = map.constBegin(); i != map.constEnd(); ++i) - qDebug() << i.key() << ":" << i.value(); -//! [13] - - -//! [14] -// RIGHT -const QList sizes = splitter->sizes(); -QList::const_iterator i; -for (i = sizes.begin(); i != sizes.end(); ++i) - ... - -// WRONG -QList::const_iterator i; -for (i = splitter->sizes().begin(); - i != splitter->sizes().end(); ++i) - ... -//! [14] - - -//! [15] -QLinkedList list; -... -QString str; -foreach (str, list) - qDebug() << str; -//! [15] - - -//! [16] -QLinkedList list; -... -QLinkedListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [16] - - -//! [17] -QLinkedList list; -... -foreach (const QString &str, list) - qDebug() << str; -//! [17] - - -//! [18] -QLinkedList list; -... -foreach (const QString &str, list) { - if (str.isEmpty()) - break; - qDebug() << str; -} -//! [18] - - -//! [19] -QMap map; -... -foreach (const QString &str, map.keys()) - qDebug() << str << ":" << map.value(str); -//! [19] - - -//! [20] -QMultiMap map; -... -foreach (const QString &str, map.uniqueKeys()) { - foreach (int i, map.values(str)) - qDebug() << str << ":" << i; -} -//! [20] - - -//! [21] -forever { - ... -} -//! [21] - - -//! [22] -CONFIG += no_keywords -//! [22] - - -//! [23] -QString onlyLetters(const QString &in) -{ - QString out; - for (int j = 0; j < in.size(); ++j) { - if (in[j].isLetter()) - out += in[j]; - } - return out; -} -//! [23] diff --git a/doc/src/snippets/code/doc_src_coordsys.cpp b/doc/src/snippets/code/doc_src_coordsys.cpp new file mode 100644 index 0000000..1ebb215 --- /dev/null +++ b/doc/src/snippets/code/doc_src_coordsys.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QPainter painter(this); + +painter.setPen(Qt::darkGreen); +painter.drawRect(1, 2, 6, 4); +//! [0] + + +//! [1] +QPainter painter(this); + +painter.setPen(Qt::darkGreen); +painter.drawLine(2, 7, 6, 1); +//! [1] + + +//! [2] +QPainter painter(this); +painter.setRenderHint( + QPainter::Antialiasing); +painter.setPen(Qt::darkGreen); +painter.drawRect(1, 2, 6, 4); +//! [2] + + +//! [3] +QPainter painter(this); +painter.setRenderHint( + QPainter::Antialiasing); +painter.setPen(Qt::darkGreen); +painter.drawLine(2, 7, 6, 1); +//! [3] + + +//! [4] +QPainter painter(this); +painter.setWindow(QRect(-50, -50, 100, 100)); +//! [4] + + +//! [5] +int side = qMin(width(), height()) +int x = (width() - side / 2); +int y = (height() - side / 2); + +painter.setViewport(x, y, side, side); +//! [5] diff --git a/doc/src/snippets/code/doc_src_coordsys.qdoc b/doc/src/snippets/code/doc_src_coordsys.qdoc deleted file mode 100644 index 1ebb215..0000000 --- a/doc/src/snippets/code/doc_src_coordsys.qdoc +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QPainter painter(this); - -painter.setPen(Qt::darkGreen); -painter.drawRect(1, 2, 6, 4); -//! [0] - - -//! [1] -QPainter painter(this); - -painter.setPen(Qt::darkGreen); -painter.drawLine(2, 7, 6, 1); -//! [1] - - -//! [2] -QPainter painter(this); -painter.setRenderHint( - QPainter::Antialiasing); -painter.setPen(Qt::darkGreen); -painter.drawRect(1, 2, 6, 4); -//! [2] - - -//! [3] -QPainter painter(this); -painter.setRenderHint( - QPainter::Antialiasing); -painter.setPen(Qt::darkGreen); -painter.drawLine(2, 7, 6, 1); -//! [3] - - -//! [4] -QPainter painter(this); -painter.setWindow(QRect(-50, -50, 100, 100)); -//! [4] - - -//! [5] -int side = qMin(width(), height()) -int x = (width() - side / 2); -int y = (height() - side / 2); - -painter.setViewport(x, y, side, side); -//! [5] diff --git a/doc/src/snippets/code/doc_src_debug.cpp b/doc/src/snippets/code/doc_src_debug.cpp new file mode 100644 index 0000000..40a5ac2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_debug.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +qDebug() << "Widget" << widget << "at position" << widget->pos(); +//! [0] + + +//! [1] +char *alloc(int size) +{ + Q_ASSERT(size > 0); + char *ptr = new char[size]; + Q_CHECK_PTR(ptr); + return ptr; +} +//! [1] + + +//! [2] +char *alloc(int size) +{ + char *ptr; + Q_CHECK_PTR(ptr = new char[size]); // WRONG + return ptr; +} +//! [2] diff --git a/doc/src/snippets/code/doc_src_debug.qdoc b/doc/src/snippets/code/doc_src_debug.qdoc deleted file mode 100644 index 40a5ac2..0000000 --- a/doc/src/snippets/code/doc_src_debug.qdoc +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -qDebug() << "Widget" << widget << "at position" << widget->pos(); -//! [0] - - -//! [1] -char *alloc(int size) -{ - Q_ASSERT(size > 0); - char *ptr = new char[size]; - Q_CHECK_PTR(ptr); - return ptr; -} -//! [1] - - -//! [2] -char *alloc(int size) -{ - char *ptr; - Q_CHECK_PTR(ptr = new char[size]); // WRONG - return ptr; -} -//! [2] diff --git a/doc/src/snippets/code/doc_src_deployment.cpp b/doc/src/snippets/code/doc_src_deployment.cpp new file mode 100644 index 0000000..e7f7511 --- /dev/null +++ b/doc/src/snippets/code/doc_src_deployment.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [9] +qApp->addLibraryPath("/some/other/path"); +//! [9] + + +//! [19] +qApp->addLibraryPath("C:\some\other\path"); +//! [19] + + +//! [49] +QDir dir(QApplication::applicationDirPath()); +dir.cdUp(); +dir.cd("plugins"); +QApplication::setLibraryPaths(QStringList(dir.absolutePath())); +//! [49] diff --git a/doc/src/snippets/code/doc_src_deployment.pro b/doc/src/snippets/code/doc_src_deployment.pro new file mode 100644 index 0000000..b9fdd54 --- /dev/null +++ b/doc/src/snippets/code/doc_src_deployment.pro @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [8] +DESTDIR = /path/to/Qt/plugandpaint/plugins +#! [8] + + +#! [21] +CONFIG += embed_manifest_exe +#! [21] + + +#! [23] +CONFIG-=embed_manifest_dll +#! [23] + + +#! [26] +CONFIG-=app_bundle +#! [26] + + +#! [51] +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3 +#! [51] + +#! [53] +QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk +CONFIG+=x86 ppc +#! [53] + +#! [56] +vendorinfo = \ + "%{\"Example Localized Vendor\"}" \ + ":\"Example Vendor\"" + +my_deployment.pkg_prerules = vendorinfo +DEPLOYMENT += my_deployment +#! [56] + +#! [57] +supported_platforms = \ + "; This demo only supports S60 5.0" \ + "[0x1028315F],0,0,0,{\"S60ProductID\"}" + +default_deployment.pkg_prerules -= pkg_platform_dependencies +my_deployment.pkg_prerules += supported_platforms +DEPLOYMENT += my_deployment +#! [57] diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc index c5f4644..523a36d 100644 --- a/doc/src/snippets/code/doc_src_deployment.qdoc +++ b/doc/src/snippets/code/doc_src_deployment.qdoc @@ -100,16 +100,6 @@ $dirname/$appname $* //! [7] -//! [8] -DESTDIR = /path/to/Qt/plugandpaint/plugins -//! [8] - - -//! [9] -qApp->addLibraryPath("/some/other/path"); -//! [9] - - //! [10] ldd ./application //! [10] @@ -164,11 +154,6 @@ plugins\pnp_extrafilters.dll //! [18] -//! [19] -qApp->addLibraryPath("C:\some\other\path"); -//! [19] - - //! [20] embed_manifest_dll embed_manifest_exe @@ -411,14 +396,6 @@ install_name_tool -change /path/to/Qt/lib/QtCore.framework/Versions/4.0/QtCore //! [48] -//! [49] -QDir dir(QApplication::applicationDirPath()); -dir.cdUp(); -dir.cd("plugins"); -QApplication::setLibraryPaths(QStringList(dir.absolutePath())); -//! [49] - - //! [50] otool -L MyApp.app/Contents/MacOS/MyApp //! [50] @@ -483,4 +460,4 @@ make release-gcce //! [59] make installer_sis -//! [59] \ No newline at end of file +//! [59] diff --git a/doc/src/snippets/code/doc_src_designer-manual.cpp b/doc/src/snippets/code/doc_src_designer-manual.cpp new file mode 100644 index 0000000..a261818 --- /dev/null +++ b/doc/src/snippets/code/doc_src_designer-manual.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +#include +//! [1] + + +//! [2] +void on__(); +//! [2] + + +//! [7] +class MyExtension: public QObject, + public QdesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACE(QDesignerContainerExtension) + + ... +} +//! [7] + + +//! [8] +QObject *ANewExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerContainerExtension)) + return 0; + + if (MyCustomWidget *widget = qobject_cast + (object)) + return new MyContainerExtension(widget, parent); + + return 0; +} +//! [8] + + +//! [9] +QObject *AGeneralExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + MyCustomWidget *widget = qobject_cast(object); + + if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { + return new MyTaskMenuExtension(widget, parent); + + } else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { + return new MyContainerExtension(widget, parent); + + } else { + return 0; + } +} +//! [9] + + +//! [10] +void MyPlugin::initialize(QDesignerFormEditorInterface *formEditor) +{ + if (initialized) + return; + + QExtensionManager *manager = formEditor->extensionManager(); + Q_ASSERT(manager != 0); + + manager->registerExtensions(new MyExtensionFactory(manager), + Q_TYPEID(QDesignerTaskMenuExtension)); + + initialized = true; +} +//! [10] diff --git a/doc/src/snippets/code/doc_src_designer-manual.js b/doc/src/snippets/code/doc_src_designer-manual.js new file mode 100644 index 0000000..074b47e --- /dev/null +++ b/doc/src/snippets/code/doc_src_designer-manual.js @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [6] +widget.text = 'Hi - I was built ' + new Date().toString(); +//! [6] diff --git a/doc/src/snippets/code/doc_src_designer-manual.pro b/doc/src/snippets/code/doc_src_designer-manual.pro new file mode 100644 index 0000000..4b14a14 --- /dev/null +++ b/doc/src/snippets/code/doc_src_designer-manual.pro @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +CONFIG += uitools +#! [0] + + +#! [3] +CONFIG += release +#! [3] + + +#! [4] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [4] + + +#! [5] +QT += script +#! [5] diff --git a/doc/src/snippets/code/doc_src_designer-manual.qdoc b/doc/src/snippets/code/doc_src_designer-manual.qdoc deleted file mode 100644 index 90e34a4..0000000 --- a/doc/src/snippets/code/doc_src_designer-manual.qdoc +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -CONFIG += uitools -//! [0] - - -//! [1] -#include -//! [1] - - -//! [2] -void on__(); -//! [2] - - -//! [3] -CONFIG += release -//! [3] - - -//! [4] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [4] - - -//! [5] -QT += script -//! [5] - - -//! [6] -widget.text = 'Hi - I was built ' + new Date().toString(); -//! [6] - - -//! [7] -class MyExtension: public QObject, - public QdesignerContainerExtension -{ - Q_OBJECT - Q_INTERFACE(QDesignerContainerExtension) - - ... -} -//! [7] - - -//! [8] -QObject *ANewExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - if (iid != Q_TYPEID(QDesignerContainerExtension)) - return 0; - - if (MyCustomWidget *widget = qobject_cast - (object)) - return new MyContainerExtension(widget, parent); - - return 0; -} -//! [8] - - -//! [9] -QObject *AGeneralExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - MyCustomWidget *widget = qobject_cast(object); - - if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { - return new MyTaskMenuExtension(widget, parent); - - } else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { - return new MyContainerExtension(widget, parent); - - } else { - return 0; - } -} -//! [9] - - -//! [10] -void MyPlugin::initialize(QDesignerFormEditorInterface *formEditor) -{ - if (initialized) - return; - - QExtensionManager *manager = formEditor->extensionManager(); - Q_ASSERT(manager != 0); - - manager->registerExtensions(new MyExtensionFactory(manager), - Q_TYPEID(QDesignerTaskMenuExtension)); - - initialized = true; -} -//! [10] diff --git a/doc/src/snippets/code/doc_src_dnd.cpp b/doc/src/snippets/code/doc_src_dnd.cpp new file mode 100644 index 0000000..d5dc721 --- /dev/null +++ b/doc/src/snippets/code/doc_src_dnd.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +void MyQt3Widget::customStartDragFunction() +{ + QDragObject *d = new QTextDrag( myHighlightedText(), this ); + d->dragCopy(); + // do NOT delete d. +} +//! [0] + + +//! [1] +void MyQt3Widget::dragEnterEvent(QDragEnterEvent* event) +{ + event->accept( + QTextDrag::canDecode(event) || + QImageDrag::canDecode(event) + ); +} +//! [1] + + +//! [2] +void MyQt3Widget::dropEvent(QDropEvent* event) +{ + QImage image; + QString text; + + if ( QImageDrag::decode(event, image) ) { + insertImageAt(image, event->pos()); + } else if ( QTextDrag::decode(event, text) ) { + insertTextAt(text, event->pos()); + } +} +//! [2] diff --git a/doc/src/snippets/code/doc_src_dnd.qdoc b/doc/src/snippets/code/doc_src_dnd.qdoc deleted file mode 100644 index d5dc721..0000000 --- a/doc/src/snippets/code/doc_src_dnd.qdoc +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -void MyQt3Widget::customStartDragFunction() -{ - QDragObject *d = new QTextDrag( myHighlightedText(), this ); - d->dragCopy(); - // do NOT delete d. -} -//! [0] - - -//! [1] -void MyQt3Widget::dragEnterEvent(QDragEnterEvent* event) -{ - event->accept( - QTextDrag::canDecode(event) || - QImageDrag::canDecode(event) - ); -} -//! [1] - - -//! [2] -void MyQt3Widget::dropEvent(QDropEvent* event) -{ - QImage image; - QString text; - - if ( QImageDrag::decode(event, image) ) { - insertImageAt(image, event->pos()); - } else if ( QTextDrag::decode(event, text) ) { - insertTextAt(text, event->pos()); - } -} -//! [2] diff --git a/doc/src/snippets/code/doc_src_emb-performance.cpp b/doc/src/snippets/code/doc_src_emb-performance.cpp new file mode 100644 index 0000000..5a465a9 --- /dev/null +++ b/doc/src/snippets/code/doc_src_emb-performance.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +void *operator new[](size_t size) +{ + return malloc(size); +} + +void *operator new(size_t size) +{ + return malloc(size); +} + +void operator delete[](void *ptr) +{ + free(ptr); +} + +void operator delete[](void *ptr, size_t) +{ + free(ptr); +} + +void operator delete(void *ptr) +{ + free(ptr); +} + +void operator delete(void *ptr, size_t) +{ + free(ptr); +} +//! [1] diff --git a/doc/src/snippets/code/doc_src_emb-performance.qdoc b/doc/src/snippets/code/doc_src_emb-performance.qdoc index 8c129fd..9abf8d1 100644 --- a/doc/src/snippets/code/doc_src_emb-performance.qdoc +++ b/doc/src/snippets/code/doc_src_emb-performance.qdoc @@ -41,36 +41,3 @@ //! [0] ./configure -static //! [0] - - -//! [1] -void *operator new[](size_t size) -{ - return malloc(size); -} - -void *operator new(size_t size) -{ - return malloc(size); -} - -void operator delete[](void *ptr) -{ - free(ptr); -} - -void operator delete[](void *ptr, size_t) -{ - free(ptr); -} - -void operator delete(void *ptr) -{ - free(ptr); -} - -void operator delete(void *ptr, size_t) -{ - free(ptr); -} -//! [1] diff --git a/doc/src/snippets/code/doc_src_emb-pointer.pro b/doc/src/snippets/code/doc_src_emb-pointer.pro new file mode 100644 index 0000000..fed7d79 --- /dev/null +++ b/doc/src/snippets/code/doc_src_emb-pointer.pro @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [7] +.... +QMAKE_CFLAGS += -I +QMAKE_LFLAGS += -L -Wl,-rpath-link= +.... +#! [7] diff --git a/doc/src/snippets/code/doc_src_emb-pointer.qdoc b/doc/src/snippets/code/doc_src_emb-pointer.qdoc index 4ec1335..1fb6d8f 100644 --- a/doc/src/snippets/code/doc_src_emb-pointer.qdoc +++ b/doc/src/snippets/code/doc_src_emb-pointer.qdoc @@ -75,14 +75,6 @@ export QWS_MOUSE_PROTO="Vr41xx:press=500:/dev/misc/ts" //! [6] -//! [7] -.... -QMAKE_CFLAGS += -I -QMAKE_LFLAGS += -L -Wl,-rpath-link= -.... -//! [7] - - //! [8] module_raw input module linear @@ -111,5 +103,3 @@ ls -l /dev/input/mouse0 //! [12] chmod a+rw /dev/input/mouse0 //! [12] - - diff --git a/doc/src/snippets/code/doc_src_examples_arrowpad.cpp b/doc/src/snippets/code/doc_src_examples_arrowpad.cpp new file mode 100644 index 0000000..c834b9f --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_arrowpad.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +qApp->translate("ArrowPad", x) +//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc b/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc index 933f419..ee3c367 100644 --- a/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc +++ b/doc/src/snippets/code/doc_src_examples_arrowpad.qdoc @@ -38,11 +38,6 @@ ** ****************************************************************************/ -//! [0] -qApp->translate("ArrowPad", x) -//! [0] - - //! [1] lrelease arrowpad.pro //! [1] diff --git a/doc/src/snippets/code/doc_src_examples_containerextension.pro b/doc/src/snippets/code/doc_src_examples_containerextension.pro new file mode 100644 index 0000000..cd86693 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_containerextension.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [0] diff --git a/doc/src/snippets/code/doc_src_examples_containerextension.qdoc b/doc/src/snippets/code/doc_src_examples_containerextension.qdoc deleted file mode 100644 index 7fe0394..0000000 --- a/doc/src/snippets/code/doc_src_examples_containerextension.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro b/doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro new file mode 100644 index 0000000..cd86693 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_customwidgetplugin.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [0] diff --git a/doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc b/doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc deleted file mode 100644 index 7fe0394..0000000 --- a/doc/src/snippets/code/doc_src_examples_customwidgetplugin.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp b/doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp new file mode 100644 index 0000000..a69a7bf --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_editabletreemodel.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QVariant a = model->index(0, 0, QModelIndex()).data(); +//! [0] + + +//! [1] +QVariant b = model->index(1, 0, QModelIndex()).data(); +//! [1] diff --git a/doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc b/doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc deleted file mode 100644 index a69a7bf..0000000 --- a/doc/src/snippets/code/doc_src_examples_editabletreemodel.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QVariant a = model->index(0, 0, QModelIndex()).data(); -//! [0] - - -//! [1] -QVariant b = model->index(1, 0, QModelIndex()).data(); -//! [1] diff --git a/doc/src/snippets/code/doc_src_examples_icons.cpp b/doc/src/snippets/code/doc_src_examples_icons.cpp new file mode 100644 index 0000000..411c49f --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_icons.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +if (!condition) + qFatal("ASSERT: "condition" in file ..."); +//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_icons.qdoc b/doc/src/snippets/code/doc_src_examples_icons.qdoc index 7684224..8ca5751 100644 --- a/doc/src/snippets/code/doc_src_examples_icons.qdoc +++ b/doc/src/snippets/code/doc_src_examples_icons.qdoc @@ -38,12 +38,6 @@ ** ****************************************************************************/ -//! [0] -if (!condition) - qFatal("ASSERT: "condition" in file ..."); -//! [0] - - //! [1] qmake "CONFIG += debug" icons.pro //! [1] diff --git a/doc/src/snippets/code/doc_src_examples_imageviewer.cpp b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp new file mode 100644 index 0000000..c86f8ac --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_imageviewer.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +imageLabel->resize(imageLabel->pixmap()->size()); +//! [0] + + +//! [1] +if (!imageLabel->pixmap()) + qFatal("ASSERT: "imageLabel->pixmap()" in file ..."); +//! [1] + + +//! [4] +scrollBar->setValue(int(factor * scrollBar->value())); +//! [4] diff --git a/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc b/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc index 84f822f..1870385 100644 --- a/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc +++ b/doc/src/snippets/code/doc_src_examples_imageviewer.qdoc @@ -38,17 +38,6 @@ ** ****************************************************************************/ -//! [0] -imageLabel->resize(imageLabel->pixmap()->size()); -//! [0] - - -//! [1] -if (!imageLabel->pixmap()) - qFatal("ASSERT: "imageLabel->pixmap()" in file ..."); -//! [1] - - //! [2] qmake "CONFIG += debug" foo.pro //! [2] @@ -57,8 +46,3 @@ qmake "CONFIG += debug" foo.pro //! [3] qmake "CONFIG += release" foo.pro //! [3] - - -//! [4] -scrollBar->setValue(int(factor * scrollBar->value())); -//! [4] diff --git a/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp b/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp new file mode 100644 index 0000000..b62236c --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +var ba = new ByteArray(); // constructs an empty ByteArray +var ba2 = new ByteArray(10); // constructs a ByteArray of length 10 (all bytes initialized to 0) +//! [0] + + +//! [1] +for (var i = 0; i < ba.length; ++i) + ba[i] = 123; +//! [1] + + +//! [2] +ba[0] = 257; +print(ba[0]); // 1 +//! [2] + + +//! [3] +var ba3 = new ByteArray(); +print(ba3.length); // 0 +ba[0] = 64; +print(ba3.length); // 1 +//! [3] + + +//! [4] +ba["foo"] = "Hello"; +//! [4] + + +//! [5] +var ba64 = ba.toBase64(); +print(ba64.toLatin1String()); +//! [5] diff --git a/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc b/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc deleted file mode 100644 index b62236c..0000000 --- a/doc/src/snippets/code/doc_src_examples_qtscriptcustomclass.qdoc +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -var ba = new ByteArray(); // constructs an empty ByteArray -var ba2 = new ByteArray(10); // constructs a ByteArray of length 10 (all bytes initialized to 0) -//! [0] - - -//! [1] -for (var i = 0; i < ba.length; ++i) - ba[i] = 123; -//! [1] - - -//! [2] -ba[0] = 257; -print(ba[0]); // 1 -//! [2] - - -//! [3] -var ba3 = new ByteArray(); -print(ba3.length); // 0 -ba[0] = 64; -print(ba3.length); // 1 -//! [3] - - -//! [4] -ba["foo"] = "Hello"; -//! [4] - - -//! [5] -var ba64 = ba.toBase64(); -print(ba64.toLatin1String()); -//! [5] diff --git a/doc/src/snippets/code/doc_src_examples_simpledommodel.cpp b/doc/src/snippets/code/doc_src_examples_simpledommodel.cpp new file mode 100644 index 0000000..1abcdc2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_simpledommodel.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +// file is an open QFile object. +QDomDocument document; +if (document.setContent(&file)) { + + QDomElement documentElement = document.documentElement(); + QString text; + QDomNode node = documentElement.firstChild(); + + while (!node.isNull()) { + if (node.isText()) + text += node.nodeValue(); + else if (node.hasChildNodes()) { + // Examine the node's children and read any text found. + ... + } + node = node.nextSibling(); + } +} +//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc b/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc deleted file mode 100644 index 1abcdc2..0000000 --- a/doc/src/snippets/code/doc_src_examples_simpledommodel.qdoc +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -// file is an open QFile object. -QDomDocument document; -if (document.setContent(&file)) { - - QDomElement documentElement = document.documentElement(); - QString text; - QDomNode node = documentElement.firstChild(); - - while (!node.isNull()) { - if (node.isText()) - text += node.nodeValue(); - else if (node.hasChildNodes()) { - // Examine the node's children and read any text found. - ... - } - node = node.nextSibling(); - } -} -//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_taskmenuextension.pro b/doc/src/snippets/code/doc_src_examples_taskmenuextension.pro new file mode 100644 index 0000000..cd86693 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_taskmenuextension.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [0] diff --git a/doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc b/doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc deleted file mode 100644 index 7fe0394..0000000 --- a/doc/src/snippets/code/doc_src_examples_taskmenuextension.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_textfinder.pro b/doc/src/snippets/code/doc_src_examples_textfinder.pro new file mode 100644 index 0000000..cdc2366 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_textfinder.pro @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +CONFIG += uitools +HEADERS = textfinder.h +RESOURCES = textfinder.qrc +SOURCES = textfinder.cpp main.cpp +#! [0] diff --git a/doc/src/snippets/code/doc_src_examples_textfinder.qdoc b/doc/src/snippets/code/doc_src_examples_textfinder.qdoc deleted file mode 100644 index d99f8ce..0000000 --- a/doc/src/snippets/code/doc_src_examples_textfinder.qdoc +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -CONFIG += uitools -HEADERS = textfinder.h -RESOURCES = textfinder.qrc -SOURCES = textfinder.cpp main.cpp -//! [0] diff --git a/doc/src/snippets/code/doc_src_examples_trollprint.cpp b/doc/src/snippets/code/doc_src_examples_trollprint.cpp new file mode 100644 index 0000000..f7b8f48 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_trollprint.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +twoSidedEnabledRadio = new QRadioButton(tr("Enabled", "two-sided")); +twoSidedDisabledRadio = new QRadioButton(tr("Disabled", "two-sided")); +//! [0] + + +//! [1] +colorsEnabledRadio = new QRadioButton(tr("Enabled", "colors"), colors); +colorsDisabledRadio = new QRadioButton(tr("Disabled", "colors"), colors); +//! [1] + + +//! [2] +/* + TRANSLATOR MainWindow + + In this application the whole application is a MainWindow. + Choose Help|About from the menu bar to see some text + belonging to MainWindow. + + ... +*/ +//! [2] + + +//! [3] +/* + TRANSLATOR ZClientErrorDialog + + Choose Client|Edit to reach the Client Edit dialog, then choose + Client Specification from the drop down list at the top and pick + client Bartel Leendert van der Waerden. Now check the Profile + checkbox and then click the Start Processing button. You should + now see a pop up window with the text "Error: Name too long!". + This window is a ZClientErrorDialog. +*/ +//! [3] diff --git a/doc/src/snippets/code/doc_src_examples_trollprint.qdoc b/doc/src/snippets/code/doc_src_examples_trollprint.qdoc deleted file mode 100644 index 4b508e9..0000000 --- a/doc/src/snippets/code/doc_src_examples_trollprint.qdoc +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -twoSidedEnabledRadio = new QRadioButton(tr("Enabled", "two-sided")); -twoSidedDisabledRadio = new QRadioButton(tr("Disabled", "two-sided")); -//! [0] - - -//! [1] -colorsEnabledRadio = new QRadioButton(tr("Enabled", "colors"), colors); -colorsDisabledRadio = new QRadioButton(tr("Disabled", "colors"), colors); -//! [1] - - -//! [2] -/* - TRANSLATOR MainWindow - - In this application the whole application is a MainWindow. - Choose Help|About from the menu bar to see some text - belonging to MainWindow. - - ... -//! [2] - - -//! [3] -/* - TRANSLATOR ZClientErrorDialog - - Choose Client|Edit to reach the Client Edit dialog, then choose - Client Specification from the drop down list at the top and pick - client Bartel Leendert van der Waerden. Now check the Profile - checkbox and then click the Start Processing button. You should - now see a pop up window with the text "Error: Name too long!". - This window is a ZClientErrorDialog. -//! [3] diff --git a/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro b/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro new file mode 100644 index 0000000..cd86693 --- /dev/null +++ b/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [0] diff --git a/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc b/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc deleted file mode 100644 index 7fe0394..0000000 --- a/doc/src/snippets/code/doc_src_examples_worldtimeclockplugin.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [0] diff --git a/doc/src/snippets/code/doc_src_graphicsview.cpp b/doc/src/snippets/code/doc_src_graphicsview.cpp new file mode 100644 index 0000000..00ebab3 --- /dev/null +++ b/doc/src/snippets/code/doc_src_graphicsview.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QGraphicsScene scene; +QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100)); + +QGraphicsItem *item = scene.itemAt(50, 50); +// item == rect +//! [0] + + +//! [1] +QGraphicsScene scene; +myPopulateScene(&scene); + +QGraphicsView view(&scene); +view.show(); +//! [1] + + +//! [2] +class View : public QGraphicsView +{ +Q_OBJECT + ... +public slots: + void zoomIn() { scale(1.2, 1.2); } + void zoomOut() { scale(1 / 1.2, 1 / 1.2); } + void rotateLeft() { rotate(-10); } + void rotateRight() { rotate(10); } + ... +}; +//! [2] + + +//! [3] +QGraphicsScene scene; +scene.addRect(QRectF(0, 0, 100, 200), QPen(Qt::black), QBrush(Qt::green)); + +QPrinter printer; +if (QPrintDialog(&printer).exec() == QDialog::Accepted) { + QPainter painter(&printer); + painter.setRenderHint(QPainter::Antialiasing); + scene.render(&painter); +} +//! [3] + + +//! [4] +QGraphicsScene scene; +scene.addRect(QRectF(0, 0, 100, 200), QPen(Qt::black), QBrush(Qt::green)); + +QPixmap pixmap; +QPainter painter(&pixmap); +painter.setRenderHint(QPainter::Antialiasing); +scene.render(&painter); +painter.end(); + +pixmap.save("scene.png"); +//! [4] + + +//! [5] +void CustomItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + QMimeData *data = new QMimeData; + data->setColor(Qt::green); + + QDrag *drag = new QDrag(event->widget()); + drag->setMimeData(data); + drag->start(); +} +//! [5] + + +//! [6] +QGraphicsView view(&scene); +view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); +//! [6] diff --git a/doc/src/snippets/code/doc_src_graphicsview.qdoc b/doc/src/snippets/code/doc_src_graphicsview.qdoc deleted file mode 100644 index 00ebab3..0000000 --- a/doc/src/snippets/code/doc_src_graphicsview.qdoc +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QGraphicsScene scene; -QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100)); - -QGraphicsItem *item = scene.itemAt(50, 50); -// item == rect -//! [0] - - -//! [1] -QGraphicsScene scene; -myPopulateScene(&scene); - -QGraphicsView view(&scene); -view.show(); -//! [1] - - -//! [2] -class View : public QGraphicsView -{ -Q_OBJECT - ... -public slots: - void zoomIn() { scale(1.2, 1.2); } - void zoomOut() { scale(1 / 1.2, 1 / 1.2); } - void rotateLeft() { rotate(-10); } - void rotateRight() { rotate(10); } - ... -}; -//! [2] - - -//! [3] -QGraphicsScene scene; -scene.addRect(QRectF(0, 0, 100, 200), QPen(Qt::black), QBrush(Qt::green)); - -QPrinter printer; -if (QPrintDialog(&printer).exec() == QDialog::Accepted) { - QPainter painter(&printer); - painter.setRenderHint(QPainter::Antialiasing); - scene.render(&painter); -} -//! [3] - - -//! [4] -QGraphicsScene scene; -scene.addRect(QRectF(0, 0, 100, 200), QPen(Qt::black), QBrush(Qt::green)); - -QPixmap pixmap; -QPainter painter(&pixmap); -painter.setRenderHint(QPainter::Antialiasing); -scene.render(&painter); -painter.end(); - -pixmap.save("scene.png"); -//! [4] - - -//! [5] -void CustomItem::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - QMimeData *data = new QMimeData; - data->setColor(Qt::green); - - QDrag *drag = new QDrag(event->widget()); - drag->setMimeData(data); - drag->start(); -} -//! [5] - - -//! [6] -QGraphicsView view(&scene); -view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers))); -//! [6] diff --git a/doc/src/snippets/code/doc_src_groups.cpp b/doc/src/snippets/code/doc_src_groups.cpp new file mode 100644 index 0000000..2d5fd97 --- /dev/null +++ b/doc/src/snippets/code/doc_src_groups.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +void QPen::setStyle(Qt::PenStyle style) +{ + detach(); // detach from common data + d->style = style; // set the style member +} + +void QPen::detach() +{ + if (d->ref != 1) { + ... // perform a deep copy + } +} +//! [0] + + +//! [1] +QPixmap p1, p2; +p1.load("image.bmp"); +p2 = p1; // p1 and p2 share data + +QPainter paint; +paint.begin(&p2); // cuts p2 loose from p1 +paint.drawText(0,50, "Hi"); +paint.end(); +//! [1] diff --git a/doc/src/snippets/code/doc_src_groups.qdoc b/doc/src/snippets/code/doc_src_groups.qdoc deleted file mode 100644 index 2d5fd97..0000000 --- a/doc/src/snippets/code/doc_src_groups.qdoc +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -void QPen::setStyle(Qt::PenStyle style) -{ - detach(); // detach from common data - d->style = style; // set the style member -} - -void QPen::detach() -{ - if (d->ref != 1) { - ... // perform a deep copy - } -} -//! [0] - - -//! [1] -QPixmap p1, p2; -p1.load("image.bmp"); -p2 = p1; // p1 and p2 share data - -QPainter paint; -paint.begin(&p2); // cuts p2 loose from p1 -paint.drawText(0,50, "Hi"); -paint.end(); -//! [1] diff --git a/doc/src/snippets/code/doc_src_i18n.cpp b/doc/src/snippets/code/doc_src_i18n.cpp new file mode 100644 index 0000000..cc85bd8 --- /dev/null +++ b/doc/src/snippets/code/doc_src_i18n.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +LoginWidget::LoginWidget() +{ + QLabel *label = new QLabel(tr("Password:")); + ... +} +//! [0] + + +//! [1] +void some_global_function(LoginWidget *logwid) +{ + QLabel *label = new QLabel( + LoginWidget::tr("Password:"), logwid); +} + +void same_global_function(LoginWidget *logwid) +{ + QLabel *label = new QLabel( + qApp->translate("LoginWidget", "Password:"), logwid); +} +//! [1] + + +//! [2] +QString FriendlyConversation::greeting(int type) +{ + static const char *greeting_strings[] = { + QT_TR_NOOP("Hello"), + QT_TR_NOOP("Goodbye") + }; + return tr(greeting_strings[type]); +} +//! [2] + + +//! [3] +static const char *greeting_strings[] = { + QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), + QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") +}; + +QString FriendlyConversation::greeting(int type) +{ + return tr(greeting_strings[type]); +} + +QString global_greeting(int type) +{ + return qApp->translate("FriendlyConversation", + greeting_strings[type]); +} +//! [3] + + +//! [4] +void FileCopier::showProgress(int done, int total, + const QString ¤tFile) +{ + label.setText(tr("%1 of %2 files copied.\nCopying: %3") + .arg(done) + .arg(total) + .arg(currentFile)); +} +//! [4] + + +//! [5] +QString s1 = "%1 of %2 files copied. Copying: %3"; +QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert."; + +qDebug() << s1.arg(5).arg(10).arg("somefile.txt"); +qDebug() << s2.arg(5).arg(10).arg("somefile.txt"); +//! [5] + + +//! [8] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QTranslator qtTranslator; + qtTranslator.load("qt_" + QLocale::system().name(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + app.installTranslator(&qtTranslator); + + QTranslator myappTranslator; + myappTranslator.load("myapp_" + QLocale::system().name()); + app.installTranslator(&myappTranslator); + + ... + return app.exec(); +} +//! [8] + + +//! [9] +QString string = ...; // some Unicode text + +QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5"); +QByteArray encodedString = codec->fromUnicode(string); +//! [9] + + +//! [10] +QByteArray encodedString = ...; // some ISO 8859-5 encoded text + +QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5"); +QString string = codec->toUnicode(encodedString); +//! [10] + + +//! [11] +void Clock::setTime(const QTime &time) +{ + if (tr("AMPM") == "AMPM") { + // 12-hour clock + } else { + // 24-hour clock + } +} +//! [11] + + +//! [12] +void MyWidget::changeEvent(QEvent *event) +{ + if (e->type() == QEvent::LanguageChange) { + titleLabel->setText(tr("Document Title")); + ... + okPushButton->setText(tr("&OK")); + } else + QWidget::changeEvent(event); +} +//! [12] diff --git a/doc/src/snippets/code/doc_src_i18n.qdoc b/doc/src/snippets/code/doc_src_i18n.qdoc index f54ce37..f8f8f02 100644 --- a/doc/src/snippets/code/doc_src_i18n.qdoc +++ b/doc/src/snippets/code/doc_src_i18n.qdoc @@ -38,82 +38,6 @@ ** ****************************************************************************/ -//! [0] -LoginWidget::LoginWidget() -{ - QLabel *label = new QLabel(tr("Password:")); - ... -} -//! [0] - - -//! [1] -void some_global_function(LoginWidget *logwid) -{ - QLabel *label = new QLabel( - LoginWidget::tr("Password:"), logwid); -} - -void same_global_function(LoginWidget *logwid) -{ - QLabel *label = new QLabel( - qApp->translate("LoginWidget", "Password:"), logwid); -} -//! [1] - - -//! [2] -QString FriendlyConversation::greeting(int type) -{ - static const char *greeting_strings[] = { - QT_TR_NOOP("Hello"), - QT_TR_NOOP("Goodbye") - }; - return tr(greeting_strings[type]); -} -//! [2] - - -//! [3] -static const char *greeting_strings[] = { - QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), - QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") -}; - -QString FriendlyConversation::greeting(int type) -{ - return tr(greeting_strings[type]); -} - -QString global_greeting(int type) -{ - return qApp->translate("FriendlyConversation", - greeting_strings[type]); -} -//! [3] - - -//! [4] -void FileCopier::showProgress(int done, int total, - const QString ¤tFile) -{ - label.setText(tr("%1 of %2 files copied.\nCopying: %3") - .arg(done) - .arg(total) - .arg(currentFile)); -} -//! [4] - - -//! [5] -QString s1 = "%1 of %2 files copied. Copying: %3"; -QString s2 = "Kopierer nu %3. Av totalt %2 filer er %1 kopiert."; - -qDebug() << s1.arg(5).arg(10).arg("somefile.txt"); -qDebug() << s2.arg(5).arg(10).arg("somefile.txt"); -//! [5] - - //! [6] 5 of 10 files copied. Copying: somefile.txt Kopierer nu somefile.txt. Av totalt 10 filer er 5 kopiert. @@ -132,64 +56,3 @@ TRANSLATIONS = superapp_dk.ts \ superapp_no.ts \ superapp_se.ts //! [7] - - -//! [8] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QTranslator qtTranslator; - qtTranslator.load("qt_" + QLocale::system().name(), - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - app.installTranslator(&qtTranslator); - - QTranslator myappTranslator; - myappTranslator.load("myapp_" + QLocale::system().name()); - app.installTranslator(&myappTranslator); - - ... - return app.exec(); -} -//! [8] - - -//! [9] -QString string = ...; // some Unicode text - -QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5"); -QByteArray encodedString = codec->fromUnicode(string); -//! [9] - - -//! [10] -QByteArray encodedString = ...; // some ISO 8859-5 encoded text - -QTextCodec *codec = QTextCodec::codecForName("ISO 8859-5"); -QString string = codec->toUnicode(encodedString); -//! [10] - - -//! [11] -void Clock::setTime(const QTime &time) -{ - if (tr("AMPM") == "AMPM") { - // 12-hour clock - } else { - // 24-hour clock - } -} -//! [11] - - -//! [12] -void MyWidget::changeEvent(QEvent *event) -{ - if (e->type() == QEvent::LanguageChange) { - titleLabel->setText(tr("Document Title")); - ... - okPushButton->setText(tr("&OK")); - } else - QWidget::changeEvent(event); -} -//! [12] diff --git a/doc/src/snippets/code/doc_src_layout.cpp b/doc/src/snippets/code/doc_src_layout.cpp new file mode 100644 index 0000000..47db36b --- /dev/null +++ b/doc/src/snippets/code/doc_src_layout.cpp @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#ifndef CARD_H +#define CARD_H + +#include +#include + +class CardLayout : public QLayout +{ +public: + CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {} + CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {} + CardLayout(int dist): QLayout(dist) {} + ~CardLayout(); + + void addItem(QLayoutItem *item); + QSize sizeHint() const; + QSize minimumSize() const; + QLayoutItem *count() const; + QLayoutItem *itemAt(int) const; + QLayoutItem *takeAt(int); + void setGeometry(const QRect &rect); + +private: + QList list; +}; +#endif +//! [0] + + +//! [1] +//#include "card.h" +//! [1] + +//! [2] +QLayoutItem *CardLayout::count() const +{ + // QList::size() returns the number of QLayoutItems in the list + return list.size(); +} +//! [2] + +//! [3] +QLayoutItem *CardLayout::itemAt(int idx) const +{ + // QList::value() performs index checking, and returns 0 if we are + // outside the valid range + return list.value(idx); +} + +QLayoutItem *CardLayout::takeAt(int idx) +{ + // QList::take does not do index checking + return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0; +} +//! [3] + + +//! [4] +void CardLayout::addItem(QLayoutItem *item) +{ + list.append(item); +} +//! [4] + + +//! [5] +CardLayout::~CardLayout() +{ + QLayoutItem *item; + while ((item = takeAt(0))) + delete item; +} +//! [5] + + +//! [6] +void CardLayout::setGeometry(const QRect &r) +{ + QLayout::setGeometry(r); + + if (list.size() == 0) + return; + + int w = r.width() - (list.count() - 1) * spacing(); + int h = r.height() - (list.count() - 1) * spacing(); + int i = 0; + while (i < list.size()) { + QLayoutItem *o = list.at(i); + QRect geom(r.x() + i * spacing(), r.y() + i * spacing(), w, h); + o->setGeometry(geom); + ++i; + } +} +//! [6] + + +//! [7] +QSize CardLayout::sizeHint() const +{ + QSize s(0,0); + int n = list.count(); + if (n > 0) + s = QSize(100,70); //start with a nice default size + int i = 0; + while (i < n) { + QLayoutItem *o = list.at(i); + s = s.expandedTo(o->sizeHint()); + ++i; + } + return s + n*QSize(spacing(), spacing()); +} + +QSize CardLayout::minimumSize() const +{ + QSize s(0,0); + int n = list.count(); + int i = 0; + while (i < n) { + QLayoutItem *o = list.at(i); + s = s.expandedTo(o->minimumSize()); + ++i; + } + return s + n*QSize(spacing(), spacing()); +} +//! [7] diff --git a/doc/src/snippets/code/doc_src_layout.qdoc b/doc/src/snippets/code/doc_src_layout.qdoc deleted file mode 100644 index 47db36b..0000000 --- a/doc/src/snippets/code/doc_src_layout.qdoc +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#ifndef CARD_H -#define CARD_H - -#include -#include - -class CardLayout : public QLayout -{ -public: - CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {} - CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {} - CardLayout(int dist): QLayout(dist) {} - ~CardLayout(); - - void addItem(QLayoutItem *item); - QSize sizeHint() const; - QSize minimumSize() const; - QLayoutItem *count() const; - QLayoutItem *itemAt(int) const; - QLayoutItem *takeAt(int); - void setGeometry(const QRect &rect); - -private: - QList list; -}; -#endif -//! [0] - - -//! [1] -//#include "card.h" -//! [1] - -//! [2] -QLayoutItem *CardLayout::count() const -{ - // QList::size() returns the number of QLayoutItems in the list - return list.size(); -} -//! [2] - -//! [3] -QLayoutItem *CardLayout::itemAt(int idx) const -{ - // QList::value() performs index checking, and returns 0 if we are - // outside the valid range - return list.value(idx); -} - -QLayoutItem *CardLayout::takeAt(int idx) -{ - // QList::take does not do index checking - return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0; -} -//! [3] - - -//! [4] -void CardLayout::addItem(QLayoutItem *item) -{ - list.append(item); -} -//! [4] - - -//! [5] -CardLayout::~CardLayout() -{ - QLayoutItem *item; - while ((item = takeAt(0))) - delete item; -} -//! [5] - - -//! [6] -void CardLayout::setGeometry(const QRect &r) -{ - QLayout::setGeometry(r); - - if (list.size() == 0) - return; - - int w = r.width() - (list.count() - 1) * spacing(); - int h = r.height() - (list.count() - 1) * spacing(); - int i = 0; - while (i < list.size()) { - QLayoutItem *o = list.at(i); - QRect geom(r.x() + i * spacing(), r.y() + i * spacing(), w, h); - o->setGeometry(geom); - ++i; - } -} -//! [6] - - -//! [7] -QSize CardLayout::sizeHint() const -{ - QSize s(0,0); - int n = list.count(); - if (n > 0) - s = QSize(100,70); //start with a nice default size - int i = 0; - while (i < n) { - QLayoutItem *o = list.at(i); - s = s.expandedTo(o->sizeHint()); - ++i; - } - return s + n*QSize(spacing(), spacing()); -} - -QSize CardLayout::minimumSize() const -{ - QSize s(0,0); - int n = list.count(); - int i = 0; - while (i < n) { - QLayoutItem *o = list.at(i); - s = s.expandedTo(o->minimumSize()); - ++i; - } - return s + n*QSize(spacing(), spacing()); -} -//! [7] diff --git a/doc/src/snippets/code/doc_src_linguist-manual.cpp b/doc/src/snippets/code/doc_src_linguist-manual.cpp new file mode 100644 index 0000000..7cb5b1e --- /dev/null +++ b/doc/src/snippets/code/doc_src_linguist-manual.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [3] +label->setText(tr("F\374r \310lise")); +//! [3] + + +void wrapInFunction() +{ +//! [6] +button = new QPushButton("&Quit", this); +//! [6] + + +//! [7] +button = new QPushButton(tr("&Quit"), this); +//! [7] + + +//! [8] +QPushButton::tr("&Quit") +//! [8] + + +//! [9] +QObject::tr("&Quit") +//! [9] + + +//! [10] +rbc = new QRadioButton(tr("Enabled", "Color frame"), this); +//! [10] + + +//! [11] +rbh = new QRadioButton(tr("Enabled", "Hue frame"), this); +//! [11] +} + + +//! [12] +/* + TRANSLATOR FindDialog + + Choose Edit|Find from the menu bar or press Ctrl+F to pop up the + Find dialog. + + ... +*/ +//! [12] + +//! [13] +/* + TRANSLATOR MyNamespace::MyClass + + Necessary for lupdate. + + ... +*/ +//! [13] + +//! [14] +void some_global_function(LoginWidget *logwid) +{ + QLabel *label = new QLabel( + LoginWidget::tr("Password:"), logwid); +} + +void same_global_function(LoginWidget *logwid) +{ + QLabel *label = new QLabel( + qApp->translate("LoginWidget", "Password:"), + logwid); +} +//! [14] + + +//! [15] +QString FriendlyConversation::greeting(int greet_type) +{ + static const char* greeting_strings[] = { + QT_TR_NOOP("Hello"), + QT_TR_NOOP("Goodbye") + }; + return tr(greeting_strings[greet_type]); +} +//! [15] + + +//! [16] +static const char* greeting_strings[] = { + QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), + QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") +}; + +QString FriendlyConversation::greeting(int greet_type) +{ + return tr(greeting_strings[greet_type]); +} + +QString global_greeting(int greet_type) +{ + return qApp->translate("FriendlyConversation", + greeting_strings[greet_type]); +} +//! [16] + +void wrapInFunction() +{ + +//! [17] +QString tr(const char *text, const char *comment, int n); +//! [17] + +//! [18] +tr("%n item(s) replaced", "", count); +//! [18] + +} diff --git a/doc/src/snippets/code/doc_src_linguist-manual.pro b/doc/src/snippets/code/doc_src_linguist-manual.pro new file mode 100644 index 0000000..3b19ba7 --- /dev/null +++ b/doc/src/snippets/code/doc_src_linguist-manual.pro @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +HEADERS = main-dlg.h \ + options-dlg.h +SOURCES = main-dlg.cpp \ + options-dlg.cpp \ + main.cpp +FORMS = search-dlg.ui +TRANSLATIONS = superapp_dk.ts \ + superapp_fi.ts \ + superapp_no.ts \ + superapp_se.ts +#! [0] + + +#! [1] +CODECFORTR = ISO-8859-5 +#! [1] + + +#! [2] +CODECFORSRC = UTF-8 +#! [2] diff --git a/doc/src/snippets/code/doc_src_linguist-manual.qdoc b/doc/src/snippets/code/doc_src_linguist-manual.qdoc index 5975c9a..34b5dcc 100644 --- a/doc/src/snippets/code/doc_src_linguist-manual.qdoc +++ b/doc/src/snippets/code/doc_src_linguist-manual.qdoc @@ -38,35 +38,6 @@ ** ****************************************************************************/ -//! [0] -HEADERS = main-dlg.h \ - options-dlg.h -SOURCES = main-dlg.cpp \ - options-dlg.cpp \ - main.cpp -FORMS = search-dlg.ui -TRANSLATIONS = superapp_dk.ts \ - superapp_fi.ts \ - superapp_no.ts \ - superapp_se.ts -//! [0] - - -//! [1] -CODECFORTR = ISO-8859-5 -//! [1] - - -//! [2] -CODECFORSRC = UTF-8 -//! [2] - - -//! [3] -label->setText(tr("F\374r \310lise")); -//! [3] - - //! [4] Usage: lupdate [options] [project-file] @@ -116,118 +87,3 @@ Options: -version Display the version of lrelease and exit //! [5] - - -void wrapInFunction() -{ -//! [6] -button = new QPushButton("&Quit", this); -//! [6] - - -//! [7] -button = new QPushButton(tr("&Quit"), this); -//! [7] - - -//! [8] -QPushButton::tr("&Quit") -//! [8] - - -//! [9] -QObject::tr("&Quit") -//! [9] - - -//! [10] -rbc = new QRadioButton(tr("Enabled", "Color frame"), this); -//! [10] - - -//! [11] -rbh = new QRadioButton(tr("Enabled", "Hue frame"), this); -//! [11] -} - - -//! [12] -/* - TRANSLATOR FindDialog - - Choose Edit|Find from the menu bar or press Ctrl+F to pop up the - Find dialog. - - ... -*/ -//! [12] - -//! [13] -/* - TRANSLATOR MyNamespace::MyClass - - Necessary for lupdate. - - ... -*/ -//! [13] - -//! [14] -void some_global_function(LoginWidget *logwid) -{ - QLabel *label = new QLabel( - LoginWidget::tr("Password:"), logwid); -} - -void same_global_function(LoginWidget *logwid) -{ - QLabel *label = new QLabel( - qApp->translate("LoginWidget", "Password:"), - logwid); -} -//! [14] - - -//! [15] -QString FriendlyConversation::greeting(int greet_type) -{ - static const char* greeting_strings[] = { - QT_TR_NOOP("Hello"), - QT_TR_NOOP("Goodbye") - }; - return tr(greeting_strings[greet_type]); -} -//! [15] - - -//! [16] -static const char* greeting_strings[] = { - QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), - QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") -}; - -QString FriendlyConversation::greeting(int greet_type) -{ - return tr(greeting_strings[greet_type]); -} - -QString global_greeting(int greet_type) -{ - return qApp->translate("FriendlyConversation", - greeting_strings[greet_type]); -} -//! [16] - -void wrapInFunction() -{ - -//! [17] -QString tr(const char *text, const char *comment, int n); -//! [17] - -//! [18] -tr("%n item(s) replaced", "", count); -//! [18] - -} - diff --git a/doc/src/snippets/code/doc_src_mac-differences.cpp b/doc/src/snippets/code/doc_src_mac-differences.cpp new file mode 100644 index 0000000..f261083 --- /dev/null +++ b/doc/src/snippets/code/doc_src_mac-differences.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +#ifdef Q_WS_MAC + CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, + kCFURLPOSIXPathStyle); + const char *pathPtr = CFStringGetCStringPtr(macPath, + CFStringGetSystemEncoding()); + qDebug("Path = %s", pathPtr); + CFRelease(appUrlRef); + CFRelease(macPath); +#endif +//! [1] diff --git a/doc/src/snippets/code/doc_src_mac-differences.pro b/doc/src/snippets/code/doc_src_mac-differences.pro new file mode 100644 index 0000000..3490bfe --- /dev/null +++ b/doc/src/snippets/code/doc_src_mac-differences.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ +#! [0] diff --git a/doc/src/snippets/code/doc_src_moc.cpp b/doc/src/snippets/code/doc_src_moc.cpp new file mode 100644 index 0000000..ec756e1 --- /dev/null +++ b/doc/src/snippets/code/doc_src_moc.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [3] +#include "foo.moc" +//! [3] + + +//! [4] +#ifndef Q_MOC_RUN + ... +#endif +//! [4] + + +//! [5] +class SomeTemplate : public QFrame +{ + Q_OBJECT + ... + +signals: + void mySignal(int); +}; +//! [5] + + +//! [6] +// correct +class SomeClass : public QObject, public OtherClass +{ + ... +}; +//! [6] + + +//! [7] +class SomeClass : public QObject +{ + Q_OBJECT + +public slots: + void apply(void (*apply)(List *, void *), char *); // WRONG +}; +//! [7] + + +//! [8] +typedef void (*ApplyFunction)(List *, void *); + +class SomeClass : public QObject +{ + Q_OBJECT + +public slots: + void apply(ApplyFunction, char *); +}; +//! [8] + + +//! [9] +class MyClass : public QObject +{ + Q_OBJECT + + enum Error { + ConnectionRefused, + RemoteHostClosed, + UnknownError + }; + +signals: + void stateChanged(MyClass::Error error); +}; +//! [9] + + +//! [10] +#ifdef ultrix +#define SIGNEDNESS(a) unsigned a +#else +#define SIGNEDNESS(a) a +#endif + +class Whatever : public QObject +{ + Q_OBJECT + +signals: + void someSignal(SIGNEDNESS(int)); +}; +//! [10] + + +//! [11] +class A +{ +public: + class B + { + Q_OBJECT + + public slots: // WRONG + void b(); + }; +}; +//! [11] diff --git a/doc/src/snippets/code/doc_src_moc.qdoc b/doc/src/snippets/code/doc_src_moc.qdoc index ef85b1b..74ab365 100644 --- a/doc/src/snippets/code/doc_src_moc.qdoc +++ b/doc/src/snippets/code/doc_src_moc.qdoc @@ -56,109 +56,3 @@ foo.o: foo.moc foo.moc: foo.cpp moc $(DEFINES) $(INCPATH) -i $< -o $@ //! [2] - - -//! [3] -#include "foo.moc" -//! [3] - - -//! [4] -#ifndef Q_MOC_RUN - ... -#endif -//! [4] - - -//! [5] -class SomeTemplate : public QFrame -{ - Q_OBJECT - ... - -signals: - void mySignal(int); -}; -//! [5] - - -//! [6] -// correct -class SomeClass : public QObject, public OtherClass -{ - ... -}; -//! [6] - - -//! [7] -class SomeClass : public QObject -{ - Q_OBJECT - -public slots: - void apply(void (*apply)(List *, void *), char *); // WRONG -}; -//! [7] - - -//! [8] -typedef void (*ApplyFunction)(List *, void *); - -class SomeClass : public QObject -{ - Q_OBJECT - -public slots: - void apply(ApplyFunction, char *); -}; -//! [8] - - -//! [9] -class MyClass : public QObject -{ - Q_OBJECT - - enum Error { - ConnectionRefused, - RemoteHostClosed, - UnknownError - }; - -signals: - void stateChanged(MyClass::Error error); -}; -//! [9] - - -//! [10] -#ifdef ultrix -#define SIGNEDNESS(a) unsigned a -#else -#define SIGNEDNESS(a) a -#endif - -class Whatever : public QObject -{ - Q_OBJECT - -signals: - void someSignal(SIGNEDNESS(int)); -}; -//! [10] - - -//! [11] -class A -{ -public: - class B - { - Q_OBJECT - - public slots: // WRONG - void b(); - }; -}; -//! [11] diff --git a/doc/src/snippets/code/doc_src_model-view-programming.cpp b/doc/src/snippets/code/doc_src_model-view-programming.cpp new file mode 100644 index 0000000..05c2e1d --- /dev/null +++ b/doc/src/snippets/code/doc_src_model-view-programming.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QAbstractItemModel *model = index.model(); +//! [0] + + +//! [1] +QModelIndex index = model->index(row, column, ...); +//! [1] + + +//! [2] +QModelIndex indexA = model->index(0, 0, QModelIndex()); +QModelIndex indexB = model->index(1, 1, QModelIndex()); +QModelIndex indexC = model->index(2, 1, QModelIndex()); +//! [2] + + +//! [3] +QModelIndex index = model->index(row, column, parent); +//! [3] + + +//! [4] +QModelIndex indexA = model->index(0, 0, QModelIndex()); +QModelIndex indexC = model->index(2, 1, QModelIndex()); +//! [4] + + +//! [5] +QModelIndex indexB = model->index(1, 0, indexA); +//! [5] + + +//! [6] +QVariant value = model->data(index, role); +//! [6] diff --git a/doc/src/snippets/code/doc_src_model-view-programming.qdoc b/doc/src/snippets/code/doc_src_model-view-programming.qdoc deleted file mode 100644 index 05c2e1d..0000000 --- a/doc/src/snippets/code/doc_src_model-view-programming.qdoc +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QAbstractItemModel *model = index.model(); -//! [0] - - -//! [1] -QModelIndex index = model->index(row, column, ...); -//! [1] - - -//! [2] -QModelIndex indexA = model->index(0, 0, QModelIndex()); -QModelIndex indexB = model->index(1, 1, QModelIndex()); -QModelIndex indexC = model->index(2, 1, QModelIndex()); -//! [2] - - -//! [3] -QModelIndex index = model->index(row, column, parent); -//! [3] - - -//! [4] -QModelIndex indexA = model->index(0, 0, QModelIndex()); -QModelIndex indexC = model->index(2, 1, QModelIndex()); -//! [4] - - -//! [5] -QModelIndex indexB = model->index(1, 0, indexA); -//! [5] - - -//! [6] -QVariant value = model->data(index, role); -//! [6] diff --git a/doc/src/snippets/code/doc_src_modules.pro b/doc/src/snippets/code/doc_src_modules.pro new file mode 100644 index 0000000..5871540 --- /dev/null +++ b/doc/src/snippets/code/doc_src_modules.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QT -= gui +#! [0] diff --git a/doc/src/snippets/code/doc_src_modules.qdoc b/doc/src/snippets/code/doc_src_modules.qdoc deleted file mode 100644 index 643a94d..0000000 --- a/doc/src/snippets/code/doc_src_modules.qdoc +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QT -= gui -//! [0] diff --git a/doc/src/snippets/code/doc_src_objecttrees.cpp b/doc/src/snippets/code/doc_src_objecttrees.cpp new file mode 100644 index 0000000..cd92a49 --- /dev/null +++ b/doc/src/snippets/code/doc_src_objecttrees.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +int main() +{ + QWidget window; + QPushButton quit("Quit", &window); + ... +} +//![0] + + +//![1] +int main() +{ + QPushButton quit("Quit"); + QWidget window; + + quit.setParent(&window); + ... +} +//![1] diff --git a/doc/src/snippets/code/doc_src_objecttrees.qdoc b/doc/src/snippets/code/doc_src_objecttrees.qdoc deleted file mode 100644 index cd92a49..0000000 --- a/doc/src/snippets/code/doc_src_objecttrees.qdoc +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -int main() -{ - QWidget window; - QPushButton quit("Quit", &window); - ... -} -//![0] - - -//![1] -int main() -{ - QPushButton quit("Quit"); - QWidget window; - - quit.setParent(&window); - ... -} -//![1] diff --git a/doc/src/snippets/code/doc_src_phonon-api.cpp b/doc/src/snippets/code/doc_src_phonon-api.cpp new file mode 100644 index 0000000..d7a989b --- /dev/null +++ b/doc/src/snippets/code/doc_src_phonon-api.cpp @@ -0,0 +1,264 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +PushStream::PushStream(QObject *parent) + : AbstractMediaStream(parent), m_timer(new QTimer(this)) +{ + setStreamSize(getMediaStreamSize()); + + connect(m_timer, SIGNAL(timeout()), SLOT(moreData())); + m_timer->setInterval(0); +} + +void PushStream::moreData() +{ + const QByteArray data = getMediaData(); + if (data.isEmpty()) { + endOfData(); + } else { + writeData(data); + } +} + +void PushStream::needData() +{ + m_timer->start(); + moreData(); +} + +void PushStream::enoughData() +{ + m_timer->stop(); +} +//! [0] + + +//! [1] +PullStream::PullStream(QObject *parent) + : AbstractMediaStream(parent) +{ + setStreamSize(getMediaStreamSize()); +} + +void PullStream::needData() +{ + const QByteArray data = getMediaData(); + if (data.isEmpty()) { + endOfData(); + } else { + writeData(data); + } +} +//! [1] + + +//! [2] +seekStream(0); +//! [2] + + +//! [3] +MediaObject m; +QString fileName("/home/foo/bar.ogg"); +QUrl url("http://www.example.com/stream.mp3"); +QBuffer *someBuffer; +m.setCurrentSource(fileName); +m.setCurrentSource(url); +m.setCurrentSource(someBuffer); +m.setCurrentSource(Phonon::Cd); +//! [3] + + +//! [4] +VideoPlayer *player = new VideoPlayer(Phonon::VideoCategory, parentWidget); +connect(player, SIGNAL(finished()), player, SLOT(deleteLater())); +player->play(url); +//! [4] + + +//! [5] +audioPlayer->load(url); +audioPlayer->play(); +//! [5] + + +//! [6] +media = new MediaObject(this); +connect(media, SIGNAL(finished()), SLOT(slotFinished()); +media->setCurrentSource("/home/username/music/filename.ogg"); + +... + +media->play(); +//! [6] + + +//! [7] +media->setCurrentSource(":/sounds/startsound.ogg"); +media->enqueue("/home/username/music/song.mp3"); +media->enqueue(":/sounds/endsound.ogg"); +//! [7] + + +//! [8] + media->setCurrentSource(":/sounds/startsound.ogg"); + connect(media, SIGNAL(aboutToFinish()), SLOT(enqueueNextSource())); +} + +void enqueueNextSource() +{ + media->enqueue("/home/username/music/song.mp3"); +} +//! [8] + + +//! [9] +int x = 200; +media->setTickInterval(x); +Q_ASSERT(x == producer->tickInterval()); +//! [9] + + +//! [10] +int x = 200; +media->setTickInterval(x); +Q_ASSERT(x >= producer->tickInterval() && + x <= 2producer->tickInterval()); +//! [10] + + +//! [11] + connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool)); + media->setCurrentSource("somevideo.avi"); + media->hasVideo(); // returns false; +} + +void hasVideoChanged(bool b) +{ + // b == true + media->hasVideo(); // returns true; +} +//! [11] + + +//! [12] + connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool)); + media->setCurrentSource("somevideo.avi"); + media->hasVideo(); // returns false; +} + +void hasVideoChanged(bool b) +{ + // b == true + media->hasVideo(); // returns true; +} +//! [12] + + +//! [13] +setMetaArtist(media->metaData("ARTIST")); +setMetaAlbum(media->metaData("ALBUM")); +setMetaTitle(media->metaData("TITLE")); +setMetaDate(media->metaData("DATE")); +setMetaGenre(media->metaData("GENRE")); +setMetaTrack(media->metaData("TRACKNUMBER")); +setMetaComment(media->metaData("DESCRIPTION")); +//! [13] + + +//! [14] +QUrl url("http://www.example.com/music.ogg"); +media->setCurrentSource(url); +//! [14] + + +//! [15] +progressBar->setRange(0, 100); // this is the default +connect(media, SIGNAL(bufferStatus(int)), progressBar, SLOT(setValue(int))); +//! [15] + + +//! [16] +QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ... +//! [16] + + +//! [17] +QComboBox *cb = new QComboBox(parentWidget); +ObjectDescriptionModel *model = new ObjectDescriptionModel(cb); +model->setModelData(BackendCapabilities::availableAudioOutputDevices()); +cb->setModel(model); +cb->setCurrentIndex(0); // select first entry +//! [17] + + +//! [18] +int cbIndex = cb->currentIndex(); +AudioOutputDevice selectedDevice = model->modelData(cbIndex); +//! [18] + + +//! [19] +Path path = Phonon::createPath(...); +Effect *effect = new Effect(this); +path.insertEffect(effect); +//! [19] + + +//! [20] +MediaObject *media = new MediaObject; +AudioOutput *output = new AudioOutput(Phonon::MusicCategory); +Path path = Phonon::createPath(media, output); +Q_ASSERT(path.isValid()); // for this simple case the path should always be + //valid - there are unit tests to ensure it +// insert an effect +QList effectList = BackendCapabilities::availableAudioEffects(); +if (!effectList.isEmpty()) { + Effect *effect = path.insertEffect(effectList.first()); +} +//! [20] + + +//! [21] +MediaObject *media = new MediaObject(parent); +VideoWidget *vwidget = new VideoWidget(parent); +Phonon::createPath(media, vwidget); +//! [21] diff --git a/doc/src/snippets/code/doc_src_phonon-api.qdoc b/doc/src/snippets/code/doc_src_phonon-api.qdoc deleted file mode 100644 index d7a989b..0000000 --- a/doc/src/snippets/code/doc_src_phonon-api.qdoc +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -PushStream::PushStream(QObject *parent) - : AbstractMediaStream(parent), m_timer(new QTimer(this)) -{ - setStreamSize(getMediaStreamSize()); - - connect(m_timer, SIGNAL(timeout()), SLOT(moreData())); - m_timer->setInterval(0); -} - -void PushStream::moreData() -{ - const QByteArray data = getMediaData(); - if (data.isEmpty()) { - endOfData(); - } else { - writeData(data); - } -} - -void PushStream::needData() -{ - m_timer->start(); - moreData(); -} - -void PushStream::enoughData() -{ - m_timer->stop(); -} -//! [0] - - -//! [1] -PullStream::PullStream(QObject *parent) - : AbstractMediaStream(parent) -{ - setStreamSize(getMediaStreamSize()); -} - -void PullStream::needData() -{ - const QByteArray data = getMediaData(); - if (data.isEmpty()) { - endOfData(); - } else { - writeData(data); - } -} -//! [1] - - -//! [2] -seekStream(0); -//! [2] - - -//! [3] -MediaObject m; -QString fileName("/home/foo/bar.ogg"); -QUrl url("http://www.example.com/stream.mp3"); -QBuffer *someBuffer; -m.setCurrentSource(fileName); -m.setCurrentSource(url); -m.setCurrentSource(someBuffer); -m.setCurrentSource(Phonon::Cd); -//! [3] - - -//! [4] -VideoPlayer *player = new VideoPlayer(Phonon::VideoCategory, parentWidget); -connect(player, SIGNAL(finished()), player, SLOT(deleteLater())); -player->play(url); -//! [4] - - -//! [5] -audioPlayer->load(url); -audioPlayer->play(); -//! [5] - - -//! [6] -media = new MediaObject(this); -connect(media, SIGNAL(finished()), SLOT(slotFinished()); -media->setCurrentSource("/home/username/music/filename.ogg"); - -... - -media->play(); -//! [6] - - -//! [7] -media->setCurrentSource(":/sounds/startsound.ogg"); -media->enqueue("/home/username/music/song.mp3"); -media->enqueue(":/sounds/endsound.ogg"); -//! [7] - - -//! [8] - media->setCurrentSource(":/sounds/startsound.ogg"); - connect(media, SIGNAL(aboutToFinish()), SLOT(enqueueNextSource())); -} - -void enqueueNextSource() -{ - media->enqueue("/home/username/music/song.mp3"); -} -//! [8] - - -//! [9] -int x = 200; -media->setTickInterval(x); -Q_ASSERT(x == producer->tickInterval()); -//! [9] - - -//! [10] -int x = 200; -media->setTickInterval(x); -Q_ASSERT(x >= producer->tickInterval() && - x <= 2producer->tickInterval()); -//! [10] - - -//! [11] - connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool)); - media->setCurrentSource("somevideo.avi"); - media->hasVideo(); // returns false; -} - -void hasVideoChanged(bool b) -{ - // b == true - media->hasVideo(); // returns true; -} -//! [11] - - -//! [12] - connect(media, SIGNAL(hasVideoChanged(bool)), hasVideoChanged(bool)); - media->setCurrentSource("somevideo.avi"); - media->hasVideo(); // returns false; -} - -void hasVideoChanged(bool b) -{ - // b == true - media->hasVideo(); // returns true; -} -//! [12] - - -//! [13] -setMetaArtist(media->metaData("ARTIST")); -setMetaAlbum(media->metaData("ALBUM")); -setMetaTitle(media->metaData("TITLE")); -setMetaDate(media->metaData("DATE")); -setMetaGenre(media->metaData("GENRE")); -setMetaTrack(media->metaData("TRACKNUMBER")); -setMetaComment(media->metaData("DESCRIPTION")); -//! [13] - - -//! [14] -QUrl url("http://www.example.com/music.ogg"); -media->setCurrentSource(url); -//! [14] - - -//! [15] -progressBar->setRange(0, 100); // this is the default -connect(media, SIGNAL(bufferStatus(int)), progressBar, SLOT(setValue(int))); -//! [15] - - -//! [16] -QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ... -//! [16] - - -//! [17] -QComboBox *cb = new QComboBox(parentWidget); -ObjectDescriptionModel *model = new ObjectDescriptionModel(cb); -model->setModelData(BackendCapabilities::availableAudioOutputDevices()); -cb->setModel(model); -cb->setCurrentIndex(0); // select first entry -//! [17] - - -//! [18] -int cbIndex = cb->currentIndex(); -AudioOutputDevice selectedDevice = model->modelData(cbIndex); -//! [18] - - -//! [19] -Path path = Phonon::createPath(...); -Effect *effect = new Effect(this); -path.insertEffect(effect); -//! [19] - - -//! [20] -MediaObject *media = new MediaObject; -AudioOutput *output = new AudioOutput(Phonon::MusicCategory); -Path path = Phonon::createPath(media, output); -Q_ASSERT(path.isValid()); // for this simple case the path should always be - //valid - there are unit tests to ensure it -// insert an effect -QList effectList = BackendCapabilities::availableAudioEffects(); -if (!effectList.isEmpty()) { - Effect *effect = path.insertEffect(effectList.first()); -} -//! [20] - - -//! [21] -MediaObject *media = new MediaObject(parent); -VideoWidget *vwidget = new VideoWidget(parent); -Phonon::createPath(media, vwidget); -//! [21] diff --git a/doc/src/snippets/code/doc_src_phonon.pro b/doc/src/snippets/code/doc_src_phonon.pro new file mode 100644 index 0000000..24cc7bd --- /dev/null +++ b/doc/src/snippets/code/doc_src_phonon.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QT += phonon +#! [0] diff --git a/doc/src/snippets/code/doc_src_phonon.qdoc b/doc/src/snippets/code/doc_src_phonon.qdoc deleted file mode 100644 index 61ee189..0000000 --- a/doc/src/snippets/code/doc_src_phonon.qdoc +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QT += phonon -//! [0] - - -//! [1] -QT += phonon -//! [1] - - -//! [2] -#include -//! [2] diff --git a/doc/src/snippets/code/doc_src_plugins-howto.qdoc b/doc/src/snippets/code/doc_src_plugins-howto.qdoc index e80faee..b03dfed 100644 --- a/doc/src/snippets/code/doc_src_plugins-howto.qdoc +++ b/doc/src/snippets/code/doc_src_plugins-howto.qdoc @@ -38,69 +38,6 @@ ** ****************************************************************************/ -//! [0] -class MyStylePlugin : public QStylePlugin -{ -public: - QStringList keys() const; - QStyle *create(const QString &key); -}; -//! [0] - - -//! [1] -#include "mystyleplugin.h" - -QStringList MyStylePlugin::keys() const -{ - return QStringList() << "MyStyle"; -} - -QStyle *MyStylePlugin::create(const QString &key) -{ - if (key.toLower() == "mystyle") - return new MyStyle; - return 0; -} - -Q_EXPORT_PLUGIN2(pnp_mystyleplugin, MyStylePlugin) -//! [1] - - -//! [2] -QApplication::setStyle(QStyleFactory::create("MyStyle")); -//! [2] - - -//! [3] -CONFIG += release -//! [3] - - -//! [4] -#include -#include - -Q_IMPORT_PLUGIN(qjpeg) -Q_IMPORT_PLUGIN(qgif) -Q_IMPORT_PLUGIN(qkrcodecs) - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - ... - return app.exec(); -} -//! [4] - - -//! [5] -QTPLUGIN += qjpeg \ - qgif \ - qkrcodecs -//! [5] - - //! [6] HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.debug HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.2.false diff --git a/doc/src/snippets/code/doc_src_porting-qsa.cpp b/doc/src/snippets/code/doc_src_porting-qsa.cpp new file mode 100644 index 0000000..f9b9c6b --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting-qsa.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [16] +QPushButton *button = new QPushButton(); +button->setObjectName("button"); +interpreter->addTransientObject(button); +//! [16] + + +//! [17] +QPushButton *button = new QPushButton(); +QScriptValue scriptButton = engine.newQObject(button); +engine.globalObject().setProperty("button", scriptButton); +//! [17] + + +//! [18] +ModuleFactory::ModuleFactory() +{ + registerClass( "ImageSource", &ImgSource::staticMetaObject); + ... +} + +QObject *ModuleFactory::create( const QString &type, + const QVariantList &, + QObject * ) +{ + if ( type == "ImageSource" ) + return new ImgSource(); + ... +} + +... + +interpreter.addObjectFactory(new ModuleFactory()); +//! [18] + + +//! [19] +QScriptValue construct_QPushButton(QScriptContext *, QScriptEngine *engine) { + return engine->newQObject(new QPushButton()); +} + +... + +QScriptValue constructor = engine.newFunction(construct_QPushButton); +QScriptValue value = + engine.newQMetaObject(&QPushButton::staticMetaObject, + constructor); +engine.globalObject().setProperty("QPushButton", value); +//! [19] diff --git a/doc/src/snippets/code/doc_src_porting-qsa.js b/doc/src/snippets/code/doc_src_porting-qsa.js new file mode 100644 index 0000000..e58f5b7 --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting-qsa.js @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +point = new Object(); +point.x = 12; +point.y = 35; +//! [0] + + +//! [1] +function manhattanLength(point) { + return point.x + point.y; +} +//! [1] + + +//! [2] +manhattanLength = function(point) { + return point.x + point.y; +} +//! [2] + + +//! [3] +point.manhattanLength = function() { + return this.x + this.y; +} +print(point.manhattanLength()); // prints 47 +//! [3] + + +//! [5] +point.manhattanLength = function() { + return this.x + this.y; +} +print(point.manhattanLength()); // prints 47 +//! [5] + + +//! [8] +var car = new Object(); +car.constructor = function(regnr) { + // ... +} +car.constructor(); +//! [8] + + +//! [10] +function Car(regnr) { + this.regNumber = regnr; + this.toString = function() { return this.regNumber; } +} +//! [10] + + +//! [11] +function Car(regnr) { + this.regNumber = regnr; +} +Car.prototype.toString = function() { return this.regNumber; } +//! [11] + + +//! [13] +function GasolineCar(regnr) { + Car(regnr); +} +GasolineCar.prototype = new Car(); +GasolineCar.prototype.toString = function() { + return "GasolineCar(" + this.regNumber + ")"; +} +//! [13] + + +//! [15] +Car.globalCount = 0; +print(Car.globalCount); +//! [15] diff --git a/doc/src/snippets/code/doc_src_porting-qsa.qdoc b/doc/src/snippets/code/doc_src_porting-qsa.qdoc index bb0b7fd..1846640 100644 --- a/doc/src/snippets/code/doc_src_porting-qsa.qdoc +++ b/doc/src/snippets/code/doc_src_porting-qsa.qdoc @@ -38,35 +38,6 @@ ** ****************************************************************************/ -//! [0] -point = new Object(); -point.x = 12; -point.y = 35; -//! [0] - - -//! [1] -function manhattanLength(point) { - return point.x + point.y; -} -//! [1] - - -//! [2] -manhattanLength = function(point) { - return point.x + point.y; -} -//! [2] - - -//! [3] -point.manhattanLength = function() { - return this.x + this.y; -} -print(point.manhattanLength()); // prints 47 -//! [3] - - //! [4] class Point() { var x; @@ -76,14 +47,6 @@ class Point() { //! [4] -//! [5] -point.manhattanLength = function() { - return this.x + this.y; -} -print(point.manhattanLength()); // prints 47 -//! [5] - - //! [6] class Car { var regNumber; @@ -103,13 +66,6 @@ var car = new Car("ABC 123"); //! [7] -//! [8] -var car = new Object(); -car.constructor = function(regnr) { ... } -car.constructor(); -//! [8] - - //! [9] class Car { var regNumber; @@ -123,22 +79,6 @@ class Car { //! [9] -//! [10] -function Car(regnr) { - this.regNumber = regnr; - this.toString = function() { return this.regNumber; } -} -//! [10] - - -//! [11] -function Car(regnr) { - this.regNumber = regnr; -} -Car.prototype.toString = function() { return this.regNumber; } -//! [11] - - //! [12] class GasolineCar extends Car { function GasolineCar(regnr) { @@ -151,77 +91,9 @@ class GasolineCar extends Car { //! [12] -//! [13] -function GasolineCar(regnr) { - Car(regnr); -} -GasolineCar.prototype = new Car(); -GasolineCar.prototype.toString = function() { - return "GasolineCar(" + this.regNumber + ")"; -} -//! [13] - - //! [14] class Car { static var globalCount = 0; } print(Car.globalCount); //! [14] - - -//! [15] -Car.globalCount = 0; -print(Car.globalCount); -//! [15] - - -//! [16] -QPushButton *button = new QPushButton(); -button->setObjectName("button"); -interpreter->addTransientObject(button); -//! [16] - - -//! [17] -QPushButton *button = new QPushButton(); -QScriptValue scriptButton = engine.newQObject(button); -engine.globalObject().setProperty("button", scriptButton); -//! [17] - - -//! [18] -ModuleFactory::ModuleFactory() -{ - registerClass( "ImageSource", &ImgSource::staticMetaObject); - ... -} - -QObject *ModuleFactory::create( const QString &type, - const QVariantList &, - QObject * ) -{ - if ( type == "ImageSource" ) - return new ImgSource(); - ... -} - -... - -interpreter.addObjectFactory(new ModuleFactory()); -//! [18] - - -//! [19] -QScriptValue construct_QPushButton(QScriptContext *, QScriptEngine *engine) { - return engine->newQObject(new QPushButton()); -} - -... - -QScriptValue constructor = engine.newFunction(construct_QPushButton); -QScriptValue value = - engine.newQMetaObject(&QPushButton::staticMetaObject, - constructor); -engine.globalObject().setProperty("QPushButton", value); -//! [19] diff --git a/doc/src/snippets/code/doc_src_porting4-canvas.cpp b/doc/src/snippets/code/doc_src_porting4-canvas.cpp new file mode 100644 index 0000000..8004163 --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting4-canvas.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +item->scene().sceneRect().intersects(item->sceneBoundingRect()); +//! [0] + + +//! [1] +class TileScene : public QGraphicsScene +{ +public: + ... + + void setTiles(const QPixmap &pixmap, int h, int v, + int tileHeight, int tileWidth); + void setTile(int x, int y, int tilenum); + +private: + QRect tileRect(int x, int y) const; + QRect tileRect(int tileNum) const; + + QVector > tiles; + QPixmap tilePixmap; + int tileW, tileH; + int hTiles, vTiles; +}; +//! [1] + + +//! [2] +void TileScene::setTiles(const QPixmap &pixmap, int h, int v, + int tileHeight, int tileWidth) +{ + tilePixmap = pixmap; + tileW = tileWidth; + tileH = tileHeight; + hTiles = h; + vTiles = v; + + tiles.resize(v); + for (int y = 0; y < v; ++y) + tiles[y].resize(h); +} +//! [2] + + +//! [3] +void TileScene::setTile(int x, int y, int tilenum) +{ + tiles[y][x] = tilenum; + update(tileRect(x, y)); +} +//! [3] + + +//! [4] +QRect TileScene::tileRect(int x, int y) const +{ + return QRect(x * tileW, y * tileH, tileW, tileH); +} +//! [4] + + +//! [5] +QRect TileScene::tileRect(int tileNum) const +{ + int numHTiles = tilePixmap.width() / tileW; + int numVTiles = tilePixmap.height() / tileH; + return tileRect(tileNum % numHTiles, tileNum / numHTiles); +} +//! [5] + + +//! [6] +void drawBackground(QPainter *painter, const QRectF &exposed) +{ + for (int y = 0; y < vTiles; ++y) { + for (int x = 0; x < hTiles; ++x) { + QRect destRect = tileRect(x, y); + if (exposed.intersects(destRect)) { + painter->drawPixmap(destRect, tilePixmap, + tileRect(tiles[y][x])); + } + } + } +} +//! [6] + + +//! [7] + // Before + Q3CanvasEllipse ellipse(10, 10); + + // After + QGraphicsEllipseItem ellipse(-5, -5, 10, 10); +//! [7] + + +//! [8] +static QPainterPath fromControlPoints(const Q3PointArray &pa) +{ + QPainterPath path; + path.moveTo(pa[0]); + for (int i = 1; i < pa.size(); i += 3) + path.cubicTo(pa[i], pa[(i + 1) % pa.size()], pa[(i + 2) % pa.size()]); + return path; +} +//! [8] + + +//! [9] +wildcardPath.replace("%1", "*"); +QFileInfo fi(wildcardPath); + +QList frames; +foreach (QString entry, QDir(fi.path(), fi.fileName()).entryList()) + frames << QPixmap(fi.path() + "/" + entry); +//! [9] diff --git a/doc/src/snippets/code/doc_src_porting4-canvas.qdoc b/doc/src/snippets/code/doc_src_porting4-canvas.qdoc deleted file mode 100644 index 8004163..0000000 --- a/doc/src/snippets/code/doc_src_porting4-canvas.qdoc +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -item->scene().sceneRect().intersects(item->sceneBoundingRect()); -//! [0] - - -//! [1] -class TileScene : public QGraphicsScene -{ -public: - ... - - void setTiles(const QPixmap &pixmap, int h, int v, - int tileHeight, int tileWidth); - void setTile(int x, int y, int tilenum); - -private: - QRect tileRect(int x, int y) const; - QRect tileRect(int tileNum) const; - - QVector > tiles; - QPixmap tilePixmap; - int tileW, tileH; - int hTiles, vTiles; -}; -//! [1] - - -//! [2] -void TileScene::setTiles(const QPixmap &pixmap, int h, int v, - int tileHeight, int tileWidth) -{ - tilePixmap = pixmap; - tileW = tileWidth; - tileH = tileHeight; - hTiles = h; - vTiles = v; - - tiles.resize(v); - for (int y = 0; y < v; ++y) - tiles[y].resize(h); -} -//! [2] - - -//! [3] -void TileScene::setTile(int x, int y, int tilenum) -{ - tiles[y][x] = tilenum; - update(tileRect(x, y)); -} -//! [3] - - -//! [4] -QRect TileScene::tileRect(int x, int y) const -{ - return QRect(x * tileW, y * tileH, tileW, tileH); -} -//! [4] - - -//! [5] -QRect TileScene::tileRect(int tileNum) const -{ - int numHTiles = tilePixmap.width() / tileW; - int numVTiles = tilePixmap.height() / tileH; - return tileRect(tileNum % numHTiles, tileNum / numHTiles); -} -//! [5] - - -//! [6] -void drawBackground(QPainter *painter, const QRectF &exposed) -{ - for (int y = 0; y < vTiles; ++y) { - for (int x = 0; x < hTiles; ++x) { - QRect destRect = tileRect(x, y); - if (exposed.intersects(destRect)) { - painter->drawPixmap(destRect, tilePixmap, - tileRect(tiles[y][x])); - } - } - } -} -//! [6] - - -//! [7] - // Before - Q3CanvasEllipse ellipse(10, 10); - - // After - QGraphicsEllipseItem ellipse(-5, -5, 10, 10); -//! [7] - - -//! [8] -static QPainterPath fromControlPoints(const Q3PointArray &pa) -{ - QPainterPath path; - path.moveTo(pa[0]); - for (int i = 1; i < pa.size(); i += 3) - path.cubicTo(pa[i], pa[(i + 1) % pa.size()], pa[(i + 2) % pa.size()]); - return path; -} -//! [8] - - -//! [9] -wildcardPath.replace("%1", "*"); -QFileInfo fi(wildcardPath); - -QList frames; -foreach (QString entry, QDir(fi.path(), fi.fileName()).entryList()) - frames << QPixmap(fi.path() + "/" + entry); -//! [9] diff --git a/doc/src/snippets/code/doc_src_porting4-designer.cpp b/doc/src/snippets/code/doc_src_porting4-designer.cpp new file mode 100644 index 0000000..1d73aae --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting4-designer.cpp @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +namespace Ui { + +class HelloWorld +{ +public: + QVBoxLayout *vboxLayout; + QPushButton *pushButton; + + void setupUi(QWidget *HelloWorld) + { + HelloWorld->setObjectName(QString::fromUtf8("HelloWorld")); + + vboxLayout = new QVBoxLayout(HelloWorld); + vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); + + pushButton = new QPushButton(HelloWorld); + pushButton->setObjectName(QString::fromUtf8("pushButton")); + + vboxLayout->addWidget(pushButton); + + retranslateUi(HelloWorld); + } +}; + +} +//! [0] + + +//! [1] +#include +#include + +#include "ui_helloworld.h" // defines Ui::HelloWorld + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QWidget w; + Ui::HelloWorld ui; + ui.setupUi(&w); + + w.show(); + return app.exec(); +} +//! [1] + + +//! [2] +#include +#include + +#include "ui_helloworld.h" // defines Ui::HelloWorld + +class HelloWorldWidget : public QWidget, public Ui::HelloWorld +{ + Q_OBJECT + +public: + HelloWorldWidget(QWidget *parent = 0) + : QWidget(parent) + { setupUi(this); } +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + HelloWorldWidget w; + w.show(); + return app.exec(); +} +//! [2] + + +//! [5] +class HelloWorldWidget : public QWidget, public Ui::HelloWorld +{ + Q_OBJECT + +public: + HelloWorldWidget(QWidget *parent = 0); + +public slots: + void mySlot(); +}; + +HelloWorldWidget::HelloWorldWidget(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); + + QObject::connect(pushButton, SIGNAL(clicked()), + this, SLOT(mySlot())); +} + +void HelloWorldWidget::mySlot() +{ + ... +} +//! [5] + + +//! [6] +class HelloWorldWidget : public QWidget, public Ui::HelloWorld +{ + Q_OBJECT + +public: + HelloWorldWidget(QWidget *parent = 0); + +public slots: + void on_pushButton_clicked(); +}; + +HelloWorldWidget::HelloWorldWidget(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); +} + +void HelloWorldWidget::on_pushButton_clicked() +{ + ... +} +//! [6] + + +//! [9] +QFile file(":/icons/yes.png"); +QIcon icon(":/icons/no.png"); +QPixmap pixmap(":/icons/no.png"); +//! [9] diff --git a/doc/src/snippets/code/doc_src_porting4-designer.pro b/doc/src/snippets/code/doc_src_porting4-designer.pro new file mode 100644 index 0000000..673e593 --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting4-designer.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [8] +RESOURCES += icons.qrc +#! [8] diff --git a/doc/src/snippets/code/doc_src_porting4-designer.qdoc b/doc/src/snippets/code/doc_src_porting4-designer.qdoc index 2c043f5..b5c686b 100644 --- a/doc/src/snippets/code/doc_src_porting4-designer.qdoc +++ b/doc/src/snippets/code/doc_src_porting4-designer.qdoc @@ -38,81 +38,6 @@ ** ****************************************************************************/ -//! [0] -namespace Ui { - -class HelloWorld -{ -public: - QVBoxLayout *vboxLayout; - QPushButton *pushButton; - - void setupUi(QWidget *HelloWorld) - { - HelloWorld->setObjectName(QString::fromUtf8("HelloWorld")); - - vboxLayout = new QVBoxLayout(HelloWorld); - vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); - - pushButton = new QPushButton(HelloWorld); - pushButton->setObjectName(QString::fromUtf8("pushButton")); - - vboxLayout->addWidget(pushButton); - - retranslateUi(HelloWorld); - } -}; - -} -//! [0] - - -//! [1] -#include -#include - -#include "ui_helloworld.h" // defines Ui::HelloWorld - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QWidget w; - Ui::HelloWorld ui; - ui.setupUi(&w); - - w.show(); - return app.exec(); -} -//! [1] - - -//! [2] -#include -#include - -#include "ui_helloworld.h" // defines Ui::HelloWorld - -class HelloWorldWidget : public QWidget, public Ui::HelloWorld -{ - Q_OBJECT - -public: - HelloWorldWidget(QWidget *parent = 0) - : QWidget(parent) - { setupUi(this); } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - HelloWorldWidget w; - w.show(); - return app.exec(); -} -//! [2] - - //! [3] uic3 myform.ui > myform.h uic3 -impl myform.h myform.ui > myform.cpp @@ -124,59 +49,6 @@ uic3 -convert myform3.ui > myform4.ui //! [4] -//! [5] -class HelloWorldWidget : public QWidget, public Ui::HelloWorld -{ - Q_OBJECT - -public: - HelloWorldWidget(QWidget *parent = 0); - -public slots: - void mySlot(); -}; - -HelloWorldWidget::HelloWorldWidget(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); - - QObject::connect(pushButton, SIGNAL(clicked()), - this, SLOT(mySlot())); -} - -void HelloWorldWidget::mySlot() -{ - ... -} -//! [5] - - -//! [6] -class HelloWorldWidget : public QWidget, public Ui::HelloWorld -{ - Q_OBJECT - -public: - HelloWorldWidget(QWidget *parent = 0); - -public slots: - void on_pushButton_clicked(); -}; - -HelloWorldWidget::HelloWorldWidget(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - -void HelloWorldWidget::on_pushButton_clicked() -{ - ... -} -//! [6] - - //! [7] @@ -185,15 +57,3 @@ void HelloWorldWidget::on_pushButton_clicked() //! [7] - - -//! [8] -RESOURCES += icons.qrc -//! [8] - - -//! [9] -QFile file(":/icons/yes.png"); -QIcon icon(":/icons/no.png"); -QPixmap pixmap(":/icons/no.png"); -//! [9] diff --git a/doc/src/snippets/code/doc_src_porting4.cpp b/doc/src/snippets/code/doc_src_porting4.cpp new file mode 100644 index 0000000..730f71f --- /dev/null +++ b/doc/src/snippets/code/doc_src_porting4.cpp @@ -0,0 +1,513 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +void MyButton::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + drawButton(&painter); +} +//! [0] + + +//! [1] +ba.at(0) = 'X'; +//! [1] + + +//! [2] +ba[0] = 'X'; +//! [2] + + +//! [3] +if (!cache.insert(key, object)) + delete object; +//! [3] + + +//! [4] +cache.insert(key, object); +//! [4] + + +//! [5] +Q3Cache cache; +cache.insert(widget->name(), widget); +... +QWidget *foo = cache.take("foo"); +if (foo) + foo->show(); +//! [5] + + +//! [6] +typedef QWidget *QWidgetPtr; +QCache cache; +cache.insert(widget->name(), new QWidgetPtr(widget)); +... +QWidgetPtr *ptr = cache.take("foo"); +if (ptr) { + QWidget *foo = *ptr; + delete ptr; + foo->show(); +} +//! [6] + + +//! [7] +painter.setBrush(palette().brush(QPalette::Text)); +//! [7] + + +//! [8] +QByteArray ba("Hello"); +ba.size(); // returns 5 (the '\0' is not counted) +ba.length(); // returns 5 +ba.data()[5]; // returns '\0' +//! [8] + + +//! [9] +dict.replace(key, value); +//! [9] + + +//! [10] +delete hash.take(key); +hash.insert(key, value); +//! [10] + + +//! [11] +dict.remove(key, value); +//! [11] + + +//! [12] +delete hash.take(key); +//! [12] + + +//! [13] +dict.clear(); +//! [13] + + +//! [14] +while (!hash.isEmpty()) { + T *value = *hash.begin(); + hash.erase(hash.begin()); + delete value; +} +//! [14] + + +//! [15] +qDeleteAll(hash); +hash.clear(); +//! [15] + + +//! [16] +Q3DictIterator i(dict); +while (i.current() != 0) { + do_something(i.currentKey(), i.current()); + ++i; +} +//! [16] + + +//! [17] +QHashIterator i(hash); +while (i.hasNext()) { + i.next(); // must come first + do_something(i.key(), i.value()); +} +//! [17] + + +//! [18] +QList myWidgets = qFindChildren(myParent); +//! [18] + + +//! [19] +list.replace(index, value); +//! [19] + + +//! [20] +delete list[index]; +list[index] = value; +//! [20] + + +//! [21] +list.removeFirst(); +//! [21] + + +//! [22] +delete list.takeFirst(); +//! [22] + + +//! [23] +list.removeLast(); +//! [23] + + +//! [24] +delete list.takeLast(); +//! [24] + + +//! [25] +list.remove(index); +//! [25] + + +//! [26] +delete list.takeAt(index); +//! [26] + + +//! [27] +list.remove(value); +//! [27] + + +//! [28] +int i = list.indexOf(value); +if (i != -1) + delete list.takeAt(i); +//! [28] + + +//! [29] +list.remove(); +//! [29] + + +//! [30] +QMutableListIterator i; +... +delete i.value(); +i.remove(); +//! [30] + + +//! [31] +list.clear(); +//! [31] + + +//! [32] +while (!list.isEmpty()) + delete list.takeFirst(); +//! [32] + + +//! [33] +qDeleteAll(list); +list.clear(); +//! [33] + + +//! [34] +QPtrList list; +... +while (list.current() != 0) { + do_something(list.current()); + list.next(); +} +//! [34] + + +//! [35] +QList list; +... +QListIterator i(list); +while (i.hasNext()) + do_something(i.next()); +//! [35] + + +//! [36] +QPtrList list; +... +QPtrListIterator i; +while (i.current() != 0) { + do_something(i.current()); + i.next(); +} +//! [36] + + +//! [37] +QList list; +... +QListIterator i(list); +while (i.hasNext()) + do_something(i.next()); +//! [37] + + +//! [38] +queue.dequeue(); +//! [38] + + +//! [39] +delete queue.dequeue(); +//! [39] + + +//! [40] +queue.remove(); +//! [40] + + +//! [41] +delete queue.dequeue(); +//! [41] + + +//! [42] +queue.clear(); +//! [42] + + +//! [43] +while (!queue.isEmpty()) + delete queue.dequeue(); +//! [43] + + +//! [44] +qDeleteAll(queue); +queue.clear(); +//! [44] + + +//! [45] +stack.pop(); +//! [45] + + +//! [46] +delete stack.pop(); +//! [46] + + +//! [47] +stack.remove(); +//! [47] + + +//! [48] +delete stack.pop(); +//! [48] + + +//! [49] +stack.clear(); +//! [49] + + +//! [50] +while (!stack.isEmpty()) + delete stack.pop(); +//! [50] + + +//! [51] +qDeleteAll(stack); +stack.clear(); +//! [51] + + +//! [52] +vect.insert(i, ptr); +//! [52] + + +//! [53] +delete vect[i]; +vect[i] = ptr; +//! [53] + + +//! [54] +vect.remove(i); +//! [54] + + +//! [55] +delete vect[i]; +vect[i] = 0; +//! [55] + + +//! [56] +T *ptr = vect.take(i); +//! [56] + + +//! [57] +T *ptr = vect[i]; +vect[i] = 0; +//! [57] + + +//! [58] +vect.resize(n) +//! [58] + + +//! [59] +while (n > vect.size()) + vect.append(0); +while (n < vect.size() { + T *ptr = vect.last(); + vect.remove(vect.size() - 1); + delete ptr; +} +//! [59] + + +//! [60] +vect.clear(); +//! [60] + + +//! [61] +for (int i = 0; i < vect.size(); ++i) + T *ptr = vect[i]; + vect[i] = 0; + delete ptr; +} +//! [61] + + +//! [62] +qDeleteAll(vect); +vect.clear(); +//! [62] + + +//! [63] +struct Shared +{ + Shared() : count(1) {} + void ref() { ++count; } + bool deref() { return !--count; } + uint count; +}; +//! [63] + +//! [63a] +// Declare the object +QSimpleRichText richText(text, font); + +// Set the width of the paragraph to w +richText.setWidth(w); + +// Or set a reasonable default size +richText.adjustSize(); + +// Query for its used size +int width = richText.widthUsed(); +int height = richText.height(); + +// Draw +richText.draw(painter, x, y, clipRect, colorGroup); +//! [63a] + + +//! [63b] +// Declare the object +QTextDocument doc; + +// If text is rich text, use setHtml() +doc.setHtml(text); + +// Otherwise, use setPlainText() +doc.setPlainText(text); + +// Set the width of the paragraph of text to w +doc.setTextWidth(w); + +// Query for the used size +int width = doc.idealWidth(); +int height = doc.size().height(); + +// Draw +painter.translate(x, y); +doc.drawContents(painter, clipRect); + +// If you have a palette/colorgroup you can draw using lower-level functions: +QAbstractTextDocumentLayout::PaintContext context; +context.palette = myPalette; +doc.documentLayout()->draw(painter, context); +//! [63b] + +//! [63c] +QSlider *slider; +slider->style()->subControlRect(CC_Slider, sliderOption, SC_SliderHandle, slider); +//! [63c] + +//! [64] +QString greeting = "Hello"; +const char *badData = greeting.toAscii().constData(); // data is invalid +QByteArray asciiData = greeting.toAscii(); +const char *goodData = asciiData.constData(); +//! [64] + + +//! [65] +str.at(0) = 'X'; +//! [65] + + +//! [66] +str[0] = 'X'; +//! [66] diff --git a/doc/src/snippets/code/doc_src_porting4.qdoc b/doc/src/snippets/code/doc_src_porting4.qdoc deleted file mode 100644 index 730f71f..0000000 --- a/doc/src/snippets/code/doc_src_porting4.qdoc +++ /dev/null @@ -1,513 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -void MyButton::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - drawButton(&painter); -} -//! [0] - - -//! [1] -ba.at(0) = 'X'; -//! [1] - - -//! [2] -ba[0] = 'X'; -//! [2] - - -//! [3] -if (!cache.insert(key, object)) - delete object; -//! [3] - - -//! [4] -cache.insert(key, object); -//! [4] - - -//! [5] -Q3Cache cache; -cache.insert(widget->name(), widget); -... -QWidget *foo = cache.take("foo"); -if (foo) - foo->show(); -//! [5] - - -//! [6] -typedef QWidget *QWidgetPtr; -QCache cache; -cache.insert(widget->name(), new QWidgetPtr(widget)); -... -QWidgetPtr *ptr = cache.take("foo"); -if (ptr) { - QWidget *foo = *ptr; - delete ptr; - foo->show(); -} -//! [6] - - -//! [7] -painter.setBrush(palette().brush(QPalette::Text)); -//! [7] - - -//! [8] -QByteArray ba("Hello"); -ba.size(); // returns 5 (the '\0' is not counted) -ba.length(); // returns 5 -ba.data()[5]; // returns '\0' -//! [8] - - -//! [9] -dict.replace(key, value); -//! [9] - - -//! [10] -delete hash.take(key); -hash.insert(key, value); -//! [10] - - -//! [11] -dict.remove(key, value); -//! [11] - - -//! [12] -delete hash.take(key); -//! [12] - - -//! [13] -dict.clear(); -//! [13] - - -//! [14] -while (!hash.isEmpty()) { - T *value = *hash.begin(); - hash.erase(hash.begin()); - delete value; -} -//! [14] - - -//! [15] -qDeleteAll(hash); -hash.clear(); -//! [15] - - -//! [16] -Q3DictIterator i(dict); -while (i.current() != 0) { - do_something(i.currentKey(), i.current()); - ++i; -} -//! [16] - - -//! [17] -QHashIterator i(hash); -while (i.hasNext()) { - i.next(); // must come first - do_something(i.key(), i.value()); -} -//! [17] - - -//! [18] -QList myWidgets = qFindChildren(myParent); -//! [18] - - -//! [19] -list.replace(index, value); -//! [19] - - -//! [20] -delete list[index]; -list[index] = value; -//! [20] - - -//! [21] -list.removeFirst(); -//! [21] - - -//! [22] -delete list.takeFirst(); -//! [22] - - -//! [23] -list.removeLast(); -//! [23] - - -//! [24] -delete list.takeLast(); -//! [24] - - -//! [25] -list.remove(index); -//! [25] - - -//! [26] -delete list.takeAt(index); -//! [26] - - -//! [27] -list.remove(value); -//! [27] - - -//! [28] -int i = list.indexOf(value); -if (i != -1) - delete list.takeAt(i); -//! [28] - - -//! [29] -list.remove(); -//! [29] - - -//! [30] -QMutableListIterator i; -... -delete i.value(); -i.remove(); -//! [30] - - -//! [31] -list.clear(); -//! [31] - - -//! [32] -while (!list.isEmpty()) - delete list.takeFirst(); -//! [32] - - -//! [33] -qDeleteAll(list); -list.clear(); -//! [33] - - -//! [34] -QPtrList list; -... -while (list.current() != 0) { - do_something(list.current()); - list.next(); -} -//! [34] - - -//! [35] -QList list; -... -QListIterator i(list); -while (i.hasNext()) - do_something(i.next()); -//! [35] - - -//! [36] -QPtrList list; -... -QPtrListIterator i; -while (i.current() != 0) { - do_something(i.current()); - i.next(); -} -//! [36] - - -//! [37] -QList list; -... -QListIterator i(list); -while (i.hasNext()) - do_something(i.next()); -//! [37] - - -//! [38] -queue.dequeue(); -//! [38] - - -//! [39] -delete queue.dequeue(); -//! [39] - - -//! [40] -queue.remove(); -//! [40] - - -//! [41] -delete queue.dequeue(); -//! [41] - - -//! [42] -queue.clear(); -//! [42] - - -//! [43] -while (!queue.isEmpty()) - delete queue.dequeue(); -//! [43] - - -//! [44] -qDeleteAll(queue); -queue.clear(); -//! [44] - - -//! [45] -stack.pop(); -//! [45] - - -//! [46] -delete stack.pop(); -//! [46] - - -//! [47] -stack.remove(); -//! [47] - - -//! [48] -delete stack.pop(); -//! [48] - - -//! [49] -stack.clear(); -//! [49] - - -//! [50] -while (!stack.isEmpty()) - delete stack.pop(); -//! [50] - - -//! [51] -qDeleteAll(stack); -stack.clear(); -//! [51] - - -//! [52] -vect.insert(i, ptr); -//! [52] - - -//! [53] -delete vect[i]; -vect[i] = ptr; -//! [53] - - -//! [54] -vect.remove(i); -//! [54] - - -//! [55] -delete vect[i]; -vect[i] = 0; -//! [55] - - -//! [56] -T *ptr = vect.take(i); -//! [56] - - -//! [57] -T *ptr = vect[i]; -vect[i] = 0; -//! [57] - - -//! [58] -vect.resize(n) -//! [58] - - -//! [59] -while (n > vect.size()) - vect.append(0); -while (n < vect.size() { - T *ptr = vect.last(); - vect.remove(vect.size() - 1); - delete ptr; -} -//! [59] - - -//! [60] -vect.clear(); -//! [60] - - -//! [61] -for (int i = 0; i < vect.size(); ++i) - T *ptr = vect[i]; - vect[i] = 0; - delete ptr; -} -//! [61] - - -//! [62] -qDeleteAll(vect); -vect.clear(); -//! [62] - - -//! [63] -struct Shared -{ - Shared() : count(1) {} - void ref() { ++count; } - bool deref() { return !--count; } - uint count; -}; -//! [63] - -//! [63a] -// Declare the object -QSimpleRichText richText(text, font); - -// Set the width of the paragraph to w -richText.setWidth(w); - -// Or set a reasonable default size -richText.adjustSize(); - -// Query for its used size -int width = richText.widthUsed(); -int height = richText.height(); - -// Draw -richText.draw(painter, x, y, clipRect, colorGroup); -//! [63a] - - -//! [63b] -// Declare the object -QTextDocument doc; - -// If text is rich text, use setHtml() -doc.setHtml(text); - -// Otherwise, use setPlainText() -doc.setPlainText(text); - -// Set the width of the paragraph of text to w -doc.setTextWidth(w); - -// Query for the used size -int width = doc.idealWidth(); -int height = doc.size().height(); - -// Draw -painter.translate(x, y); -doc.drawContents(painter, clipRect); - -// If you have a palette/colorgroup you can draw using lower-level functions: -QAbstractTextDocumentLayout::PaintContext context; -context.palette = myPalette; -doc.documentLayout()->draw(painter, context); -//! [63b] - -//! [63c] -QSlider *slider; -slider->style()->subControlRect(CC_Slider, sliderOption, SC_SliderHandle, slider); -//! [63c] - -//! [64] -QString greeting = "Hello"; -const char *badData = greeting.toAscii().constData(); // data is invalid -QByteArray asciiData = greeting.toAscii(); -const char *goodData = asciiData.constData(); -//! [64] - - -//! [65] -str.at(0) = 'X'; -//! [65] - - -//! [66] -str[0] = 'X'; -//! [66] diff --git a/doc/src/snippets/code/doc_src_properties.cpp b/doc/src/snippets/code/doc_src_properties.cpp new file mode 100644 index 0000000..1238bc5 --- /dev/null +++ b/doc/src/snippets/code/doc_src_properties.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q_PROPERTY(type name + READ getFunction + [WRITE setFunction] + [RESET resetFunction] + [NOTIFY notifySignal] + [DESIGNABLE bool] + [SCRIPTABLE bool] + [STORED bool] + [USER bool] + [CONSTANT] + [FINAL]) +//! [0] + + +//! [1] +Q_PROPERTY(bool focus READ hasFocus) +Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) +Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) +//! [1] + + +//! [2] +Q_PROPERTY(QDate date READ getDate WRITE setDate) +//! [2] + + +//! [3] +QPushButton *button = new QPushButton; +QObject *object = button; + +button->setDown(true); +object->setProperty("down", true); +//! [3] + + +//! [4] +QObject *object = ... +const QMetaObject *metaobject = object->metaObject(); +int count = metaobject->propertyCount(); +for (int i=0; iproperty(i); + const char *name = metaproperty.name(); + QVariant value = object->property(name); + ... +} +//! [4] + + +//! [5] +class MyClass : public QObject +{ + Q_OBJECT + Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) + Q_ENUMS(Priority) + +public: + MyClass(QObject *parent = 0); + ~MyClass(); + + enum Priority { High, Low, VeryHigh, VeryLow }; + + void setPriority(Priority priority) + { + m_priority = priority; + emit priorityChanged(priority); + } + Priority priority() const + { return m_priority; } + +signals: + void priorityChanged(Priority); + +private: + Priority m_priority; +}; +//! [5] + + +//! [6] +MyClass *myinstance = new MyClass; +QObject *object = myinstance; + +myinstance->setPriority(MyClass::VeryHigh); +object->setProperty("priority", "VeryHigh"); +//! [6] + + +//! [7] +Q_CLASSINFO("Version", "3.0.0") +//! [7] diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc deleted file mode 100644 index 1238bc5..0000000 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q_PROPERTY(type name - READ getFunction - [WRITE setFunction] - [RESET resetFunction] - [NOTIFY notifySignal] - [DESIGNABLE bool] - [SCRIPTABLE bool] - [STORED bool] - [USER bool] - [CONSTANT] - [FINAL]) -//! [0] - - -//! [1] -Q_PROPERTY(bool focus READ hasFocus) -Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) -Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor) -//! [1] - - -//! [2] -Q_PROPERTY(QDate date READ getDate WRITE setDate) -//! [2] - - -//! [3] -QPushButton *button = new QPushButton; -QObject *object = button; - -button->setDown(true); -object->setProperty("down", true); -//! [3] - - -//! [4] -QObject *object = ... -const QMetaObject *metaobject = object->metaObject(); -int count = metaobject->propertyCount(); -for (int i=0; iproperty(i); - const char *name = metaproperty.name(); - QVariant value = object->property(name); - ... -} -//! [4] - - -//! [5] -class MyClass : public QObject -{ - Q_OBJECT - Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) - Q_ENUMS(Priority) - -public: - MyClass(QObject *parent = 0); - ~MyClass(); - - enum Priority { High, Low, VeryHigh, VeryLow }; - - void setPriority(Priority priority) - { - m_priority = priority; - emit priorityChanged(priority); - } - Priority priority() const - { return m_priority; } - -signals: - void priorityChanged(Priority); - -private: - Priority m_priority; -}; -//! [5] - - -//! [6] -MyClass *myinstance = new MyClass; -QObject *object = myinstance; - -myinstance->setPriority(MyClass::VeryHigh); -object->setProperty("priority", "VeryHigh"); -//! [6] - - -//! [7] -Q_CLASSINFO("Version", "3.0.0") -//! [7] diff --git a/doc/src/snippets/code/doc_src_q3asciidict.cpp b/doc/src/snippets/code/doc_src_q3asciidict.cpp new file mode 100644 index 0000000..4b32817 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3asciidict.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q3AsciiDict fields; // char* keys, QLineEdit* values +fields.insert( "forename", new QLineEdit( this ) ); +fields.insert( "surname", new QLineEdit( this ) ); + +fields["forename"]->setText( "Homer" ); +fields["surname"]->setText( "Simpson" ); + +Q3AsciiDictIterator it( fields ); // See Q3AsciiDictIterator +for( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; +cout << endl; + +if ( fields["forename"] && fields["surname"] ) + cout << fields["forename"]->text() << " " + << fields["surname"]->text() << endl; // Prints "Homer Simpson" + +fields.remove( "forename" ); // Does not delete the line edit +if ( ! fields["forename"] ) + cout << "forename is not in the dictionary" << endl; +//! [0] + + +//! [1] +Q3AsciiDict dict; + ... +if ( dict.find(key) ) + dict.remove( key ); +dict.insert( key, item ); +//! [1] + + +//! [2] +Q3AsciiDict fields; +fields.insert( "forename", new QLineEdit( this ) ); +fields.insert( "surname", new QLineEdit( this ) ); +fields.insert( "age", new QLineEdit( this ) ); + +fields["forename"]->setText( "Homer" ); +fields["surname"]->setText( "Simpson" ); +fields["age"]->setText( "45" ); + +Q3AsciiDictIterator it( fields ); +for( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; +cout << endl; + +// Output (random order): +// age: 45 +// surname: Simpson +// forename: Homer +//! [2] diff --git a/doc/src/snippets/code/doc_src_q3asciidict.qdoc b/doc/src/snippets/code/doc_src_q3asciidict.qdoc deleted file mode 100644 index 4b32817..0000000 --- a/doc/src/snippets/code/doc_src_q3asciidict.qdoc +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q3AsciiDict fields; // char* keys, QLineEdit* values -fields.insert( "forename", new QLineEdit( this ) ); -fields.insert( "surname", new QLineEdit( this ) ); - -fields["forename"]->setText( "Homer" ); -fields["surname"]->setText( "Simpson" ); - -Q3AsciiDictIterator it( fields ); // See Q3AsciiDictIterator -for( ; it.current(); ++it ) - cout << it.currentKey() << ": " << it.current()->text() << endl; -cout << endl; - -if ( fields["forename"] && fields["surname"] ) - cout << fields["forename"]->text() << " " - << fields["surname"]->text() << endl; // Prints "Homer Simpson" - -fields.remove( "forename" ); // Does not delete the line edit -if ( ! fields["forename"] ) - cout << "forename is not in the dictionary" << endl; -//! [0] - - -//! [1] -Q3AsciiDict dict; - ... -if ( dict.find(key) ) - dict.remove( key ); -dict.insert( key, item ); -//! [1] - - -//! [2] -Q3AsciiDict fields; -fields.insert( "forename", new QLineEdit( this ) ); -fields.insert( "surname", new QLineEdit( this ) ); -fields.insert( "age", new QLineEdit( this ) ); - -fields["forename"]->setText( "Homer" ); -fields["surname"]->setText( "Simpson" ); -fields["age"]->setText( "45" ); - -Q3AsciiDictIterator it( fields ); -for( ; it.current(); ++it ) - cout << it.currentKey() << ": " << it.current()->text() << endl; -cout << endl; - -// Output (random order): -// age: 45 -// surname: Simpson -// forename: Homer -//! [2] diff --git a/doc/src/snippets/code/doc_src_q3dict.cpp b/doc/src/snippets/code/doc_src_q3dict.cpp new file mode 100644 index 0000000..9c51cae --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3dict.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q3Dict dict; + ... +if ( dict.find( key ) ) + dict.remove( key ); +dict.insert( key, item ); +//! [0] + + +//! [1] +Q3Dict fields; +fields.insert( "forename", new QLineEdit( this ) ); +fields.insert( "surname", new QLineEdit( this ) ); +fields.insert( "age", new QLineEdit( this ) ); + +fields["forename"]->setText( "Homer" ); +fields["surname"]->setText( "Simpson" ); +fields["age"]->setText( "45" ); + +Q3DictIterator it( fields ); +for( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; +cout << endl; + +// Output (random order): +// age: 45 +// surname: Simpson +// forename: Homer +//! [1] diff --git a/doc/src/snippets/code/doc_src_q3dict.qdoc b/doc/src/snippets/code/doc_src_q3dict.qdoc deleted file mode 100644 index 9c51cae..0000000 --- a/doc/src/snippets/code/doc_src_q3dict.qdoc +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q3Dict dict; - ... -if ( dict.find( key ) ) - dict.remove( key ); -dict.insert( key, item ); -//! [0] - - -//! [1] -Q3Dict fields; -fields.insert( "forename", new QLineEdit( this ) ); -fields.insert( "surname", new QLineEdit( this ) ); -fields.insert( "age", new QLineEdit( this ) ); - -fields["forename"]->setText( "Homer" ); -fields["surname"]->setText( "Simpson" ); -fields["age"]->setText( "45" ); - -Q3DictIterator it( fields ); -for( ; it.current(); ++it ) - cout << it.currentKey() << ": " << it.current()->text() << endl; -cout << endl; - -// Output (random order): -// age: 45 -// surname: Simpson -// forename: Homer -//! [1] diff --git a/doc/src/snippets/code/doc_src_q3intdict.cpp b/doc/src/snippets/code/doc_src_q3intdict.cpp new file mode 100644 index 0000000..0f15b6f --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3intdict.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q3IntDict fields; // long int keys, QLineEdit* values +for ( int i = 0; i < 3; i++ ) + fields.insert( i, new QLineEdit( this ) ); + +fields[0]->setText( "Homer" ); +fields[1]->setText( "Simpson" ); +fields[2]->setText( "45" ); + +Q3IntDictIterator it( fields ); +for ( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; + +for ( int i = 0; i < 3; i++ ) + cout << fields[i]->text() << " "; // Prints "Homer Simpson 45" +cout << endl; + +fields.remove( 1 ); // Does not delete the line edit +for ( int i = 0; i < 3; i++ ) + if ( fields[i] ) + cout << fields[i]->text() << " "; // Prints "Homer 45" +//! [0] + + +//! [1] +Q3IntDict dict; +// ... +if ( dict.find(key) ) + dict.remove( key ); +dict.insert( key, item ); +//! [1] + + +//! [2] +Q3IntDict fields; +for ( int i = 0; i < 3; i++ ) + fields.insert( i, new QLineEdit( this ) ); + +fields[0]->setText( "Homer" ); +fields[1]->setText( "Simpson" ); +fields[2]->setText( "45" ); + +Q3IntDictIterator it( fields ); +for ( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; + +// Output (random order): +// 0: Homer +// 1: Simpson +// 2: 45 +//! [2] diff --git a/doc/src/snippets/code/doc_src_q3intdict.qdoc b/doc/src/snippets/code/doc_src_q3intdict.qdoc deleted file mode 100644 index 0f15b6f..0000000 --- a/doc/src/snippets/code/doc_src_q3intdict.qdoc +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q3IntDict fields; // long int keys, QLineEdit* values -for ( int i = 0; i < 3; i++ ) - fields.insert( i, new QLineEdit( this ) ); - -fields[0]->setText( "Homer" ); -fields[1]->setText( "Simpson" ); -fields[2]->setText( "45" ); - -Q3IntDictIterator it( fields ); -for ( ; it.current(); ++it ) - cout << it.currentKey() << ": " << it.current()->text() << endl; - -for ( int i = 0; i < 3; i++ ) - cout << fields[i]->text() << " "; // Prints "Homer Simpson 45" -cout << endl; - -fields.remove( 1 ); // Does not delete the line edit -for ( int i = 0; i < 3; i++ ) - if ( fields[i] ) - cout << fields[i]->text() << " "; // Prints "Homer 45" -//! [0] - - -//! [1] -Q3IntDict dict; -// ... -if ( dict.find(key) ) - dict.remove( key ); -dict.insert( key, item ); -//! [1] - - -//! [2] -Q3IntDict fields; -for ( int i = 0; i < 3; i++ ) - fields.insert( i, new QLineEdit( this ) ); - -fields[0]->setText( "Homer" ); -fields[1]->setText( "Simpson" ); -fields[2]->setText( "45" ); - -Q3IntDictIterator it( fields ); -for ( ; it.current(); ++it ) - cout << it.currentKey() << ": " << it.current()->text() << endl; - -// Output (random order): -// 0: Homer -// 1: Simpson -// 2: 45 -//! [2] diff --git a/doc/src/snippets/code/doc_src_q3memarray.cpp b/doc/src/snippets/code/doc_src_q3memarray.cpp new file mode 100644 index 0000000..2c91050 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3memarray.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +#include + +Q3MemArray fib( int num ) // returns fibonacci array +{ + Q_ASSERT( num > 2 ); + Q3MemArray f( num ); // array of ints + + f[0] = f[1] = 1; + for ( int i = 2; i < num; i++ ) + f[i] = f[i-1] + f[i-2]; + + return f; +} + +int main() +{ + Q3MemArray a = fib( 6 ); // get first 6 fibonaccis + for ( int i = 0; i < a.size(); i++ ) + qDebug( "%d: %d", i, a[i] ); + + qDebug( "1 is found %d times", a.contains(1) ); + qDebug( "5 is found at index %d", a.find(5) ); + + return 0; +} +//! [0] + + +//! [2] +// MyStruct may be padded to 4 or 8 bytes +struct MyStruct +{ + short i; // 2 bytes + char c; // 1 byte +}; + +Q3MemArray a(1); +a[0].i = 5; +a[0].c = 't'; + +MyStruct x; +x.i = '5'; +x.c = 't'; +int i = a.find( x ); // may return -1 if the pad bytes differ +//! [2] + + +//! [3] +static char bindata[] = { 231, 1, 44, ... }; +QByteArray a; +a.setRawData( bindata, sizeof(bindata) ); // a points to bindata +QDataStream s( a, IO_ReadOnly ); // open on a's data +s >> ; // read raw bindata +a.resetRawData( bindata, sizeof(bindata) ); // finished +//! [3] + + +//! [4] +static char bindata[] = { 231, 1, 44, ... }; +QByteArray a, b; +a.setRawData( bindata, sizeof(bindata) ); // a points to bindata +a.resize( 8 ); // will crash +b = a; // will crash +a[2] = 123; // might crash +// forget to resetRawData: will crash +//! [4] diff --git a/doc/src/snippets/code/doc_src_q3memarray.qdoc b/doc/src/snippets/code/doc_src_q3memarray.qdoc index 8e5e008..a966e50 100644 --- a/doc/src/snippets/code/doc_src_q3memarray.qdoc +++ b/doc/src/snippets/code/doc_src_q3memarray.qdoc @@ -38,36 +38,6 @@ ** ****************************************************************************/ -//! [0] -#include -#include - -Q3MemArray fib( int num ) // returns fibonacci array -{ - Q_ASSERT( num > 2 ); - Q3MemArray f( num ); // array of ints - - f[0] = f[1] = 1; - for ( int i = 2; i < num; i++ ) - f[i] = f[i-1] + f[i-2]; - - return f; -} - -int main() -{ - Q3MemArray a = fib( 6 ); // get first 6 fibonaccis - for ( int i = 0; i < a.size(); i++ ) - qDebug( "%d: %d", i, a[i] ); - - qDebug( "1 is found %d times", a.contains(1) ); - qDebug( "5 is found at index %d", a.find(5) ); - - return 0; -} -//! [0] - - //! [1] 0: 1 1: 1 @@ -78,43 +48,3 @@ int main() 1 is found 2 times 5 is found at index 4 //! [1] - - -//! [2] -// MyStruct may be padded to 4 or 8 bytes -struct MyStruct -{ - short i; // 2 bytes - char c; // 1 byte -}; - -Q3MemArray a(1); -a[0].i = 5; -a[0].c = 't'; - -MyStruct x; -x.i = '5'; -x.c = 't'; -int i = a.find( x ); // may return -1 if the pad bytes differ -//! [2] - - -//! [3] -static char bindata[] = { 231, 1, 44, ... }; -QByteArray a; -a.setRawData( bindata, sizeof(bindata) ); // a points to bindata -QDataStream s( a, IO_ReadOnly ); // open on a's data -s >> ; // read raw bindata -a.resetRawData( bindata, sizeof(bindata) ); // finished -//! [3] - - -//! [4] -static char bindata[] = { 231, 1, 44, ... }; -QByteArray a, b; -a.setRawData( bindata, sizeof(bindata) ); // a points to bindata -a.resize( 8 ); // will crash -b = a; // will crash -a[2] = 123; // might crash -// forget to resetRawData: will crash -//! [4] diff --git a/doc/src/snippets/code/doc_src_q3ptrdict.cpp b/doc/src/snippets/code/doc_src_q3ptrdict.cpp new file mode 100644 index 0000000..e64d874 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3ptrdict.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q3PtrDict fields; // void* keys, char* values + +QLineEdit *le1 = new QLineEdit( this ); +le1->setText( "Simpson" ); +QLineEdit *le2 = new QLineEdit( this ); +le2->setText( "Homer" ); +QLineEdit *le3 = new QLineEdit( this ); +le3->setText( "45" ); + +fields.insert( le1, "Surname" ); +fields.insert( le2, "Forename" ); +fields.insert( le3, "Age" ); + +Q3PtrDictIterator it( fields ); +for( ; it.current(); ++it ) + cout << it.current() << endl; +cout << endl; + +if ( fields[le1] ) // Prints "Surname: Simpson" + cout << fields[le1] << ": " << le1->text() << endl; +if ( fields[le2] ) // Prints "Forename: Homer" + cout << fields[le2] << ": " << le2->text() << endl; + +fields.remove( le1 ); // Removes le1 from the dictionary +cout << le1->text() << endl; // Prints "Simpson" +//! [0] + + +//! [1] +Q3PtrDict dict; + ... +if ( dict.find( key ) ) + dict.remove( key ); +dict.insert( key, item ); +//! [1] + + +//! [2] +Q3PtrDict fields; + +QLineEdit *le1 = new QLineEdit( this ); +le1->setText( "Simpson" ); +QLineEdit *le2 = new QLineEdit( this ); +le2->setText( "Homer" ); +QLineEdit *le3 = new QLineEdit( this ); +le3->setText( "45" ); + +fields.insert( le1, "Surname" ); +fields.insert( le2, "Forename" ); +fields.insert( le3, "Age" ); + +Q3PtrDictIterator it( fields ); +for( ; it.current(); ++it ) { + QLineEdit *le = (QLineEdit)it.currentKey(); + cout << it.current() << ": " << le->text() << endl; +} +cout << endl; + +// Output (random order): +// Forename: Homer +// Age: 45 +// Surname: Simpson +//! [2] + + diff --git a/doc/src/snippets/code/doc_src_q3ptrdict.qdoc b/doc/src/snippets/code/doc_src_q3ptrdict.qdoc deleted file mode 100644 index e64d874..0000000 --- a/doc/src/snippets/code/doc_src_q3ptrdict.qdoc +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q3PtrDict fields; // void* keys, char* values - -QLineEdit *le1 = new QLineEdit( this ); -le1->setText( "Simpson" ); -QLineEdit *le2 = new QLineEdit( this ); -le2->setText( "Homer" ); -QLineEdit *le3 = new QLineEdit( this ); -le3->setText( "45" ); - -fields.insert( le1, "Surname" ); -fields.insert( le2, "Forename" ); -fields.insert( le3, "Age" ); - -Q3PtrDictIterator it( fields ); -for( ; it.current(); ++it ) - cout << it.current() << endl; -cout << endl; - -if ( fields[le1] ) // Prints "Surname: Simpson" - cout << fields[le1] << ": " << le1->text() << endl; -if ( fields[le2] ) // Prints "Forename: Homer" - cout << fields[le2] << ": " << le2->text() << endl; - -fields.remove( le1 ); // Removes le1 from the dictionary -cout << le1->text() << endl; // Prints "Simpson" -//! [0] - - -//! [1] -Q3PtrDict dict; - ... -if ( dict.find( key ) ) - dict.remove( key ); -dict.insert( key, item ); -//! [1] - - -//! [2] -Q3PtrDict fields; - -QLineEdit *le1 = new QLineEdit( this ); -le1->setText( "Simpson" ); -QLineEdit *le2 = new QLineEdit( this ); -le2->setText( "Homer" ); -QLineEdit *le3 = new QLineEdit( this ); -le3->setText( "45" ); - -fields.insert( le1, "Surname" ); -fields.insert( le2, "Forename" ); -fields.insert( le3, "Age" ); - -Q3PtrDictIterator it( fields ); -for( ; it.current(); ++it ) { - QLineEdit *le = (QLineEdit)it.currentKey(); - cout << it.current() << ": " << le->text() << endl; -} -cout << endl; - -// Output (random order): -// Forename: Homer -// Age: 45 -// Surname: Simpson -//! [2] - - diff --git a/doc/src/snippets/code/doc_src_q3ptrlist.cpp b/doc/src/snippets/code/doc_src_q3ptrlist.cpp new file mode 100644 index 0000000..4f97c65 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3ptrlist.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +class Employee +{ +public: + Employee() : sn( 0 ) { } + Employee( const QString& forename, const QString& surname, int salary ) + : fn( forename ), sn( surname ), sal( salary ) + { } + + void setSalary( int salary ) { sal = salary; } + + QString forename() const { return fn; } + QString surname() const { return sn; } + int salary() const { return sal; } + +private: + QString fn; + QString sn; + int sal; +}; + +Q3PtrList list; +list.setAutoDelete( TRUE ); // the list owns the objects + +list.append( new Employee("John", "Doe", 50000) ); +list.append( new Employee("Jane", "Williams", 80000) ); +list.append( new Employee("Tom", "Jones", 60000) ); + +Employee *employee; +for ( employee = list.first(); employee; employee = list.next() ) + cout << employee->surname().latin1() << ", " << + employee->forename().latin1() << " earns " << + employee->salary() << endl; +cout << endl; + +// very inefficient for big lists +for ( uint i = 0; i < list.count(); ++i ) + if ( list.at(i) ) + cout << list.at( i )->surname().latin1() << endl; +//! [0] + + +//! [1] +Doe, John earns 50000 +Williams, Jane earns 80000 +Jones, Tom earns 60000 + +Doe +Williams +Jones +//! [1] + + +//! [2] +if ( list.findRef( item ) != -1 ) + list.remove(); +//! [2] + + +//! [3] +Q3PtrList list; + +list.append( new Employee("John", "Doe", 50000) ); +list.append( new Employee("Jane", "Williams", 80000) ); +list.append( new Employee("Tom", "Jones", 60000) ); + +Q3PtrListIterator it( list ); +Employee *employee; +while ( (employee = it.current()) != 0 ) { + ++it; + cout << employee->surname().latin1() << ", " << + employee->forename().latin1() << " earns " << + employee->salary() << endl; +} +//! [3] + + +//! [4] +Doe, John earns 50000 +Williams, Jane earns 80000 +Jones, Tom earns 60000 +//! [4] diff --git a/doc/src/snippets/code/doc_src_q3ptrlist.qdoc b/doc/src/snippets/code/doc_src_q3ptrlist.qdoc deleted file mode 100644 index 4f97c65..0000000 --- a/doc/src/snippets/code/doc_src_q3ptrlist.qdoc +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -class Employee -{ -public: - Employee() : sn( 0 ) { } - Employee( const QString& forename, const QString& surname, int salary ) - : fn( forename ), sn( surname ), sal( salary ) - { } - - void setSalary( int salary ) { sal = salary; } - - QString forename() const { return fn; } - QString surname() const { return sn; } - int salary() const { return sal; } - -private: - QString fn; - QString sn; - int sal; -}; - -Q3PtrList list; -list.setAutoDelete( TRUE ); // the list owns the objects - -list.append( new Employee("John", "Doe", 50000) ); -list.append( new Employee("Jane", "Williams", 80000) ); -list.append( new Employee("Tom", "Jones", 60000) ); - -Employee *employee; -for ( employee = list.first(); employee; employee = list.next() ) - cout << employee->surname().latin1() << ", " << - employee->forename().latin1() << " earns " << - employee->salary() << endl; -cout << endl; - -// very inefficient for big lists -for ( uint i = 0; i < list.count(); ++i ) - if ( list.at(i) ) - cout << list.at( i )->surname().latin1() << endl; -//! [0] - - -//! [1] -Doe, John earns 50000 -Williams, Jane earns 80000 -Jones, Tom earns 60000 - -Doe -Williams -Jones -//! [1] - - -//! [2] -if ( list.findRef( item ) != -1 ) - list.remove(); -//! [2] - - -//! [3] -Q3PtrList list; - -list.append( new Employee("John", "Doe", 50000) ); -list.append( new Employee("Jane", "Williams", 80000) ); -list.append( new Employee("Tom", "Jones", 60000) ); - -Q3PtrListIterator it( list ); -Employee *employee; -while ( (employee = it.current()) != 0 ) { - ++it; - cout << employee->surname().latin1() << ", " << - employee->forename().latin1() << " earns " << - employee->salary() << endl; -} -//! [3] - - -//! [4] -Doe, John earns 50000 -Williams, Jane earns 80000 -Jones, Tom earns 60000 -//! [4] diff --git a/doc/src/snippets/code/doc_src_q3valuelist.cpp b/doc/src/snippets/code/doc_src_q3valuelist.cpp new file mode 100644 index 0000000..38ee9f6 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3valuelist.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +class Employee +{ +public: + Employee(): sn(0) {} + Employee( const QString& forename, const QString& surname, int salary ) + : fn(forename), sn(surname), sal(salary) + {} + + QString forename() const { return fn; } + QString surname() const { return sn; } + int salary() const { return sal; } + void setSalary( int salary ) { sal = salary; } + +private: + QString fn; + QString sn; + int sal; +}; + +typedef Q3ValueList EmployeeList; +EmployeeList list; + +list.append( Employee("John", "Doe", 50000) ); +list.append( Employee("Jane", "Williams", 80000) ); +list.append( Employee("Tom", "Jones", 60000) ); + +Employee mary( "Mary", "Hawthorne", 90000 ); +list.append( mary ); +mary.setSalary( 100000 ); + +EmployeeList::iterator it; +for ( it = list.begin(); it != list.end(); ++it ) + cout << (*it).surname().latin1() << ", " << + (*it).forename().latin1() << " earns " << + (*it).salary() << endl; + +// Output: +// Doe, John earns 50000 +// Williams, Jane earns 80000 +// Hawthorne, Mary earns 90000 +// Jones, Tom earns 60000 +//! [0] + + +//! [1] +Q3ValueList list; +list.append( 1 ); +list.append( 2 ); +list.append( 3 ); +... +if ( !list.empty() ) { + // OK, modify the first item + int& i = list.first(); + i = 18; +} +... +Q3ValueList dlist; +double d = dlist.last(); // undefined +//! [1] + + +//! [2] +Q3ValueList l; +... +Q3ValueList::iterator it = l.end(); +--it; +if ( it != end() ) + // ... +//! [2] + + +//! [3] +Q3ValueList l; +... +Q3ValueList::iterator it = l.end(); +--it; +if ( it != end() ) + // ... +//! [3] + + +//! [4] +EmployeeList::iterator it; +for ( it = list.begin(); it != list.end(); ++it ) + cout << (*it).surname().latin1() << ", " << + (*it).forename().latin1() << " earns " << + (*it).salary() << endl; + +// Output: +// Doe, John earns 50000 +// Williams, Jane earns 80000 +// Hawthorne, Mary earns 90000 +// Jones, Tom earns 60000 +//! [4] diff --git a/doc/src/snippets/code/doc_src_q3valuelist.qdoc b/doc/src/snippets/code/doc_src_q3valuelist.qdoc deleted file mode 100644 index 38ee9f6..0000000 --- a/doc/src/snippets/code/doc_src_q3valuelist.qdoc +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -class Employee -{ -public: - Employee(): sn(0) {} - Employee( const QString& forename, const QString& surname, int salary ) - : fn(forename), sn(surname), sal(salary) - {} - - QString forename() const { return fn; } - QString surname() const { return sn; } - int salary() const { return sal; } - void setSalary( int salary ) { sal = salary; } - -private: - QString fn; - QString sn; - int sal; -}; - -typedef Q3ValueList EmployeeList; -EmployeeList list; - -list.append( Employee("John", "Doe", 50000) ); -list.append( Employee("Jane", "Williams", 80000) ); -list.append( Employee("Tom", "Jones", 60000) ); - -Employee mary( "Mary", "Hawthorne", 90000 ); -list.append( mary ); -mary.setSalary( 100000 ); - -EmployeeList::iterator it; -for ( it = list.begin(); it != list.end(); ++it ) - cout << (*it).surname().latin1() << ", " << - (*it).forename().latin1() << " earns " << - (*it).salary() << endl; - -// Output: -// Doe, John earns 50000 -// Williams, Jane earns 80000 -// Hawthorne, Mary earns 90000 -// Jones, Tom earns 60000 -//! [0] - - -//! [1] -Q3ValueList list; -list.append( 1 ); -list.append( 2 ); -list.append( 3 ); -... -if ( !list.empty() ) { - // OK, modify the first item - int& i = list.first(); - i = 18; -} -... -Q3ValueList dlist; -double d = dlist.last(); // undefined -//! [1] - - -//! [2] -Q3ValueList l; -... -Q3ValueList::iterator it = l.end(); ---it; -if ( it != end() ) - // ... -//! [2] - - -//! [3] -Q3ValueList l; -... -Q3ValueList::iterator it = l.end(); ---it; -if ( it != end() ) - // ... -//! [3] - - -//! [4] -EmployeeList::iterator it; -for ( it = list.begin(); it != list.end(); ++it ) - cout << (*it).surname().latin1() << ", " << - (*it).forename().latin1() << " earns " << - (*it).salary() << endl; - -// Output: -// Doe, John earns 50000 -// Williams, Jane earns 80000 -// Hawthorne, Mary earns 90000 -// Jones, Tom earns 60000 -//! [4] diff --git a/doc/src/snippets/code/doc_src_q3valuestack.cpp b/doc/src/snippets/code/doc_src_q3valuestack.cpp new file mode 100644 index 0000000..50827e6 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3valuestack.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +Q3ValueStack stack; +stack.push( 1 ); +stack.push( 2 ); +stack.push( 3 ); +while ( ! stack.isEmpty() ) + cout << "Item: " << stack.pop() << endl; + +// Output: +// Item: 3 +// Item: 2 +// Item: 1 +//! [0] diff --git a/doc/src/snippets/code/doc_src_q3valuestack.qdoc b/doc/src/snippets/code/doc_src_q3valuestack.qdoc deleted file mode 100644 index 50827e6..0000000 --- a/doc/src/snippets/code/doc_src_q3valuestack.qdoc +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -Q3ValueStack stack; -stack.push( 1 ); -stack.push( 2 ); -stack.push( 3 ); -while ( ! stack.isEmpty() ) - cout << "Item: " << stack.pop() << endl; - -// Output: -// Item: 3 -// Item: 2 -// Item: 1 -//! [0] diff --git a/doc/src/snippets/code/doc_src_q3valuevector.cpp b/doc/src/snippets/code/doc_src_q3valuevector.cpp new file mode 100644 index 0000000..8af1568 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3valuevector.cpp @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +#include +#include + +class Employee +{ +public: + Employee(): s(0) {} + Employee( const QString& name, int salary ) + : n( name ), s( salary ) + { } + + QString name() const { return n; } + int salary() const { return s; } + void setSalary( int salary ) { s = salary; } +private: + QString n; + int s; +}; + +int main() +{ + typedef Q3ValueVector EmployeeVector; + EmployeeVector vec( 3 ); // vector of 3 Employees + + vec[0] = Employee( "Bill", 50000 ); + vec[1] = Employee( "Steve", 80000 ); + vec[2] = Employee( "Ron", 60000 ); + + Employee joe( "Joe", 50000 ); + vec.push_back( joe ); // vector expands to accommodate 4 Employees + joe.setSalary( 70000 ); + + EmployeeVector::iterator it; + for( it = vec.begin(); it != vec.end(); ++it ) + printf( "%s earns %d\n", (*it).name().latin1(), (*it).salary() ); + + return 0; +} +//! [0] + + +//! [1] +Bill earns 50000 +Steve earns 80000 +Ron earns 60000 +Joe earns 50000 +//! [1] + + +//! [2] +Q3ValueVector vec1; // an empty vector +vec1[10] = 4; // WARNING: undefined, probably a crash + +Q3ValueVector vec2(25); // initialize with 25 elements +vec2[10] = "Dave"; // OK +//! [2] + + +//! [3] +void func( Q3ValueVector& vec ) +{ + if ( vec.size() > 10 ) { + vec[9] = 99; // OK + } +}; +//! [3] + + +//! [4] +Q3ValueVector vec( 3 ); +vec.push_back( 1 ); +vec.push_back( 2 ); +vec.push_back( 3 ); +... +if ( !vec.empty() ) { + // OK: modify the first element + int& i = vec.front(); + i = 18; +} +... +Q3ValueVector dvec; +double d = dvec.back(); // undefined behavior +//! [4] diff --git a/doc/src/snippets/code/doc_src_q3valuevector.qdoc b/doc/src/snippets/code/doc_src_q3valuevector.qdoc deleted file mode 100644 index 8af1568..0000000 --- a/doc/src/snippets/code/doc_src_q3valuevector.qdoc +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -#include -#include - -class Employee -{ -public: - Employee(): s(0) {} - Employee( const QString& name, int salary ) - : n( name ), s( salary ) - { } - - QString name() const { return n; } - int salary() const { return s; } - void setSalary( int salary ) { s = salary; } -private: - QString n; - int s; -}; - -int main() -{ - typedef Q3ValueVector EmployeeVector; - EmployeeVector vec( 3 ); // vector of 3 Employees - - vec[0] = Employee( "Bill", 50000 ); - vec[1] = Employee( "Steve", 80000 ); - vec[2] = Employee( "Ron", 60000 ); - - Employee joe( "Joe", 50000 ); - vec.push_back( joe ); // vector expands to accommodate 4 Employees - joe.setSalary( 70000 ); - - EmployeeVector::iterator it; - for( it = vec.begin(); it != vec.end(); ++it ) - printf( "%s earns %d\n", (*it).name().latin1(), (*it).salary() ); - - return 0; -} -//! [0] - - -//! [1] -Bill earns 50000 -Steve earns 80000 -Ron earns 60000 -Joe earns 50000 -//! [1] - - -//! [2] -Q3ValueVector vec1; // an empty vector -vec1[10] = 4; // WARNING: undefined, probably a crash - -Q3ValueVector vec2(25); // initialize with 25 elements -vec2[10] = "Dave"; // OK -//! [2] - - -//! [3] -void func( Q3ValueVector& vec ) -{ - if ( vec.size() > 10 ) { - vec[9] = 99; // OK - } -}; -//! [3] - - -//! [4] -Q3ValueVector vec( 3 ); -vec.push_back( 1 ); -vec.push_back( 2 ); -vec.push_back( 3 ); -... -if ( !vec.empty() ) { - // OK: modify the first element - int& i = vec.front(); - i = 18; -} -... -Q3ValueVector dvec; -double d = dvec.back(); // undefined behavior -//! [4] diff --git a/doc/src/snippets/code/doc_src_qalgorithms.cpp b/doc/src/snippets/code/doc_src_qalgorithms.cpp new file mode 100644 index 0000000..0438105 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qalgorithms.cpp @@ -0,0 +1,354 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QStringList list; +list << "one" << "two" << "three"; + +qFill(list.begin(), list.end(), "eleven"); +// list: [ "eleven", "eleven", "eleven" ] +//! [0] + + +//! [1] +qFill(list.begin() + 1, list.end(), "six"); +// list: [ "eleven", "six", "six" ] +//! [1] + + +//! [2] +QChar resolveEntity(const QString &entity) +{ + static const QLatin1String name_table[] = { + "AElig", "Aacute", ..., "zwnj" + }; + static const ushort value_table[] = { + 0x0061, 0x00c1, ..., 0x200c + }; + int N = sizeof(name_table) / sizeof(name_table[0]); + + const QLatin1String *name = qBinaryFind(name_table, name_table + N, + entity); + int index = name - name_table; + if (index == N) + return QChar(); + + return QChar(value_table[index]); +} +//! [2] + + +//! [3] +QChar resolveEntity(const QString &entity) +{ + static QMap entityMap; + + if (!entityMap) { + entityMap.insert("AElig", 0x0061); + entityMap.insert("Aacute", 0x00c1); + ... + entityMap.insert("zwnj", 0x200c); + } + return QChar(entityMap.value(entity)); +} +//! [3] + + +//! [4] +QStringList list; +list << "one" << "two" << "three"; + +QVector vect1(3); +qCopy(list.begin(), list.end(), vect1.begin()); +// vect: [ "one", "two", "three" ] + +QVector vect2(8); +qCopy(list.begin(), list.end(), vect2.begin() + 2); +// vect: [ "", "", "one", "two", "three", "", "", "" ] +//! [4] + + +//! [5] +QStringList list; +list << "one" << "two" << "three"; + +QVector vect(5); +qCopyBackward(list.begin(), list.end(), vect.end()); +// vect: [ "", "", "one", "two", "three" ] +//! [5] + + +//! [6] +QStringList list; +list << "one" << "two" << "three"; + +QVector vect(3); +vect[0] = "one"; +vect[1] = "two"; +vect[2] = "three"; + +bool ret1 = qEqual(list.begin(), list.end(), vect.begin()); +// ret1 == true + +vect[2] = "seven"; +bool ret2 = qEqual(list.begin(), list.end(), vect.begin()); +// ret2 == false +//! [6] + + +//! [7] +QStringList list; +list << "one" << "two" << "three"; + +qFill(list.begin(), list.end(), "eleven"); +// list: [ "eleven", "eleven", "eleven" ] + +qFill(list.begin() + 1, list.end(), "six"); +// list: [ "eleven", "six", "six" ] +//! [7] + + +//! [8] +QStringList list; +list << "one" << "two" << "three"; + +QStringList::iterator i1 = qFind(list.begin(), list.end(), "two"); +// i1 == list.begin() + 1 + +QStringList::iterator i2 = qFind(list.begin(), list.end(), "seventy"); +// i2 == list.end() +//! [8] + + +//! [9] +QList list; +list << 3 << 3 << 6 << 6 << 6 << 8; + +int countOf6 = 0; +qCount(list.begin(), list.end(), 6, countOf6); +// countOf6 == 3 + +int countOf7 = 0; +qCount(list.begin(), list.end(), 7, countOf7); +// countOf7 == 0 +//! [9] + + +//! [10] +double pi = 3.14; +double e = 2.71; + +qSwap(pi, e); +// pi == 2.71, e == 3.14 +//! [10] + + +//! [11] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qSort(list.begin(), list.end()); +// list: [ 6, 12, 12, 33, 68 ] +//! [11] + + +//! [12] +bool caseInsensitiveLessThan(const QString &s1, const QString &s2) +{ + return s1.toLower() < s2.toLower(); +} + +int doSomething() +{ + QStringList list; + list << "AlPha" << "beTA" << "gamma" << "DELTA"; + qSort(list.begin(), list.end(), caseInsensitiveLessThan); + // list: [ "AlPha", "beTA", "DELTA", "gamma" ] +} +//! [12] + + +//! [13] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qSort(list.begin(), list.end(), qGreater()); +// list: [ 68, 33, 12, 12, 6 ] +//! [13] + + +//! [14] +QStringList list; +list << "AlPha" << "beTA" << "gamma" << "DELTA"; + +QMap map; +foreach (const QString &str, list) + map.insert(str.toLower(), str); + +list = map.values(); +//! [14] + + +//! [15] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qStableSort(list.begin(), list.end()); +// list: [ 6, 12, 12, 33, 68 ] +//! [15] + + +//! [16] +bool caseInsensitiveLessThan(const QString &s1, const QString &s2) +{ + return s1.toLower() < s2.toLower(); +} + +int doSomething() +{ + QStringList list; + list << "AlPha" << "beTA" << "gamma" << "DELTA"; + qStableSort(list.begin(), list.end(), caseInsensitiveLessThan); + // list: [ "AlPha", "beTA", "DELTA", "gamma" ] +} +//! [16] + + +//! [17] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qStableSort(list.begin(), list.end(), qGreater()); +// list: [ 68, 33, 12, 12, 6 ] +//! [17] + + +//! [18] +QList list; +list << 3 << 3 << 6 << 6 << 6 << 8; + +QList::iterator i = qLowerBound(list.begin(), list.end(), 5); +list.insert(i, 5); +// list: [ 3, 3, 5, 6, 6, 6, 8 ] + +i = qLowerBound(list.begin(), list.end(), 12); +list.insert(i, 12); +// list: [ 3, 3, 5, 6, 6, 6, 8, 12 ] +//! [18] + + +//! [19] +QVector vect; +vect << 3 << 3 << 6 << 6 << 6 << 8; +QVector::iterator begin6 = + qLowerBound(vect.begin(), vect.end(), 6); +QVector::iterator end6 = + qUpperBound(begin6, vect.end(), 6); + +QVector::iterator i = begin6; +while (i != end6) { + *i = 7; + ++i; +} +// vect: [ 3, 3, 7, 7, 7, 8 ] +//! [19] + + +//! [20] +QList list; +list << 3 << 3 << 6 << 6 << 6 << 8; + +QList::iterator i = qUpperBound(list.begin(), list.end(), 5); +list.insert(i, 5); +// list: [ 3, 3, 5, 6, 6, 6, 8 ] + +i = qUpperBound(list.begin(), list.end(), 12); +list.insert(i, 12); +// list: [ 3, 3, 5, 6, 6, 6, 8, 12 ] +//! [20] + + +//! [21] +QVector vect; +vect << 3 << 3 << 6 << 6 << 6 << 8; +QVector::iterator begin6 = + qLowerBound(vect.begin(), vect.end(), 6); +QVector::iterator end6 = + qUpperBound(vect.begin(), vect.end(), 6); + +QVector::iterator i = begin6; +while (i != end6) { + *i = 7; + ++i; +} +// vect: [ 3, 3, 7, 7, 7, 8 ] +//! [21] + + +//! [22] +QVector vect; +vect << 3 << 3 << 6 << 6 << 6 << 8; + +QVector::iterator i = + qBinaryFind(vect.begin(), vect.end(), 6); +// i == vect.begin() + 2 (or 3 or 4) +//! [22] + + +//! [23] +QList list; +list.append(new Employee("Blackpool", "Stephen")); +list.append(new Employee("Twist", "Oliver")); + +qDeleteAll(list.begin(), list.end()); +list.clear(); +//! [23] + + +//! [24] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qSort(list.begin(), list.end(), qLess()); +// list: [ 6, 12, 12, 33, 68 ] +//! [24] + + +//! [25] +QList list; +list << 33 << 12 << 68 << 6 << 12; +qSort(list.begin(), list.end(), qGreater()); +// list: [ 68, 33, 12, 12, 6 ] +//! [25] diff --git a/doc/src/snippets/code/doc_src_qalgorithms.qdoc b/doc/src/snippets/code/doc_src_qalgorithms.qdoc deleted file mode 100644 index 0438105..0000000 --- a/doc/src/snippets/code/doc_src_qalgorithms.qdoc +++ /dev/null @@ -1,354 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QStringList list; -list << "one" << "two" << "three"; - -qFill(list.begin(), list.end(), "eleven"); -// list: [ "eleven", "eleven", "eleven" ] -//! [0] - - -//! [1] -qFill(list.begin() + 1, list.end(), "six"); -// list: [ "eleven", "six", "six" ] -//! [1] - - -//! [2] -QChar resolveEntity(const QString &entity) -{ - static const QLatin1String name_table[] = { - "AElig", "Aacute", ..., "zwnj" - }; - static const ushort value_table[] = { - 0x0061, 0x00c1, ..., 0x200c - }; - int N = sizeof(name_table) / sizeof(name_table[0]); - - const QLatin1String *name = qBinaryFind(name_table, name_table + N, - entity); - int index = name - name_table; - if (index == N) - return QChar(); - - return QChar(value_table[index]); -} -//! [2] - - -//! [3] -QChar resolveEntity(const QString &entity) -{ - static QMap entityMap; - - if (!entityMap) { - entityMap.insert("AElig", 0x0061); - entityMap.insert("Aacute", 0x00c1); - ... - entityMap.insert("zwnj", 0x200c); - } - return QChar(entityMap.value(entity)); -} -//! [3] - - -//! [4] -QStringList list; -list << "one" << "two" << "three"; - -QVector vect1(3); -qCopy(list.begin(), list.end(), vect1.begin()); -// vect: [ "one", "two", "three" ] - -QVector vect2(8); -qCopy(list.begin(), list.end(), vect2.begin() + 2); -// vect: [ "", "", "one", "two", "three", "", "", "" ] -//! [4] - - -//! [5] -QStringList list; -list << "one" << "two" << "three"; - -QVector vect(5); -qCopyBackward(list.begin(), list.end(), vect.end()); -// vect: [ "", "", "one", "two", "three" ] -//! [5] - - -//! [6] -QStringList list; -list << "one" << "two" << "three"; - -QVector vect(3); -vect[0] = "one"; -vect[1] = "two"; -vect[2] = "three"; - -bool ret1 = qEqual(list.begin(), list.end(), vect.begin()); -// ret1 == true - -vect[2] = "seven"; -bool ret2 = qEqual(list.begin(), list.end(), vect.begin()); -// ret2 == false -//! [6] - - -//! [7] -QStringList list; -list << "one" << "two" << "three"; - -qFill(list.begin(), list.end(), "eleven"); -// list: [ "eleven", "eleven", "eleven" ] - -qFill(list.begin() + 1, list.end(), "six"); -// list: [ "eleven", "six", "six" ] -//! [7] - - -//! [8] -QStringList list; -list << "one" << "two" << "three"; - -QStringList::iterator i1 = qFind(list.begin(), list.end(), "two"); -// i1 == list.begin() + 1 - -QStringList::iterator i2 = qFind(list.begin(), list.end(), "seventy"); -// i2 == list.end() -//! [8] - - -//! [9] -QList list; -list << 3 << 3 << 6 << 6 << 6 << 8; - -int countOf6 = 0; -qCount(list.begin(), list.end(), 6, countOf6); -// countOf6 == 3 - -int countOf7 = 0; -qCount(list.begin(), list.end(), 7, countOf7); -// countOf7 == 0 -//! [9] - - -//! [10] -double pi = 3.14; -double e = 2.71; - -qSwap(pi, e); -// pi == 2.71, e == 3.14 -//! [10] - - -//! [11] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qSort(list.begin(), list.end()); -// list: [ 6, 12, 12, 33, 68 ] -//! [11] - - -//! [12] -bool caseInsensitiveLessThan(const QString &s1, const QString &s2) -{ - return s1.toLower() < s2.toLower(); -} - -int doSomething() -{ - QStringList list; - list << "AlPha" << "beTA" << "gamma" << "DELTA"; - qSort(list.begin(), list.end(), caseInsensitiveLessThan); - // list: [ "AlPha", "beTA", "DELTA", "gamma" ] -} -//! [12] - - -//! [13] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qSort(list.begin(), list.end(), qGreater()); -// list: [ 68, 33, 12, 12, 6 ] -//! [13] - - -//! [14] -QStringList list; -list << "AlPha" << "beTA" << "gamma" << "DELTA"; - -QMap map; -foreach (const QString &str, list) - map.insert(str.toLower(), str); - -list = map.values(); -//! [14] - - -//! [15] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qStableSort(list.begin(), list.end()); -// list: [ 6, 12, 12, 33, 68 ] -//! [15] - - -//! [16] -bool caseInsensitiveLessThan(const QString &s1, const QString &s2) -{ - return s1.toLower() < s2.toLower(); -} - -int doSomething() -{ - QStringList list; - list << "AlPha" << "beTA" << "gamma" << "DELTA"; - qStableSort(list.begin(), list.end(), caseInsensitiveLessThan); - // list: [ "AlPha", "beTA", "DELTA", "gamma" ] -} -//! [16] - - -//! [17] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qStableSort(list.begin(), list.end(), qGreater()); -// list: [ 68, 33, 12, 12, 6 ] -//! [17] - - -//! [18] -QList list; -list << 3 << 3 << 6 << 6 << 6 << 8; - -QList::iterator i = qLowerBound(list.begin(), list.end(), 5); -list.insert(i, 5); -// list: [ 3, 3, 5, 6, 6, 6, 8 ] - -i = qLowerBound(list.begin(), list.end(), 12); -list.insert(i, 12); -// list: [ 3, 3, 5, 6, 6, 6, 8, 12 ] -//! [18] - - -//! [19] -QVector vect; -vect << 3 << 3 << 6 << 6 << 6 << 8; -QVector::iterator begin6 = - qLowerBound(vect.begin(), vect.end(), 6); -QVector::iterator end6 = - qUpperBound(begin6, vect.end(), 6); - -QVector::iterator i = begin6; -while (i != end6) { - *i = 7; - ++i; -} -// vect: [ 3, 3, 7, 7, 7, 8 ] -//! [19] - - -//! [20] -QList list; -list << 3 << 3 << 6 << 6 << 6 << 8; - -QList::iterator i = qUpperBound(list.begin(), list.end(), 5); -list.insert(i, 5); -// list: [ 3, 3, 5, 6, 6, 6, 8 ] - -i = qUpperBound(list.begin(), list.end(), 12); -list.insert(i, 12); -// list: [ 3, 3, 5, 6, 6, 6, 8, 12 ] -//! [20] - - -//! [21] -QVector vect; -vect << 3 << 3 << 6 << 6 << 6 << 8; -QVector::iterator begin6 = - qLowerBound(vect.begin(), vect.end(), 6); -QVector::iterator end6 = - qUpperBound(vect.begin(), vect.end(), 6); - -QVector::iterator i = begin6; -while (i != end6) { - *i = 7; - ++i; -} -// vect: [ 3, 3, 7, 7, 7, 8 ] -//! [21] - - -//! [22] -QVector vect; -vect << 3 << 3 << 6 << 6 << 6 << 8; - -QVector::iterator i = - qBinaryFind(vect.begin(), vect.end(), 6); -// i == vect.begin() + 2 (or 3 or 4) -//! [22] - - -//! [23] -QList list; -list.append(new Employee("Blackpool", "Stephen")); -list.append(new Employee("Twist", "Oliver")); - -qDeleteAll(list.begin(), list.end()); -list.clear(); -//! [23] - - -//! [24] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qSort(list.begin(), list.end(), qLess()); -// list: [ 6, 12, 12, 33, 68 ] -//! [24] - - -//! [25] -QList list; -list << 33 << 12 << 68 << 6 << 12; -qSort(list.begin(), list.end(), qGreater()); -// list: [ 68, 33, 12, 12, 6 ] -//! [25] diff --git a/doc/src/snippets/code/doc_src_qaxcontainer.pro b/doc/src/snippets/code/doc_src_qaxcontainer.pro new file mode 100644 index 0000000..ff39e67 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qaxcontainer.pro @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +CONFIG += qaxcontainer +#! [0] + + +#! [1] +TYPELIBS = file.tlb +#! [1] diff --git a/doc/src/snippets/code/doc_src_qaxcontainer.qdoc b/doc/src/snippets/code/doc_src_qaxcontainer.qdoc deleted file mode 100644 index 93aa60b..0000000 --- a/doc/src/snippets/code/doc_src_qaxcontainer.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -CONFIG += qaxcontainer -//! [0] - - -//! [1] -TYPELIBS = file.tlb -//! [1] diff --git a/doc/src/snippets/code/doc_src_qaxserver.cpp b/doc/src/snippets/code/doc_src_qaxserver.cpp new file mode 100644 index 0000000..dc16776 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qaxserver.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [3] +#include + +class MyActiveX : public QWidget +{ + Q_OBJECT +//! [3] + + +//! [4] +Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}") +Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}") +Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}") +//! [4] + + +//! [5] +Q_PROPERTY(int value READ value WRITE setValue) +//! [5] + + +//! [6] +public: + MyActiveX(QWidget *parent = 0) + ... + + int value() const; + +public slots: + void setValue(int v); + ... + +signals: + void valueChange(int v); + ... + +}; +//! [6] + + +//! [7] +#include +#include + +class MyActiveX : public QWidget, public QAxBindable +{ + Q_OBJECT +//! [7] + + +//! [8] +QAXFACTORY_BEGIN("{ad90301a-849e-4e8b-9a91-0a6dc5f6461f}", + "{a8f21901-7ff7-4f6a-b939-789620c03d83}") + QAXCLASS(MyWidget) + QAXCLASS(MyWidget2) + QAXTYPE(MySubType) +QAXFACTORY_END() +//! [8] + + +//! [9] +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + if (!QAxFactory::isServer()) { + // create and show main window + } + return app.exec(); +} +//! [9] + + +//! [10] +MyFactory(const QUuid &, const QUuid &); +//! [10] + + +//! [11] +HMODULE dll = LoadLibrary("myserver.dll"); +typedef HRESULT(__stdcall *DllRegisterServerProc)(); +DllRegisterServerProc DllRegisterServer = + (DllRegisterServerProc)GetProcAddress(dll, "DllRegisterServer"); + +HRESULT res = E_FAIL; +if (DllRegisterServer) + res = DllRegisterServer(); +if (res != S_OK) + // error handling +//! [11] + + +//! [15] +class MyActiveX : public QWidget +{ + Q_OBJECT + Q_CLASSINFO("Version", "2.0") + Q_CLASSINFO("ClassID", "{7a4cffd8-cbcd-4ae9-ae7e-343e1e5710df}") + Q_CLASSINFO("InterfaceID", "{6fb035bf-8019-48d8-be51-ef05427d8994}") + Q_CLASSINFO("EventsID", "{c42fffdf-6557-47c9-817a-2da2228bc29c}") + Q_CLASSINFO("Insertable", "yes") + Q_CLASSINFO("ToSuperClass", "MyActiveX") + Q_PROPERTY(...) + +public: + MyActiveX(QWidget *parent = 0); + + ... +}; +//! [15] + + +//! [16] +class MyLicensedControl : public QWidget +{ + Q_OBJECT + Q_CLASSINFO("LicenseKey", "") + ... +}; +//! [16] + + +//! [17] +class AxImpl : public QAxAggregated, public ISomeCOMInterface +{ +public: + AxImpl() {} + + long queryInterface(const QUuid &iid, void **iface); + + // IUnknown + QAXAGG_IUNKNOWN + + // ISomeCOMInterface + ... +} +//! [17] + + +//! [18] +long AxImpl::queryInterface(const QUuid &iid, void **iface) +{ + *iface = 0; + if (iid == IID_ISomeCOMInterface) + *iface = (ISomeCOMInterface *)this; + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} +//! [18] + + +//! [19] +HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) +{ + return controllingUnknown()->QueryInterface(iid, iface); +} +//! [19] + + +//! [20] +class MyActiveX : public QWidget, public QAxBindable +{ + Q_OBJECT + +public: + MyActiveX(QWidget *parent); + + QAxAggregated *createAggregate() + { + return new AxImpl(); + } +}; +//! [20] diff --git a/doc/src/snippets/code/doc_src_qaxserver.pro b/doc/src/snippets/code/doc_src_qaxserver.pro new file mode 100644 index 0000000..18d66f3 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qaxserver.pro @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +TEMPLATE = app +CONFIG += qaxserver + +RC_FILE = qaxserver.rc +... +#! [0] + + +#! [1] +TEMPLATE = lib +CONFIG += qaxserver dll + +DEF_FILE = qaxserver.def +RC_FILE = qaxserver.rc +... +#! [1] + + +#! [2] +TEMPLATE = lib +VERSION = 2.5 +... +#! [2] diff --git a/doc/src/snippets/code/doc_src_qaxserver.qdoc b/doc/src/snippets/code/doc_src_qaxserver.qdoc index c5906e9..2fd79e3 100644 --- a/doc/src/snippets/code/doc_src_qaxserver.qdoc +++ b/doc/src/snippets/code/doc_src_qaxserver.qdoc @@ -38,126 +38,6 @@ ** ****************************************************************************/ -//! [0] -TEMPLATE = app -CONFIG += qaxserver - -RC_FILE = qaxserver.rc -... -//! [0] - - -//! [1] -TEMPLATE = lib -CONFIG += qaxserver dll - -DEF_FILE = qaxserver.def -RC_FILE = qaxserver.rc -... -//! [1] - - -//! [2] -TEMPLATE = lib -VERSION = 2.5 -... -//! [2] - - -//! [3] -#include - -class MyActiveX : public QWidget -{ - Q_OBJECT -//! [3] - - -//! [4] -Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}") -Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}") -Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}") -//! [4] - - -//! [5] -Q_PROPERTY(int value READ value WRITE setValue) -//! [5] - - -//! [6] -public: - MyActiveX(QWidget *parent = 0) - ... - - int value() const; - -public slots: - void setValue(int v); - ... - -signals: - void valueChange(int v); - ... - -}; -//! [6] - - -//! [7] -#include -#include - -class MyActiveX : public QWidget, public QAxBindable -{ - Q_OBJECT -//! [7] - - -//! [8] -QAXFACTORY_BEGIN("{ad90301a-849e-4e8b-9a91-0a6dc5f6461f}", - "{a8f21901-7ff7-4f6a-b939-789620c03d83}") - QAXCLASS(MyWidget) - QAXCLASS(MyWidget2) - QAXTYPE(MySubType) -QAXFACTORY_END() -//! [8] - - -//! [9] -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - if (!QAxFactory::isServer()) { - // create and show main window - } - return app.exec(); -} -//! [9] - - -//! [10] -MyFactory(const QUuid &, const QUuid &); -//! [10] - - -//! [11] -HMODULE dll = LoadLibrary("myserver.dll"); -typedef HRESULT(__stdcall *DllRegisterServerProc)(); -DllRegisterServerProc DllRegisterServer = - (DllRegisterServerProc)GetProcAddress(dll, "DllRegisterServer"); - -HRESULT res = E_FAIL; -if (DllRegisterServer) - res = DllRegisterServer(); -if (res != S_OK) - // error handling -//! [11] - - //! [12] cabarc N simpleax.cab simpleax.exe simple.inf //! [12] @@ -175,89 +55,3 @@ cabarc N simpleax.cab simpleax.exe simple.inf <\object> //! [14] - - -//! [15] -class MyActiveX : public QWidget -{ - Q_OBJECT - Q_CLASSINFO("Version", "2.0") - Q_CLASSINFO("ClassID", "{7a4cffd8-cbcd-4ae9-ae7e-343e1e5710df}") - Q_CLASSINFO("InterfaceID", "{6fb035bf-8019-48d8-be51-ef05427d8994}") - Q_CLASSINFO("EventsID", "{c42fffdf-6557-47c9-817a-2da2228bc29c}") - Q_CLASSINFO("Insertable", "yes") - Q_CLASSINFO("ToSuperClass", "MyActiveX") - Q_PROPERTY(...) - -public: - MyActiveX(QWidget *parent = 0); - - ... -}; -//! [15] - - -//! [16] -class MyLicensedControl : public QWidget -{ - Q_OBJECT - Q_CLASSINFO("LicenseKey", "") - ... -}; -//! [16] - - -//! [17] -class AxImpl : public QAxAggregated, public ISomeCOMInterface -{ -public: - AxImpl() {} - - long queryInterface(const QUuid &iid, void **iface); - - // IUnknown - QAXAGG_IUNKNOWN - - // ISomeCOMInterface - ... -} -//! [17] - - -//! [18] -long AxImpl::queryInterface(const QUuid &iid, void **iface) -{ - *iface = 0; - if (iid == IID_ISomeCOMInterface) - *iface = (ISomeCOMInterface *)this; - else - return E_NOINTERFACE; - - AddRef(); - return S_OK; -} -//! [18] - - -//! [19] -HRESULT AxImpl::QueryInterface(REFIID iid, void **iface) -{ - return controllingUnknown()->QueryInterface(iid, iface); -} -//! [19] - - -//! [20] -class MyActiveX : public QWidget, public QAxBindable -{ - Q_OBJECT - -public: - MyActiveX(QWidget *parent); - - QAxAggregated *createAggregate() - { - return new AxImpl(); - } -}; -//! [20] diff --git a/doc/src/snippets/code/doc_src_qcache.cpp b/doc/src/snippets/code/doc_src_qcache.cpp new file mode 100644 index 0000000..81fa3cf --- /dev/null +++ b/doc/src/snippets/code/doc_src_qcache.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QCache cache; +//! [0] + + +//! [1] +Employee *employee = new Employee; +employee->setId(37); +employee->setName("Richard Schmit"); +... +cache.insert(employee->id(), employee); +//! [1] + + +//! [2] +QCache cache(5000); +//! [2] diff --git a/doc/src/snippets/code/doc_src_qcache.qdoc b/doc/src/snippets/code/doc_src_qcache.qdoc deleted file mode 100644 index 81fa3cf..0000000 --- a/doc/src/snippets/code/doc_src_qcache.qdoc +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QCache cache; -//! [0] - - -//! [1] -Employee *employee = new Employee; -employee->setId(37); -employee->setName("Richard Schmit"); -... -cache.insert(employee->id(), employee); -//! [1] - - -//! [2] -QCache cache(5000); -//! [2] diff --git a/doc/src/snippets/code/doc_src_qdbusadaptors.cpp b/doc/src/snippets/code/doc_src_qdbusadaptors.cpp new file mode 100644 index 0000000..abb31a1 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qdbusadaptors.cpp @@ -0,0 +1,293 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] + class MainApplicationAdaptor: public QDBusAbstractAdaptor + { + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication") + Q_PROPERTY(QString caption READ caption WRITE setCaption) + Q_PROPERTY(QString organizationName READ organizationName) + Q_PROPERTY(QString organizationDomain READ organizationDomain) + + private: + QApplication *app; + + public: + MainApplicationAdaptor(QApplication *application) + : QDBusAbstractAdaptor(application), app(application) + { + connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit())); + connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)), + SLOT(focusChangedSlot(QWidget*, QWidget*))); + } + + QString caption() + { + if (app->hasMainWindow()) + return app->mainWindow()->caption(); + return QString(""); // must not return a null QString + } + + void setCaption(const QString &newCaption) + { + if (app->hasMainWindow()) + app->mainWindow()->setCaption(newCaption); + } + + QString organizationName() + { + return app->organizationName(); + } + + QString organizationDomain() + { + return app->organizationDomain(); + } + + public slots: + Q_NOREPLY void quit() + { app->quit(); } + + void reparseConfiguration() + { app->reparseConfiguration(); } + + QString mainWindowObject() + { + if (app->hasMainWindow()) + return QString("/%1/mainwindow").arg(app->applicationName()); + return QString(); + } + + void setSessionManagement(bool enable) + { + if (enable) + app->enableSessionManagement(); + else + app->disableSessionManagement(); + } + + private slots: + void focusChangedSlot(QWidget *, QWidget *now) + { + if (now == app->mainWindow()) + emit mainWindowHasFocus(); + } + + signals: + void aboutToQuit(); + void mainWindowHasFocus(); + }; +//! [0] + + +//! [1] +interface org.kde.DBus.MainApplication +{ + property readwrite STRING caption + property read STRING organizationName + property read STRING organizationDomain + + method quit() annotation("org.freedesktop.DBus.Method.NoReply", "true") + method reparseConfiguration() + method mainWindowObject(out STRING) + method disableSessionManagement(in BOOLEAN enable) + + signal aboutToQuit() + signal mainWindowHasFocus() +} +//! [1] + + +//! [2] +int main(int argc, char **argv) +{ + // create the QApplication object + QApplication app(argc, argv); + + // create the MainApplication adaptor: + new MainApplicationAdaptor(app); + + // connect to D-Bus and register as an object: + QDBusConnection::sessionBus().registerObject("/MainApplication", app); + + // add main window, etc. + [...] + + app.exec(); +} +//! [2] + + +//! [3] +class MainApplicationAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication") +//! [3] + + +//! [4] + Q_PROPERTY(QString caption READ caption WRITE setCaption) + Q_PROPERTY(QString organizationName READ organizationName) + Q_PROPERTY(QString organizationDomain READ organizationDomain) +//! [4] + + +//! [5] +QString caption() +{ + if (app->hasMainWindow()) + return app->mainWindow()->caption(); + return QString(); +} + +void setCaption(const QString &newCaption) +{ + if (app->hasMainWindow()) + app->mainWindow()->setCaption(newCaption); +} + +QString organizationName() +{ + return app->organizationName(); +} + +QString organizationDomain() +{ + return app->organizationDomain(); +} +//! [5] + + +//! [6] +MyInterfaceAdaptor(QApplication *application) + : QDBusAbstractAdaptor(application), app(application) +{ + connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()); + connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)), + SLOT(focusChangedSlot(QWidget*, QWidget*))); +} +//! [6] + + +//! [7] +public slots: + Q_NOREPLY void quit() + { app->quit(); } + + void reparseConfiguration() + { app->reparseConfiguration(); } + + QString mainWindowObject() + { + if (app->hasMainWindow()) + return QString("/%1/mainwindow").arg(app->applicationName()); + return QString(); + } + + void setSessionManagement(bool enable) + { + if (enable) + app->enableSessionManagement(); + else + app->disableSessionManagement(); + } +//! [7] + + +//! [8] +signals: + void aboutToQuit(); + void mainWindowHasFocus(); +//! [8] + + +//! [9] +private slots: + void focusChangedSlot(QWidget *, QWidget *now) + { + if (now == app->mainWindow()) + emit mainWindowHasFocus(); + } +//! [9] + + +//! [10] +struct RequestData +{ + QString request; + QString processedData; + QDBusMessage reply; +}; + +QString processRequest(const QString &request, const QDBusMessage &message) +{ + RequestData *data = new RequestData; + data->request = request; + message.setDelayedReply(true); + data->reply = message.createReply(); + QDBusConnection::sessionBus().send(data->reply); + + appendRequest(data); + return QString(); +} +//! [10] + + +//! [11] +void sendReply(RequestData *data) +{ + // data->processedData has been initialized with the request's reply + QDBusMessage &reply = &data->reply; + + // send the reply over D-Bus: + reply << data->processedData; + QDBusConnection::sessionBus().send(reply); + + // dispose of the transaction data + delete data; +} +//! [11] + + +//! [12] +Q_NOREPLY void myMethod(); +//! [12] diff --git a/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc b/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc deleted file mode 100644 index abb31a1..0000000 --- a/doc/src/snippets/code/doc_src_qdbusadaptors.qdoc +++ /dev/null @@ -1,293 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] - class MainApplicationAdaptor: public QDBusAbstractAdaptor - { - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication") - Q_PROPERTY(QString caption READ caption WRITE setCaption) - Q_PROPERTY(QString organizationName READ organizationName) - Q_PROPERTY(QString organizationDomain READ organizationDomain) - - private: - QApplication *app; - - public: - MainApplicationAdaptor(QApplication *application) - : QDBusAbstractAdaptor(application), app(application) - { - connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit())); - connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)), - SLOT(focusChangedSlot(QWidget*, QWidget*))); - } - - QString caption() - { - if (app->hasMainWindow()) - return app->mainWindow()->caption(); - return QString(""); // must not return a null QString - } - - void setCaption(const QString &newCaption) - { - if (app->hasMainWindow()) - app->mainWindow()->setCaption(newCaption); - } - - QString organizationName() - { - return app->organizationName(); - } - - QString organizationDomain() - { - return app->organizationDomain(); - } - - public slots: - Q_NOREPLY void quit() - { app->quit(); } - - void reparseConfiguration() - { app->reparseConfiguration(); } - - QString mainWindowObject() - { - if (app->hasMainWindow()) - return QString("/%1/mainwindow").arg(app->applicationName()); - return QString(); - } - - void setSessionManagement(bool enable) - { - if (enable) - app->enableSessionManagement(); - else - app->disableSessionManagement(); - } - - private slots: - void focusChangedSlot(QWidget *, QWidget *now) - { - if (now == app->mainWindow()) - emit mainWindowHasFocus(); - } - - signals: - void aboutToQuit(); - void mainWindowHasFocus(); - }; -//! [0] - - -//! [1] -interface org.kde.DBus.MainApplication -{ - property readwrite STRING caption - property read STRING organizationName - property read STRING organizationDomain - - method quit() annotation("org.freedesktop.DBus.Method.NoReply", "true") - method reparseConfiguration() - method mainWindowObject(out STRING) - method disableSessionManagement(in BOOLEAN enable) - - signal aboutToQuit() - signal mainWindowHasFocus() -} -//! [1] - - -//! [2] -int main(int argc, char **argv) -{ - // create the QApplication object - QApplication app(argc, argv); - - // create the MainApplication adaptor: - new MainApplicationAdaptor(app); - - // connect to D-Bus and register as an object: - QDBusConnection::sessionBus().registerObject("/MainApplication", app); - - // add main window, etc. - [...] - - app.exec(); -} -//! [2] - - -//! [3] -class MainApplicationAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication") -//! [3] - - -//! [4] - Q_PROPERTY(QString caption READ caption WRITE setCaption) - Q_PROPERTY(QString organizationName READ organizationName) - Q_PROPERTY(QString organizationDomain READ organizationDomain) -//! [4] - - -//! [5] -QString caption() -{ - if (app->hasMainWindow()) - return app->mainWindow()->caption(); - return QString(); -} - -void setCaption(const QString &newCaption) -{ - if (app->hasMainWindow()) - app->mainWindow()->setCaption(newCaption); -} - -QString organizationName() -{ - return app->organizationName(); -} - -QString organizationDomain() -{ - return app->organizationDomain(); -} -//! [5] - - -//! [6] -MyInterfaceAdaptor(QApplication *application) - : QDBusAbstractAdaptor(application), app(application) -{ - connect(application, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()); - connect(application, SIGNAL(focusChanged(QWidget*, QWidget*)), - SLOT(focusChangedSlot(QWidget*, QWidget*))); -} -//! [6] - - -//! [7] -public slots: - Q_NOREPLY void quit() - { app->quit(); } - - void reparseConfiguration() - { app->reparseConfiguration(); } - - QString mainWindowObject() - { - if (app->hasMainWindow()) - return QString("/%1/mainwindow").arg(app->applicationName()); - return QString(); - } - - void setSessionManagement(bool enable) - { - if (enable) - app->enableSessionManagement(); - else - app->disableSessionManagement(); - } -//! [7] - - -//! [8] -signals: - void aboutToQuit(); - void mainWindowHasFocus(); -//! [8] - - -//! [9] -private slots: - void focusChangedSlot(QWidget *, QWidget *now) - { - if (now == app->mainWindow()) - emit mainWindowHasFocus(); - } -//! [9] - - -//! [10] -struct RequestData -{ - QString request; - QString processedData; - QDBusMessage reply; -}; - -QString processRequest(const QString &request, const QDBusMessage &message) -{ - RequestData *data = new RequestData; - data->request = request; - message.setDelayedReply(true); - data->reply = message.createReply(); - QDBusConnection::sessionBus().send(data->reply); - - appendRequest(data); - return QString(); -} -//! [10] - - -//! [11] -void sendReply(RequestData *data) -{ - // data->processedData has been initialized with the request's reply - QDBusMessage &reply = &data->reply; - - // send the reply over D-Bus: - reply << data->processedData; - QDBusConnection::sessionBus().send(reply); - - // dispose of the transaction data - delete data; -} -//! [11] - - -//! [12] -Q_NOREPLY void myMethod(); -//! [12] diff --git a/doc/src/snippets/code/doc_src_qiterator.cpp b/doc/src/snippets/code/doc_src_qiterator.cpp new file mode 100644 index 0000000..82b1bd3 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qiterator.cpp @@ -0,0 +1,420 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QList list; +... +QListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [0] + + +//! [1] +QListIterator i(list); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [1] + + +//! [2] +QLinkedList list; +... +QLinkedListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [2] + + +//! [3] +QLinkedListIterator i(list); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [3] + + +//! [4] +QVector vector; +... +QVectorIterator i(vector); +while (i.hasNext()) + qDebug() << i.next(); +//! [4] + + +//! [5] +QVectorIterator i(vector); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [5] + + +//! [6] +QSet set; +... +QSetIterator i(set); +while (i.hasNext()) + qDebug() << i.next(); +//! [6] + + +//! [7] +QSetIterator i(set); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [7] + + +//! [8] +QList list; +... +QMutableListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [8] + + +//! [9] +QMutableListIterator i(list); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [9] + + +//! [10] +QMutableListIterator i(list); +while (i.hasNext()) { + int val = i.next(); + if (val < 0) { + i.setValue(-val); + } else if (val == 0) { + i.remove(); + } +} +//! [10] + + +//! [11] +QLinkedList list; +... +QMutableLinkedListIterator i(list); +while (i.hasNext()) + qDebug() << i.next(); +//! [11] + + +//! [12] +QMutableLinkedListIterator i(list); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [12] + + +//! [13] +QMutableLinkedListIterator i(list); +while (i.hasNext()) { + int val = i.next(); + if (val < 0) { + i.setValue(-val); + } else if (val == 0) { + i.remove(); + } +} +//! [13] + + +//! [14] +QVector vector; +... +QMutableVectorIterator i(vector); +while (i.hasNext()) + qDebug() << i.next(); +//! [14] + + +//! [15] +QMutableVectorIterator i(vector); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [15] + + +//! [16] +QMutableVectorIterator i(vector); +while (i.hasNext()) { + int val = i.next(); + if (val < 0) { + i.setValue(-val); + } else if (val == 0) { + i.remove(); + } +} +//! [16] + + +//! [17] +QSet set; +... +QMutableSetIterator i(set); +while (i.hasNext()) + qDebug() << i.next(); +//! [17] + + +//! [18] +QMutableSetIterator i(set); +i.toBack(); +while (i.hasPrevious()) + qDebug() << i.previous(); +//! [18] + + +//! [19] +QMutableListIterator i(list); +while (i.hasNext()) { + int val = i.next(); + if (val < -32768 || val > 32767) + i.remove(); +} +//! [19] + + +//! [20] +QMutableLinkedListIterator i(list); +while (i.hasNext()) { + int val = i.next(); + if (val < -32768 || val > 32767) + i.remove(); +} +//! [20] + + +//! [21] +QMutableVectorIterator i(vector); +while (i.hasNext()) { + int val = i.next(); + if (val < -32768 || val > 32767) + i.remove(); +} +//! [21] + + +//! [22] +QMutableSetIterator i(set); +while (i.hasNext()) { + int val = i.next(); + if (val < -32768 || val > 32767) + i.remove(); +} +//! [22] + + +//! [23] +QMutableListIterator i(list); +while (i.hasNext()) { + double val = i.next(); + i.setValue(sqrt(val)); +} +//! [23] + + +//! [24] +QMutableLinkedListIterator i(list); +while (i.hasNext()) { + double val = i.next(); + i.setValue(sqrt(val)); +} +//! [24] + + +//! [25] +QMutableVectorIterator i(list); +while (i.hasNext()) { + double val = i.next(); + i.setValue(sqrt(val)); +} +//! [25] + + +//! [26] +QMap map; +... +QMapIterator i(map); +while (i.hasNext()) { + i.next(); + qDebug() << i.key() << ": " << i.value(); +} +//! [26] + + +//! [27] +QMapIterator i(map); +i.toBack(); +while (i.hasPrevious()) { + i.previous(); + qDebug() << i.key() << ": " << i.value(); +} +//! [27] + + +//! [28] +QMapIterator i(map); +while (i.findNext(widget)) { + qDebug() << "Found widget " << widget << " under key " + << i.key(); +} +//! [28] + + +//! [29] +QHash hash; +... +QHashIterator i(hash); +while (i.hasNext()) { + i.next(); + qDebug() << i.key() << ": " << i.value(); +} +//! [29] + + +//! [30] +QHashIterator i(hash); +i.toBack(); +while (i.hasPrevious()) { + i.previous(); + qDebug() << i.key() << ": " << i.value(); +} +//! [30] + + +//! [31] +QHashIterator i(hash); +while (i.findNext(widget)) { + qDebug() << "Found widget " << widget << " under key " + << i.key(); +} +//! [31] + + +//! [32] +QMap map; +... +QMutableMapIterator i(map); +while (i.hasNext()) { + i.next(); + qDebug() << i.key() << ": " << i.value(); +} +//! [32] + + +//! [33] +QMutableMapIterator i(map); +i.toBack(); +while (i.hasPrevious()) { + i.previous(); + qDebug() << i.key() << ": " << i.value(); +} +//! [33] + + +//! [34] +QMutableMapIterator i(map); +while (i.findNext(widget)) { + qDebug() << "Found widget " << widget << " under key " + << i.key(); +} +//! [34] + + +//! [35] +QMutableMapIterator i(map); +while (i.hasNext()) { + i.next(); + if (i.key() == i.value()) + i.remove(); +} +//! [35] + + +//! [36] +QHash hash; +... +QMutableHashIterator i(hash); +while (i.hasNext()) { + i.next(); + qDebug() << i.key() << ": " << i.value(); +} +//! [36] + + +//! [37] +QMutableHashIterator i(hash); +i.toBack(); +while (i.hasPrevious()) { + i.previous(); + qDebug() << i.key() << ": " << i.value(); +} +//! [37] + + +//! [38] +QMutableHashIterator i(hash); +while (i.findNext(widget)) { + qDebug() << "Found widget " << widget << " under key " + << i.key(); +} +//! [38] + + +//! [39] +QMutableHashIterator i(hash); +while (i.hasNext()) { + i.next(); + if (i.key() == i.value()) + i.remove(); +} +//! [39] diff --git a/doc/src/snippets/code/doc_src_qiterator.qdoc b/doc/src/snippets/code/doc_src_qiterator.qdoc deleted file mode 100644 index 82b1bd3..0000000 --- a/doc/src/snippets/code/doc_src_qiterator.qdoc +++ /dev/null @@ -1,420 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QList list; -... -QListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [0] - - -//! [1] -QListIterator i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [1] - - -//! [2] -QLinkedList list; -... -QLinkedListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [2] - - -//! [3] -QLinkedListIterator i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [3] - - -//! [4] -QVector vector; -... -QVectorIterator i(vector); -while (i.hasNext()) - qDebug() << i.next(); -//! [4] - - -//! [5] -QVectorIterator i(vector); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [5] - - -//! [6] -QSet set; -... -QSetIterator i(set); -while (i.hasNext()) - qDebug() << i.next(); -//! [6] - - -//! [7] -QSetIterator i(set); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [7] - - -//! [8] -QList list; -... -QMutableListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [8] - - -//! [9] -QMutableListIterator i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [9] - - -//! [10] -QMutableListIterator i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < 0) { - i.setValue(-val); - } else if (val == 0) { - i.remove(); - } -} -//! [10] - - -//! [11] -QLinkedList list; -... -QMutableLinkedListIterator i(list); -while (i.hasNext()) - qDebug() << i.next(); -//! [11] - - -//! [12] -QMutableLinkedListIterator i(list); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [12] - - -//! [13] -QMutableLinkedListIterator i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < 0) { - i.setValue(-val); - } else if (val == 0) { - i.remove(); - } -} -//! [13] - - -//! [14] -QVector vector; -... -QMutableVectorIterator i(vector); -while (i.hasNext()) - qDebug() << i.next(); -//! [14] - - -//! [15] -QMutableVectorIterator i(vector); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [15] - - -//! [16] -QMutableVectorIterator i(vector); -while (i.hasNext()) { - int val = i.next(); - if (val < 0) { - i.setValue(-val); - } else if (val == 0) { - i.remove(); - } -} -//! [16] - - -//! [17] -QSet set; -... -QMutableSetIterator i(set); -while (i.hasNext()) - qDebug() << i.next(); -//! [17] - - -//! [18] -QMutableSetIterator i(set); -i.toBack(); -while (i.hasPrevious()) - qDebug() << i.previous(); -//! [18] - - -//! [19] -QMutableListIterator i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < -32768 || val > 32767) - i.remove(); -} -//! [19] - - -//! [20] -QMutableLinkedListIterator i(list); -while (i.hasNext()) { - int val = i.next(); - if (val < -32768 || val > 32767) - i.remove(); -} -//! [20] - - -//! [21] -QMutableVectorIterator i(vector); -while (i.hasNext()) { - int val = i.next(); - if (val < -32768 || val > 32767) - i.remove(); -} -//! [21] - - -//! [22] -QMutableSetIterator i(set); -while (i.hasNext()) { - int val = i.next(); - if (val < -32768 || val > 32767) - i.remove(); -} -//! [22] - - -//! [23] -QMutableListIterator i(list); -while (i.hasNext()) { - double val = i.next(); - i.setValue(sqrt(val)); -} -//! [23] - - -//! [24] -QMutableLinkedListIterator i(list); -while (i.hasNext()) { - double val = i.next(); - i.setValue(sqrt(val)); -} -//! [24] - - -//! [25] -QMutableVectorIterator i(list); -while (i.hasNext()) { - double val = i.next(); - i.setValue(sqrt(val)); -} -//! [25] - - -//! [26] -QMap map; -... -QMapIterator i(map); -while (i.hasNext()) { - i.next(); - qDebug() << i.key() << ": " << i.value(); -} -//! [26] - - -//! [27] -QMapIterator i(map); -i.toBack(); -while (i.hasPrevious()) { - i.previous(); - qDebug() << i.key() << ": " << i.value(); -} -//! [27] - - -//! [28] -QMapIterator i(map); -while (i.findNext(widget)) { - qDebug() << "Found widget " << widget << " under key " - << i.key(); -} -//! [28] - - -//! [29] -QHash hash; -... -QHashIterator i(hash); -while (i.hasNext()) { - i.next(); - qDebug() << i.key() << ": " << i.value(); -} -//! [29] - - -//! [30] -QHashIterator i(hash); -i.toBack(); -while (i.hasPrevious()) { - i.previous(); - qDebug() << i.key() << ": " << i.value(); -} -//! [30] - - -//! [31] -QHashIterator i(hash); -while (i.findNext(widget)) { - qDebug() << "Found widget " << widget << " under key " - << i.key(); -} -//! [31] - - -//! [32] -QMap map; -... -QMutableMapIterator i(map); -while (i.hasNext()) { - i.next(); - qDebug() << i.key() << ": " << i.value(); -} -//! [32] - - -//! [33] -QMutableMapIterator i(map); -i.toBack(); -while (i.hasPrevious()) { - i.previous(); - qDebug() << i.key() << ": " << i.value(); -} -//! [33] - - -//! [34] -QMutableMapIterator i(map); -while (i.findNext(widget)) { - qDebug() << "Found widget " << widget << " under key " - << i.key(); -} -//! [34] - - -//! [35] -QMutableMapIterator i(map); -while (i.hasNext()) { - i.next(); - if (i.key() == i.value()) - i.remove(); -} -//! [35] - - -//! [36] -QHash hash; -... -QMutableHashIterator i(hash); -while (i.hasNext()) { - i.next(); - qDebug() << i.key() << ": " << i.value(); -} -//! [36] - - -//! [37] -QMutableHashIterator i(hash); -i.toBack(); -while (i.hasPrevious()) { - i.previous(); - qDebug() << i.key() << ": " << i.value(); -} -//! [37] - - -//! [38] -QMutableHashIterator i(hash); -while (i.findNext(widget)) { - qDebug() << "Found widget " << widget << " under key " - << i.key(); -} -//! [38] - - -//! [39] -QMutableHashIterator i(hash); -while (i.hasNext()) { - i.next(); - if (i.key() == i.value()) - i.remove(); -} -//! [39] diff --git a/doc/src/snippets/code/doc_src_qmake-manual.cpp b/doc/src/snippets/code/doc_src_qmake-manual.cpp new file mode 100644 index 0000000..4f60e1d --- /dev/null +++ b/doc/src/snippets/code/doc_src_qmake-manual.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [104] +// Add C includes here + +#if defined __cplusplus +// Add C++ includes here +#include +#include +#include +#include // Qt includes +#include +#include +#include "thirdparty/include/libmain.h" +#include "my_stable_class.h" +... +#endif +//! [104] + + diff --git a/doc/src/snippets/code/doc_src_qmake-manual.pro b/doc/src/snippets/code/doc_src_qmake-manual.pro new file mode 100644 index 0000000..e5b749e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qmake-manual.pro @@ -0,0 +1,1013 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +make all +#! [0] + + +#! [1] +CONFIG += qt thread debug +#! [1] + + +#! [2] +CONFIG += qt +QT += network xml +#! [2] + + +#! [3] +QT = network xml # This will omit the core and gui modules. +#! [3] + + +#! [4] +QT -= gui # Only the core module is used. +#! [4] + + +#! [5] +CONFIG += link_pkgconfig +PKGCONFIG += ogg dbus-1 +#! [5] + + +#! [6] +LIBS += -L/usr/local/lib -lmath +#! [6] + + +#! [7] +INCLUDEPATH = c:/msdev/include d:/stl/include +#! [7] + + +#! [8] +qmake [mode] [options] files +#! [8] + + +#! [9] +qmake -makefile [options] files +#! [9] + + +#! [10] +qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro +#! [10] + + +#! [11] +qmake "CONFIG+=test" test.pro +#! [11] + + +#! [12] +qmake -project [options] files +#! [12] + + +#! [13] +qmake -spec macx-g++ +#! [13] + + +#! [14] +QMAKE_LFLAGS += -F/path/to/framework/directory/ +#! [14] + + +#! [15] +LIBS += -framework TheFramework +#! [15] + + +#! [16] +TEMPLATE = lib +CONFIG += lib_bundle +#! [16] + + +#! [17] +FRAMEWORK_HEADERS.version = Versions +FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h +FRAMEWORK_HEADERS.path = Headers +QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS +#! [17] + + +#! [18] +CONFIG += x86 ppc +#! [18] + + +#! [19] +qmake -spec macx-xcode project.pro +#! [19] + + +#! [20] +qmake -tp vc +#! [20] + + +#! [21] +qmake -tp vc -r +#! [21] + + +#! [22] +CONFIG -= embed_manifest_exe +#! [22] + + +#! [23] +CONFIG -= embed_manifest_dll +#! [23] + + +#! [24] +make all +#! [24] + + +#! [25] +build_pass:CONFIG(debug, debug|release) { + unix: TARGET = $$join(TARGET,,,_debug) + else: TARGET = $$join(TARGET,,,d) +} +#! [25] + + +#! [26] +CONFIG += qt console newstuff +... +newstuff { + SOURCES += new.cpp + HEADERS += new.h +} +#! [26] + + +#! [27] +DEFINES += USE_MY_STUFF QT_DLL +#! [27] + + +#! [28] +myFiles.sources = path\*.png +DEPLOYMENT += myFiles +#! [28] + + +#! [29] +myFiles.sources = path\file1.ext1 path2\file2.ext1 path3\* +myFiles.path = \some\path\on\device +someother.sources = C:\additional\files\* +someother.path = \myFiles\path2 +DEPLOYMENT += myFiles someother +#! [29] + + +#! [30] +DESTDIR = ../../lib +#! [30] + + +#! [31] +DISTFILES += ../program.txt +#! [31] + + +#! [32] +FORMS = mydialog.ui \ + mywidget.ui \ + myconfig.ui +#! [32] + + +#! [33] +FORMS3 = my_uic3_dialog.ui \ + my_uic3_widget.ui \ + my_uic3_config.ui +#! [33] + + +#! [34] +HEADERS = myclass.h \ + login.h \ + mainwindow.h +#! [34] + + +#! [35] +INCLUDEPATH = c:/msdev/include d:/stl/include +#! [35] + + +#! [36] +target.path += $$[QT_INSTALL_PLUGINS]/imageformats +INSTALLS += target +#! [36] + + +#! [37] +LEXSOURCES = lexer.l +#! [37] + + +#! [38] +unix:LIBS += -L/usr/local/lib -lmath +win32:LIBS += c:/mylibs/math.lib +#! [38] + + +#! [39] +CONFIG += no_lflags_merge +#! [39] + + +#! [40] +unix:MOC_DIR = ../myproject/tmp +win32:MOC_DIR = c:/myproject/tmp +#! [40] + + +#! [41] +unix:OBJECTS_DIR = ../myproject/tmp +win32:OBJECTS_DIR = c:/myproject/tmp +#! [41] + + +#! [42] +app { + # Conditional code for 'app' template here +} +#! [42] + + +#! [43] +FRAMEWORK_HEADERS.version = Versions +FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h +FRAMEWORK_HEADERS.path = Headers +QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS +#! [43] + + +#! [44] +QMAKE_BUNDLE_EXTENSION = .myframework +#! [44] + + +#! [45] +QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9 +#! [45] + + +#! [46] +QMAKE_UIC = uic -L /path/to/plugin +#! [46] + + +#! [47] +QT -= gui # Only the core module is used. +#! [47] + + +#! [48] +unix:RCC_DIR = ../myproject/resources +win32:RCC_DIR = c:/myproject/resources +#! [48] + + +#! [49] +SOURCES = myclass.cpp \ + login.cpp \ + mainwindow.cpp +#! [49] + + +#! [50] +SUBDIRS = kernel \ + tools +#! [50] + + +#! [51] +CONFIG += ordered +#! [51] + + +#! [52] +TEMPLATE = app +TARGET = myapp +SOURCES = main.cpp +#! [52] + + +#! [53] +TEMPLATE = lib +SOURCES = main.cpp +TARGET = mylib +#! [53] + + +#! [54] +unix:UI_DIR = ../myproject/ui +win32:UI_DIR = c:/myproject/ui +#! [54] + + +#! [55] +unix:UI_HEADERS_DIR = ../myproject/ui/include +win32:UI_HEADERS_DIR = c:/myproject/ui/include +#! [55] + + +#! [56] +unix:UI_SOURCES_DIR = ../myproject/ui/src +win32:UI_SOURCES_DIR = c:/myproject/ui/src +#! [56] + + +#! [57] +VERSION = 1.2.3 +#! [57] + + +#! [58] +YACCSOURCES = moc.y +#! [58] + + +#! [59] +FILE = /etc/passwd +FILENAME = $$basename(FILE) #passwd +#! [59] + + +#! [60] +CONFIG = debug +CONFIG += release +CONFIG(release, debug|release):message(Release build!) #will print +CONFIG(debug, debug|release):message(Debug build!) #no print +#! [60] + + +#! [61] +contains( drivers, network ) { + # drivers contains 'network' + message( "Configuring for network build..." ) + HEADERS += network.h + SOURCES += network.cpp +} +#! [61] + + +#! [62] +error(An error has occurred in the configuration process.) +#! [62] + + +#! [63] +exists( $(QTDIR)/lib/libqt-mt* ) { + message( "Configuring for multi-threaded Qt..." ) + CONFIG += thread +} +#! [63] + + +#! [64] +MY_VAR = one two three four +MY_VAR2 = $$join(MY_VAR, " -L", -L) -Lfive +MY_VAR3 = $$member(MY_VAR, 2) $$find(MY_VAR, t.*) +#! [64] + + +#! [65] +LIST = 1 2 3 +for(a, LIST):exists(file.$${a}):message(I see a file.$${a}!) +#! [65] + + +#! [66] +include( shared.pri ) +OPTIONS = standard custom +!include( options.pri ) { + message( "No custom build options specified" ) +OPTIONS -= custom +} +#! [66] + + +#! [67] +isEmpty( CONFIG ) { +CONFIG += qt warn_on debug +} +#! [67] + + +#! [68] +message( "This is a message" ) +#! [68] + + +#! [69] +!build_pass:message( "This is a message" ) +#! [69] + + +#! [70] +This is a test. +#! [70] + + +#! [71] +system(ls /bin):HAS_BIN=FALSE +#! [71] + + +#! [72] +UNAME = $$system(uname -s) +contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me ) +#! [72] + + +#! [73] +ARGS = 1 2 3 2 5 1 +ARGS = $$unique(ARGS) #1 2 3 5 +#! [73] + + +#! [74] +qmake -set VARIABLE VALUE +#! [74] + + +#! [75] +qmake -query VARIABLE +qmake -query #queries all current VARIABLE/VALUE pairs.. +#! [75] + + +#! [76] +qmake -query "1.06a/VARIABLE" +#! [76] + + +#! [77] +qmake -query "QT_INSTALL_PREFIX" +#! [77] + + +#! [78] +QMAKE_VERS = $$[QMAKE_VERSION] +#! [78] + + +#! [79] +documentation.path = /usr/local/program/doc +documentation.files = docs/* +#! [79] + + +#! [80] +INSTALLS += documentation +#! [80] + + +#! [81] +unix:documentation.extra = create_docs; mv master.doc toc.doc +#! [81] + + +#! [82] +target.path = /usr/local/myprogram +INSTALLS += target +#! [82] + + +#! [83] +CONFIG += create_prl +#! [83] + + +#! [84] +CONFIG += link_prl +#! [84] + + +#! [85] +QMAKE_EXT_MOC = .mymoc +#! [85] + + +#! [86] +mytarget.target = .buildfile +mytarget.commands = touch $$mytarget.target +mytarget.depends = mytarget2 + +mytarget2.commands = @echo Building $$mytarget.target +#! [86] + + +#! [87] +QMAKE_EXTRA_TARGETS += mytarget mytarget2 +#! [87] + + +#! [88] +new_moc.output = moc_${QMAKE_FILE_BASE}.cpp +new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} +new_moc.depend_command = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,," +new_moc.input = NEW_HEADERS +QMAKE_EXTRA_COMPILERS += new_moc +#! [88] + + +#! [89] +TARGET = myapp +#! [89] + + +#! [90] +DEFINES += QT_DLL +#! [90] + + +#! [91] +DEFINES -= QT_DLL +#! [91] + + +#! [92] +DEFINES *= QT_DLL +#! [92] + + +#! [93] +DEFINES ~= s/QT_[DT].+/QT +#! [93] + + +#! [94] +EVERYTHING = $$SOURCES $$HEADERS +message("The project contains the following files:") +message($$EVERYTHING) +#! [94] + + +#! [95] +win32:DEFINES += QT_DLL +#! [95] + + +#! [96] +win32:xml { + message(Building for Windows) + SOURCES += xmlhandler_win.cpp +} else:xml { + SOURCES += xmlhandler.cpp +} else { + message("Unknown configuration") +} +#! [96] + + +#! [97] +MY_VARIABLE = value +#! [97] + + +#! [98] +MY_DEFINES = $$DEFINES +#! [98] + + +#! [99] +MY_DEFINES = $${DEFINES} +#! [99] + + +#! [100] +TARGET = myproject_$${TEMPLATE} +#! [100] + + +#! [101] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [101] + + +#! [102] +defineReplace(functionName){ + #function code +} +#! [102] + + +#! [103] +CONFIG += myfeatures +#! [103] + + +#! [105] +PRECOMPILED_HEADER = stable.h +#! [105] + + +#! [106] +precompile_header:!isEmpty(PRECOMPILED_HEADER) { +DEFINES += USING_PCH +} +#! [106] + + +#! [107] +PRECOMPILED_HEADER = window.h +SOURCES = window.cpp +#! [107] + + +#! [108] +SOURCES += hello.cpp +#! [108] + + +#! [109] +SOURCES += hello.cpp +SOURCES += main.cpp +#! [109] + + +#! [110] +SOURCES = hello.cpp \ + main.cpp +#! [110] + + +#! [111] +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [111] + + +#! [112] +TARGET = helloworld +#! [112] + + +#! [113] +CONFIG += qt +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [113] + + +#! [114] +qmake -o Makefile hello.pro +#! [114] + + +#! [115] +qmake -tp vc hello.pro +#! [115] + + +#! [116] +CONFIG += qt debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [116] + + +#! [117] +win32 { + SOURCES += hellowin.cpp +} +#! [117] + + +#! [118] +CONFIG += qt debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +#! [118] + + +#! [119] +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +#! [119] + + +#! [120] +CONFIG += qt debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +#! [120] + + +#! [121] +win32 { + debug { + CONFIG += console + } +} +#! [121] + + +#! [122] +CONFIG += qt debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +win32:debug { + CONFIG += console +} +#! [122] + + +#! [123] +TEMPLATE = app +DESTDIR = c:/helloapp +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +DEFINES += QT_DLL +CONFIG += qt warn_on release +#! [123] + + +#! [124] +make all +#! [124] + + +#! [125] +make +#! [125] + + +#! [126] +make install +#! [126] + + +#! [127] +CONFIG(debug, debug|release) { + mac: TARGET = $$join(TARGET,,,_debug) + win32: TARGET = $$join(TARGET,,d) +} +#! [127] + +#! [128] +customplugin.sources = customimageplugin.dll +customplugin.sources += c:\myplugins\othercustomimageplugin.dll +customplugin.path = imageformats +dynamiclibrary.sources = mylib.dll helper.exe +dynamiclibrary.path = \sys\bin +globalplugin.sources = someglobalimageplugin.dll +globalplugin.path = \resource\qt\plugins\imageformats +DEPLOYMENT += customplugin dynamiclibrary globalplugin +#! [128] + +#! [129] +TARGET.EPOCALLOWDLLDATA = 1 +#! [129] + +#! [130] +TARGET.EPOCHEAPSIZE = 10000 10000000 +TARGET.EPOCSTACKSIZE = 0x8000 +#! [130] + +#! [131] +QMAKE_CXXFLAGS.CW += -O2 +QMAKE_CXXFLAGS.ARMCC += -O0 +#! [131] + +#! [132] +TARGET.UID2 = 0x00000001 +TARGET.UID3 = 0x00000002 +TARGET.SID = 0x00000003 +TARGET.VID = 0x00000004 +#! [132] + +#! [133] +TARGET.CAPABILITY += AllFiles +#! [133] + +#! [134] +TARGET.CAPABILITY = ALL -TCB -DRM -AllFiles +#! [134] + +#! [135] +TARGET.EPOCHEAPSIZE = 10000 10000000 +#! [135] + +#! [136] +TARGET.EPOCSTACKSIZE = 0x8000 +#! [136] + +#! [137] +MMP_RULES += "DEFFILE hello.def" +#! [137] + +#! [138] +myBlock = \ +"START RESOURCE foo.rss" \ +"TARGET bar" \ +"TARGETPATH private\10001234" \ +"HEADER" \ +"LANG 01" \ +"UID 0x10002345 0x10003456" \ +"END" + +MMP_RULES += myBlock +#! [138] + +#! [139] +myIfdefBlock = \ +"$${LITERAL_HASH}ifdef WINSCW" \ +"DEFFILE hello_winscw.def" \ +"$${LITERAL_HASH}endif" + +MMP_RULES += myIfdefBlock +#! [139] + +#! [140] +somelib.sources = somelib.dll +somelib.path = \sys\bin +somelib.pkg_prerules = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \ + "(0x87654321), 1, *, * ~ 2, 2, 0, {\"Some Other Package\"}" +justdep.pkg_prerules = "(0xAAAABBBB), 0, 2, 0, {\"My Framework\"}" +DEPLOYMENT += somelib justdep +#! [140] + +#! [141] +default_deployment.pkg_prerules -= pkg_platform_dependencies +my_deployment.pkg_prerules = "[0x11223344],0,0,0,{\"SomeSpecificDeviceID\"}" +DEPLOYMENT += my_deployment +#! [141] + +#! [142] +DEPLOYMENT_PLUGIN += qjpeg +#! [142] + +#! [143] +myextension = \ + "start extension myextension" \ + "$${LITERAL_HASH}if defined(WINSCW)" \ + "option MYOPTION foo" \ + "$${LITERAL_HASH}endif" \ + "option MYOPTION bar" \ + "end" +BLD_INF_RULES.prj_extensions += myextension +#! [143] + +#! [144] +RSS_RULES += "hidden = KAppIsHidden;" +#! [144] + +#! [145] +myrssrules = \ + "hidden = KAppIsHidden;" \ + "launch = KAppLaunchInBackground;" \ +RSS_RULES += myrssrules +#! [145] + +#! [146] +DEPLOYMENT.installer_header = 0x12345678 +#! [146] + +#! [147] +DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"My Application Installer\"},(0x12345678),1,0,0" +#! [147] + +#! [148] +# Set conditional libraries +LIB.MARM = "LIBRARY myarm.lib" +LIB.WINSCW = "LIBRARY mywinscw.lib" +LIB.default = "LIBRARY mydefault.lib" + +# Add the conditional MMP rules +MYCONDITIONS = MARM WINSCW +MYVARIABLES = LIB + +addMMPRules(MYCONDITIONS, MYVARIABLES) +#! [148] + +#! [149] +SUBDIRS += my_executable my_library +my_executable.subdir = app +my_executable.depends = my_library +my_library.subdir = lib +#! [149] + +#! [150] +symbian { + SUBDIRS += emulator_dll + emulator_dll.condition = WINSCW +} +#! [150] + +#! [151] +RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" +RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" +#! [151] + +#! [152] +my_exports = \ + "foo.h /epoc32/include/mylib/foo.h" \ + "bar.h /epoc32/include/mylib/bar.h" +BLD_INF_RULES.prj_exports += my_exports +#! [152] + +#! [153] +my_note.pkg_postrules.installer = "\"myinstallnote.txt\" - \"\", FILETEXT, TEXTCONTINUE" +DEPLOYMENT += my_note +#! [153] + +#! [154] +DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_deployment +#! [154] + +#! [155] +default_bin_deployment.flags += FILERUN RUNINSTALL +dep_note.sources = install_note.txt +dep_note.flags = FILETEXT TEXTEXIT +DEPLOYMENT += dep_note +#! [155] + +#! [156] +DEPLOYMENT.display_name = My Qt App +#! [156] diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc deleted file mode 100644 index fb71e39..0000000 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ /dev/null @@ -1,1031 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -make all -//! [0] - - -//! [1] -CONFIG += qt thread debug -//! [1] - - -//! [2] -CONFIG += qt -QT += network xml -//! [2] - - -//! [3] -QT = network xml # This will omit the core and gui modules. -//! [3] - - -//! [4] -QT -= gui # Only the core module is used. -//! [4] - - -//! [5] -CONFIG += link_pkgconfig -PKGCONFIG += ogg dbus-1 -//! [5] - - -//! [6] -LIBS += -L/usr/local/lib -lmath -//! [6] - - -//! [7] -INCLUDEPATH = c:/msdev/include d:/stl/include -//! [7] - - -//! [8] -qmake [mode] [options] files -//! [8] - - -//! [9] -qmake -makefile [options] files -//! [9] - - -//! [10] -qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro -//! [10] - - -//! [11] -qmake "CONFIG+=test" test.pro -//! [11] - - -//! [12] -qmake -project [options] files -//! [12] - - -//! [13] -qmake -spec macx-g++ -//! [13] - - -//! [14] -QMAKE_LFLAGS += -F/path/to/framework/directory/ -//! [14] - - -//! [15] -LIBS += -framework TheFramework -//! [15] - - -//! [16] -TEMPLATE = lib -CONFIG += lib_bundle -//! [16] - - -//! [17] -FRAMEWORK_HEADERS.version = Versions -FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h -FRAMEWORK_HEADERS.path = Headers -QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS -//! [17] - - -//! [18] -CONFIG += x86 ppc -//! [18] - - -//! [19] -qmake -spec macx-xcode project.pro -//! [19] - - -//! [20] -qmake -tp vc -//! [20] - - -//! [21] -qmake -tp vc -r -//! [21] - - -//! [22] -CONFIG -= embed_manifest_exe -//! [22] - - -//! [23] -CONFIG -= embed_manifest_dll -//! [23] - - -//! [24] -make all -//! [24] - - -//! [25] -build_pass:CONFIG(debug, debug|release) { - unix: TARGET = $$join(TARGET,,,_debug) - else: TARGET = $$join(TARGET,,,d) -} -//! [25] - - -//! [26] -CONFIG += qt console newstuff -... -newstuff { - SOURCES += new.cpp - HEADERS += new.h -} -//! [26] - - -//! [27] -DEFINES += USE_MY_STUFF QT_DLL -//! [27] - - -//! [28] -myFiles.sources = path\*.png -DEPLOYMENT += myFiles -//! [28] - - -//! [29] -myFiles.sources = path\file1.ext1 path2\file2.ext1 path3\* -myFiles.path = \some\path\on\device -someother.sources = C:\additional\files\* -someother.path = \myFiles\path2 -DEPLOYMENT += myFiles someother -//! [29] - - -//! [30] -DESTDIR = ../../lib -//! [30] - - -//! [31] -DISTFILES += ../program.txt -//! [31] - - -//! [32] -FORMS = mydialog.ui \ - mywidget.ui \ - myconfig.ui -//! [32] - - -//! [33] -FORMS3 = my_uic3_dialog.ui \ - my_uic3_widget.ui \ - my_uic3_config.ui -//! [33] - - -//! [34] -HEADERS = myclass.h \ - login.h \ - mainwindow.h -//! [34] - - -//! [35] -INCLUDEPATH = c:/msdev/include d:/stl/include -//! [35] - - -//! [36] -target.path += $$[QT_INSTALL_PLUGINS]/imageformats -INSTALLS += target -//! [36] - - -//! [37] -LEXSOURCES = lexer.l -//! [37] - - -//! [38] -unix:LIBS += -L/usr/local/lib -lmath -win32:LIBS += c:/mylibs/math.lib -//! [38] - - -//! [39] -CONFIG += no_lflags_merge -//! [39] - - -//! [40] -unix:MOC_DIR = ../myproject/tmp -win32:MOC_DIR = c:/myproject/tmp -//! [40] - - -//! [41] -unix:OBJECTS_DIR = ../myproject/tmp -win32:OBJECTS_DIR = c:/myproject/tmp -//! [41] - - -//! [42] -app { - # Conditional code for 'app' template here -} -//! [42] - - -//! [43] -FRAMEWORK_HEADERS.version = Versions -FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h -FRAMEWORK_HEADERS.path = Headers -QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS -//! [43] - - -//! [44] -QMAKE_BUNDLE_EXTENSION = .myframework -//! [44] - - -//! [45] -QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9 -//! [45] - - -//! [46] -QMAKE_UIC = uic -L /path/to/plugin -//! [46] - - -//! [47] -QT -= gui # Only the core module is used. -//! [47] - - -//! [48] -unix:RCC_DIR = ../myproject/resources -win32:RCC_DIR = c:/myproject/resources -//! [48] - - -//! [49] -SOURCES = myclass.cpp \ - login.cpp \ - mainwindow.cpp -//! [49] - - -//! [50] -SUBDIRS = kernel \ - tools -//! [50] - - -//! [51] -CONFIG += ordered -//! [51] - - -//! [52] -TEMPLATE = app -TARGET = myapp -SOURCES = main.cpp -//! [52] - - -//! [53] -TEMPLATE = lib -SOURCES = main.cpp -TARGET = mylib -//! [53] - - -//! [54] -unix:UI_DIR = ../myproject/ui -win32:UI_DIR = c:/myproject/ui -//! [54] - - -//! [55] -unix:UI_HEADERS_DIR = ../myproject/ui/include -win32:UI_HEADERS_DIR = c:/myproject/ui/include -//! [55] - - -//! [56] -unix:UI_SOURCES_DIR = ../myproject/ui/src -win32:UI_SOURCES_DIR = c:/myproject/ui/src -//! [56] - - -//! [57] -VERSION = 1.2.3 -//! [57] - - -//! [58] -YACCSOURCES = moc.y -//! [58] - - -//! [59] -FILE = /etc/passwd -FILENAME = $$basename(FILE) #passwd -//! [59] - - -//! [60] -CONFIG = debug -CONFIG += release -CONFIG(release, debug|release):message(Release build!) #will print -CONFIG(debug, debug|release):message(Debug build!) #no print -//! [60] - - -//! [61] -contains( drivers, network ) { - # drivers contains 'network' - message( "Configuring for network build..." ) - HEADERS += network.h - SOURCES += network.cpp -} -//! [61] - - -//! [62] -error(An error has occurred in the configuration process.) -//! [62] - - -//! [63] -exists( $(QTDIR)/lib/libqt-mt* ) { - message( "Configuring for multi-threaded Qt..." ) - CONFIG += thread -} -//! [63] - - -//! [64] -MY_VAR = one two three four -MY_VAR2 = $$join(MY_VAR, " -L", -L) -Lfive -MY_VAR3 = $$member(MY_VAR, 2) $$find(MY_VAR, t.*) -//! [64] - - -//! [65] -LIST = 1 2 3 -for(a, LIST):exists(file.$${a}):message(I see a file.$${a}!) -//! [65] - - -//! [66] -include( shared.pri ) -OPTIONS = standard custom -!include( options.pri ) { - message( "No custom build options specified" ) -OPTIONS -= custom -} -//! [66] - - -//! [67] -isEmpty( CONFIG ) { -CONFIG += qt warn_on debug -} -//! [67] - - -//! [68] -message( "This is a message" ) -//! [68] - - -//! [69] -!build_pass:message( "This is a message" ) -//! [69] - - -//! [70] -This is a test. -//! [70] - - -//! [71] -system(ls /bin):HAS_BIN=FALSE -//! [71] - - -//! [72] -UNAME = $$system(uname -s) -contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me ) -//! [72] - - -//! [73] -ARGS = 1 2 3 2 5 1 -ARGS = $$unique(ARGS) #1 2 3 5 -//! [73] - - -//! [74] -qmake -set VARIABLE VALUE -//! [74] - - -//! [75] -qmake -query VARIABLE -qmake -query #queries all current VARIABLE/VALUE pairs.. -//! [75] - - -//! [76] -qmake -query "1.06a/VARIABLE" -//! [76] - - -//! [77] -qmake -query "QT_INSTALL_PREFIX" -//! [77] - - -//! [78] -QMAKE_VERS = $$[QMAKE_VERSION] -//! [78] - - -//! [79] -documentation.path = /usr/local/program/doc -documentation.files = docs/* -//! [79] - - -//! [80] -INSTALLS += documentation -//! [80] - - -//! [81] -unix:documentation.extra = create_docs; mv master.doc toc.doc -//! [81] - - -//! [82] -target.path = /usr/local/myprogram -INSTALLS += target -//! [82] - - -//! [83] -CONFIG += create_prl -//! [83] - - -//! [84] -CONFIG += link_prl -//! [84] - - -//! [85] -QMAKE_EXT_MOC = .mymoc -//! [85] - - -//! [86] -mytarget.target = .buildfile -mytarget.commands = touch $$mytarget.target -mytarget.depends = mytarget2 - -mytarget2.commands = @echo Building $$mytarget.target -//! [86] - - -//! [87] -QMAKE_EXTRA_TARGETS += mytarget mytarget2 -//! [87] - - -//! [88] -new_moc.output = moc_${QMAKE_FILE_BASE}.cpp -new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} -new_moc.depend_command = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,," -new_moc.input = NEW_HEADERS -QMAKE_EXTRA_COMPILERS += new_moc -//! [88] - - -//! [89] -TARGET = myapp -//! [89] - - -//! [90] -DEFINES += QT_DLL -//! [90] - - -//! [91] -DEFINES -= QT_DLL -//! [91] - - -//! [92] -DEFINES *= QT_DLL -//! [92] - - -//! [93] -DEFINES ~= s/QT_[DT].+/QT -//! [93] - - -//! [94] -EVERYTHING = $$SOURCES $$HEADERS -message("The project contains the following files:") -message($$EVERYTHING) -//! [94] - - -//! [95] -win32:DEFINES += QT_DLL -//! [95] - - -//! [96] -win32:xml { - message(Building for Windows) - SOURCES += xmlhandler_win.cpp -} else:xml { - SOURCES += xmlhandler.cpp -} else { - message("Unknown configuration") -} -//! [96] - - -//! [97] -MY_VARIABLE = value -//! [97] - - -//! [98] -MY_DEFINES = $$DEFINES -//! [98] - - -//! [99] -MY_DEFINES = $${DEFINES} -//! [99] - - -//! [100] -TARGET = myproject_$${TEMPLATE} -//! [100] - - -//! [101] -target.path = $$[QT_INSTALL_PLUGINS]/designer -INSTALLS += target -//! [101] - - -//! [102] -defineReplace(functionName){ - #function code -} -//! [102] - - -//! [103] -CONFIG += myfeatures -//! [103] - - -//! [104] -// Add C includes here - -#if defined __cplusplus -// Add C++ includes here -#include -#include -#include -#include // Qt includes -#include -#include -#include "thirdparty/include/libmain.h" -#include "my_stable_class.h" -... -#endif -//! [104] - - -//! [105] -PRECOMPILED_HEADER = stable.h -//! [105] - - -//! [106] -precompile_header:!isEmpty(PRECOMPILED_HEADER) { -DEFINES += USING_PCH -} -//! [106] - - -//! [107] -PRECOMPILED_HEADER = window.h -SOURCES = window.cpp -//! [107] - - -//! [108] -SOURCES += hello.cpp -//! [108] - - -//! [109] -SOURCES += hello.cpp -SOURCES += main.cpp -//! [109] - - -//! [110] -SOURCES = hello.cpp \ - main.cpp -//! [110] - - -//! [111] -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -//! [111] - - -//! [112] -TARGET = helloworld -//! [112] - - -//! [113] -CONFIG += qt -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -//! [113] - - -//! [114] -qmake -o Makefile hello.pro -//! [114] - - -//! [115] -qmake -tp vc hello.pro -//! [115] - - -//! [116] -CONFIG += qt debug -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -//! [116] - - -//! [117] -win32 { - SOURCES += hellowin.cpp -} -//! [117] - - -//! [118] -CONFIG += qt debug -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -win32 { - SOURCES += hellowin.cpp -} -unix { - SOURCES += hellounix.cpp -} -//! [118] - - -//! [119] -!exists( main.cpp ) { - error( "No main.cpp file found" ) -} -//! [119] - - -//! [120] -CONFIG += qt debug -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -win32 { - SOURCES += hellowin.cpp -} -unix { - SOURCES += hellounix.cpp -} -!exists( main.cpp ) { - error( "No main.cpp file found" ) -} -//! [120] - - -//! [121] -win32 { - debug { - CONFIG += console - } -} -//! [121] - - -//! [122] -CONFIG += qt debug -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -win32 { - SOURCES += hellowin.cpp -} -unix { - SOURCES += hellounix.cpp -} -!exists( main.cpp ) { - error( "No main.cpp file found" ) -} -win32:debug { - CONFIG += console -} -//! [122] - - -//! [123] -TEMPLATE = app -DESTDIR = c:/helloapp -HEADERS += hello.h -SOURCES += hello.cpp -SOURCES += main.cpp -DEFINES += QT_DLL -CONFIG += qt warn_on release -//! [123] - - -//! [124] -make all -//! [124] - - -//! [125] -make -//! [125] - - -//! [126] -make install -//! [126] - - -//! [127] -CONFIG(debug, debug|release) { - mac: TARGET = $$join(TARGET,,,_debug) - win32: TARGET = $$join(TARGET,,d) -} -//! [127] - -//! [128] -customplugin.sources = customimageplugin.dll -customplugin.sources += c:\myplugins\othercustomimageplugin.dll -customplugin.path = imageformats -dynamiclibrary.sources = mylib.dll helper.exe -dynamiclibrary.path = \sys\bin -globalplugin.sources = someglobalimageplugin.dll -globalplugin.path = \resource\qt\plugins\imageformats -DEPLOYMENT += customplugin dynamiclibrary globalplugin -//! [128] - -//! [129] -TARGET.EPOCALLOWDLLDATA = 1 -//! [129] - -//! [130] -TARGET.EPOCHEAPSIZE = 10000 10000000 -TARGET.EPOCSTACKSIZE = 0x8000 -//! [130] - -//! [131] -QMAKE_CXXFLAGS.CW += -O2 -QMAKE_CXXFLAGS.ARMCC += -O0 -//! [131] - -//! [132] -TARGET.UID2 = 0x00000001 -TARGET.UID3 = 0x00000002 -TARGET.SID = 0x00000003 -TARGET.VID = 0x00000004 -//! [132] - -//! [133] -TARGET.CAPABILITY += AllFiles -//! [133] - -//! [134] -TARGET.CAPABILITY = ALL -TCB -DRM -AllFiles -//! [134] - -//! [135] -TARGET.EPOCHEAPSIZE = 10000 10000000 -//! [135] - -//! [136] -TARGET.EPOCSTACKSIZE = 0x8000 -//! [136] - -//! [137] -MMP_RULES += "DEFFILE hello.def" -//! [137] - -//! [138] -myBlock = \ -"START RESOURCE foo.rss" \ -"TARGET bar" \ -"TARGETPATH private\10001234" \ -"HEADER" \ -"LANG 01" \ -"UID 0x10002345 0x10003456" \ -"END" - -MMP_RULES += myBlock -//! [138] - -//! [139] -myIfdefBlock = \ -"$${LITERAL_HASH}ifdef WINSCW" \ -"DEFFILE hello_winscw.def" \ -"$${LITERAL_HASH}endif" - -MMP_RULES += myIfdefBlock -//! [139] - -//! [140] -somelib.sources = somelib.dll -somelib.path = \sys\bin -somelib.pkg_prerules = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \ - "(0x87654321), 1, *, * ~ 2, 2, 0, {\"Some Other Package\"}" -justdep.pkg_prerules = "(0xAAAABBBB), 0, 2, 0, {\"My Framework\"}" -DEPLOYMENT += somelib justdep -//! [140] - -//! [141] -default_deployment.pkg_prerules -= pkg_platform_dependencies -my_deployment.pkg_prerules = "[0x11223344],0,0,0,{\"SomeSpecificDeviceID\"}" -DEPLOYMENT += my_deployment -//! [141] - -//! [142] -DEPLOYMENT_PLUGIN += qjpeg -//! [142] - -//! [143] -myextension = \ - "start extension myextension" \ - "$${LITERAL_HASH}if defined(WINSCW)" \ - "option MYOPTION foo" \ - "$${LITERAL_HASH}endif" \ - "option MYOPTION bar" \ - "end" -BLD_INF_RULES.prj_extensions += myextension -//! [143] - -//! [144] -RSS_RULES += "hidden = KAppIsHidden;" -//! [144] - -//! [145] -myrssrules = \ - "hidden = KAppIsHidden;" \ - "launch = KAppLaunchInBackground;" \ -RSS_RULES += myrssrules -//! [145] - -//! [146] -DEPLOYMENT.installer_header = 0x12345678 -//! [146] - -//! [147] -DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"My Application Installer\"},(0x12345678),1,0,0" -//! [147] - -//! [148] -# Set conditional libraries -LIB.MARM = "LIBRARY myarm.lib" -LIB.WINSCW = "LIBRARY mywinscw.lib" -LIB.default = "LIBRARY mydefault.lib" - -# Add the conditional MMP rules -MYCONDITIONS = MARM WINSCW -MYVARIABLES = LIB - -addMMPRules(MYCONDITIONS, MYVARIABLES) -//! [148] - -//! [149] -SUBDIRS += my_executable my_library -my_executable.subdir = app -my_executable.depends = my_library -my_library.subdir = lib -//! [149] - -//! [150] -symbian { - SUBDIRS += emulator_dll - emulator_dll.condition = WINSCW -} -//! [150] - -//! [151] -RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" -RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" -//! [151] - -//! [152] -my_exports = \ - "foo.h /epoc32/include/mylib/foo.h" \ - "bar.h /epoc32/include/mylib/bar.h" -BLD_INF_RULES.prj_exports += my_exports -//! [152] - -//! [153] -my_note.pkg_postrules.installer = "\"myinstallnote.txt\" - \"\", FILETEXT, TEXTCONTINUE" -DEPLOYMENT += my_note -//! [153] - -//! [154] -DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_deployment -//! [154] - -//! [155] -default_bin_deployment.flags += FILERUN RUNINSTALL -dep_note.sources = install_note.txt -dep_note.flags = FILETEXT TEXTEXIT -DEPLOYMENT += dep_note -//! [155] - -//! [156] -DEPLOYMENT.display_name = My Qt App -//! [156] diff --git a/doc/src/snippets/code/doc_src_qnamespace.cpp b/doc/src/snippets/code/doc_src_qnamespace.cpp new file mode 100644 index 0000000..c512862 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qnamespace.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +enum CustomEventPriority +{ + // An important event + ImportantEventPriority = Qt::HighEventPriority, + + // A more important event + MoreImportantEventPriority = ImportantEventPriority + 1, + + // A critical event + CriticalEventPriority = 100 * MoreImportantEventPriority, + + // Not that important + StatusEventPriority = Qt::LowEventPriority, + + // These are less important than Status events + IdleProcessingDoneEventPriority = StatusEventPriority - 1 +}; +//! [1] diff --git a/doc/src/snippets/code/doc_src_qnamespace.qdoc b/doc/src/snippets/code/doc_src_qnamespace.qdoc index a1bd0b7..6b5ce6a 100644 --- a/doc/src/snippets/code/doc_src_qnamespace.qdoc +++ b/doc/src/snippets/code/doc_src_qnamespace.qdoc @@ -41,24 +41,3 @@ //! [0] QObject::connect: Cannot queue arguments of type 'MyType' //! [0] - - -//! [1] -enum CustomEventPriority -{ - // An important event - ImportantEventPriority = Qt::HighEventPriority, - - // A more important event - MoreImportantEventPriority = ImportantEventPriority + 1, - - // A critical event - CriticalEventPriority = 100 * MoreImportantEventPriority, - - // Not that important - StatusEventPriority = Qt::LowEventPriority, - - // These are less important than Status events - IdleProcessingDoneEventPriority = StatusEventPriority - 1 -}; -//! [1] diff --git a/doc/src/snippets/code/doc_src_qpair.cpp b/doc/src/snippets/code/doc_src_qpair.cpp new file mode 100644 index 0000000..a9a061e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qpair.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QPair pair; +//! [0] + + +//! [1] +pair.first = "pi"; +pair.second = 3.14159265358979323846; +//! [1] + + +//! [2] +QList > list; +list.append(qMakePair(66, 3.14159)); +//! [2] diff --git a/doc/src/snippets/code/doc_src_qpair.qdoc b/doc/src/snippets/code/doc_src_qpair.qdoc deleted file mode 100644 index a9a061e..0000000 --- a/doc/src/snippets/code/doc_src_qpair.qdoc +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QPair pair; -//! [0] - - -//! [1] -pair.first = "pi"; -pair.second = 3.14159265358979323846; -//! [1] - - -//! [2] -QList > list; -list.append(qMakePair(66, 3.14159)); -//! [2] diff --git a/doc/src/snippets/code/doc_src_qplugin.cpp b/doc/src/snippets/code/doc_src_qplugin.cpp new file mode 100644 index 0000000..fdacc08 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qplugin.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +namespace Foo +{ + struct MyInterface { ... }; +} + +Q_DECLARE_INTERFACE(Foo::MyInterface, "org.examples.MyInterface") +//! [0] + + +//! [1] +Q_EXPORT_PLUGIN2(pnp_extrafilters, ExtraFiltersPlugin) +//! [1] + + +//! [2] +Q_IMPORT_PLUGIN(qjpeg) +//! [2] + + +//! [3] +TEMPLATE = app +QTPLUGIN += qjpeg qgif qmng # image formats +//! [3] diff --git a/doc/src/snippets/code/doc_src_qplugin.pro b/doc/src/snippets/code/doc_src_qplugin.pro new file mode 100644 index 0000000..f3444e2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qplugin.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [3] +TEMPLATE = app +QTPLUGIN += qjpeg qgif qmng # image formats +#! [3] diff --git a/doc/src/snippets/code/doc_src_qplugin.qdoc b/doc/src/snippets/code/doc_src_qplugin.qdoc deleted file mode 100644 index fdacc08..0000000 --- a/doc/src/snippets/code/doc_src_qplugin.qdoc +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -namespace Foo -{ - struct MyInterface { ... }; -} - -Q_DECLARE_INTERFACE(Foo::MyInterface, "org.examples.MyInterface") -//! [0] - - -//! [1] -Q_EXPORT_PLUGIN2(pnp_extrafilters, ExtraFiltersPlugin) -//! [1] - - -//! [2] -Q_IMPORT_PLUGIN(qjpeg) -//! [2] - - -//! [3] -TEMPLATE = app -QTPLUGIN += qjpeg qgif qmng # image formats -//! [3] diff --git a/doc/src/snippets/code/doc_src_qset.cpp b/doc/src/snippets/code/doc_src_qset.cpp new file mode 100644 index 0000000..4a4953d --- /dev/null +++ b/doc/src/snippets/code/doc_src_qset.cpp @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QSet set; +//! [0] + + +//! [1] +set.insert("one"); +set.insert("three"); +set.insert("seven"); +//! [1] + + +//! [2] +set << "twelve" << "fifteen" << "nineteen"; +//! [2] + + +//! [3] +if (!set.contains("ninety-nine")) + ... +//! [3] + + +//! [4] +QSetIterator i(set); +while (i.hasNext()) + qDebug() << i.next(); +//! [4] + + +//! [5] +QSet::const_iterator i = set.constBegin(); +while (i != set.constEnd()) { + qDebug() << *i; + ++i; +} +//! [5] + + +//! [6] +QSet set; +... +foreach (const QString &value, set) + qDebug() << value; +//! [6] + + +//! [7] +QSet set; +set.reserve(20000); +for (int i = 0; i < 20000; ++i) + set.insert(values[i]); +//! [7] + + +//! [8] +QSet set; +set << "January" << "February" << ... << "December"; + +QSet::iterator i; +for (i = set.begin(); i != set.end(); ++i) + qDebug() << *i; +//! [8] + + +//! [9] +QSet set; +set << "January" << "February" << ... << "December"; + +QSet::iterator i = set.begin(); +while (i != set.end()) { + if ((*i).startsWith('J')) { + i = set.erase(i); + } else { + ++i; + } +} +//! [9] + + +//! [10] +QSet set; +... +QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); +if (it != set.end()) + cout << "Found Jeanette" << endl; +//! [10] + + +//! [11] +QSet set; +set << "January" << "February" << ... << "December"; + +QSet::const_iterator i; +for (i = set.begin(); i != set.end(); ++i) + qDebug() << *i; +//! [11] + + +//! [12] +QSet set; +... +QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); +if (it != set.constEnd()) + cout << "Found Jeanette" << endl; +//! [12] + + +//! [13] +QSet set; +set << "red" << "green" << "blue" << ... << "black"; + +QList list = set.toList(); +qSort(list); +//! [13] + + +//! [14] +QStringList list; +list << "Julia" << "Mike" << "Mike" << "Julia" << "Julia"; + +QSet set = QSet::fromList(list); +set.contains("Julia"); // returns true +set.contains("Mike"); // returns true +set.size(); // returns 2 +//! [14] diff --git a/doc/src/snippets/code/doc_src_qset.qdoc b/doc/src/snippets/code/doc_src_qset.qdoc deleted file mode 100644 index 4a4953d..0000000 --- a/doc/src/snippets/code/doc_src_qset.qdoc +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QSet set; -//! [0] - - -//! [1] -set.insert("one"); -set.insert("three"); -set.insert("seven"); -//! [1] - - -//! [2] -set << "twelve" << "fifteen" << "nineteen"; -//! [2] - - -//! [3] -if (!set.contains("ninety-nine")) - ... -//! [3] - - -//! [4] -QSetIterator i(set); -while (i.hasNext()) - qDebug() << i.next(); -//! [4] - - -//! [5] -QSet::const_iterator i = set.constBegin(); -while (i != set.constEnd()) { - qDebug() << *i; - ++i; -} -//! [5] - - -//! [6] -QSet set; -... -foreach (const QString &value, set) - qDebug() << value; -//! [6] - - -//! [7] -QSet set; -set.reserve(20000); -for (int i = 0; i < 20000; ++i) - set.insert(values[i]); -//! [7] - - -//! [8] -QSet set; -set << "January" << "February" << ... << "December"; - -QSet::iterator i; -for (i = set.begin(); i != set.end(); ++i) - qDebug() << *i; -//! [8] - - -//! [9] -QSet set; -set << "January" << "February" << ... << "December"; - -QSet::iterator i = set.begin(); -while (i != set.end()) { - if ((*i).startsWith('J')) { - i = set.erase(i); - } else { - ++i; - } -} -//! [9] - - -//! [10] -QSet set; -... -QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); -if (it != set.end()) - cout << "Found Jeanette" << endl; -//! [10] - - -//! [11] -QSet set; -set << "January" << "February" << ... << "December"; - -QSet::const_iterator i; -for (i = set.begin(); i != set.end(); ++i) - qDebug() << *i; -//! [11] - - -//! [12] -QSet set; -... -QSet::iterator it = qFind(set.begin(), set.end(), "Jeanette"); -if (it != set.constEnd()) - cout << "Found Jeanette" << endl; -//! [12] - - -//! [13] -QSet set; -set << "red" << "green" << "blue" << ... << "black"; - -QList list = set.toList(); -qSort(list); -//! [13] - - -//! [14] -QStringList list; -list << "Julia" << "Mike" << "Mike" << "Julia" << "Julia"; - -QSet set = QSet::fromList(list); -set.contains("Julia"); // returns true -set.contains("Mike"); // returns true -set.size(); // returns 2 -//! [14] diff --git a/doc/src/snippets/code/doc_src_qsignalspy.cpp b/doc/src/snippets/code/doc_src_qsignalspy.cpp new file mode 100644 index 0000000..12462e2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qsignalspy.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QCheckBox *box = ...; +QSignalSpy spy(box, SIGNAL(clicked(bool))); + +// do something that triggers the signal +box->animateClick(); + +QCOMPARE(spy.count(), 1); // make sure the signal was emitted exactly one time +QList arguments = spy.takeFirst(); // take the first signal + +QVERIFY(arguments.at(0).toBool() == true); // verify the first argument +//! [0] + + +//! [1] +QSignalSpy spy(myCustomObject, SIGNAL(mySignal(int, QString, double))); + +myCustomObject->doSomething(); // trigger emission of the signal + +QList arguments = spy.takeFirst(); +QVERIFY(arguments.at(0).type() == QVariant::Int); +QVERIFY(arguments.at(1).type() == QVariant::QString); +QVERIFY(arguments.at(2).type() == QVariant::double); +//! [1] + + +//! [2] +qRegisterMetaType("QModelIndex"); +QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex))); +//! [2] + + +//! [3] +// get the first argument from the first received signal: +QModelIndex result = qvariant_cast(spy.at(0).at(0)); +//! [3] + + +//! [4] +QSignalSpy spy(myPushButton, SIGNAL(clicked(bool))); +//! [4] diff --git a/doc/src/snippets/code/doc_src_qsignalspy.qdoc b/doc/src/snippets/code/doc_src_qsignalspy.qdoc deleted file mode 100644 index 12462e2..0000000 --- a/doc/src/snippets/code/doc_src_qsignalspy.qdoc +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QCheckBox *box = ...; -QSignalSpy spy(box, SIGNAL(clicked(bool))); - -// do something that triggers the signal -box->animateClick(); - -QCOMPARE(spy.count(), 1); // make sure the signal was emitted exactly one time -QList arguments = spy.takeFirst(); // take the first signal - -QVERIFY(arguments.at(0).toBool() == true); // verify the first argument -//! [0] - - -//! [1] -QSignalSpy spy(myCustomObject, SIGNAL(mySignal(int, QString, double))); - -myCustomObject->doSomething(); // trigger emission of the signal - -QList arguments = spy.takeFirst(); -QVERIFY(arguments.at(0).type() == QVariant::Int); -QVERIFY(arguments.at(1).type() == QVariant::QString); -QVERIFY(arguments.at(2).type() == QVariant::double); -//! [1] - - -//! [2] -qRegisterMetaType("QModelIndex"); -QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex))); -//! [2] - - -//! [3] -// get the first argument from the first received signal: -QModelIndex result = qvariant_cast(spy.at(0).at(0)); -//! [3] - - -//! [4] -QSignalSpy spy(myPushButton, SIGNAL(clicked(bool))); -//! [4] diff --git a/doc/src/snippets/code/doc_src_qt3support.cpp b/doc/src/snippets/code/doc_src_qt3support.cpp new file mode 100644 index 0000000..196efd4 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt3support.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qt3support.pro b/doc/src/snippets/code/doc_src_qt3support.pro new file mode 100644 index 0000000..20fcc14 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt3support.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += qt3support +#! [1] diff --git a/doc/src/snippets/code/doc_src_qt3support.qdoc b/doc/src/snippets/code/doc_src_qt3support.qdoc deleted file mode 100644 index 9e0f682..0000000 --- a/doc/src/snippets/code/doc_src_qt3support.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -QT += qt3support -//! [1] diff --git a/doc/src/snippets/code/doc_src_qt3to4.cpp b/doc/src/snippets/code/doc_src_qt3to4.cpp new file mode 100644 index 0000000..d8eb5b4 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt3to4.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [2] +using namespace Qt; +//! [2] diff --git a/doc/src/snippets/code/doc_src_qt4-accessibility.cpp b/doc/src/snippets/code/doc_src_qt4-accessibility.cpp new file mode 100644 index 0000000..efbbc5a --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-accessibility.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [environment] +export QT_ACCESSIBILITY=1 +//! [environment] + +//! [0] +class MyWidgetInterface : public QAccessibleWidget +{ +public: + MyWidgetInterface(QWidget *widget, Role role); + + QString text(Text text, int child) const; + State state(int child) const; + QString actionText(int action, Text text, int child) const; + bool doAction(int action, int child, const QVariantList ¶ms); + ... +}; +//! [0] + + +//! [1] +bool MyWidgetInterface::doAction(int action, int child, + const QVariantList ¶ms) +{ + if (child || !widget()->isEnabled()) + return false; + + switch (action) { + case DefaultAction: + case Press: + { + MyWidget *widget = qobject_cast(object()); + if (widget) + widget->click(); + } + return true; + } + return QAccessibleWidget::doAction(action, child, params); +} +//! [1] + + +//! [2] +QStringList MyFactory::keys() const +{ + return QStringList() << "MyWidget" << "MyOtherWidget"; +} + +QAccessibleInterface *MyFactory::create(const QString &className, + QObject *object) +{ + if (classname == "MyWidget") + return new MyWidgetInterface(object); + if (classname == "MyOtherWidget") + return new MyOtherWidgetInterface(object); + return 0; +} + +Q_EXPORT_PLUGIN2(myfactory, MyFactory) +//! [2] diff --git a/doc/src/snippets/code/doc_src_qt4-accessibility.qdoc b/doc/src/snippets/code/doc_src_qt4-accessibility.qdoc deleted file mode 100644 index efbbc5a..0000000 --- a/doc/src/snippets/code/doc_src_qt4-accessibility.qdoc +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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$ -** -****************************************************************************/ - -//! [environment] -export QT_ACCESSIBILITY=1 -//! [environment] - -//! [0] -class MyWidgetInterface : public QAccessibleWidget -{ -public: - MyWidgetInterface(QWidget *widget, Role role); - - QString text(Text text, int child) const; - State state(int child) const; - QString actionText(int action, Text text, int child) const; - bool doAction(int action, int child, const QVariantList ¶ms); - ... -}; -//! [0] - - -//! [1] -bool MyWidgetInterface::doAction(int action, int child, - const QVariantList ¶ms) -{ - if (child || !widget()->isEnabled()) - return false; - - switch (action) { - case DefaultAction: - case Press: - { - MyWidget *widget = qobject_cast(object()); - if (widget) - widget->click(); - } - return true; - } - return QAccessibleWidget::doAction(action, child, params); -} -//! [1] - - -//! [2] -QStringList MyFactory::keys() const -{ - return QStringList() << "MyWidget" << "MyOtherWidget"; -} - -QAccessibleInterface *MyFactory::create(const QString &className, - QObject *object) -{ - if (classname == "MyWidget") - return new MyWidgetInterface(object); - if (classname == "MyOtherWidget") - return new MyOtherWidgetInterface(object); - return 0; -} - -Q_EXPORT_PLUGIN2(myfactory, MyFactory) -//! [2] diff --git a/doc/src/snippets/code/doc_src_qt4-arthur.cpp b/doc/src/snippets/code/doc_src_qt4-arthur.cpp new file mode 100644 index 0000000..6268309 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-arthur.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QLinearGradient gradient(0, 0, 100, 100); +gradient.setColorAt(0, Qt::red); +gradient.setColorAt(0.5, Qt::green); +gradient.setColorAt(1, Qt::blue); +painter.setBrush(gradient); +painter.drawRect(0, 0, 100, 100); +//! [0] + + +//! [1] +QRadialGradient gradient(50, 50, 50, 30, 30); +gradient.setColorAt(0.2, Qt::white); +gradient.setColorAt(0.8, Qt::green); +gradient.setColorAt(1, Qt::black); +painter.setBrush(gradient); +painter.drawEllipse(0, 0, 100, 100); +//! [1] + + +//! [2] +QConicalGradient gradient(60, 40, 0); +gradient.setColorAt(0, Qt::black); +gradient.setColorAt(0.4, Qt::green); +gradient.setColorAt(0.6, Qt::white); +gradient.setColorAt(1, Qt::black); +painter.setBrush(gradient); +painter.drawEllipse(0, 0, 100, 100); +//! [2] + + +//! [3] +// Specfiy semi-transparent red +painter.setBrush(QColor(255, 0, 0, 127)); +painter.drawRect(0, 0, width()/2, height()); + +// Specify semi-transparend blue +painter.setBrush(QColor(0, 0, 255, 127)); +painter.drawRect(0, 0, width(), height()/2); +//! [3] + + +//! [4] +// One line without anti-aliasing +painter.drawLine(0, 0, width()/2, height()); + +// One line with anti-aliasing +painter.setRenderHint(QPainter::Antialiasing); +painter.drawLine(width()/2, 0, width()/2, height()); +//! [4] + + +//! [5] +QPainterPath path; +path.addRect(20, 20, 60, 60); +path.addBezier(0, 0, 99, 0, 50, 50, 99, 99); +path.addBezier(99, 99, 0, 99, 50, 50, 0, 0); +painter.drawPath(path); +//! [5] + + +//! [6] +QPixmap buffer(size()); +QPainter painter(&buffer); + +// Paint code here + +painter.end(); +bitBlt(this, 0, 0, &buffer); +//! [6] + + +//! [7] +QPainter painter(this); + +// Paint code here + +painter.end(); +//! [7] + + +//! [8] +unbufferedWidget->setAttribute(Qt::WA_PaintOnScreen); +//! [8] + + +//! [9] +QLinearGradient gradient(0, 0, 100, 100); +gradient.setColorAt(0, Qt::blue); +gradient.setColorAt(1, Qt::red); +painter.setPen(QPen(gradient, 0)); +for (int y=fontSize; y<100; y+=fontSize) + drawText(0, y, text); +//! [9] + + +//! [10] +QImage image(100, 100, 32); +QPainter painter(&image); + +// painter commands. + +painter.end(); +//! [10] diff --git a/doc/src/snippets/code/doc_src_qt4-arthur.qdoc b/doc/src/snippets/code/doc_src_qt4-arthur.qdoc deleted file mode 100644 index 6268309..0000000 --- a/doc/src/snippets/code/doc_src_qt4-arthur.qdoc +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QLinearGradient gradient(0, 0, 100, 100); -gradient.setColorAt(0, Qt::red); -gradient.setColorAt(0.5, Qt::green); -gradient.setColorAt(1, Qt::blue); -painter.setBrush(gradient); -painter.drawRect(0, 0, 100, 100); -//! [0] - - -//! [1] -QRadialGradient gradient(50, 50, 50, 30, 30); -gradient.setColorAt(0.2, Qt::white); -gradient.setColorAt(0.8, Qt::green); -gradient.setColorAt(1, Qt::black); -painter.setBrush(gradient); -painter.drawEllipse(0, 0, 100, 100); -//! [1] - - -//! [2] -QConicalGradient gradient(60, 40, 0); -gradient.setColorAt(0, Qt::black); -gradient.setColorAt(0.4, Qt::green); -gradient.setColorAt(0.6, Qt::white); -gradient.setColorAt(1, Qt::black); -painter.setBrush(gradient); -painter.drawEllipse(0, 0, 100, 100); -//! [2] - - -//! [3] -// Specfiy semi-transparent red -painter.setBrush(QColor(255, 0, 0, 127)); -painter.drawRect(0, 0, width()/2, height()); - -// Specify semi-transparend blue -painter.setBrush(QColor(0, 0, 255, 127)); -painter.drawRect(0, 0, width(), height()/2); -//! [3] - - -//! [4] -// One line without anti-aliasing -painter.drawLine(0, 0, width()/2, height()); - -// One line with anti-aliasing -painter.setRenderHint(QPainter::Antialiasing); -painter.drawLine(width()/2, 0, width()/2, height()); -//! [4] - - -//! [5] -QPainterPath path; -path.addRect(20, 20, 60, 60); -path.addBezier(0, 0, 99, 0, 50, 50, 99, 99); -path.addBezier(99, 99, 0, 99, 50, 50, 0, 0); -painter.drawPath(path); -//! [5] - - -//! [6] -QPixmap buffer(size()); -QPainter painter(&buffer); - -// Paint code here - -painter.end(); -bitBlt(this, 0, 0, &buffer); -//! [6] - - -//! [7] -QPainter painter(this); - -// Paint code here - -painter.end(); -//! [7] - - -//! [8] -unbufferedWidget->setAttribute(Qt::WA_PaintOnScreen); -//! [8] - - -//! [9] -QLinearGradient gradient(0, 0, 100, 100); -gradient.setColorAt(0, Qt::blue); -gradient.setColorAt(1, Qt::red); -painter.setPen(QPen(gradient, 0)); -for (int y=fontSize; y<100; y+=fontSize) - drawText(0, y, text); -//! [9] - - -//! [10] -QImage image(100, 100, 32); -QPainter painter(&image); - -// painter commands. - -painter.end(); -//! [10] diff --git a/doc/src/snippets/code/doc_src_qt4-intro.cpp b/doc/src/snippets/code/doc_src_qt4-intro.cpp new file mode 100644 index 0000000..76ed4a5 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-intro.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [3] +#include +//! [3] + + +//! [4] +#include +#include +#include +//! [4] + + +//! [5] +#include +//! [5] + + +//! [6] +#include +//! [6] + + +//! [7] +using namespace Qt; +//! [7] + + +//! [8] +QLabel *label1 = new QLabel("Hello", this); +QLabel *label2 = new QLabel(this, "Hello"); +//! [8] + + +//! [9] +MyWidget::MyWidget(QWidget *parent, const char *name) + : QWidget(parent, name) +{ + ... +} +//! [9] + + +//! [10] +// DEPRECATED +if (obj->inherits("QPushButton")) { + QPushButton *pushButton = (QPushButton *)obj; + ... +} +//! [10] + + +//! [11] +QPushButton *pushButton = qobject_cast(obj); +if (pushButton) { + ... +} +//! [11] + + +//! [12] +QLabel *label = new QLabel; +QPointer safeLabel = label; +safeLabel->setText("Hello world!"); +delete label; +// safeLabel is now 0, whereas label is a dangling pointer +//! [12] diff --git a/doc/src/snippets/code/doc_src_qt4-intro.pro b/doc/src/snippets/code/doc_src_qt4-intro.pro new file mode 100644 index 0000000..40853b3 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-intro.pro @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QT -= gui +#! [0] + + +#! [1] +QT += network opengl sql qt3support +#! [1] + + +#! [2] +CONFIG += uic3 +#! [2] + + +#! [13] +QT += qt3support +#! [13] + + +#! [14] +DEFINES += QT3_SUPPORT +#! [14] + + +#! [15] +DEFINES += QT3_SUPPORT_WARNINGS +#! [15] + + +#! [16] +DEFINES += QT3_SUPPORT +#! [16] diff --git a/doc/src/snippets/code/doc_src_qt4-intro.qdoc b/doc/src/snippets/code/doc_src_qt4-intro.qdoc deleted file mode 100644 index 45da7d0..0000000 --- a/doc/src/snippets/code/doc_src_qt4-intro.qdoc +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QT -= gui -//! [0] - - -//! [1] -QT += network opengl sql qt3support -//! [1] - - -//! [2] -CONFIG += uic3 -//! [2] - - -//! [3] -#include -//! [3] - - -//! [4] -#include -#include -#include -//! [4] - - -//! [5] -#include -//! [5] - - -//! [6] -#include -//! [6] - - -//! [7] -using namespace Qt; -//! [7] - - -//! [8] -QLabel *label1 = new QLabel("Hello", this); -QLabel *label2 = new QLabel(this, "Hello"); -//! [8] - - -//! [9] -MyWidget::MyWidget(QWidget *parent, const char *name) - : QWidget(parent, name) -{ - ... -} -//! [9] - - -//! [10] -// DEPRECATED -if (obj->inherits("QPushButton")) { - QPushButton *pushButton = (QPushButton *)obj; - ... -} -//! [10] - - -//! [11] -QPushButton *pushButton = qobject_cast(obj); -if (pushButton) { - ... -} -//! [11] - - -//! [12] -QLabel *label = new QLabel; -QPointer safeLabel = label; -safeLabel->setText("Hello world!"); -delete label; -// safeLabel is now 0, whereas label is a dangling pointer -//! [12] - - -//! [13] -QT += qt3support -//! [13] - - -//! [14] -DEFINES += QT3_SUPPORT -//! [14] - - -//! [15] -DEFINES += QT3_SUPPORT_WARNINGS -//! [15] - - -//! [16] -DEFINES += QT3_SUPPORT -//! [16] diff --git a/doc/src/snippets/code/doc_src_qt4-mainwindow.cpp b/doc/src/snippets/code/doc_src_qt4-mainwindow.cpp new file mode 100644 index 0000000..d0c758e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-mainwindow.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ +//! [0] + + +//! [1] +fileToolbar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); +addToolBar(Qt::TopToolBarArea, fileToolbar); +//! [1] + + +//! [2] +setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); +setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); +setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); +setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); +//! [2] + + +//! [3] +QWidget *centralWidget = new QWidget(this); +setCentralWidget(centralWidget); +//! [3] + + +//! [4] +QPopupMenu *fileMenu = new QPopupMenu(this); +openAction->addTo(fileMenu); +saveAction->addTo(fileMenu); +... +menuBar()->insertItem(tr("&File"), fileMenu); +//! [4] + + +//! [5] +QMenu *fileMenu = menuBar()->addMenu(tr("&File")); +fileMenu->addAction(openAction); +fileMenu->addAction(saveAction); +... +//! [5] + + +//! [6] +QToolBar *fileTools = new QToolBar(this, "file toolbar"); +openAction->addTo(fileTools); +saveAction->addTo(fileTools); +... +//! [6] + + +//! [7] +QToolBar *fileTools = addToolBar(tr("File Tool Bar")); +fileTools->addAction(openAction); +fileTools->addAction(saveAction); +... +//! [7] + + +//! [8] +QDockWidget *dockWidget = new QDockWidget(this); +mainWin->moveDockWidget(dockWidget, Qt::DockLeft); +//! [8] + + +//! [9] +QDockWidget *dockWidget = new QDockWidget(mainWindow); +mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget); +//! [9] diff --git a/doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc b/doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc deleted file mode 100644 index d0c758e..0000000 --- a/doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ -//! [0] - - -//! [1] -fileToolbar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); -addToolBar(Qt::TopToolBarArea, fileToolbar); -//! [1] - - -//! [2] -setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); -setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); -setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); -setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); -//! [2] - - -//! [3] -QWidget *centralWidget = new QWidget(this); -setCentralWidget(centralWidget); -//! [3] - - -//! [4] -QPopupMenu *fileMenu = new QPopupMenu(this); -openAction->addTo(fileMenu); -saveAction->addTo(fileMenu); -... -menuBar()->insertItem(tr("&File"), fileMenu); -//! [4] - - -//! [5] -QMenu *fileMenu = menuBar()->addMenu(tr("&File")); -fileMenu->addAction(openAction); -fileMenu->addAction(saveAction); -... -//! [5] - - -//! [6] -QToolBar *fileTools = new QToolBar(this, "file toolbar"); -openAction->addTo(fileTools); -saveAction->addTo(fileTools); -... -//! [6] - - -//! [7] -QToolBar *fileTools = addToolBar(tr("File Tool Bar")); -fileTools->addAction(openAction); -fileTools->addAction(saveAction); -... -//! [7] - - -//! [8] -QDockWidget *dockWidget = new QDockWidget(this); -mainWin->moveDockWidget(dockWidget, Qt::DockLeft); -//! [8] - - -//! [9] -QDockWidget *dockWidget = new QDockWidget(mainWindow); -mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget); -//! [9] diff --git a/doc/src/snippets/code/doc_src_qt4-sql.cpp b/doc/src/snippets/code/doc_src_qt4-sql.cpp new file mode 100644 index 0000000..cbcfb2d --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-sql.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QSqlQueryModel model; +model.setQuery("select * from person"); + +QTableView view; +view.setModel(&model); +view.show(); +//! [0] + + +//! [1] +QSqlTableModel model; +model.setTable("person"); +model.select(); + +QTableView view; +view.setModel(&model); +view.show(); +//! [1] diff --git a/doc/src/snippets/code/doc_src_qt4-sql.qdoc b/doc/src/snippets/code/doc_src_qt4-sql.qdoc deleted file mode 100644 index cbcfb2d..0000000 --- a/doc/src/snippets/code/doc_src_qt4-sql.qdoc +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QSqlQueryModel model; -model.setQuery("select * from person"); - -QTableView view; -view.setModel(&model); -view.show(); -//! [0] - - -//! [1] -QSqlTableModel model; -model.setTable("person"); -model.select(); - -QTableView view; -view.setModel(&model); -view.show(); -//! [1] diff --git a/doc/src/snippets/code/doc_src_qt4-styles.cpp b/doc/src/snippets/code/doc_src_qt4-styles.cpp new file mode 100644 index 0000000..effe3cd --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-styles.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +const QStyleOptionFocusRect *focusRectOption = + qstyleoption_cast(option); +if (focusRectOption) { + ... +} +//! [0] + + +//! [1] +void MyWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + ... + + QStyleOptionFocusRect option(1); + option.init(this); + option.backgroundColor = palette().color(QPalette::Window); + + style().drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, + this); +} +//! [1] + + +//! [2] +void drawControl(ControlElement element, + QPainter *painter, + const QWidget *widget, + const QRect &rect, + const QColorGroup &colorGroup, + SFlags how = Style_Default, + const QStyleOption &option = QStyleOption::Default) const; +//! [2] + + +//! [3] +void drawControl(ControlElement element, + const QStyleOption *option, + QPainter *painter, + const QWidget *widget = 0) const; +//! [3] diff --git a/doc/src/snippets/code/doc_src_qt4-styles.qdoc b/doc/src/snippets/code/doc_src_qt4-styles.qdoc deleted file mode 100644 index effe3cd..0000000 --- a/doc/src/snippets/code/doc_src_qt4-styles.qdoc +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -const QStyleOptionFocusRect *focusRectOption = - qstyleoption_cast(option); -if (focusRectOption) { - ... -} -//! [0] - - -//! [1] -void MyWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - ... - - QStyleOptionFocusRect option(1); - option.init(this); - option.backgroundColor = palette().color(QPalette::Window); - - style().drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, - this); -} -//! [1] - - -//! [2] -void drawControl(ControlElement element, - QPainter *painter, - const QWidget *widget, - const QRect &rect, - const QColorGroup &colorGroup, - SFlags how = Style_Default, - const QStyleOption &option = QStyleOption::Default) const; -//! [2] - - -//! [3] -void drawControl(ControlElement element, - const QStyleOption *option, - QPainter *painter, - const QWidget *widget = 0) const; -//! [3] diff --git a/doc/src/snippets/code/doc_src_qt4-tulip.cpp b/doc/src/snippets/code/doc_src_qt4-tulip.cpp new file mode 100644 index 0000000..83b1210 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qt4-tulip.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +foreach (variable, container) + statement; +//! [0] + + +//! [1] +QList list; +... +foreach (const QString &str, list) + cout << str.ascii() << endl; +//! [1] + + +//! [2] +QString str; +foreach (str, list) + cout << str.ascii() << endl; +//! [2] + + +//! [3] +// forward // backward +QList list; QList list; +... ... +QListIterator i(list); QListIterator i(list); +while (i.hasNext()) i.toBack(); + cout << i.next().ascii() << endl; while (i.hasPrev()) + cout << i.prev().ascii() << endl; +//! [3] + + +//! [4] +// forward // backward +QMutableListIterator i(list); QMutableListIterator i(list); +while (i.hasNext()) i.toBack(); + if (i.next() > 128) while (i.hasPrev()) + i.setValue(128); if (i.prev() > 128) + i.setValue(128); +//! [4] + + +//! [5] +// forward // backward +QMutableListIterator i(list); QMutableListIterator i(list); +while (i.hasNext()) i.toBack(); + if (i.next() % 2 != 0) while (i.hasPrev()) + i.remove(); if (i.prev() % 2 != 0) + i.remove(); +//! [5] + + +//! [6] +// STL-style // Java-style +QMap::const_iterator i; QMapIterator i(map); +for (i = map.begin(); i != map.end(); ++i) while (i.findNext(widget)) + if (i.value() == widget) cout << "Found widget " << widget + cout << "Found widget " << widget << " under key " + << " under key " << i.key() << endl; + << i.key() << endl; +//! [6] + + +//! [7] +// STL-style // Java-style +QList::iterator i = list.begin(); QMutableListIterator i(list); +while (i != list.end()) { while (i.hasNext()) { + if (*i == 0) { int val = i.next(); + i = list.erase(i); if (val < 0) + } else { i.setValue(-val); + if (*i < 0) else if (val == 0) + *i = -*i; i.remove(); + ++i; } + } +} +//! [7] + + +//! [8] +QList list; +... +for (int i = 0; i < list.size(); ++i) { + if (list[i] < 0.0) + list[i] = 0.0; +} +//! [8] + + +//! [9] +QMap map; +... +map.value("TIMEOUT", 30); // returns 30 if "TIMEOUT" isn't in the map +//! [9] + + +//! [10] +QMultiMap map; +... +QList values = map.values("TIMEOUT"); +//! [10] diff --git a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc b/doc/src/snippets/code/doc_src_qt4-tulip.qdoc deleted file mode 100644 index 83b1210..0000000 --- a/doc/src/snippets/code/doc_src_qt4-tulip.qdoc +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -foreach (variable, container) - statement; -//! [0] - - -//! [1] -QList list; -... -foreach (const QString &str, list) - cout << str.ascii() << endl; -//! [1] - - -//! [2] -QString str; -foreach (str, list) - cout << str.ascii() << endl; -//! [2] - - -//! [3] -// forward // backward -QList list; QList list; -... ... -QListIterator i(list); QListIterator i(list); -while (i.hasNext()) i.toBack(); - cout << i.next().ascii() << endl; while (i.hasPrev()) - cout << i.prev().ascii() << endl; -//! [3] - - -//! [4] -// forward // backward -QMutableListIterator i(list); QMutableListIterator i(list); -while (i.hasNext()) i.toBack(); - if (i.next() > 128) while (i.hasPrev()) - i.setValue(128); if (i.prev() > 128) - i.setValue(128); -//! [4] - - -//! [5] -// forward // backward -QMutableListIterator i(list); QMutableListIterator i(list); -while (i.hasNext()) i.toBack(); - if (i.next() % 2 != 0) while (i.hasPrev()) - i.remove(); if (i.prev() % 2 != 0) - i.remove(); -//! [5] - - -//! [6] -// STL-style // Java-style -QMap::const_iterator i; QMapIterator i(map); -for (i = map.begin(); i != map.end(); ++i) while (i.findNext(widget)) - if (i.value() == widget) cout << "Found widget " << widget - cout << "Found widget " << widget << " under key " - << " under key " << i.key() << endl; - << i.key() << endl; -//! [6] - - -//! [7] -// STL-style // Java-style -QList::iterator i = list.begin(); QMutableListIterator i(list); -while (i != list.end()) { while (i.hasNext()) { - if (*i == 0) { int val = i.next(); - i = list.erase(i); if (val < 0) - } else { i.setValue(-val); - if (*i < 0) else if (val == 0) - *i = -*i; i.remove(); - ++i; } - } -} -//! [7] - - -//! [8] -QList list; -... -for (int i = 0; i < list.size(); ++i) { - if (list[i] < 0.0) - list[i] = 0.0; -} -//! [8] - - -//! [9] -QMap map; -... -map.value("TIMEOUT", 30); // returns 30 if "TIMEOUT" isn't in the map -//! [9] - - -//! [10] -QMultiMap map; -... -QList values = map.values("TIMEOUT"); -//! [10] diff --git a/doc/src/snippets/code/doc_src_qtcore.cpp b/doc/src/snippets/code/doc_src_qtcore.cpp new file mode 100644 index 0000000..35916ea --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtcore.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtcore.qdoc b/doc/src/snippets/code/doc_src_qtcore.qdoc deleted file mode 100644 index 35916ea..0000000 --- a/doc/src/snippets/code/doc_src_qtcore.qdoc +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] diff --git a/doc/src/snippets/code/doc_src_qtdbus.cpp b/doc/src/snippets/code/doc_src_qtdbus.cpp new file mode 100644 index 0000000..2143b5b --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtdbus.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtdbus.pro b/doc/src/snippets/code/doc_src_qtdbus.pro new file mode 100644 index 0000000..6607d7d --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtdbus.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += dbus +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtdbus.qdoc b/doc/src/snippets/code/doc_src_qtdbus.qdoc deleted file mode 100644 index 20ff513..0000000 --- a/doc/src/snippets/code/doc_src_qtdbus.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -QT += dbus -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtdesigner.cpp b/doc/src/snippets/code/doc_src_qtdesigner.cpp new file mode 100644 index 0000000..562002e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtdesigner.cpp @@ -0,0 +1,328 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] + + +//! [2] +QDesignerMemberSheetExtension *memberSheet = 0; +QExtensionManager manager = formEditor->extensionManager(); + +memberSheet = qt_extension(manager, widget); +int index = memberSheet->indexOf(setEchoMode); +memberSheet->setVisible(index, false); + +delete memberSheet; +//! [2] + + +//! [3] +class MyMemberSheetExtension : public QObject, + public QDesignerMemberSheetExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerMemberSheetExtension) + +public: + ... +} +//! [3] + + +//! [4] +QObject *ANewExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerMemberSheetExtension)) + return 0; + + if (MyCustomWidget *widget = qobject_cast + (object)) + return new MyMemberSheetExtension(widget, parent); + + return 0; +} +//! [4] + + +//! [5] +QObject *AGeneralExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + MyCustomWidget *widget = qobject_cast(object); + + if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { + return new MyTaskMenuExtension(widget, parent); + + } else if (widget && (iid == Q_TYPEID(QDesignerMemberSheetExtension))) { + return new MyMemberSheetExtension(widget, parent); + + } else { + return 0; + } +} +//! [5] + + +//! [6] +class MyContainerExtension : public QObject, + public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) + +public: + MyContainerExtension(MyCustomWidget *widget, + QObject *parent = 0); + int count() const; + QWidget *widget(int index) const; + int currentIndex() const; + void setCurrentIndex(int index); + void addWidget(QWidget *widget); + void insertWidget(int index, QWidget *widget); + void remove(int index); + +private: + MyCustomWidget *myWidget; +}; +//! [6] + + +//! [7] +QObject *ANewExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerContainerExtension)) + return 0; + + if (MyCustomWidget *widget = qobject_cast + (object)) + return new MyContainerExtension(widget, parent); + + return 0; +} +//! [7] + + +//! [8] +QObject *AGeneralExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + MyCustomWidget *widget = qobject_cast(object); + + if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { + return new MyTaskMenuExtension(widget, parent); + + } else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { + return new MyContainerExtension(widget, parent); + + } else { + return 0; + } +} +//! [8] + + +//! [9] +class MyTaskMenuExtension : public QObject, + public QDesignerTaskMenuExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerTaskMenuExtension) + +public: + MyTaskMenuExtension(MyCustomWidget *widget, QObject *parent); + + QAction *preferredEditAction() const; + QList taskActions() const; + +private slots: + void mySlot(); + +private: + MyCustomWidget *widget; + QAction *myAction; +}; +//! [9] + + +//! [10] +QObject *ANewExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerTaskMenuExtension)) + return 0; + + if (MyCustomWidget *widget = qobject_cast(object)) + return new MyTaskMenuExtension(widget, parent); + + return 0; +} +//! [10] + + +//! [11] +QObject *AGeneralExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + MyCustomWidget *widget = qobject_cast(object); + + if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { + return new MyContainerExtension(widget, parent); + + } else if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { + return new MyTaskMenuExtension(widget, parent); + + } else { + return 0; + } +} +//! [11] + + +//! [12] +#include customwidgetoneinterface.h +#include customwidgettwointerface.h +#include customwidgetthreeinterface.h + +#include +#include + +class MyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) + +public: + MyCustomWidgets(QObject *parent = 0); + + virtual QList customWidgets() const; + +private: + QList widgets; +}; +//! [12] + + +//! [13] +MyCustomWidgets::MyCustomWidgets(QObject *parent) + : QObject(parent) +{ + widgets.append(new CustomWidgetOneInterface(this)); + widgets.append(new CustomWidgetTwoInterface(this)); + widgets.append(new CustomWidgetThreeInterface(this)); +} + +QList MyCustomWidgets::customWidgets() const +{ + return widgets; +} + +Q_EXPORT_PLUGIN2(customwidgetsplugin, MyCustomWidgets) +//! [13] + + +//! [14] +Q_EXPORT_PLUGIN2(customwidgetplugin, MyCustomWidget) +//! [14] + + +//! [15] +QDesignerPropertySheetExtension *propertySheet = 0; +QExtensionManager manager = formEditor->extensionManager(); + +propertySheet = qt_extension(manager, widget); +int index = propertySheet->indexOf(QLatin1String("margin")); + +propertySheet->setProperty(index, 10); +propertySheet->setChanged(index, true); + +delete propertySheet; +//! [15] + + +//! [16] +class MyPropertySheetExtension : public QObject, + public QDesignerPropertySheetExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerPropertySheetExtension) + +public: + ... +} +//! [16] + + +//! [17] +QObject *ANewExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerPropertySheetExtension)) + return 0; + + if (MyCustomWidget *widget = qobject_cast + (object)) + return new MyPropertySheetExtension(widget, parent); + + return 0; +} +//! [17] + + +//! [18] +QObject *AGeneralExtensionFactory::createExtension(QObject *object, + const QString &iid, QObject *parent) const +{ + MyCustomWidget *widget = qobject_cast(object); + + if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { + return new MyTaskMenuExtension(widget, parent); + + } else if (widget && (iid == Q_TYPEID(QDesignerPropertySheetExtension))) { + return new MyPropertySheetExtension(widget, parent); + + } else { + return 0; + } +} +//! [18] diff --git a/doc/src/snippets/code/doc_src_qtdesigner.pro b/doc/src/snippets/code/doc_src_qtdesigner.pro new file mode 100644 index 0000000..dc962ef --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtdesigner.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +CONFIG += designer +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtdesigner.qdoc b/doc/src/snippets/code/doc_src_qtdesigner.qdoc deleted file mode 100644 index a37b77f..0000000 --- a/doc/src/snippets/code/doc_src_qtdesigner.qdoc +++ /dev/null @@ -1,333 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -CONFIG += designer -//! [1] - - -//! [2] -QDesignerMemberSheetExtension *memberSheet = 0; -QExtensionManager manager = formEditor->extensionManager(); - -memberSheet = qt_extension(manager, widget); -int index = memberSheet->indexOf(setEchoMode); -memberSheet->setVisible(index, false); - -delete memberSheet; -//! [2] - - -//! [3] -class MyMemberSheetExtension : public QObject, - public QDesignerMemberSheetExtension -{ - Q_OBJECT - Q_INTERFACES(QDesignerMemberSheetExtension) - -public: - ... -} -//! [3] - - -//! [4] -QObject *ANewExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - if (iid != Q_TYPEID(QDesignerMemberSheetExtension)) - return 0; - - if (MyCustomWidget *widget = qobject_cast - (object)) - return new MyMemberSheetExtension(widget, parent); - - return 0; -} -//! [4] - - -//! [5] -QObject *AGeneralExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - MyCustomWidget *widget = qobject_cast(object); - - if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { - return new MyTaskMenuExtension(widget, parent); - - } else if (widget && (iid == Q_TYPEID(QDesignerMemberSheetExtension))) { - return new MyMemberSheetExtension(widget, parent); - - } else { - return 0; - } -} -//! [5] - - -//! [6] -class MyContainerExtension : public QObject, - public QDesignerContainerExtension -{ - Q_OBJECT - Q_INTERFACES(QDesignerContainerExtension) - -public: - MyContainerExtension(MyCustomWidget *widget, - QObject *parent = 0); - int count() const; - QWidget *widget(int index) const; - int currentIndex() const; - void setCurrentIndex(int index); - void addWidget(QWidget *widget); - void insertWidget(int index, QWidget *widget); - void remove(int index); - -private: - MyCustomWidget *myWidget; -}; -//! [6] - - -//! [7] -QObject *ANewExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - if (iid != Q_TYPEID(QDesignerContainerExtension)) - return 0; - - if (MyCustomWidget *widget = qobject_cast - (object)) - return new MyContainerExtension(widget, parent); - - return 0; -} -//! [7] - - -//! [8] -QObject *AGeneralExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - MyCustomWidget *widget = qobject_cast(object); - - if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { - return new MyTaskMenuExtension(widget, parent); - - } else if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { - return new MyContainerExtension(widget, parent); - - } else { - return 0; - } -} -//! [8] - - -//! [9] -class MyTaskMenuExtension : public QObject, - public QDesignerTaskMenuExtension -{ - Q_OBJECT - Q_INTERFACES(QDesignerTaskMenuExtension) - -public: - MyTaskMenuExtension(MyCustomWidget *widget, QObject *parent); - - QAction *preferredEditAction() const; - QList taskActions() const; - -private slots: - void mySlot(); - -private: - MyCustomWidget *widget; - QAction *myAction; -}; -//! [9] - - -//! [10] -QObject *ANewExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - if (iid != Q_TYPEID(QDesignerTaskMenuExtension)) - return 0; - - if (MyCustomWidget *widget = qobject_cast(object)) - return new MyTaskMenuExtension(widget, parent); - - return 0; -} -//! [10] - - -//! [11] -QObject *AGeneralExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - MyCustomWidget *widget = qobject_cast(object); - - if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) { - return new MyContainerExtension(widget, parent); - - } else if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { - return new MyTaskMenuExtension(widget, parent); - - } else { - return 0; - } -} -//! [11] - - -//! [12] -#include customwidgetoneinterface.h -#include customwidgettwointerface.h -#include customwidgetthreeinterface.h - -#include -#include - -class MyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface -{ - Q_OBJECT - Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) - -public: - MyCustomWidgets(QObject *parent = 0); - - virtual QList customWidgets() const; - -private: - QList widgets; -}; -//! [12] - - -//! [13] -MyCustomWidgets::MyCustomWidgets(QObject *parent) - : QObject(parent) -{ - widgets.append(new CustomWidgetOneInterface(this)); - widgets.append(new CustomWidgetTwoInterface(this)); - widgets.append(new CustomWidgetThreeInterface(this)); -} - -QList MyCustomWidgets::customWidgets() const -{ - return widgets; -} - -Q_EXPORT_PLUGIN2(customwidgetsplugin, MyCustomWidgets) -//! [13] - - -//! [14] -Q_EXPORT_PLUGIN2(customwidgetplugin, MyCustomWidget) -//! [14] - - -//! [15] -QDesignerPropertySheetExtension *propertySheet = 0; -QExtensionManager manager = formEditor->extensionManager(); - -propertySheet = qt_extension(manager, widget); -int index = propertySheet->indexOf(QLatin1String("margin")); - -propertySheet->setProperty(index, 10); -propertySheet->setChanged(index, true); - -delete propertySheet; -//! [15] - - -//! [16] -class MyPropertySheetExtension : public QObject, - public QDesignerPropertySheetExtension -{ - Q_OBJECT - Q_INTERFACES(QDesignerPropertySheetExtension) - -public: - ... -} -//! [16] - - -//! [17] -QObject *ANewExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - if (iid != Q_TYPEID(QDesignerPropertySheetExtension)) - return 0; - - if (MyCustomWidget *widget = qobject_cast - (object)) - return new MyPropertySheetExtension(widget, parent); - - return 0; -} -//! [17] - - -//! [18] -QObject *AGeneralExtensionFactory::createExtension(QObject *object, - const QString &iid, QObject *parent) const -{ - MyCustomWidget *widget = qobject_cast(object); - - if (widget && (iid == Q_TYPEID(QDesignerTaskMenuExtension))) { - return new MyTaskMenuExtension(widget, parent); - - } else if (widget && (iid == Q_TYPEID(QDesignerPropertySheetExtension))) { - return new MyPropertySheetExtension(widget, parent); - - } else { - return 0; - } -} -//! [18] diff --git a/doc/src/snippets/code/doc_src_qtestevent.cpp b/doc/src/snippets/code/doc_src_qtestevent.cpp new file mode 100644 index 0000000..fd1c819 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtestevent.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QTestEventList events; +events.addKeyClick('a'); +events.addKeyClick(Qt::Key_Backspace); +events.addDelay(200); + +QLineEdit *lineEdit = new QLineEdit(myParent); +... +events.simulate(lineEdit); +events.simulate(lineEdit); +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtestevent.qdoc b/doc/src/snippets/code/doc_src_qtestevent.qdoc deleted file mode 100644 index fd1c819..0000000 --- a/doc/src/snippets/code/doc_src_qtestevent.qdoc +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QTestEventList events; -events.addKeyClick('a'); -events.addKeyClick(Qt::Key_Backspace); -events.addDelay(200); - -QLineEdit *lineEdit = new QLineEdit(myParent); -... -events.simulate(lineEdit); -events.simulate(lineEdit); -//! [0] diff --git a/doc/src/snippets/code/doc_src_qtestlib.cpp b/doc/src/snippets/code/doc_src_qtestlib.cpp new file mode 100644 index 0000000..bd98807 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtestlib.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +class MyFirstTest: public QObject +{ + Q_OBJECT +private slots: + void initTestCase() + { qDebug("called before everything else"); } + void myFirstTest() + { QVERIFY(1 == 1); } + void mySecondTest() + { QVERIFY(1 != 2); } + void cleanupTestCase() + { qDebug("called after myFirstTest and mySecondTest"); } +}; +//! [0] + + +//! [8] +void TestQString::toUpper() +{ + QString str = "Hello"; + QVERIFY(str.toUpper() == "HELLO"); +} +//! [8] + + +//! [11] +QCOMPARE(QString("hello").toUpper(), QString("HELLO")); +QCOMPARE(QString("Hello").toUpper(), QString("HELLO")); +QCOMPARE(QString("HellO").toUpper(), QString("HELLO")); +QCOMPARE(QString("HELLO").toUpper(), QString("HELLO")); +//! [11] + +//! [12] +class MyFirstBenchmark: public QObject +{ + Q_OBJECT +private slots: + void myFirstBenchmark() + { + QString string1; + QString string2; + QBENCHMARK { + string1.localeAwareCompare(string2); + } + } +}; +//! [12] diff --git a/doc/src/snippets/code/doc_src_qtestlib.pro b/doc/src/snippets/code/doc_src_qtestlib.pro new file mode 100644 index 0000000..a8fc56a --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtestlib.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += testlib +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtestlib.qdoc b/doc/src/snippets/code/doc_src_qtestlib.qdoc index 80b7d92..92d528e 100644 --- a/doc/src/snippets/code/doc_src_qtestlib.qdoc +++ b/doc/src/snippets/code/doc_src_qtestlib.qdoc @@ -38,28 +38,6 @@ ** ****************************************************************************/ -//! [0] -class MyFirstTest: public QObject -{ - Q_OBJECT -private slots: - void initTestCase() - { qDebug("called before everything else"); } - void myFirstTest() - { QVERIFY(1 == 1); } - void mySecondTest() - { QVERIFY(1 != 2); } - void cleanupTestCase() - { qDebug("called after myFirstTest and mySecondTest"); } -}; -//! [0] - - -//! [1] -QT += testlib -//! [1] - - //! [2] testname [options] [testfunctions[:testdata]]... //! [2] @@ -91,15 +69,6 @@ set LIB=C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SD //! [7] -//! [8] -void TestQString::toUpper() -{ - QString str = "Hello"; - QVERIFY(str.toUpper() == "HELLO"); -} -//! [8] - - //! [9] /myTestDirectory$ qmake -project "CONFIG += qtestlib" /myTestDirectory$ qmake @@ -116,27 +85,3 @@ PASS : TestQString::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped ********* Finished testing of TestQString ********* //! [10] - - -//! [11] -QCOMPARE(QString("hello").toUpper(), QString("HELLO")); -QCOMPARE(QString("Hello").toUpper(), QString("HELLO")); -QCOMPARE(QString("HellO").toUpper(), QString("HELLO")); -QCOMPARE(QString("HELLO").toUpper(), QString("HELLO")); -//! [11] - -//! [12] -class MyFirstBenchmark: public QObject -{ - Q_OBJECT -private slots: - void myFirstBenchmark() - { - QString string1; - QString string2; - QBENCHMARK { - string1.localeAwareCompare(string2); - } - } -}; -//! [12] diff --git a/doc/src/snippets/code/doc_src_qtgui.pro b/doc/src/snippets/code/doc_src_qtgui.pro new file mode 100644 index 0000000..dd3405c --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtgui.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +#! [0] diff --git a/doc/src/snippets/code/doc_src_qtgui.qdoc b/doc/src/snippets/code/doc_src_qtgui.qdoc deleted file mode 100644 index 370529a..0000000 --- a/doc/src/snippets/code/doc_src_qtgui.qdoc +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] diff --git a/doc/src/snippets/code/doc_src_qthelp.cpp b/doc/src/snippets/code/doc_src_qthelp.cpp new file mode 100644 index 0000000..2825738 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qthelp.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] + +//! [6] +QHelpEngineCore helpEngine("mycollection.qhc"); +... + +// get all file references for the identifier +QMap links = + helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton")); + +// If help is available for this keyword, get the help data +// of the first file reference. +if (links.count()) { + QByteArray helpData = helpEngine->fileData(links.constBegin().value()); + // show the documentation to the user + if (!helpData.isEmpty()) + displayHelp(helpData); +} +//! [6] + + diff --git a/doc/src/snippets/code/doc_src_qthelp.qdoc b/doc/src/snippets/code/doc_src_qthelp.qdoc index 4ad2100..ff25d19 100644 --- a/doc/src/snippets/code/doc_src_qthelp.qdoc +++ b/doc/src/snippets/code/doc_src_qthelp.qdoc @@ -38,11 +38,6 @@ ** ****************************************************************************/ -//! [0] -#include -//! [0] - - //! [1] CONFIG += help //! [1] @@ -87,25 +82,6 @@ qcollectiongenerator mycollection.qhcp -o mycollection.qhc //! [5] -//! [6] -QHelpEngineCore helpEngine("mycollection.qhc"); -... - -// get all file references for the identifier -QMap links = - helpEngine.linksForIdentifier(QLatin1String("MyDialog::ChangeButton")); - -// If help is available for this keyword, get the help data -// of the first file reference. -if (links.count()) { - QByteArray helpData = helpEngine->fileData(links.constBegin().value()); - // show the documentation to the user - if (!helpData.isEmpty()) - displayHelp(helpData); -} -//! [6] - - //! [7] diff --git a/doc/src/snippets/code/doc_src_qtmultimedia.cpp b/doc/src/snippets/code/doc_src_qtmultimedia.cpp new file mode 100644 index 0000000..3f25c11 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtmultimedia.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +#include +//! [1] diff --git a/doc/src/snippets/code/doc_src_qtmultimedia.pro b/doc/src/snippets/code/doc_src_qtmultimedia.pro new file mode 100644 index 0000000..b23c994 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtmultimedia.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QT += multimedia +#! [0] diff --git a/doc/src/snippets/code/doc_src_qtmultimedia.qdoc b/doc/src/snippets/code/doc_src_qtmultimedia.qdoc deleted file mode 100644 index 76fb9cd..0000000 --- a/doc/src/snippets/code/doc_src_qtmultimedia.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QT += multimedia -//! [0] - - -//! [1] -#include -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtnetwork.cpp b/doc/src/snippets/code/doc_src_qtnetwork.cpp new file mode 100644 index 0000000..7100f1a --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtnetwork.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +#include +//! [1] diff --git a/doc/src/snippets/code/doc_src_qtnetwork.pro b/doc/src/snippets/code/doc_src_qtnetwork.pro new file mode 100644 index 0000000..f6c3a5a --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtnetwork.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QT += network +#! [0] diff --git a/doc/src/snippets/code/doc_src_qtnetwork.qdoc b/doc/src/snippets/code/doc_src_qtnetwork.qdoc deleted file mode 100644 index 42d1808..0000000 --- a/doc/src/snippets/code/doc_src_qtnetwork.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -QT += network -//! [0] - - -//! [1] -#include -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtopengl.cpp b/doc/src/snippets/code/doc_src_qtopengl.cpp new file mode 100644 index 0000000..088b31b --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtopengl.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtopengl.pro b/doc/src/snippets/code/doc_src_qtopengl.pro new file mode 100644 index 0000000..97fbf28 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtopengl.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += opengl +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtopengl.qdoc b/doc/src/snippets/code/doc_src_qtopengl.qdoc deleted file mode 100644 index 555d571..0000000 --- a/doc/src/snippets/code/doc_src_qtopengl.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -QT += opengl -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtscript.cpp b/doc/src/snippets/code/doc_src_qtscript.cpp new file mode 100644 index 0000000..822e6fa --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtscript.cpp @@ -0,0 +1,568 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] + +//! [13] +Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) +//! [13] + +//! [18] +QScriptValue myQObjectConstructor(QScriptContext *context, QScriptEngine *engine) +{ + // let the engine manage the new object's lifetime. + return engine->newQObject(new MyQObject(), QScriptEngine::ScriptOwnership); +} +//! [18] + + +//! [19] +class MyObject : public QObject +{ + Q_OBJECT + +public: + MyObject( ... ); + + void aNonScriptableFunction(); + +public slots: // these functions (slots) will be available in QtScript + void calculate( ... ); + void setEnabled( bool enabled ); + bool isEnabled() const; + +private: + .... + +}; +//! [19] + + +//! [20] +class MyObject : public QObject +{ + Q_OBJECT + + public: + Q_INVOKABLE void thisMethodIsInvokableInQtScript(); + void thisMethodIsNotInvokableInQtScript(); + + ... +}; +//! [20] + + +//! [23] +class MyObject : public QObject +{ + Q_OBJECT + // define the enabled property + Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled ) + +public: + MyObject( ... ); + + void aNonScriptableFunction(); + +public slots: // these functions (slots) will be available in QtScript + void calculate( ... ); + void setEnabled( bool enabled ); + bool isEnabled() const; + +private: + .... + +}; +//! [23] + + +//! [24] +Q_PROPERTY(int nonScriptableProperty READ foo WRITE bar SCRIPTABLE false) +//! [24] + + +//! [25] +class MyObject : public QObject +{ + Q_OBJECT + // define the enabled property + Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled ) + +public: + MyObject( ... ); + + void aNonScriptableFunction(); + +public slots: // these functions (slots) will be available in QtScript + void calculate( ... ); + void setEnabled( bool enabled ); + bool isEnabled() const; + +signals: // the signals + void enabledChanged( bool newState ); + +private: + .... + +}; +//! [25] + + +//! [34] +QScriptValue Person_ctor(QScriptContext *context, QScriptEngine *engine) +{ + QString name = context->argument(0).toString(); + context->thisObject().setProperty("name", name); + return engine->undefinedValue(); +} +//! [34] + + +//! [35] +QScriptValue Person_prototype_toString(QScriptContext *context, QScriptEngine *engine) +{ + QString name = context->thisObject().property("name").toString(); + QString result = QString::fromLatin1("Person(name: %0)").arg(name); + return result; +} +//! [35] + + +//! [36] +QScriptEngine engine; +QScriptValue ctor = engine.newFunction(Person_ctor); +ctor.property("prototype").setProperty("toString", engine.newFunction(Person_prototype_toString)); +QScriptValue global = engine.globalObject(); +global.setProperty("Person", ctor); +//! [36] + + +//! [37] +QScriptValue Employee_ctor(QScriptContext *context, QScriptEngine *engine) +{ + QScriptValue super = context->callee().property("prototype").property("constructor"); + super.call(context->thisObject(), QScriptValueList() << context->argument(0)); + context->thisObject().setProperty("salary", context->argument(1)); + return engine->undefinedValue(); +} +//! [37] + + +//! [38] +QScriptValue empCtor = engine.newFunction(Employee_ctor); +empCtor.setProperty("prototype", global.property("Person").construct()); +global.setProperty("Employee", empCtor); +//! [38] + + +//! [39] +Q_DECLARE_METATYPE(QPointF) +Q_DECLARE_METATYPE(QPointF*) + +QScriptValue QPointF_prototype_x(QScriptContext *context, QScriptEngine *engine) +{ + // Since the point is not to be modified, it's OK to cast to a value here + QPointF point = qscriptvalue_cast(context->thisObject()); + return point.x(); +} + +QScriptValue QPointF_prototype_setX(QScriptContext *context, QScriptEngine *engine) +{ + // Cast to a pointer to be able to modify the underlying C++ value + QPointF *point = qscriptvalue_cast(context->thisObject()); + if (!point) + return context->throwError(QScriptContext::TypeError, "QPointF.prototype.setX: this object is not a QPointF"); + point->setX(context->argument(0).toNumber()); + return engine->undefinedValue(); +} +//! [39] + + +//! [43] +class MyObject : public QObject +{ + Q_OBJECT + ... +}; + +Q_DECLARE_METATYPE(MyObject*) + +QScriptValue myObjectToScriptValue(QScriptEngine *engine, MyObject* const &in) +{ return engine->newQObject(in); } + +void myObjectFromScriptValue(const QScriptValue &object, MyObject* &out) +{ out = qobject_cast(object.toQObject()); } + +... + +qScriptRegisterMetaType(&engine, myObjectToScriptValue, myObjectFromScriptValue); +//! [43] + +//! [44] +QScriptValue QPoint_ctor(QScriptContext *context, QScriptEngine *engine) +{ + int x = context->argument(0).toInt32(); + int y = context->argument(1).toInt32(); + return engine->toScriptValue(QPoint(x, y)); +} + +... + +engine.globalObject().setProperty("QPoint", engine.newFunction(QPoint_ctor)); +//! [44] + +//! [45] +QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine) +{ + QString result; + for (int i = 0; i < context->argumentCount(); ++i) { + if (i > 0) + result.append(" "); + result.append(context->argument(i).toString()); + } + + QScriptValue calleeData = context->callee().data(); + QPlainTextEdit *edit = qobject_cast(calleeData.toQObject()); + edit->appendPlainText(result); + + return engine->undefinedValue(); +} +//! [45] + +//! [46] +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QScriptEngine eng; + QPlainTextEdit edit; + + QScriptValue fun = eng.newFunction(myPrintFunction); + fun.setData(eng.newQObject(&edit)); + eng.globalObject().setProperty("print", fun); + + eng.evaluate("print('hello', 'world')"); + + edit.show(); + return app.exec(); +} +//! [46] + + +//! [47] +QScriptEngine eng; +QLineEdit *edit = new QLineEdit(...); +QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })"); +qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler); +//! [47] + +//! [48] +QLineEdit *edit1 = new QLineEdit(...); +QLineEdit *edit2 = new QLineEdit(...); + +QScriptValue handler = eng.evaluate("(function() { print('I am', this.name); })"); +QScriptValue obj1 = eng.newObject(); +obj1.setProperty("name", "the walrus"); +QScriptValue obj2 = eng.newObject(); +obj2.setProperty("name", "Sam"); + +qScriptConnect(edit1, SIGNAL(returnPressed()), obj1, handler); +qScriptConnect(edit2, SIGNAL(returnPressed()), obj2, handler); +//! [48] + +//! [52] +QScriptValue getProperty(QScriptContext *ctx, QScriptEngine *eng) +{ + QString name = ctx->argument(0).toString(); + return ctx->thisObject().property(name); +} +//! [52] + +//! [53] +QScriptValue myCompare(QScriptContext *ctx, QScriptEngine *eng) +{ + double first = ctx->argument(0).toNumber(); + double second = ctx->argument(1).toNumber(); + int result; + if (first == second) + result = 0; + else if (first < second) + result = -1; + else + result = 1; + return result; +} +//! [53] + +//! [54] +QScriptEngine eng; +QScriptValue comparefn = eng.newFunction(myCompare); +QScriptValue array = eng.evaluate("new Array(10, 5, 20, 15, 30)"); +array.property("sort").call(array, QScriptValueList() << comparefn); + +// prints "5,10,15,20,30" +qDebug() << array.toString(); +//! [54] + +//! [55] +QScriptValue rectifier(QScriptContext *ctx, QScriptEngine *eng) +{ + QRectF magicRect = qscriptvalue_cast(ctx->callee().data()); + QRectF sourceRect = qscriptvalue_cast(ctx->argument(0)); + return eng->toScriptValue(sourceRect.intersected(magicRect)); +} + +... + +QScriptValue fun = eng.newFunction(rectifier); +QRectF magicRect = QRectF(10, 20, 30, 40); +fun.setData(eng.toScriptValue(magicRect)); +eng.globalObject().setProperty("rectifier", fun); +//! [55] + +//! [58] +QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) +{ + double a = ctx->argument(0).toNumber(); + double b = ctx->argument(1).toNumber(); + return a + b; +} +//! [58] + +//! [62] +QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) +{ + if (ctx->argumentCount() != 2) + return ctx->throwError("add() takes exactly two arguments"); + double a = ctx->argument(0).toNumber(); + double b = ctx->argument(1).toNumber(); + return a + b; +} +//! [62] + +//! [63] +QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) +{ + if (ctx->argumentCount() != 2) + return ctx->throwError("add() takes exactly two arguments"); + if (!ctx->argument(0).isNumber()) + return ctx->throwError(QScriptContext::TypeError, "add(): first argument is not a number"); + if (!ctx->argument(1).isNumber()) + return ctx->throwError(QScriptContext::TypeError, "add(): second argument is not a number"); + double a = ctx->argument(0).toNumber(); + double b = ctx->argument(1).toNumber(); + return a + b; +} +//! [63] + +//! [65] +QScriptValue concat(QScriptContext *ctx, QScriptEngine *eng) +{ + QString result = ""; + for (int i = 0; i < ctx->argumentCount(); ++i) + result += ctx->argument(i).toString(); + return result; +} +//! [65] + +//! [67] +QScriptValue sort(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue comparefn = ctx->argument(0); + if (comparefn.isUndefined()) + comparefn = /* the built-in comparison function */; + else if (!comparefn.isFunction()) + return ctx->throwError(QScriptContext::TypeError, "sort(): argument is not a function"); + ... +} +//! [67] + +//! [69] +QScriptValue foo(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue bar = eng->globalObject().property("bar"); + QScriptValue arguments = ctx->argumentsObject(); + qDebug() << "calling bar() with" << arguments.property("length").toInt32() << "arguments"; + QScriptValue result = bar.apply(ctx->thisObject(), arguments); + qDebug() << "bar() returned" << result.toString(); + return result; +} +//! [69] + +//! [72] +QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue act = ctx->activationObject(); + act.setProperty("count", 0); + QScriptValue result = eng->newFunction(counter_inner); + result.setScope(act); + return result; +} +//! [72] + +//! [73] +QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue outerAct = ctx->callee().scope(); + double count = outerAct.property("count").toNumber(); + outerAct.setProperty("count", count+1); + return count; +} +//! [73] + +//! [74] +QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue act = ctx->activationObject(); + act.setProperty("count", 0); + return eng->evaluate("(function() { return count++; })"); +} +//! [74] + +//! [76] +QScriptValue Person_ctor(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue object; + if (ctx->isCalledAsConstructor()) { + object = ctx->thisObject(); + } else { + object = eng->newObject(); + object.setPrototype(ctx->callee().property("prototype")); + } + object.setProperty("name", ctx->argument(0)); + return object; +} +//! [76] + +//! [77] +QScriptContext *ctx = eng.pushContext(); +QScriptValue act = ctx->activationObject(); +act.setProperty("digit", 7); + +qDebug() << eng.evaluate("digit + 1").toNumber(); // 8 + +eng.popContext(); +//! [77] + +//! [78] +QScriptValue getSet(QScriptContext *ctx, QScriptEngine *eng) +{ + QScriptValue obj = ctx->thisObject(); + QScriptValue data = obj.data(); + if (!data.isValid()) { + data = eng->newObject(); + obj.setData(data); + } + QScriptValue result; + if (ctx->argumentCount() == 1) { + QString str = ctx->argument(0).toString(); + str.replace("Roberta", "Ken"); + result = str; + data.setProperty("x", result); + } else { + result = data.property("x"); + } + return result; +} +//! [78] + +//! [79] +QScriptEngine eng; +QScriptValue obj = eng.newObject(); +obj.setProperty("x", eng.newFunction(getSet), + QScriptValue::PropertyGetter|QScriptValue::PropertySetter); +//! [79] + +//! [91] +QScriptValue object = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })"); +QScriptValue toKelvin = object.property("toKelvin"); +QScriptValue result = toKelvin.call(object, QScriptValueList() << 100); +qDebug() << result.toNumber(); // 373 +//! [91] + +//! [92] +QScriptValue add = engine.globalObject().property("add"); +qDebug() << add.call(QScriptValue(), QScriptValueList() << 1 << 2).toNumber(); // 3 +//! [92] + +//! [93] +typedef QSharedPointer XmlStreamReaderPointer; + +Q_DECLARE_METATYPE(XmlStreamReaderPointer) + +QScriptValue constructXmlStreamReader(QScriptContext *context, QScriptEngine *engine) +{ + if (!context->isCalledAsConstructor()) + return context->throwError(QScriptContext::SyntaxError, "please use the 'new' operator"); + + QIODevice *device = qobject_cast(context->argument(0).toQObject()); + if (!device) + return context->throwError(QScriptContext::TypeError, "please supply a QIODevice as first argument"); + + // Create the C++ object + QXmlStreamReader *reader = new QXmlStreamReader(device); + + XmlStreamReaderPointer pointer(reader); + + // store the shared pointer in the script object that we are constructing + return engine->newVariant(context->thisObject(), qVariantFromValue(pointer)); +} +//! [93] + +//! [94] +QScriptValue xmlStreamReader_atEnd(QScriptContext *context, QScriptEngine *) +{ + XmlStreamReaderPointer reader = qscriptvalue_cast(context->thisObject()); + if (!reader) + return context->throwError(QScriptContext::TypeError, "this object is not an XmlStreamReader"); + return reader->atEnd(); +} +//! [94] + +//! [95] + QScriptEngine engine; + QScriptValue xmlStreamReaderProto = engine.newObject(); + xmlStreamReaderProto.setProperty("atEnd", engine.newFunction(xmlStreamReader_atEnd)); + + QScriptValue xmlStreamReaderCtor = engine.newFunction(constructXmlStreamReader, xmlStreamReaderProto); + engine.globalObject().setProperty("XmlStreamReader", xmlStreamReaderCtor); +//! [95] diff --git a/doc/src/snippets/code/doc_src_qtscript.js b/doc/src/snippets/code/doc_src_qtscript.js new file mode 100644 index 0000000..fe1f9b9 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtscript.js @@ -0,0 +1,444 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [2] +function myInterestingScriptFunction() { + // ... +} +// ... +myQObject.somethingChanged.connect(myInterestingScriptFunction); +//! [2] + + +//! [3] +myQObject.somethingChanged.connect(myOtherQObject.doSomething); +//! [3] + + +//! [4] +myQObject.somethingChanged.disconnect(myInterestingFunction); +myQObject.somethingChanged.disconnect(myOtherQObject.doSomething); +//! [4] + + +//! [5] +var obj = { x: 123 }; +var fun = function() { print(this.x); }; +myQObject.somethingChanged.connect(obj, fun); +//! [5] + + +//! [6] +myQObject.somethingChanged.disconnect(obj, fun); +//! [6] + + +//! [7] +var obj = { x: 123, fun: function() { print(this.x); } }; +myQObject.somethingChanged.connect(obj, "fun"); +//! [7] + + +//! [8] +myQObject.somethingChanged.disconnect(obj, "fun"); +//! [8] + + +//! [9] +try { + myQObject.somethingChanged.connect(myQObject, "slotThatDoesntExist"); +} catch (e) { + print(e); +} +//! [9] + + +//! [10] +myQObject.somethingChanged("hello"); +//! [10] + + +//! [11] +myQObject.myOverloadedSlot(10); // will call the int overload +myQObject.myOverloadedSlot("10"); // will call the QString overload +//! [11] + + +//! [12] +myQObject['myOverloadedSlot(int)']("10"); // call int overload; the argument is converted to an int +myQObject['myOverloadedSlot(QString)'](10); // call QString overload; the argument is converted to a string +//! [12] + + +//! [14] +myQObject.enabled = true; + +// ... + +myQObject.enabled = !myQObject.enabled; +//! [14] + + +//! [15] +myDialog.okButton +//! [15] + + +//! [16] +myDialog.okButton.objectName = "cancelButton"; +// from now on, myDialog.cancelButton references the button +//! [16] + + +//! [17] +var okButton = myDialog.findChild("okButton"); +if (okButton != null) { + // do something with the OK button +} + +var buttons = myDialog.findChildren(RegExp("button[0-9]+")); +for (var i = 0; i < buttons.length; ++i) { + // do something with buttons[i] +} +//! [17] + + +//! [21] +var obj = new MyObject; +obj.setEnabled( true ); +print( "obj is enabled: " + obj.isEnabled() ); +//! [21] + + +//! [22] +var obj = new MyObject; +obj.enabled = true; +print( "obj is enabled: " + obj.enabled ); +//! [22] + + +//! [26] +function enabledChangedHandler( b ) +{ + print( "state changed to: " + b ); +} + +function init() +{ + var obj = new MyObject(); + // connect a script function to the signal + obj["enabledChanged(bool)"].connect(enabledChangedHandler); + obj.enabled = true; + print( "obj is enabled: " + obj.enabled ); +} +//! [26] + + +//! [27] +var o = new Object(); +o.foo = 123; +print(o.hasOwnProperty('foo')); // true +print(o.hasOwnProperty('bar')); // false +print(o); // calls o.toString(), which returns "[object Object]" +//! [27] + + +//! [28] +function Person(name) +{ + this.name = name; +} +//! [28] + + +//! [29] +Person.prototype.toString = function() { return "Person(name: " + this.name + ")"; } +//! [29] + + +//! [30] +var p1 = new Person("John Doe"); +var p2 = new Person("G.I. Jane"); +print(p1); // "Person(name: John Doe)" +print(p2); // "Person(name: G.I. Jane)" +//! [30] + + +//! [31] +print(p1.hasOwnProperty('name')); // 'name' is an instance variable, so this returns true +print(p1.hasOwnProperty('toString')); // returns false; inherited from prototype +print(p1 instanceof Person); // true +print(p1 instanceof Object); // true +//! [31] + + +//! [32] +function Employee(name, salary) +{ + Person.call(this, name); // call base constructor + + this.salary = salary; +} + +// set the prototype to be an instance of the base class +Employee.prototype = new Person(); + +// initialize prototype +Employee.prototype.toString = function() { + // ... +} +//! [32] + + +//! [33] +var e = new Employee("Johnny Bravo", 5000000); +print(e instanceof Employee); // true +print(e instanceof Person); // true +print(e instanceof Object); // true +print(e instanceof Array); // false +//! [33] + + +//! [40] +var o = new Object(); +(o.__proto__ === Object.prototype); // this evaluates to true +//! [40] + + +//! [41] +var o = new Object(); +o.__defineGetter__("x", function() { return 123; }); +var y = o.x; // 123 +//! [41] + + +//! [42] +var o = new Object(); +o.__defineSetter__("x", function(v) { print("and the value is:", v); }); +o.x = 123; // will print "and the value is: 123" +//! [42] + + +//! [49] +var getProperty = function(name) { return this[name]; }; + +name = "Global Object"; // creates a global variable +print(getProperty("name")); // "Global Object" + +var myObject = { name: 'My Object' }; +print(getProperty.call(myObject, "name")); // "My Object" + +myObject.getProperty = getProperty; +print(myObject.getProperty("name")); // "My Object" + +getProperty.name = "The getProperty() function"; +getProperty.getProperty = getProperty; +getProperty.getProperty("name"); // "The getProperty() function" +//! [49] + +//! [50] +var o = { a: 1, b: 2, sum: function() { return a + b; } }; +print(o.sum()); // reference error, or sum of global variables a and b!! +//! [50] + +//! [51] +var o = { a: 1, b: 2, sum: function() { return this.a + this.b; } }; +print(o.sum()); // 3 +//! [51] + +//! [56] +function add(a, b) { + return a + b; +} +//! [56] + +//! [57] +function add() { + return arguments[0] + arguments[1]; +} +//! [57] + +//! [59] +function add() { + if (arguments.length != 2) + throw Error("add() takes exactly two arguments"); + return arguments[0] + arguments[1]; +} +//! [59] + +//! [60] +function add() { + if (arguments.length != 2) + throw Error("add() takes exactly two arguments"); + if (typeof arguments[0] != "number") + throw TypeError("add(): first argument is not a number"); + if (typeof arguments[1] != "number") + throw TypeError("add(): second argument is not a number"); + return arguments[0] + arguments[1]; +} +//! [60] + +//! [61] +function add() { + if (arguments.length != 2) + throw Error("add() takes exactly two arguments"); + return Number(arguments[0]) + Number(arguments[1]); +} +//! [61] + +//! [64] +function concat() { + var result = ""; + for (var i = 0; i < arguments.length; ++i) + result += String(arguments[i]); + return result; +} +//! [64] + +//! [66] +function sort(comparefn) { + if (comparefn == undefined) + comparefn = fn; /* replace fn with the built-in comparison function */ + else if (typeof comparefn != "function") + throw TypeError("sort(): argument must be a function"); + // ... +} +//! [66] + +//! [68] +function foo() { + // Let bar() take care of this. + print("calling bar() with " + arguments.length + "arguments"); + var result = bar.apply(this, arguments); + print("bar() returned" + result); + return result; +} +//! [68] + +//! [70] +function counter() { + var count = 0; + return function() { + return count++; + } +} +//! [70] + +//! [71] +var c1 = counter(); // create a new counter function +var c2 = counter(); // create a new counter function +print(c1()); // 0 +print(c1()); // 1 +print(c2()); // 0 +print(c2()); // 1 +//! [71] + +//! [75] +function Book(isbn) { + this.isbn = isbn; +} + +var coolBook1 = new Book("978-0131872493"); +var coolBook2 = new Book("978-1593271473"); +//! [75] + +//! [80] +obj.x = "Roberta sent me"; +print(obj.x); // "Ken sent me" +obj.x = "I sent the bill to Roberta"; +print(obj.x); // "I sent the bill to Ken" +//! [80] + +//! [81] +obj = {}; +obj.__defineGetter__("x", function() { return this._x; }); +obj.__defineSetter__("x", function(v) { print("setting x to", v); this._x = v; }); +obj.x = 123; +//! [81] + +//! [82] +myButton.text = qsTr("Hello world!"); +//! [82] + +//! [83] +myButton.text = qsTranslate("MyAwesomeScript", "Hello world!"); +//! [83] + +//! [84] +FriendlyConversation.prototype.greeting = function(type) +{ + if (FriendlyConversation['greeting_strings'] == undefined) { + FriendlyConversation['greeting_strings'] = [ + QT_TR_NOOP("Hello"), + QT_TR_NOOP("Goodbye") + ]; + } + return qsTr(FriendlyConversation.greeting_strings[type]); +} +//! [84] + +//! [85] +FriendlyConversation.prototype.greeting = function(type) +{ + if (FriendlyConversation['greeting_strings'] == undefined) { + FriendlyConversation['greeting_strings'] = [ + QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), + QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") + ]; + } + return qsTranslate("FriendlyConversation", FriendlyConversation.greeting_strings[type]); +} +//! [85] + +//! [86] +FileCopier.prototype.showProgress = function(done, total, currentFileName) +{ + this.label.text = qsTr("%1 of %2 files copied.\nCopying: %3") + .arg(done) + .arg(total) + .arg(currentFileName); +} +//! [86] + +//! [90] +({ unitName: "Celsius", + toKelvin: function(x) { return x + 273; } + }) +//! [90] diff --git a/doc/src/snippets/code/doc_src_qtscript.pro b/doc/src/snippets/code/doc_src_qtscript.pro new file mode 100644 index 0000000..ce687d7 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtscript.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += script +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtscript.qdoc b/doc/src/snippets/code/doc_src_qtscript.qdoc index a168d5b..b65311f 100644 --- a/doc/src/snippets/code/doc_src_qtscript.qdoc +++ b/doc/src/snippets/code/doc_src_qtscript.qdoc @@ -38,882 +38,6 @@ ** ****************************************************************************/ -//! [0] -#include -//! [0] - - -//! [1] -QT += script -//! [1] - - -//! [2] -function myInterestingScriptFunction() { ... } -... -myQObject.somethingChanged.connect(myInterestingScriptFunction); -//! [2] - - -//! [3] -myQObject.somethingChanged.connect(myOtherQObject.doSomething); -//! [3] - - -//! [4] -myQObject.somethingChanged.disconnect(myInterestingFunction); -myQObject.somethingChanged.disconnect(myOtherQObject.doSomething); -//! [4] - - -//! [5] -var obj = { x: 123 }; -var fun = function() { print(this.x); }; -myQObject.somethingChanged.connect(obj, fun); -//! [5] - - -//! [6] -myQObject.somethingChanged.disconnect(obj, fun); -//! [6] - - -//! [7] -var obj = { x: 123, fun: function() { print(this.x); } }; -myQObject.somethingChanged.connect(obj, "fun"); -//! [7] - - -//! [8] -myQObject.somethingChanged.disconnect(obj, "fun"); -//! [8] - - -//! [9] -try { - myQObject.somethingChanged.connect(myQObject, "slotThatDoesntExist"); -} catch (e) { - print(e); -} -//! [9] - - -//! [10] -myQObject.somethingChanged("hello"); -//! [10] - - -//! [11] -myQObject.myOverloadedSlot(10); // will call the int overload -myQObject.myOverloadedSlot("10"); // will call the QString overload -//! [11] - - -//! [12] -myQObject['myOverloadedSlot(int)']("10"); // call int overload; the argument is converted to an int -myQObject['myOverloadedSlot(QString)'](10); // call QString overload; the argument is converted to a string -//! [12] - - -//! [13] -Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) -//! [13] - - -//! [14] -myQObject.enabled = true; - -... - -myQObject.enabled = !myQObject.enabled; -//! [14] - - -//! [15] -myDialog.okButton -//! [15] - - -//! [16] -myDialog.okButton.objectName = "cancelButton"; -// from now on, myDialog.cancelButton references the button -//! [16] - - -//! [17] -var okButton = myDialog.findChild("okButton"); -if (okButton != null) { - // do something with the OK button -} - -var buttons = myDialog.findChildren(RegExp("button[0-9]+")); -for (var i = 0; i < buttons.length; ++i) { - // do something with buttons[i] -} -//! [17] - - -//! [18] -QScriptValue myQObjectConstructor(QScriptContext *context, QScriptEngine *engine) -{ - // let the engine manage the new object's lifetime. - return engine->newQObject(new MyQObject(), QScriptEngine::ScriptOwnership); -} -//! [18] - - -//! [19] -class MyObject : public QObject -{ - Q_OBJECT - -public: - MyObject( ... ); - - void aNonScriptableFunction(); - -public slots: // these functions (slots) will be available in QtScript - void calculate( ... ); - void setEnabled( bool enabled ); - bool isEnabled() const; - -private: - .... - -}; -//! [19] - - -//! [20] -class MyObject : public QObject -{ - Q_OBJECT - - public: - Q_INVOKABLE void thisMethodIsInvokableInQtScript(); - void thisMethodIsNotInvokableInQtScript(); - - ... -}; -//! [20] - - -//! [21] -var obj = new MyObject; -obj.setEnabled( true ); -print( "obj is enabled: " + obj.isEnabled() ); -//! [21] - - -//! [22] -var obj = new MyObject; -obj.enabled = true; -print( "obj is enabled: " + obj.enabled ); -//! [22] - - -//! [23] -class MyObject : public QObject -{ - Q_OBJECT - // define the enabled property - Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled ) - -public: - MyObject( ... ); - - void aNonScriptableFunction(); - -public slots: // these functions (slots) will be available in QtScript - void calculate( ... ); - void setEnabled( bool enabled ); - bool isEnabled() const; - -private: - .... - -}; -//! [23] - - -//! [24] -Q_PROPERTY(int nonScriptableProperty READ foo WRITE bar SCRIPTABLE false) -//! [24] - - -//! [25] -class MyObject : public QObject -{ - Q_OBJECT - // define the enabled property - Q_PROPERTY( bool enabled WRITE setEnabled READ isEnabled ) - -public: - MyObject( ... ); - - void aNonScriptableFunction(); - -public slots: // these functions (slots) will be available in QtScript - void calculate( ... ); - void setEnabled( bool enabled ); - bool isEnabled() const; - -signals: // the signals - void enabledChanged( bool newState ); - -private: - .... - -}; -//! [25] - - -//! [26] -function enabledChangedHandler( b ) -{ - print( "state changed to: " + b ); -} - -function init() -{ - var obj = new MyObject(); - // connect a script function to the signal - obj["enabledChanged(bool)"].connect(enabledChangedHandler); - obj.enabled = true; - print( "obj is enabled: " + obj.enabled ); -} -//! [26] - - -//! [27] -var o = new Object(); -o.foo = 123; -print(o.hasOwnProperty('foo')); // true -print(o.hasOwnProperty('bar')); // false -print(o); // calls o.toString(), which returns "[object Object]" -//! [27] - - -//! [28] -function Person(name) -{ - this.name = name; -} -//! [28] - - -//! [29] -Person.prototype.toString = function() { return "Person(name: " + this.name + ")"; } -//! [29] - - -//! [30] -var p1 = new Person("John Doe"); -var p2 = new Person("G.I. Jane"); -print(p1); // "Person(name: John Doe)" -print(p2); // "Person(name: G.I. Jane)" -//! [30] - - -//! [31] -print(p1.hasOwnProperty('name')); // 'name' is an instance variable, so this returns true -print(p1.hasOwnProperty('toString')); // returns false; inherited from prototype -print(p1 instanceof Person); // true -print(p1 instanceof Object); // true -//! [31] - - -//! [32] -function Employee(name, salary) -{ - Person.call(this, name); // call base constructor - - this.salary = salary; -} - -// set the prototype to be an instance of the base class -Employee.prototype = new Person(); - -// initialize prototype -Employee.prototype.toString = function() { ... } -//! [32] - - -//! [33] -var e = new Employee("Johnny Bravo", 5000000); -print(e instanceof Employee); // true -print(e instanceof Person); // true -print(e instanceof Object); // true -print(e instanceof Array); // false -//! [33] - - -//! [34] -QScriptValue Person_ctor(QScriptContext *context, QScriptEngine *engine) -{ - QString name = context->argument(0).toString(); - context->thisObject().setProperty("name", name); - return engine->undefinedValue(); -} -//! [34] - - -//! [35] -QScriptValue Person_prototype_toString(QScriptContext *context, QScriptEngine *engine) -{ - QString name = context->thisObject().property("name").toString(); - QString result = QString::fromLatin1("Person(name: %0)").arg(name); - return result; -} -//! [35] - - -//! [36] -QScriptEngine engine; -QScriptValue ctor = engine.newFunction(Person_ctor); -ctor.property("prototype").setProperty("toString", engine.newFunction(Person_prototype_toString)); -QScriptValue global = engine.globalObject(); -global.setProperty("Person", ctor); -//! [36] - - -//! [37] -QScriptValue Employee_ctor(QScriptContext *context, QScriptEngine *engine) -{ - QScriptValue super = context->callee().property("prototype").property("constructor"); - super.call(context->thisObject(), QScriptValueList() << context->argument(0)); - context->thisObject().setProperty("salary", context->argument(1)); - return engine->undefinedValue(); -} -//! [37] - - -//! [38] -QScriptValue empCtor = engine.newFunction(Employee_ctor); -empCtor.setProperty("prototype", global.property("Person").construct()); -global.setProperty("Employee", empCtor); -//! [38] - - -//! [39] -Q_DECLARE_METATYPE(QPointF) -Q_DECLARE_METATYPE(QPointF*) - -QScriptValue QPointF_prototype_x(QScriptContext *context, QScriptEngine *engine) -{ - // Since the point is not to be modified, it's OK to cast to a value here - QPointF point = qscriptvalue_cast(context->thisObject()); - return point.x(); -} - -QScriptValue QPointF_prototype_setX(QScriptContext *context, QScriptEngine *engine) -{ - // Cast to a pointer to be able to modify the underlying C++ value - QPointF *point = qscriptvalue_cast(context->thisObject()); - if (!point) - return context->throwError(QScriptContext::TypeError, "QPointF.prototype.setX: this object is not a QPointF"); - point->setX(context->argument(0).toNumber()); - return engine->undefinedValue(); -} -//! [39] - - -//! [40] -var o = new Object(); -(o.__proto__ === Object.prototype); // this evaluates to true -//! [40] - - -//! [41] -var o = new Object(); -o.__defineGetter__("x", function() { return 123; }); -var y = o.x; // 123 -//! [41] - - -//! [42] -var o = new Object(); -o.__defineSetter__("x", function(v) { print("and the value is:", v); }); -o.x = 123; // will print "and the value is: 123" -//! [42] - - -//! [43] -class MyObject : public QObject -{ - Q_OBJECT - ... -}; - -Q_DECLARE_METATYPE(MyObject*) - -QScriptValue myObjectToScriptValue(QScriptEngine *engine, MyObject* const &in) -{ return engine->newQObject(in); } - -void myObjectFromScriptValue(const QScriptValue &object, MyObject* &out) -{ out = qobject_cast(object.toQObject()); } - -... - -qScriptRegisterMetaType(&engine, myObjectToScriptValue, myObjectFromScriptValue); -//! [43] - -//! [44] -QScriptValue QPoint_ctor(QScriptContext *context, QScriptEngine *engine) -{ - int x = context->argument(0).toInt32(); - int y = context->argument(1).toInt32(); - return engine->toScriptValue(QPoint(x, y)); -} - -... - -engine.globalObject().setProperty("QPoint", engine.newFunction(QPoint_ctor)); -//! [44] - -//! [45] -QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine) -{ - QString result; - for (int i = 0; i < context->argumentCount(); ++i) { - if (i > 0) - result.append(" "); - result.append(context->argument(i).toString()); - } - - QScriptValue calleeData = context->callee().data(); - QPlainTextEdit *edit = qobject_cast(calleeData.toQObject()); - edit->appendPlainText(result); - - return engine->undefinedValue(); -} -//! [45] - -//! [46] -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QScriptEngine eng; - QPlainTextEdit edit; - - QScriptValue fun = eng.newFunction(myPrintFunction); - fun.setData(eng.newQObject(&edit)); - eng.globalObject().setProperty("print", fun); - - eng.evaluate("print('hello', 'world')"); - - edit.show(); - return app.exec(); -} -//! [46] - - -//! [47] -QScriptEngine eng; -QLineEdit *edit = new QLineEdit(...); -QScriptValue handler = eng.evaluate("(function(text) { print('text was changed to', text); })"); -qScriptConnect(edit, SIGNAL(textChanged(const QString &)), QScriptValue(), handler); -//! [47] - -//! [48] -QLineEdit *edit1 = new QLineEdit(...); -QLineEdit *edit2 = new QLineEdit(...); - -QScriptValue handler = eng.evaluate("(function() { print('I am', this.name); })"); -QScriptValue obj1 = eng.newObject(); -obj1.setProperty("name", "the walrus"); -QScriptValue obj2 = eng.newObject(); -obj2.setProperty("name", "Sam"); - -qScriptConnect(edit1, SIGNAL(returnPressed()), obj1, handler); -qScriptConnect(edit2, SIGNAL(returnPressed()), obj2, handler); -//! [48] - -//! [49] -var getProperty = function(name) { return this[name]; }; - -name = "Global Object"; // creates a global variable -print(getProperty("name")); // "Global Object" - -var myObject = { name: 'My Object' }; -print(getProperty.call(myObject, "name")); // "My Object" - -myObject.getProperty = getProperty; -print(myObject.getProperty("name")); // "My Object" - -getProperty.name = "The getProperty() function"; -getProperty.getProperty = getProperty; -getProperty.getProperty("name"); // "The getProperty() function" -//! [49] - -//! [50] -var o = { a: 1, b: 2, sum: function() { return a + b; } }; -print(o.sum()); // reference error, or sum of global variables a and b!! -//! [50] - -//! [51] -var o = { a: 1, b: 2, sum: function() { return this.a + this.b; } }; -print(o.sum()); // 3 -//! [51] - -//! [52] -QScriptValue getProperty(QScriptContext *ctx, QScriptEngine *eng) -{ - QString name = ctx->argument(0).toString(); - return ctx->thisObject().property(name); -} -//! [52] - -//! [53] -QScriptValue myCompare(QScriptContext *ctx, QScriptEngine *eng) -{ - double first = ctx->argument(0).toNumber(); - double second = ctx->argument(1).toNumber(); - int result; - if (first == second) - result = 0; - else if (first < second) - result = -1; - else - result = 1; - return result; -} -//! [53] - -//! [54] -QScriptEngine eng; -QScriptValue comparefn = eng.newFunction(myCompare); -QScriptValue array = eng.evaluate("new Array(10, 5, 20, 15, 30)"); -array.property("sort").call(array, QScriptValueList() << comparefn); - -// prints "5,10,15,20,30" -qDebug() << array.toString(); -//! [54] - -//! [55] -QScriptValue rectifier(QScriptContext *ctx, QScriptEngine *eng) -{ - QRectF magicRect = qscriptvalue_cast(ctx->callee().data()); - QRectF sourceRect = qscriptvalue_cast(ctx->argument(0)); - return eng->toScriptValue(sourceRect.intersected(magicRect)); -} - -... - -QScriptValue fun = eng.newFunction(rectifier); -QRectF magicRect = QRectF(10, 20, 30, 40); -fun.setData(eng.toScriptValue(magicRect)); -eng.globalObject().setProperty("rectifier", fun); -//! [55] - -//! [56] -function add(a, b) { - return a + b; -} -//! [56] - -//! [57] -function add() { - return arguments[0] + arguments[1]; -} -//! [57] - -//! [58] -QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) -{ - double a = ctx->argument(0).toNumber(); - double b = ctx->argument(1).toNumber(); - return a + b; -} -//! [58] - -//! [59] -function add() { - if (arguments.length != 2) - throw Error("add() takes exactly two arguments"); - return arguments[0] + arguments[1]; -} -//! [59] - -//! [60] -function add() { - if (arguments.length != 2) - throw Error("add() takes exactly two arguments"); - if (typeof arguments[0] != "number") - throw TypeError("add(): first argument is not a number"); - if (typeof arguments[1] != "number") - throw TypeError("add(): second argument is not a number"); - return arguments[0] + arguments[1]; -} -//! [60] - -//! [61] -function add() { - if (arguments.length != 2) - throw Error("add() takes exactly two arguments"); - return Number(arguments[0]) + Number(arguments[1]); -} -//! [61] - -//! [62] -QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) -{ - if (ctx->argumentCount() != 2) - return ctx->throwError("add() takes exactly two arguments"); - double a = ctx->argument(0).toNumber(); - double b = ctx->argument(1).toNumber(); - return a + b; -} -//! [62] - -//! [63] -QScriptValue add(QScriptContext *ctx, QScriptEngine *eng) -{ - if (ctx->argumentCount() != 2) - return ctx->throwError("add() takes exactly two arguments"); - if (!ctx->argument(0).isNumber()) - return ctx->throwError(QScriptContext::TypeError, "add(): first argument is not a number"); - if (!ctx->argument(1).isNumber()) - return ctx->throwError(QScriptContext::TypeError, "add(): second argument is not a number"); - double a = ctx->argument(0).toNumber(); - double b = ctx->argument(1).toNumber(); - return a + b; -} -//! [63] - -//! [64] -function concat() { - var result = ""; - for (var i = 0; i < arguments.length; ++i) - result += String(arguments[i]); - return result; -} -//! [64] - -//! [65] -QScriptValue concat(QScriptContext *ctx, QScriptEngine *eng) -{ - QString result = ""; - for (int i = 0; i < ctx->argumentCount(); ++i) - result += ctx->argument(i).toString(); - return result; -} -//! [65] - -//! [66] -function sort(comparefn) { - if (comparefn == undefined) - comparefn = /* the built-in comparison function */; - else if (typeof comparefn != "function") - throw TypeError("sort(): argument must be a function"); - ... -} -//! [66] - -//! [67] -QScriptValue sort(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue comparefn = ctx->argument(0); - if (comparefn.isUndefined()) - comparefn = /* the built-in comparison function */; - else if (!comparefn.isFunction()) - return ctx->throwError(QScriptContext::TypeError, "sort(): argument is not a function"); - ... -} -//! [67] - -//! [68] -function foo() { - // Let bar() take care of this. - print("calling bar() with " + arguments.length + "arguments"); - var result = return bar.apply(this, arguments); - print("bar() returned" + result); - return result; -} -//! [68] - -//! [69] -QScriptValue foo(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue bar = eng->globalObject().property("bar"); - QScriptValue arguments = ctx->argumentsObject(); - qDebug() << "calling bar() with" << arguments.property("length").toInt32() << "arguments"; - QScriptValue result = bar.apply(ctx->thisObject(), arguments); - qDebug() << "bar() returned" << result.toString(); - return result; -} -//! [69] - -//! [70] -function counter() { - var count = 0; - return function() { - return count++; - } -} -//! [70] - -//! [71] -var c1 = counter(); // create a new counter function -var c2 = counter(); // create a new counter function -print(c1()); // 0 -print(c1()); // 1 -print(c2()); // 0 -print(c2()); // 1 -//! [71] - -//! [72] -QScriptValue counter(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue act = ctx->activationObject(); - act.setProperty("count", 0); - QScriptValue result = eng->newFunction(counter_inner); - result.setScope(act); - return result; -} -//! [72] - -//! [73] -QScriptValue counter_inner(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue outerAct = ctx->callee().scope(); - double count = outerAct.property("count").toNumber(); - outerAct.setProperty("count", count+1); - return count; -} -//! [73] - -//! [74] -QScriptValue counter_hybrid(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue act = ctx->activationObject(); - act.setProperty("count", 0); - return eng->evaluate("(function() { return count++; })"); -} -//! [74] - -//! [75] -function Book(isbn) { - this.isbn = isbn; -} - -var coolBook1 = new Book("978-0131872493"); -var coolBook2 = new Book("978-1593271473"); -//! [75] - -//! [76] -QScriptValue Person_ctor(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue object; - if (ctx->isCalledAsConstructor()) { - object = ctx->thisObject(); - } else { - object = eng->newObject(); - object.setPrototype(ctx->callee().property("prototype")); - } - object.setProperty("name", ctx->argument(0)); - return object; -} -//! [76] - -//! [77] -QScriptContext *ctx = eng.pushContext(); -QScriptValue act = ctx->activationObject(); -act.setProperty("digit", 7); - -qDebug() << eng.evaluate("digit + 1").toNumber(); // 8 - -eng.popContext(); -//! [77] - -//! [78] -QScriptValue getSet(QScriptContext *ctx, QScriptEngine *eng) -{ - QScriptValue obj = ctx->thisObject(); - QScriptValue data = obj.data(); - if (!data.isValid()) { - data = eng->newObject(); - obj.setData(data); - } - QScriptValue result; - if (ctx->argumentCount() == 1) { - QString str = ctx->argument(0).toString(); - str.replace("Roberta", "Ken"); - result = str; - data.setProperty("x", result); - } else { - result = data.property("x"); - } - return result; -} -//! [78] - -//! [79] -QScriptEngine eng; -QScriptValue obj = eng.newObject(); -obj.setProperty("x", eng.newFunction(getSet), - QScriptValue::PropertyGetter|QScriptValue::PropertySetter); -//! [79] - -//! [80] -obj.x = "Roberta sent me"; -print(obj.x); // "Ken sent me" -obj.x = "I sent the bill to Roberta"; -print(obj.x); // "I sent the bill to Ken" -//! [80] - -//! [81] -obj = {}; -obj.__defineGetter__("x", function() { return this._x; }); -obj.__defineSetter__("x", function(v) { print("setting x to", v); this._x = v; }); -obj.x = 123; -//! [81] - -//! [82] -myButton.text = qsTr("Hello world!"); -//! [82] - -//! [83] -myButton.text = qsTranslate("MyAwesomeScript", "Hello world!"); -//! [83] - -//! [84] -FriendlyConversation.prototype.greeting = function(type) -{ - if (FriendlyConversation['greeting_strings'] == undefined) { - FriendlyConversation['greeting_strings'] = [ - QT_TR_NOOP("Hello"), - QT_TR_NOOP("Goodbye") - ]; - } - return qsTr(FriendlyConversation.greeting_strings[type]); -} -//! [84] - -//! [85] -FriendlyConversation.prototype.greeting = function(type) -{ - if (FriendlyConversation['greeting_strings'] == undefined) { - FriendlyConversation['greeting_strings'] = [ - QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"), - QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye") - ]; - } - return qsTranslate("FriendlyConversation", FriendlyConversation.greeting_strings[type]); -} -//! [85] - -//! [86] -FileCopier.prototype.showProgress = function(done, total, currentFileName) -{ - this.label.text = qsTr("%1 of %2 files copied.\nCopying: %3") - .arg(done) - .arg(total) - .arg(currentFileName)); -} -//! [86] - //! [87] lupdate myscript.qs -ts myscript_la.ts //! [87] @@ -925,64 +49,3 @@ lupdate -extensions qs scripts/ -ts scripts_la.ts //! [89] lrelease myscript_la.ts //! [89] - -//! [90] -({ unitName: "Celsius", - toKelvin: function(x) { return x + 273; } - }) -//! [90] - -//! [91] -QScriptValue object = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })"); -QScriptValue toKelvin = object.property("toKelvin"); -QScriptValue result = toKelvin.call(object, QScriptValueList() << 100); -qDebug() << result.toNumber(); // 373 -//! [91] - -//! [92] -QScriptValue add = engine.globalObject().property("add"); -qDebug() << add.call(QScriptValue(), QScriptValueList() << 1 << 2).toNumber(); // 3 -//! [92] - -//! [93] -typedef QSharedPointer XmlStreamReaderPointer; - -Q_DECLARE_METATYPE(XmlStreamReaderPointer) - -QScriptValue constructXmlStreamReader(QScriptContext *context, QScriptEngine *engine) -{ - if (!context->isCalledAsConstructor()) - return context->throwError(QScriptContext::SyntaxError, "please use the 'new' operator"); - - QIODevice *device = qobject_cast(context->argument(0).toQObject()); - if (!device) - return context->throwError(QScriptContext::TypeError, "please supply a QIODevice as first argument"); - - // Create the C++ object - QXmlStreamReader *reader = new QXmlStreamReader(device); - - XmlStreamReaderPointer pointer(reader); - - // store the shared pointer in the script object that we are constructing - return engine->newVariant(context->thisObject(), qVariantFromValue(pointer)); -} -//! [93] - -//! [94] -QScriptValue xmlStreamReader_atEnd(QScriptContext *context, QScriptEngine *) -{ - XmlStreamReaderPointer reader = qscriptvalue_cast(context->thisObject()); - if (!reader) - return context->throwError(QScriptContext::TypeError, "this object is not an XmlStreamReader"); - return reader->atEnd(); -} -//! [94] - -//! [95] - QScriptEngine engine; - QScriptValue xmlStreamReaderProto = engine.newObject(); - xmlStreamReaderProto.setProperty("atEnd", engine.newFunction(xmlStreamReader_atEnd)); - - QScriptValue xmlStreamReaderCtor = engine.newFunction(constructXmlStreamReader, xmlStreamReaderProto); - engine.globalObject().setProperty("XmlStreamReader", xmlStreamReaderCtor); -//! [95] diff --git a/doc/src/snippets/code/doc_src_qtscriptextensions.js b/doc/src/snippets/code/doc_src_qtscriptextensions.js new file mode 100644 index 0000000..456077d --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtscriptextensions.js @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +print("importing " + __extension__); +__setupPackage__("cool.stuff"); + +cool.stuff.add = function(a, b) { return a + b; } +cool.stuff.subtract = function(a, b) { return a - b; } +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtscriptextensions.qdoc b/doc/src/snippets/code/doc_src_qtscriptextensions.qdoc deleted file mode 100644 index 456077d..0000000 --- a/doc/src/snippets/code/doc_src_qtscriptextensions.qdoc +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -print("importing " + __extension__); -__setupPackage__("cool.stuff"); - -cool.stuff.add = function(a, b) { return a + b; } -cool.stuff.subtract = function(a, b) { return a - b; } -//! [0] diff --git a/doc/src/snippets/code/doc_src_qtscripttools.cpp b/doc/src/snippets/code/doc_src_qtscripttools.cpp new file mode 100644 index 0000000..258c7df --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtscripttools.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtsql.cpp b/doc/src/snippets/code/doc_src_qtsql.cpp new file mode 100644 index 0000000..9c0c16e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtsql.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtsql.pro b/doc/src/snippets/code/doc_src_qtsql.pro new file mode 100644 index 0000000..4e31846 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtsql.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += sql +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtsql.qdoc b/doc/src/snippets/code/doc_src_qtsql.qdoc deleted file mode 100644 index 1bc7518..0000000 --- a/doc/src/snippets/code/doc_src_qtsql.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -QT += sql -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtsvg.cpp b/doc/src/snippets/code/doc_src_qtsvg.cpp new file mode 100644 index 0000000..c66b4da --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtsvg.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtsvg.pro b/doc/src/snippets/code/doc_src_qtsvg.pro new file mode 100644 index 0000000..1a75d03 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtsvg.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += svg +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtsvg.qdoc b/doc/src/snippets/code/doc_src_qtsvg.qdoc deleted file mode 100644 index 57db6de..0000000 --- a/doc/src/snippets/code/doc_src_qtsvg.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -QT += svg -//! [1] diff --git a/doc/src/snippets/code/doc_src_qttest.cpp b/doc/src/snippets/code/doc_src_qttest.cpp new file mode 100644 index 0000000..5b21c9e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qttest.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qttest.pro b/doc/src/snippets/code/doc_src_qttest.pro new file mode 100644 index 0000000..73d210e --- /dev/null +++ b/doc/src/snippets/code/doc_src_qttest.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +CONFIG += qtestlib +#! [1] diff --git a/doc/src/snippets/code/doc_src_qttest.qdoc b/doc/src/snippets/code/doc_src_qttest.qdoc deleted file mode 100644 index 354d188..0000000 --- a/doc/src/snippets/code/doc_src_qttest.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -#include -//! [0] - - -//! [1] -CONFIG += qtestlib -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtuiloader.cpp b/doc/src/snippets/code/doc_src_qtuiloader.cpp new file mode 100644 index 0000000..de35e78 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtuiloader.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [1] +#include +//! [1] diff --git a/doc/src/snippets/code/doc_src_qtuiloader.pro b/doc/src/snippets/code/doc_src_qtuiloader.pro new file mode 100644 index 0000000..a050213 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtuiloader.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +CONFIG += uitools +#! [0] diff --git a/doc/src/snippets/code/doc_src_qtuiloader.qdoc b/doc/src/snippets/code/doc_src_qtuiloader.qdoc deleted file mode 100644 index b8d8019..0000000 --- a/doc/src/snippets/code/doc_src_qtuiloader.qdoc +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -CONFIG += uitools -//! [0] - - -//! [1] -#include -//! [1] diff --git a/doc/src/snippets/code/doc_src_qtxml.cpp b/doc/src/snippets/code/doc_src_qtxml.cpp new file mode 100644 index 0000000..5413fd2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtxml.cpp @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtxml.pro b/doc/src/snippets/code/doc_src_qtxml.pro new file mode 100644 index 0000000..d69b2ce --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtxml.pro @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +#! [1] +QT += xml +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtxml.qdoc b/doc/src/snippets/code/doc_src_qtxml.qdoc index 6576815..1e864ea 100644 --- a/doc/src/snippets/code/doc_src_qtxml.qdoc +++ b/doc/src/snippets/code/doc_src_qtxml.qdoc @@ -38,21 +38,6 @@ ** ****************************************************************************/ -//! [0] -#include -//! [0] - - -//! [1] -QT += xml -//! [1] - - -//! [2] -QT += xml -//! [2] - - //! [3] A quotation. //! [3] diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp b/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp new file mode 100644 index 0000000..2c3235c --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +#include +//! [0] diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.pro b/doc/src/snippets/code/doc_src_qtxmlpatterns.pro new file mode 100644 index 0000000..61ee910 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.pro @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + + +#! [1] +QT += xmlpatterns +#! [1] diff --git a/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc b/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc index 560cc53..22e2dde 100644 --- a/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc +++ b/doc/src/snippets/code/doc_src_qtxmlpatterns.qdoc @@ -42,15 +42,6 @@ void wrapInFunction() { -//! [0] -#include -//! [0] - - -//! [1] -QT += xmlpatterns -//! [1] - //! [2] xmlpatterns myQuery.xq //! [2] diff --git a/doc/src/snippets/code/doc_src_qvarlengtharray.cpp b/doc/src/snippets/code/doc_src_qvarlengtharray.cpp new file mode 100644 index 0000000..a938330 --- /dev/null +++ b/doc/src/snippets/code/doc_src_qvarlengtharray.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +int myfunc(int n) +{ + int table[n + 1]; // WRONG + ... + return table[n]; +} +//! [0] + + +//! [1] +int myfunc(int n) +{ + int *table = new int[n + 1]; + ... + int ret = table[n]; + delete[] table; + return ret; +} +//! [1] + + +//! [2] +int myfunc(int n) +{ + QVarLengthArray array(n + 1); + ... + return array[n]; +} +//! [2] + + +//! [3] +QVarLengthArray array(10); +int *data = array.data(); +for (int i = 0; i < 10; ++i) + data[i] = 2 * i; +//! [3] diff --git a/doc/src/snippets/code/doc_src_qvarlengtharray.qdoc b/doc/src/snippets/code/doc_src_qvarlengtharray.qdoc deleted file mode 100644 index a938330..0000000 --- a/doc/src/snippets/code/doc_src_qvarlengtharray.qdoc +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -int myfunc(int n) -{ - int table[n + 1]; // WRONG - ... - return table[n]; -} -//! [0] - - -//! [1] -int myfunc(int n) -{ - int *table = new int[n + 1]; - ... - int ret = table[n]; - delete[] table; - return ret; -} -//! [1] - - -//! [2] -int myfunc(int n) -{ - QVarLengthArray array(n + 1); - ... - return array[n]; -} -//! [2] - - -//! [3] -QVarLengthArray array(10); -int *data = array.data(); -for (int i = 0; i < 10; ++i) - data[i] = 2 * i; -//! [3] diff --git a/doc/src/snippets/code/doc_src_resources.cpp b/doc/src/snippets/code/doc_src_resources.cpp new file mode 100644 index 0000000..b965cbe --- /dev/null +++ b/doc/src/snippets/code/doc_src_resources.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [4] +QResource::registerResource("/path/to/myresource.rcc"); +//! [4] + + +//! [5] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + Q_INIT_RESOURCE(graphlib); + ... + return app.exec(); +} +//! [5] diff --git a/doc/src/snippets/code/doc_src_resources.qdoc b/doc/src/snippets/code/doc_src_resources.qdoc index c524ae7..0b727da 100644 --- a/doc/src/snippets/code/doc_src_resources.qdoc +++ b/doc/src/snippets/code/doc_src_resources.qdoc @@ -63,19 +63,3 @@ //! [3] rcc -binary myresource.qrc -o myresource.rcc //! [3] - - -//! [4] -QResource::registerResource("/path/to/myresource.rcc"); -//! [4] - - -//! [5] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - Q_INIT_RESOURCE(graphlib); - ... - return app.exec(); -} -//! [5] diff --git a/doc/src/snippets/code/doc_src_richtext.cpp b/doc/src/snippets/code/doc_src_richtext.cpp new file mode 100644 index 0000000..8de5f4c --- /dev/null +++ b/doc/src/snippets/code/doc_src_richtext.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +QTextDocument *newDocument = new QTextDocument; +//! [0] + + +//! [1] +QTextEdit *editor = new QTextEdit; +QTextDocument *editorDocument = editor->document(); +//! [1] + + +//! [2] +QTextEdit *editor = new QTextEdit(parent); +editor->setHtml(aStringContainingHTMLtext); +editor->show(); +//! [2] + + +//! [3] +QTextDocument *document = editor->document(); +//! [3] + + +//! [4] +QTextCursor cursor = editor->textCursor(); +//! [4] + + +//! [5] +editor->setTextCursor(cursor); +//! [5] + + +//! [6] +textEdit.show(); + +textCursor.beginEditBlock(); + +for (int i = 0; i < 1000; ++i) { + textCursor.insertBlock(); + textCursor.insertText(paragraphText.at(i)); +} + +textCursor.endEditBlock(); +//! [6] diff --git a/doc/src/snippets/code/doc_src_richtext.qdoc b/doc/src/snippets/code/doc_src_richtext.qdoc index e031d77..2b79fdb 100644 --- a/doc/src/snippets/code/doc_src_richtext.qdoc +++ b/doc/src/snippets/code/doc_src_richtext.qdoc @@ -38,53 +38,6 @@ ** ****************************************************************************/ -//! [0] -QTextDocument *newDocument = new QTextDocument; -//! [0] - - -//! [1] -QTextEdit *editor = new QTextEdit; -QTextDocument *editorDocument = editor->document(); -//! [1] - - -//! [2] -QTextEdit *editor = new QTextEdit(parent); -editor->setHtml(aStringContainingHTMLtext); -editor->show(); -//! [2] - - -//! [3] -QTextDocument *document = editor->document(); -//! [3] - - -//! [4] -QTextCursor cursor = editor->textCursor(); -//! [4] - - -//! [5] -editor->setTextCursor(cursor); -//! [5] - - -//! [6] -textEdit.show(); - -textCursor.beginEditBlock(); - -for (int i = 0; i < 1000; ++i) { - textCursor.insertBlock(); - textCursor.insertText(paragraphText.at(i)); -} - -textCursor.endEditBlock(); -//! [6] - - //! [7] //! [7] diff --git a/doc/src/snippets/code/doc_src_sql-driver.cpp b/doc/src/snippets/code/doc_src_sql-driver.cpp new file mode 100644 index 0000000..56e4f9b --- /dev/null +++ b/doc/src/snippets/code/doc_src_sql-driver.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [2] +QSqlQuery q; +q.exec("call qtestproc (@outval1, @outval2)"); +q.exec("select @outval1, @outval2"); +q.next(); +qDebug() << q.value(0) << q.value(1); // outputs "42" and "43" +//! [2] + + +//! [10] +// STORED_PROC uses the return statement or returns multiple result sets +QSqlQuery query; +query.setForwardOnly(true); +query.exec("{call STORED_PROC}"); +//! [10] + + +//! [24] +db.setHostName("MyServer"); +db.setDatabaseName("C:\\test.gdb"); +//! [24] + + +//! [25] +// connect to database using the Latin-1 character set +db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1"); +db.open(); +//! [25] + + +//! [26] +QSqlQuery q; +q.exec("execute procedure my_procedure"); +q.next(); +qDebug() << q.value(0); // outputs the first RETURN/OUT value +//! [26] + + +//! [31] +QSqlDatabase: QMYSQL driver not loaded +QSqlDatabase: available drivers: QMYSQL +//! [31] diff --git a/doc/src/snippets/code/doc_src_sql-driver.qdoc b/doc/src/snippets/code/doc_src_sql-driver.qdoc index 482e38c..46cd1b3 100644 --- a/doc/src/snippets/code/doc_src_sql-driver.qdoc +++ b/doc/src/snippets/code/doc_src_sql-driver.qdoc @@ -59,15 +59,6 @@ END //! [1] -//! [2] -QSqlQuery q; -q.exec("call qtestproc (@outval1, @outval2)"); -q.exec("select @outval1, @outval2"); -q.next(); -qDebug() << q.value(0) << q.value(1); // outputs "42" and "43" -//! [2] - - //! [3] cd $QTDIR/src/plugins/sqldrivers/mysql qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro @@ -116,14 +107,6 @@ set PATH=%PATH%;c:\oracle\bin //! [9] -//! [10] -\\ STORED_PROC uses the return statement or returns multiple result sets -QSqlQuery query; -query.setForwardOnly(true); -query.exec("{call STORED_PROC}"); -//! [10] - - //! [11] cd $QTDIR/src/plugins/sqldrivers/odbc qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc" @@ -212,27 +195,6 @@ nmake //! [23] -//! [24] -db.setHostName("MyServer"); -db.setDatabaseName("C:\\test.gdb"); -//! [24] - - -//! [25] -// connect to database using the Latin-1 character set -db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1"); -db.open(); -//! [25] - - -//! [26] -QSqlQuery q; -q.exec("execute procedure my_procedure"); -q.next(); -qDebug() << q.value(0); // outputs the first RETURN/OUT value -//! [26] - - //! [27] cd $QTDIR/src/plugins/sqldrivers/ibase qmake "INCLUDEPATH+=/opt/interbase/include" "LIBS+=-L/opt/interbase/lib" ibase.pro @@ -261,11 +223,6 @@ nmake //! [30] -//! [31] -QSqlDatabase: QMYSQL driver not loaded -QSqlDatabase: available drivers: QMYSQL -//! [31] - //! [32] configure -I /usr/include/oracle/10.1.0.3/client -L /usr/lib/oracle/10.1.0.3/client/lib -R /usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10 make @@ -276,4 +233,3 @@ cd $QTDIR/src/plugins/sqldrivers/oci qmake "INCLUDEPATH+=/usr/include/oracle/10.1.0.3/client" "LIBS+=-L/usr/lib/oracle/10.1.0.3/client/lib -Wl,-rpath,/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10" oci.pro make //! [33] - diff --git a/doc/src/snippets/code/doc_src_styles.cpp b/doc/src/snippets/code/doc_src_styles.cpp new file mode 100644 index 0000000..a2a6fa9 --- /dev/null +++ b/doc/src/snippets/code/doc_src_styles.cpp @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] + opt.initFrom(q); + if (down) + opt.state |= QStyle::State_Sunken; + if (tristate && noChange) + opt.state |= QStyle::State_NoChange; + else + opt.state |= checked ? QStyle::State_On : + QStyle::State_Off; + if (q->testAttribute(Qt::WA_Hover) && q->underMouse()) { + if (hovering) + opt.state |= QStyle::State_MouseOver; + else + opt.state &= ~QStyle::State_MouseOver; + } + opt.text = text; + opt.icon = icon; + opt.iconSize = q->iconSize(); +//! [0] + + +//! [1] + state = QStyle::State_None; + if (widget->isEnabled()) + state |= QStyle::State_Enabled; + if (widget->hasFocus()) + state |= QStyle::State_HasFocus; + if (widget->window()->testAttribute(Qt::WA_KeyboardFocusChange)) + state |= QStyle::State_KeyboardFocusChange; + if (widget->underMouse()) + state |= QStyle::State_MouseOver; + if (widget->window()->isActiveWindow()) + state |= QStyle::State_Active; +#ifdef Q_WS_MAC + extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp + if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) + state &= ~QStyle::State_Enabled; +#endif +#ifdef QT_KEYPAD_NAVIGATION + if (widget->hasEditFocus()) + state |= QStyle::State_HasEditFocus; +#endif + + direction = widget->layoutDirection(); + rect = widget->rect(); + palette = widget->palette(); + fontMetrics = widget->fontMetrics(); +//! [1] + + +//! [2] + QStylePainter p(this); + QStyleOptionButton opt = d->getStyleOption(); + p.drawControl(QStyle::CE_CheckBox, opt); +//! [2] + + +//! [3] + QStyleOptionButton subopt = *btn; + subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget); + drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget); + subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget); + drawControl(CE_CheckBoxLabel, &subopt, p, widget); + + if (btn->state & State_HasFocus) { + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*btn); + fropt.rect = subElementRect(SE_CheckBoxFocusRect, btn, widget); + drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + } +//! [3] + + +//! [4] + const QStyleOptionButton *btn = qstyleoption_cast(opt); + uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter); + + if (!styleHint(SH_UnderlineShortcut, btn, widget)) + alignment |= Qt::TextHideMnemonic; + QPixmap pix; + QRect textRect = btn->rect; + if (!btn->icon.isNull()) { + pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); + drawItemPixmap(p, btn->rect, alignment, pix); + if (btn->direction == Qt::RightToLeft) + textRect.setRight(textRect.right() - btn->iconSize.width() - 4); + else + textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); + } + if (!btn->text.isEmpty()){ + drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, + btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText); + } +//! [4] diff --git a/doc/src/snippets/code/doc_src_styles.qdoc b/doc/src/snippets/code/doc_src_styles.qdoc deleted file mode 100644 index a2a6fa9..0000000 --- a/doc/src/snippets/code/doc_src_styles.qdoc +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] - opt.initFrom(q); - if (down) - opt.state |= QStyle::State_Sunken; - if (tristate && noChange) - opt.state |= QStyle::State_NoChange; - else - opt.state |= checked ? QStyle::State_On : - QStyle::State_Off; - if (q->testAttribute(Qt::WA_Hover) && q->underMouse()) { - if (hovering) - opt.state |= QStyle::State_MouseOver; - else - opt.state &= ~QStyle::State_MouseOver; - } - opt.text = text; - opt.icon = icon; - opt.iconSize = q->iconSize(); -//! [0] - - -//! [1] - state = QStyle::State_None; - if (widget->isEnabled()) - state |= QStyle::State_Enabled; - if (widget->hasFocus()) - state |= QStyle::State_HasFocus; - if (widget->window()->testAttribute(Qt::WA_KeyboardFocusChange)) - state |= QStyle::State_KeyboardFocusChange; - if (widget->underMouse()) - state |= QStyle::State_MouseOver; - if (widget->window()->isActiveWindow()) - state |= QStyle::State_Active; -#ifdef Q_WS_MAC - extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp - if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) - state &= ~QStyle::State_Enabled; -#endif -#ifdef QT_KEYPAD_NAVIGATION - if (widget->hasEditFocus()) - state |= QStyle::State_HasEditFocus; -#endif - - direction = widget->layoutDirection(); - rect = widget->rect(); - palette = widget->palette(); - fontMetrics = widget->fontMetrics(); -//! [1] - - -//! [2] - QStylePainter p(this); - QStyleOptionButton opt = d->getStyleOption(); - p.drawControl(QStyle::CE_CheckBox, opt); -//! [2] - - -//! [3] - QStyleOptionButton subopt = *btn; - subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget); - drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget); - subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget); - drawControl(CE_CheckBoxLabel, &subopt, p, widget); - - if (btn->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*btn); - fropt.rect = subElementRect(SE_CheckBoxFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); - } -//! [3] - - -//! [4] - const QStyleOptionButton *btn = qstyleoption_cast(opt); - uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter); - - if (!styleHint(SH_UnderlineShortcut, btn, widget)) - alignment |= Qt::TextHideMnemonic; - QPixmap pix; - QRect textRect = btn->rect; - if (!btn->icon.isNull()) { - pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); - drawItemPixmap(p, btn->rect, alignment, pix); - if (btn->direction == Qt::RightToLeft) - textRect.setRight(textRect.right() - btn->iconSize.width() - 4); - else - textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); - } - if (!btn->text.isEmpty()){ - drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, - btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText); - } -//! [4] diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc index 9b8a3b5..99b31c9 100644 --- a/doc/src/snippets/code/doc_src_stylesheet.qdoc +++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc @@ -170,53 +170,6 @@ LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */ //! [20] -//! [21] -qApp->setStyleSheet("QPushButton { color: white }"); -//! [21] - - -//! [22] -myPushButton->setStyleSheet("* { color: blue }"); -//! [22] - - -//! [23] -myPushButton->setStyleSheet("color: blue"); -//! [23] - - -//! [24] -qApp->setStyleSheet("QGroupBox { color: red; } "); -//! [24] - - -//! [25] -qApp->setStyleSheet("QGroupBox, QGroupBox * { color: red; }"); -//! [25] - - -//! [26] -class MyPushButton : public QPushButton { - // ... -} - -// ... -qApp->setStyleSheet("MyPushButton { background: yellow; }"); -//! [26] - - -//! [27] -namespace ns { - class MyPushButton : public QPushButton { - // ... - } -} - -// ... -qApp->setStyleSheet("ns--MyPushButton { background: yellow; }"); -//! [27] - - //! [28] MyLabel { qproperty-pixmap: url(pixmap.png); } MyGroupBox { qproperty-titleColor: rgb(100, 200, 100); } @@ -234,17 +187,6 @@ QToolButton { background-color: red; border: none; } //! [31] -//! [32] -void CustomWidget::paintEvent(QPaintEvent *) -{ - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); -} -//! [32] - - //! [33] QTreeView { alternate-background-color: blue; @@ -617,56 +559,11 @@ QPushButton { color: palette(dark); } //! [87] -//! [88] -qApp->setStyleSheet("QLineEdit { background-color: yellow }"); -//! [88] - - -//! [89] -myDialog->setStyleSheet("QLineEdit { background-color: yellow }"); -//! [89] - - -//! [90] -myDialog->setStyleSheet("QLineEdit#nameEdit { background-color: yellow }"); -//! [90] - - -//! [91] -nameEdit->setStyleSheet("background-color: yellow"); -//! [91] - - -//! [92] -nameEdit->setStyleSheet("color: blue; background-color: yellow"); -//! [92] - - -//! [93] -nameEdit->setStyleSheet("color: blue;" - "background-color: yellow;" - "selection-color: yellow;" - "selection-background-color: blue;"); -//! [93] - - //! [94] *[mandatoryField="true"] { background-color: yellow } //! [94] -//! [95] -QLineEdit *nameEdit = new QLineEdit(this); -nameEdit->setProperty("mandatoryField", true); - -QLineEdit *emailEdit = new QLineEdit(this); -emailEdit->setProperty("mandatoryField", true); - -QSpinBox *ageSpinBox = new QSpinBox(this); -ageSpinBox->setProperty("mandatoryField", true); -//! [95] - - //! [96] QPushButton#evilButton { background-color: red } //! [96] diff --git a/doc/src/snippets/code/doc_src_unicode.cpp b/doc/src/snippets/code/doc_src_unicode.cpp new file mode 100644 index 0000000..4415cf2 --- /dev/null +++ b/doc/src/snippets/code/doc_src_unicode.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +label->setText("Password:"); +//! [0] + + +//! [1] +label->setText(tr("Password:")); +//! [1] + + +//! [2] +QFile file(QString::fromLatin1("appicon.png")); +//! [2] + + +//! [3] +QFile file(QLatin1String("appicon.png")); +//! [3] diff --git a/doc/src/snippets/code/doc_src_unicode.qdoc b/doc/src/snippets/code/doc_src_unicode.qdoc deleted file mode 100644 index 4415cf2..0000000 --- a/doc/src/snippets/code/doc_src_unicode.qdoc +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -label->setText("Password:"); -//! [0] - - -//! [1] -label->setText(tr("Password:")); -//! [1] - - -//! [2] -QFile file(QString::fromLatin1("appicon.png")); -//! [2] - - -//! [3] -QFile file(QLatin1String("appicon.png")); -//! [3] diff --git a/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp new file mode 100644 index 0000000..fd5f386 --- /dev/null +++ b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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] +class MyDaemon : public QObject +{ + Q_OBJECT + + public: + MyDaemon(QObject *parent = 0, const char *name = 0); + ~MyDaemon(); + + // Unix signal handlers. + static void hupSignalHandler(int unused); + static void termSignalHandler(int unused); + + public slots: + // Qt signal handlers. + void handleSigHup(); + void handleSigTerm(); + + private: + static int sighupFd[2]; + static int sigtermFd[2]; + + QSocketNotifier *snHup; + QSocketNotifier *snTerm; +}; +//! [0] + + +//! [1] +MyDaemon::MyDaemon(QObject *parent, const char *name) + : QObject(parent,name) +{ + if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd)) + qFatal("Couldn't create HUP socketpair"); + + if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigtermFd)) + qFatal("Couldn't create TERM socketpair"); + snHup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this); + connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); + snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this); + connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm())); + + ... +} +//! [1] + + +//! [2] +static int setup_unix_signal_handlers() +{ + struct sigaction hup, term; + + hup.sa_handler = MyDaemon::hupSignalHandler; + sigemptyset(&hup.sa_mask); + hup.sa_flags = 0; + hup.sa_flags |= SA_RESTART; + + if (sigaction(SIGHUP, &hup, 0) > 0) + return 1; + + term.sa_handler = MyDaemon::termSignalHandler; + sigemptyset(&term.sa_mask); + term.sa_flags |= SA_RESTART; + + if (sigaction(SIGTERM, &term, 0) > 0) + return 2; + + return 0; +} +//! [2] + + +//! [3] +void MyDaemon::hupSignalHandler(int) +{ + char a = 1; + ::write(sighupFd[0], &a, sizeof(a)); +} + +void MyDaemon::termSignalHandler(int) +{ + char a = 1; + ::write(sigtermFd[0], &a, sizeof(a)); +} +//! [3] + + +//! [4] +void MyDaemon::handleSigTerm() +{ + snTerm->setEnabled(false); + char tmp; + ::read(sigtermFd[1], &tmp, sizeof(tmp)); + + // do Qt stuff + + snTerm->setEnabled(true); +} + +void MyDaemon::handleSigHup() +{ + snHup->setEnabled(false); + char tmp; + ::read(sighupFd[1], &tmp, sizeof(tmp)); + + // do Qt stuff + + snHup->setEnabled(true); +} +//! [4] diff --git a/doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc b/doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc deleted file mode 100644 index fd5f386..0000000 --- a/doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 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: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] -class MyDaemon : public QObject -{ - Q_OBJECT - - public: - MyDaemon(QObject *parent = 0, const char *name = 0); - ~MyDaemon(); - - // Unix signal handlers. - static void hupSignalHandler(int unused); - static void termSignalHandler(int unused); - - public slots: - // Qt signal handlers. - void handleSigHup(); - void handleSigTerm(); - - private: - static int sighupFd[2]; - static int sigtermFd[2]; - - QSocketNotifier *snHup; - QSocketNotifier *snTerm; -}; -//! [0] - - -//! [1] -MyDaemon::MyDaemon(QObject *parent, const char *name) - : QObject(parent,name) -{ - if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd)) - qFatal("Couldn't create HUP socketpair"); - - if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigtermFd)) - qFatal("Couldn't create TERM socketpair"); - snHup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this); - connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); - snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this); - connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm())); - - ... -} -//! [1] - - -//! [2] -static int setup_unix_signal_handlers() -{ - struct sigaction hup, term; - - hup.sa_handler = MyDaemon::hupSignalHandler; - sigemptyset(&hup.sa_mask); - hup.sa_flags = 0; - hup.sa_flags |= SA_RESTART; - - if (sigaction(SIGHUP, &hup, 0) > 0) - return 1; - - term.sa_handler = MyDaemon::termSignalHandler; - sigemptyset(&term.sa_mask); - term.sa_flags |= SA_RESTART; - - if (sigaction(SIGTERM, &term, 0) > 0) - return 2; - - return 0; -} -//! [2] - - -//! [3] -void MyDaemon::hupSignalHandler(int) -{ - char a = 1; - ::write(sighupFd[0], &a, sizeof(a)); -} - -void MyDaemon::termSignalHandler(int) -{ - char a = 1; - ::write(sigtermFd[0], &a, sizeof(a)); -} -//! [3] - - -//! [4] -void MyDaemon::handleSigTerm() -{ - snTerm->setEnabled(false); - char tmp; - ::read(sigtermFd[1], &tmp, sizeof(tmp)); - - // do Qt stuff - - snTerm->setEnabled(true); -} - -void MyDaemon::handleSigHup() -{ - snHup->setEnabled(false); - char tmp; - ::read(sighupFd[1], &tmp, sizeof(tmp)); - - // do Qt stuff - - snHup->setEnabled(true); -} -//! [4] diff --git a/doc/src/snippets/code/doc_src_wince-customization.cpp b/doc/src/snippets/code/doc_src_wince-customization.cpp new file mode 100644 index 0000000..90c2207 --- /dev/null +++ b/doc/src/snippets/code/doc_src_wince-customization.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ + +//! [9] +wchar_t* libraries[] = { + L"QtCore4.dll", + L"QtGui4.dll", + 0 +}; + +for (int i = 0; libraries[i] != 0; ++i) { + HINSTANCE instance = LoadLibraryW(libraries[i]); + OutputDebugStringW(libraries[i]); + if (instance != NULL) { + OutputDebugStringW(L" : Successfully instantiated\n"); + FreeLibrary(instance); + } else { + OutputDebugStringW(L" : Could not be loaded\n"); + } +} +//! [9] diff --git a/doc/src/snippets/code/doc_src_wince-customization.qdoc b/doc/src/snippets/code/doc_src_wince-customization.qdoc index 657786f..ab09222 100644 --- a/doc/src/snippets/code/doc_src_wince-customization.qdoc +++ b/doc/src/snippets/code/doc_src_wince-customization.qdoc @@ -89,22 +89,3 @@ if(equals(TEMPLATE_PREFIX, "vc") | equals(TEMPLATE, "vc*")) { DEFINES -= _M_ARM } //! [8] - -//! [9] -wchar_t* libraries[] = { - L"QtCore4.dll", - L"QtGui4.dll", - 0 -}; - -for (int i = 0; libraries[i] != 0; ++i) { - HINSTANCE instance = LoadLibraryW(libraries[i]); - OutputDebugStringW(libraries[i]); - if (instance != NULL) { - OutputDebugStringW(L" : Successfully instantiated\n"); - FreeLibrary(instance); - } else { - OutputDebugStringW(L" : Could not be loaded\n"); - } -} -//! [9] diff --git a/doc/src/snippets/qtreeview-dnd/dragdropmodel.h b/doc/src/snippets/qtreeview-dnd/dragdropmodel.h index ed01540..a20b1bb 100644 --- a/doc/src/snippets/qtreeview-dnd/dragdropmodel.h +++ b/doc/src/snippets/qtreeview-dnd/dragdropmodel.h @@ -38,17 +38,6 @@ ** ****************************************************************************/ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of an example program for Qt. -** EDITIONS: NOLIMITS -** -****************************************************************************/ - #ifndef DRAGDROPMODEL_H #define DRAGDROPMODEL_H diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 1476491..42cfefd 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -121,7 +121,7 @@ Source code to access the OUT values: - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 2 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 2 \bold{Note:} \c{@outval1} and \c{@outval2} are variables local to the current connection and will not be affected by queries sent from another host @@ -392,7 +392,7 @@ sets, will be accessible only if you set the query's forward only mode to \e forward using \l QSqlQuery::setForwardOnly(). - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 10 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 10 \bold{Note:} The value returned by the stored procedure's return statement is discarded. @@ -679,7 +679,7 @@ database file, no matter whether it is stored locally or on another server. - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 24 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 24 You need the InterBase/Firebird development headers and libraries to build this plugin. @@ -694,7 +694,7 @@ be overridden by setting the ISC_DPB_LC_CTYPE parameter with QSqlDatabase::setConnectOptions() before opening the connection. - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 25 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 25 If Qt doesn't support the given text encoding the driver will issue a warning message and connect to the database using UNICODE_FSS. @@ -708,7 +708,7 @@ procedure, only IN values need to be bound via QSqlQuery::bindValue(). The RETURN/OUT values can be retrieved via QSqlQuery::value(). Example: - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 26 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 26 \section3 How to Build the QIBASE Plugin on Unix and Mac OS X @@ -775,7 +775,7 @@ Make sure you have followed the guide to \l{Deploying Plugins}. If you experience plugin load problems and see output like this: - \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 31 + \snippet doc/src/snippets/code/doc_src_sql-driver.cpp 31 the problem is usually that the plugin had the wrong \l{Deploying Plugins#The Build Key}{build key}. This might require removing an diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc index c3db5fa..1d8214b 100644 --- a/doc/src/widgets-and-layouts/layout.qdoc +++ b/doc/src/widgets-and-layouts/layout.qdoc @@ -319,16 +319,16 @@ \section2 The Header File (\c card.h) - \snippet doc/src/snippets/code/doc_src_layout.qdoc 0 + \snippet doc/src/snippets/code/doc_src_layout.cpp 0 \section2 The Implementation File (\c card.cpp) - \snippet doc/src/snippets/code/doc_src_layout.qdoc 1 + \snippet doc/src/snippets/code/doc_src_layout.cpp 1 First we define \c{count()} to fetch the number of items in the list. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 2 + \snippet doc/src/snippets/code/doc_src_layout.cpp 2 Then we define two functions that iterate over the layout: \c{itemAt()} and \c{takeAt()}. These functions are used internally by the layout system @@ -341,7 +341,7 @@ structure, we may have to spend more effort defining a linear order for the items. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 3 + \snippet doc/src/snippets/code/doc_src_layout.cpp 3 \c{addItem()} implements the default placement strategy for layout items. This function must be implemented. It is used by QLayout::add(), by the @@ -351,26 +351,26 @@ QGridLayout::addItem(), QGridLayout::addWidget(), and QGridLayout::addLayout(). - \snippet doc/src/snippets/code/doc_src_layout.qdoc 4 + \snippet doc/src/snippets/code/doc_src_layout.cpp 4 The layout takes over responsibility of the items added. Since QLayoutItem does not inherit QObject, we must delete the items manually. In the destructor, we remove each item from the list using \c{takeAt()}, and then delete it. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 5 + \snippet doc/src/snippets/code/doc_src_layout.cpp 5 The \c{setGeometry()} function actually performs the layout. The rectangle supplied as an argument does not include \c{margin()}. If relevant, use \c{spacing()} as the distance between items. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 6 + \snippet doc/src/snippets/code/doc_src_layout.cpp 6 \c{sizeHint()} and \c{minimumSize()} are normally very similar in implementation. The sizes returned by both functions should include \c{spacing()}, but not \c{margin()}. - \snippet doc/src/snippets/code/doc_src_layout.qdoc 7 + \snippet doc/src/snippets/code/doc_src_layout.cpp 7 \section2 Further Notes diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index 8231fcb..9e9dd64 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -283,12 +283,12 @@ pointer type is correct. If the object isn't of the right type, qstyleoption_cast() returns 0. For example: - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 0 The following code snippet illustrates how to use QStyle to draw the focus rectangle from a custom widget's paintEvent(): - \snippet doc/src/snippets/code/doc_src_qt4-styles.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-styles.cpp 1 The next example shows how to derive from an existing style to customize the look of a graphical element: @@ -542,7 +542,7 @@ We start with a look at how QCheckBox builds it style option, which is QStyleOptionButton for checkboxes: - \snippet doc/src/snippets/code/doc_src_styles.qdoc 0 + \snippet doc/src/snippets/code/doc_src_styles.cpp 0 First we let QStyleOption set up the option with the information that is common for all widgets with \c initFrom(). We will look at @@ -561,7 +561,7 @@ attributes that are common for all widgets. We print its implementation here: - \snippet doc/src/snippets/code/doc_src_styles.qdoc 1 + \snippet doc/src/snippets/code/doc_src_styles.cpp 1 The State_Enabled is set when the widget is enabled. When the widget has focus the State_HasFocus flag is set. Equally, the @@ -625,7 +625,7 @@ notably, it wraps the methods in QStyle used for painting. The QCheckBox draws itself as follows: - \snippet doc/src/snippets/code/doc_src_styles.qdoc 2 + \snippet doc/src/snippets/code/doc_src_styles.cpp 2 QCommonStyle handles the CE_CheckBox element. The QCheckBox has two sub elements: SE_CheckBoxIndicator (the checked indicator) @@ -633,7 +633,7 @@ checkbox label). QCommonStyle also implements these sub element bounding rectangles. We have a look at the QCommonStyle code: - \snippet doc/src/snippets/code/doc_src_styles.qdoc 3 + \snippet doc/src/snippets/code/doc_src_styles.cpp 3 As can be seen from the code extract, the common style gets the bounding rectangles of the two sub elements of @@ -644,7 +644,7 @@ handles CE_CheckboxLabel. We will examine each implementation and start with CE_CheckBoxLabel: - \snippet doc/src/snippets/code/doc_src_styles.qdoc 4 + \snippet doc/src/snippets/code/doc_src_styles.cpp 4 \l{QStyle::}{visualAlignment()} adjusts the alignment of text according to the layout direction. We then draw an icon if it diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index be845c4..8cfa2b4 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -469,11 +469,11 @@ sheet. Consider the following example. First, we set a style sheet on the QApplication: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 21 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 21 Then we set a style sheet on a QPushButton object: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 22 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 22 The style sheet on the QPushButton forces the QPushButton (and any child widget) to have blue text, in spite of the more @@ -481,7 +481,7 @@ The result would have been the same if we had written - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 23 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 23 except that if the QPushButton had children (which is unlikely), the style sheet would have no impact on them. @@ -500,14 +500,14 @@ For example, consider a QPushButton inside a QGroupBox: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 24 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 24 The QPushButton does not have an explicit color set. Hence, instead of inheriting color of its parent QGroupBox, it has the system color. If we want to set the color on a QGroupBox and its children, we can write: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 25 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 25 In contrast, setting a font and propagate using QWidget::setFont() and QWidget::setPalette() propagates to child widgets. @@ -517,7 +517,7 @@ The Type Selector can be used to style widgets of a particular type. For example, - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 26 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 26 Qt Style Sheet uses QObject::className() of the widget to determine when to apply the Type Selector. When custom widgets are inside namespaces, @@ -526,7 +526,7 @@ when using the Type Selector for widgets inside namespaces, we must replace the "::" with "--". For example, - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 27 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 27 \section1 Setting QObject properties @@ -1328,7 +1328,7 @@ If you subclass from QWidget, you need to provide a paintEvent for your custom QWidget as below: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 32 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 32 The above code is a no-operation if there is no stylesheet set. @@ -3373,35 +3373,35 @@ \l{QLineEdit}s in an application. This could be achieved like this: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 88 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 88 If we want the property to apply only to the \l{QLineEdit}s that are children (or grandchildren or grand-grandchildren) of a specific dialog, we would rather do this: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 89 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 89 If we want the property to apply only to one specific QLineEdit, we can give it a name using QObject::setObjectName() and use an ID Selector to refer to it: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 90 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 90 Alternatively, we can set the \l{Qt Style Sheets Reference#background-prop}{background-color} property directly on the QLineEdit, omitting the selector: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 91 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 91 To ensure a good contrast, we should also specify a suitable color for the text: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 92 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 92 It might be a good idea to change the colors used for selected text as well: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 93 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 93 \section2 Customizing Using Dynamic Properties @@ -3422,7 +3422,7 @@ \c mandatoryField property on the fly and set it to true. For example: - \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 95 + \snippet doc/src/snippets/code/doc_src_stylesheet.cpp 95 \section2 Customizing a QPushButton Using the Box Model diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index 0bf4909..e7df502 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -198,7 +198,7 @@ the first time it is called. You can also call QMainWindow::setMenuBar() to use a custom menu bar in the main window. - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 0 \dots \snippet examples/mainwindows/menus/mainwindow.cpp 5 \dots @@ -222,7 +222,7 @@ \snippet examples/mainwindows/sdi/mainwindow.cpp 0 \dots - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 1 In this example, the toolbar is restricted to the top and bottom toolbar areas of the main window, and is initially placed in the @@ -244,7 +244,7 @@ required, the default can be changed with the QMainWindow::setCorner() function: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 2 The following diagram shows the configuration produced by the above code. Note that the left and right dock widgets will occupy the top and bottom @@ -255,7 +255,7 @@ Once all of the main window components have been set up, the central widget is created and installed by using code similar to the following: - \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qt4-mainwindow.cpp 3 The central widget can be any subclass of QWidget. */ diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 65cd7f4..fa31f21 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2861,7 +2861,7 @@ INT_MIN, inclusive. For example, you can define custom priorities as being relative to each other: - \snippet doc/src/snippets/code/doc_src_qnamespace.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qnamespace.cpp 1 \sa QCoreApplication::postEvent() */ diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index 54b2b38..7043fa0 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -51,7 +51,7 @@ If you want to use Q_DECLARE_INTERFACE with interface classes declared in a namespace then you have to make sure the Q_DECLARE_INTERFACE is not inside a namespace though. For example: - \snippet doc/src/snippets/code/doc_src_qplugin.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qplugin.cpp 0 \sa Q_INTERFACES(), Q_EXPORT_PLUGIN2(), {How to Create Qt Plugins} */ @@ -82,7 +82,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qplugin.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qplugin.cpp 1 See the \l{tools/plugandpaint}{Plug & Paint} example for details. @@ -102,14 +102,14 @@ Example: - \snippet doc/src/snippets/code/doc_src_qplugin.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qplugin.cpp 2 Static plugins must also be included by the linker when your application is built. For Qt's predefined plugins, you can use the \c QTPLUGIN to add the required plugins to your build. For example: - \snippet doc/src/snippets/code/doc_src_qplugin.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qplugin.pro 3 \sa {Static Plugins}, {How to Create Qt Plugins}, {Using qmake} */ diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 34918a3..a9b7ddc 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -60,14 +60,14 @@ a particular value. If you need that functionality, you can use qFill(): - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 0 qFill() takes a begin iterator, an end iterator, and a value. In the example above, we pass \c list.begin() and \c list.end() as the begin and end iterators, but this doesn't have to be the case: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 1 Different algorithms can have different requirements for the iterators they accept. For example, qFill() accepts two @@ -98,13 +98,13 @@ name_table array and return the corresponding Unicode value from the \c value_table if the entity is recognized: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 2 This kind of code is for advanced users only; for most applications, a QMap- or QHash-based approach would work just as well: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 3 \section1 Types of Iterators @@ -185,7 +185,7 @@ position \a begin2 + 1; and so on. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 4 \sa qCopyBackward(), {input iterators}, {output iterators} */ @@ -201,7 +201,7 @@ at position \a end2 - 2; and so on. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 5 \sa qCopy(), {bidirectional iterators} */ @@ -214,7 +214,7 @@ items compare equal; otherwise returns false. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 6 This function requires the item type (in the example above, QString) to implement \c operator==(). @@ -228,7 +228,7 @@ Fills the range [\a begin, \a end) with \a value. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 7 \sa qCopy(), {forward iterators} */ @@ -249,7 +249,7 @@ value isn't found. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 8 This function requires the item type (in the example above, QString) to implement \c operator==(). @@ -278,7 +278,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 9 This function requires the item type (in the example above, \c int) to implement \c operator==(). @@ -302,7 +302,7 @@ of \a value in the variable passed as a reference in argument \a n. Exchanges the values of variables \a var1 and \a var2. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 10 */ /*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end) @@ -312,7 +312,7 @@ of \a value in the variable passed as a reference in argument \a n. using the quicksort algorithm. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 11 The sort algorithm is efficient on large data sets. It operates in \l {linear-logarithmic time}, O(\e{n} log \e{n}). @@ -338,13 +338,13 @@ of \a value in the variable passed as a reference in argument \a n. For example, here's how to sort the strings in a QStringList in case-insensitive alphabetical order: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 12 To sort values in reverse order, pass \l{qGreater()}{qGreater()} as the \a lessThan parameter. For example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 13 If neither of the two items is "less than" the other, the items are taken to be equal. It is then undefined which one of the two @@ -356,7 +356,7 @@ of \a value in the variable passed as a reference in argument \a n. following code shows how to sort a list of strings case insensitively using QMap: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 14 \sa QMap */ @@ -382,7 +382,7 @@ of \a value in the variable passed as a reference in argument \a n. property is often useful when sorting user-visible data. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 15 The sort algorithm is efficient on large data sets. It operates in \l {linear-logarithmic time}, O(\e{n} log \e{n}). @@ -405,7 +405,7 @@ of \a value in the variable passed as a reference in argument \a n. For example, here's how to sort the strings in a QStringList in case-insensitive alphabetical order: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 16 Note that earlier versions of Qt allowed using a lessThan function that took its arguments by non-const reference. From 4.3 and on this is no longer possible, @@ -415,7 +415,7 @@ of \a value in the variable passed as a reference in argument \a n. \l{qGreater()}{qGreater()} as the \a lessThan parameter. For example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 17 If neither of the two items is "less than" the other, the items are taken to be equal. The item that appeared before the other in the @@ -444,7 +444,7 @@ of \a value in the variable passed as a reference in argument \a n. ascending order; see qSort(). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 18 This function requires the item type (in the example above, \c{int}) to implement \c operator<(). @@ -452,7 +452,7 @@ of \a value in the variable passed as a reference in argument \a n. qLowerBound() can be used in conjunction with qUpperBound() to iterate over all occurrences of the same value: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 19 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 19 \sa qUpperBound(), qBinaryFind() */ @@ -494,7 +494,7 @@ of \a value in the variable passed as a reference in argument \a n. ascending order; see qSort(). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 20 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 20 This function requires the item type (in the example above, \c{int}) to implement \c operator<(). @@ -502,7 +502,7 @@ of \a value in the variable passed as a reference in argument \a n. qUpperBound() can be used in conjunction with qLowerBound() to iterate over all occurrences of the same value: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 21 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 21 \sa qLowerBound(), qBinaryFind() */ @@ -545,7 +545,7 @@ of \a value in the variable passed as a reference in argument \a n. finer control. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 22 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 22 This function requires the item type (in the example above, QString) to implement \c operator<(). @@ -587,7 +587,7 @@ of \a value in the variable passed as a reference in argument \a n. example, \c{QWidget *}). Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 23 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 23 Notice that qDeleteAll() doesn't remove the items from the container; it merely calls \c delete on them. In the example @@ -618,7 +618,7 @@ of \a value in the variable passed as a reference in argument \a n. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 24 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 24 \sa {qGreater()}{qGreater()} */ @@ -631,7 +631,7 @@ of \a value in the variable passed as a reference in argument \a n. Example: - \snippet doc/src/snippets/code/doc_src_qalgorithms.qdoc 25 + \snippet doc/src/snippets/code/doc_src_qalgorithms.cpp 25 \sa {qLess()}{qLess()} */ diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc index 991238b..9e12c92 100644 --- a/src/corelib/tools/qcache.qdoc +++ b/src/corelib/tools/qcache.qdoc @@ -39,11 +39,11 @@ definition of a cache that stores objects of type Employee associated with an integer key: - \snippet doc/src/snippets/code/doc_src_qcache.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qcache.cpp 0 Here's how to insert an object in the cache: - \snippet doc/src/snippets/code/doc_src_qcache.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qcache.cpp 1 The advantage of using QCache over some other key-based data structure (such as QMap or QHash) is that QCache automatically @@ -59,7 +59,7 @@ By default, QCache's maxCost() is 100. You can specify a different value in the QCache constructor: - \snippet doc/src/snippets/code/doc_src_qcache.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qcache.cpp 2 Each time you call insert(), you can specify a cost as third argument (after the key and a pointer to the object to insert). diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index d651343..6830442 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -50,7 +50,7 @@ the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 0 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -65,7 +65,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 1 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -98,7 +98,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 2 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -113,7 +113,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 3 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -150,7 +150,7 @@ of the vector (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 4 The next() function returns the next item in the vector and advances the iterator. Unlike STL-style iterators, Java-style @@ -165,7 +165,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 5 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -197,7 +197,7 @@ the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 6 The next() function returns the next item in the set and advances the iterator. Unlike STL-style iterators, Java-style @@ -212,7 +212,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 7 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -251,7 +251,7 @@ of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 8 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -266,7 +266,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 9 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -277,7 +277,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 10 The example traverses a list, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -312,7 +312,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 11 The next() function returns the next item in the list and advances the iterator. Unlike STL-style iterators, Java-style @@ -327,7 +327,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 12 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -338,7 +338,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 13 The example traverses a list, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -378,7 +378,7 @@ beginning of the list (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 14 The next() function returns the next item in the vector and advances the iterator. Unlike STL-style iterators, Java-style @@ -393,7 +393,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 15 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. @@ -404,7 +404,7 @@ insert(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 16 The example traverses a vector, replacing negative numbers with their absolute values, and eliminating zeroes. @@ -440,7 +440,7 @@ of the set (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 17 The next() function returns the next item in the set and advances the iterator. Unlike STL-style iterators, Java-style @@ -455,7 +455,7 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 18 If you want to remove items as you iterate over the set, use remove(). @@ -755,7 +755,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 19 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 19 \sa insert(), setValue() */ @@ -766,7 +766,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 20 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 20 \sa insert(), setValue() */ @@ -777,7 +777,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 21 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 21 \sa insert(), setValue() */ @@ -788,7 +788,7 @@ traversal functions (next(), previous(), findNext(), findPrevious()). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 22 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 22 \sa value() */ @@ -802,7 +802,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 23 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 23 \sa value(), remove(), insert() */ @@ -816,7 +816,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 24 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 24 \sa value(), remove(), insert() */ @@ -830,7 +830,7 @@ findPrevious(). Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 25 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 25 \sa value(), remove(), insert() */ @@ -889,7 +889,7 @@ the map (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 26 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 26 The next() function returns the next item in the map and advances the iterator. The key() and value() functions return the @@ -906,12 +906,12 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 27 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 27 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 28 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 28 Multiple iterators can be used on the same map. If the map is modified while a QMapIterator is active, the QMapIterator will @@ -941,7 +941,7 @@ the hash (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 29 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 29 The next() function returns the next item in the hash and advances the iterator. The key() and value() functions return the @@ -958,12 +958,12 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 30 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 30 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 31 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 31 Multiple iterators can be used on the same hash. If the hash is modified while a QHashIterator is active, the QHashIterator will @@ -994,7 +994,7 @@ of the map (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 32 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 32 The next() function returns the next item in the map and advances the iterator. The key() and value() functions return the @@ -1011,12 +1011,12 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 33 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 33 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 34 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 34 If you want to remove items as you iterate over the map, use remove(). If you want to modify the value of an item, use @@ -1024,7 +1024,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 35 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 35 The example removes all (key, value) pairs where the key and the value are the same. @@ -1059,7 +1059,7 @@ of the hash (before the first item). Here's how to iterate over all the elements sequentially: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 36 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 36 The next() function returns the next item in the hash and advances the iterator. The key() and value() functions return the @@ -1076,12 +1076,12 @@ Here's how to iterate over the elements in reverse order: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 37 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 37 If you want to find all occurrences of a particular value, use findNext() or findPrevious() in a loop. For example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 38 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 38 If you want to remove items as you iterate over the hash, use remove(). If you want to modify the value of an item, use @@ -1089,7 +1089,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qiterator.qdoc 39 + \snippet doc/src/snippets/code/doc_src_qiterator.cpp 39 The example removes all (key, value) pairs where the key and the value are the same. diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index b900c4f..925100d 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -40,12 +40,12 @@ Here's an example of a QPair that stores one QString and one \c double value: - \snippet doc/src/snippets/code/doc_src_qpair.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qpair.cpp 0 The components are accessible as public data members called \l first and \l second. For example: - \snippet doc/src/snippets/code/doc_src_qpair.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qpair.cpp 1 QPair's template data types (T1 and T2) must be \l{assignable data types}. You cannot, for example, store a QWidget as a value; @@ -186,7 +186,7 @@ Returns a QPair\ that contains \a value1 and \a value2. Example: - \snippet doc/src/snippets/code/doc_src_qpair.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qpair.cpp 2 This is equivalent to QPair(\a value1, \a value2), but usually requires less typing. diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index 011e9ee..5249182 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -40,19 +40,19 @@ Here's an example QSet with QString values: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qset.cpp 0 To insert a value into the set, use insert(): - \snippet doc/src/snippets/code/doc_src_qset.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qset.cpp 1 Another way to insert items into the set is to use operator<<(): - \snippet doc/src/snippets/code/doc_src_qset.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qset.cpp 2 To test whether an item belongs to the set or not, use contains(): - \snippet doc/src/snippets/code/doc_src_qset.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qset.cpp 3 If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both \l{Java-style @@ -60,18 +60,18 @@ iterators} (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet using a Java-style iterator: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qset.cpp 4 Here's the same code, but using an STL-style iterator: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qset.cpp 5 QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap. To navigate through a QSet, you can also use \l{foreach}: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qset.cpp 6 Items can be removed from the set using remove(). There is also a clear() function that removes all items. @@ -187,7 +187,7 @@ This function is useful for code that needs to build a huge set and wants to avoid repeated reallocation. For example: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qset.cpp 7 Ideally, \a size should be slightly more than the maximum number of elements expected in the set. \a size doesn't have to be prime, @@ -603,18 +603,18 @@ start iterating. Here's a typical loop that prints all the items stored in a set: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qset.cpp 8 Here's a loop that removes certain items (all those that start with 'J') from a set while iterating: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qset.cpp 9 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the set using the qFind() algorithm: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qset.cpp 10 Multiple iterators can be used on the same set. However, you may not attempt to modify the container while iterating on it. @@ -646,13 +646,13 @@ start iterating. Here's a typical loop that prints all the items stored in a set: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qset.cpp 11 STL-style iterators can be used as arguments to \l{generic algorithms}. For example, here's how to find an item in the set using the qFind() algorithm: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qset.cpp 12 Multiple iterators can be used on the same set. However, you may not attempt to modify the container while iterating on it. @@ -886,7 +886,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qset.cpp 13 \sa fromList(), QList::fromSet(), qSort() */ @@ -911,7 +911,7 @@ Example: - \snippet doc/src/snippets/code/doc_src_qset.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qset.cpp 14 \sa toList(), QList::toSet() */ diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index d68e8a1..996ca7f 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -35,12 +35,12 @@ The C++ language doesn't support variable-length arrays on the stack. For example, the following code won't compile: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 0 The alternative is to allocate the array on the heap (with \c{new}): - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 1 However, if myfunc() is called very frequently from the application's inner loop, heap allocation can be a major source @@ -53,7 +53,7 @@ it is much faster than heap allocation. Example: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 2 In the example above, QVarLengthArray will preallocate 1024 elements on the stack and use them unless \c{n + 1} is greater @@ -223,7 +223,7 @@ be used to access and modify the items in the array. Example: - \snippet doc/src/snippets/code/doc_src_qvarlengtharray.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qvarlengtharray.cpp 3 The pointer remains valid as long as the array isn't reallocated. diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 5a66aab..83a7d83 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -117,6 +117,8 @@ public: id: area } // ... + \endqml + \qml Connections { target: area onClicked: foo(parameters) diff --git a/src/qt3support/tools/q3asciidict.qdoc b/src/qt3support/tools/q3asciidict.qdoc index e744633..c276682 100644 --- a/src/qt3support/tools/q3asciidict.qdoc +++ b/src/qt3support/tools/q3asciidict.qdoc @@ -43,7 +43,7 @@ performace as a Q3AsciiDict. Example: - \snippet doc/src/snippets/code/doc_src_q3asciidict.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3asciidict.cpp 0 In this example we use a dictionary to keep track of the line edits we're using. We insert each line edit into the dictionary with a unique name and then access the line edits via the @@ -164,7 +164,7 @@ \a item may not be 0. Equivalent to: - \snippet doc/src/snippets/code/doc_src_q3asciidict.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3asciidict.cpp 1 If there are two or more items with equal keys, then the most recently inserted item will be replaced. @@ -295,7 +295,7 @@ iterator that operates on Q3AsciiDict\ (dictionary of X*). Example: - \snippet doc/src/snippets/code/doc_src_q3asciidict.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3asciidict.cpp 2 In the example we insert some line edits into a dictionary, then iterate over the dictionary printing the strings associated with those line edits. diff --git a/src/qt3support/tools/q3dict.qdoc b/src/qt3support/tools/q3dict.qdoc index 6b221f1..8fcbba4 100644 --- a/src/qt3support/tools/q3dict.qdoc +++ b/src/qt3support/tools/q3dict.qdoc @@ -192,7 +192,7 @@ \a item may not be 0. Equivalent to: - \snippet doc/src/snippets/code/doc_src_q3dict.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3dict.cpp 0 If there are two or more items with equal keys, then the last item that was inserted will be replaced. @@ -326,7 +326,7 @@ point to the next item in the (arbitrary) traversal order. Example: - \snippet doc/src/snippets/code/doc_src_q3dict.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3dict.cpp 1 In the example we insert some pointers to line edits into a dictionary, then iterate over the dictionary printing the strings associated with the line edits. diff --git a/src/qt3support/tools/q3intdict.qdoc b/src/qt3support/tools/q3intdict.qdoc index 684fc63..f108f30 100644 --- a/src/qt3support/tools/q3intdict.qdoc +++ b/src/qt3support/tools/q3intdict.qdoc @@ -39,7 +39,7 @@ pointer. Dictionaries provide very fast insertion and lookup. Example: - \snippet doc/src/snippets/code/doc_src_q3intdict.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3intdict.cpp 0 See Q3Dict for full details, including the choice of dictionary size, and how deletions are handled. @@ -145,7 +145,7 @@ \a item may not be 0. Equivalent to: - \snippet doc/src/snippets/code/doc_src_q3intdict.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3intdict.cpp 1 If there are two or more items with equal keys, then the most recently inserted item will be replaced. @@ -270,7 +270,7 @@ iterator that operates on Q3IntDict\ (dictionary of X*). Example: - \snippet doc/src/snippets/code/doc_src_q3intdict.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3intdict.cpp 2 Note that the traversal order is arbitrary; you are not guaranteed the order shown above. diff --git a/src/qt3support/tools/q3memarray.qdoc b/src/qt3support/tools/q3memarray.qdoc index f05f433..5d6f9b2 100644 --- a/src/qt3support/tools/q3memarray.qdoc +++ b/src/qt3support/tools/q3memarray.qdoc @@ -51,7 +51,7 @@ and less copying of data. Example: - \snippet doc/src/snippets/code/doc_src_q3memarray.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3memarray.cpp 0 Program output: \snippet doc/src/snippets/code/doc_src_q3memarray.qdoc 1 @@ -63,7 +63,7 @@ the remaining bytes will typically be uninitialized, this can cause find() etc. to fail to find the element. Example: - \snippet doc/src/snippets/code/doc_src_q3memarray.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3memarray.cpp 2 To work around this, make sure that you use a struct where sizeof() returns the same as the sum of the sizes of the members @@ -352,10 +352,10 @@ allocating memory or copying data. Example I (intended use): - \snippet doc/src/snippets/code/doc_src_q3memarray.qdoc 3 + \snippet doc/src/snippets/code/doc_src_q3memarray.cpp 3 Example II (you don't want to do this): - \snippet doc/src/snippets/code/doc_src_q3memarray.qdoc 4 + \snippet doc/src/snippets/code/doc_src_q3memarray.cpp 4 \warning If you do not call resetRawData(), Q3MemArray will attempt to deallocate or reallocate the raw data, which might not be too diff --git a/src/qt3support/tools/q3ptrdict.qdoc b/src/qt3support/tools/q3ptrdict.qdoc index 8831a55..21dcdfd 100644 --- a/src/qt3support/tools/q3ptrdict.qdoc +++ b/src/qt3support/tools/q3ptrdict.qdoc @@ -39,7 +39,7 @@ pointer. Dictionaries provide very fast insertion and lookup. Example: - \snippet doc/src/snippets/code/doc_src_q3ptrdict.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3ptrdict.cpp 0 In this example we use a dictionary to add an extra property (a char*) to the line edits we're using. @@ -147,7 +147,7 @@ \a item may not be 0. Equivalent to - \snippet doc/src/snippets/code/doc_src_q3ptrdict.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3ptrdict.cpp 1 If there are two or more items with equal keys, then the most recently inserted item will be replaced. @@ -272,7 +272,7 @@ iterator that operates on Q3PtrDict\ (dictionary of X*). Example: - \snippet doc/src/snippets/code/doc_src_q3ptrdict.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3ptrdict.cpp 2 In the example we insert some line edits into a dictionary, associating a string with each. We then iterate over the dictionary printing the associated strings. diff --git a/src/qt3support/tools/q3ptrlist.qdoc b/src/qt3support/tools/q3ptrlist.qdoc index 13e478e..e19d6bf 100644 --- a/src/qt3support/tools/q3ptrlist.qdoc +++ b/src/qt3support/tools/q3ptrlist.qdoc @@ -54,10 +54,10 @@ \target example Example: - \snippet doc/src/snippets/code/doc_src_q3ptrlist.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3ptrlist.cpp 0 The output is - \snippet doc/src/snippets/code/doc_src_q3ptrlist.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3ptrlist.cpp 1 Q3PtrList has several member functions for traversing the list, but using a Q3PtrListIterator can be more practical. Multiple list @@ -353,7 +353,7 @@ auto-deletion\endlink is enabled. Equivalent to: - \snippet doc/src/snippets/code/doc_src_q3ptrlist.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3ptrlist.cpp 2 The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last @@ -785,10 +785,10 @@ but it uses Q3PtrListIterator. The class Employee is defined there. - \snippet doc/src/snippets/code/doc_src_q3ptrlist.qdoc 3 + \snippet doc/src/snippets/code/doc_src_q3ptrlist.cpp 3 The output is - \snippet doc/src/snippets/code/doc_src_q3ptrlist.qdoc 4 + \snippet doc/src/snippets/code/doc_src_q3ptrlist.cpp 4 Using a list iterator is a more robust way of traversing the list than using the Q3PtrList member functions \link Q3PtrList::first() diff --git a/src/qt3support/tools/q3valuelist.qdoc b/src/qt3support/tools/q3valuelist.qdoc index 99f1634..a5ebf60 100644 --- a/src/qt3support/tools/q3valuelist.qdoc +++ b/src/qt3support/tools/q3valuelist.qdoc @@ -71,7 +71,7 @@ prefer to use the STL-compatible functions. Example: - \snippet doc/src/snippets/code/doc_src_q3valuelist.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3valuelist.cpp 0 Notice that the latest changes to Mary's salary did not affect the @@ -99,7 +99,7 @@ (your application will crash or do unpredictable things). Use last() and first() with caution, for example: - \snippet doc/src/snippets/code/doc_src_q3valuelist.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3valuelist.cpp 1 Because Q3ValueList is value-based there is no need to be careful about deleting items in the list. The list holds its own copies @@ -352,7 +352,7 @@ Use the end() function instead. For example: - \snippet doc/src/snippets/code/doc_src_q3valuelist.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3valuelist.cpp 2 */ @@ -364,7 +364,7 @@ Use the end() function instead. For example: - \snippet doc/src/snippets/code/doc_src_q3valuelist.qdoc 3 + \snippet doc/src/snippets/code/doc_src_q3valuelist.cpp 3 */ @@ -443,7 +443,7 @@ iterator. Example (see Q3ValueList for the complete code): - \snippet doc/src/snippets/code/doc_src_q3valuelist.qdoc 4 + \snippet doc/src/snippets/code/doc_src_q3valuelist.cpp 4 Q3ValueList is highly optimized for performance and memory usage. This means that you must be careful: Q3ValueList does not know diff --git a/src/qt3support/tools/q3valuestack.qdoc b/src/qt3support/tools/q3valuestack.qdoc index 4ad0d7d..6c2c57b 100644 --- a/src/qt3support/tools/q3valuestack.qdoc +++ b/src/qt3support/tools/q3valuestack.qdoc @@ -44,7 +44,7 @@ without removing it. Example: - \snippet doc/src/snippets/code/doc_src_q3valuestack.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3valuestack.cpp 0 Q3ValueStack is a specialized Q3ValueList provided for convenience. All of Q3ValueList's functionality also applies to Q3PtrStack, for diff --git a/src/qt3support/tools/q3valuevector.qdoc b/src/qt3support/tools/q3valuevector.qdoc index 58bd8e3..960bbac 100644 --- a/src/qt3support/tools/q3valuevector.qdoc +++ b/src/qt3support/tools/q3valuevector.qdoc @@ -70,10 +70,10 @@ objects it contains. Example: - \snippet doc/src/snippets/code/doc_src_q3valuevector.qdoc 0 + \snippet doc/src/snippets/code/doc_src_q3valuevector.cpp 0 Program output: - \snippet doc/src/snippets/code/doc_src_q3valuevector.qdoc 1 + \snippet doc/src/snippets/code/doc_src_q3valuevector.cpp 1 As you can see, the most recent change to Joe's salary did not affect the value in the vector because the vector created a copy @@ -102,13 +102,13 @@ an element that does not exist (your application will probably crash). For example: - \snippet doc/src/snippets/code/doc_src_q3valuevector.qdoc 2 + \snippet doc/src/snippets/code/doc_src_q3valuevector.cpp 2 Whenever inserting, removing or referencing elements in a vector, always make sure you are referring to valid positions. For example: - \snippet doc/src/snippets/code/doc_src_q3valuevector.qdoc 3 + \snippet doc/src/snippets/code/doc_src_q3valuevector.cpp 3 The iterators provided by vector are random access iterators, therefore you can use them with many generic algorithms, for @@ -127,7 +127,7 @@ application will crash or do unpredictable things). Use back() and front() with caution, for example: - \snippet doc/src/snippets/code/doc_src_q3valuevector.qdoc 4 + \snippet doc/src/snippets/code/doc_src_q3valuevector.cpp 4 Because Q3ValueVector manages memory dynamically, it is recommended that you contruct a vector with an initial size. Inserting and diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index 298b2b7..0c22868 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -38,7 +38,7 @@ The following example records all signal emissions for the \c clicked() signal of a QCheckBox: - \snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 0 \c{spy.takeFirst()} returns the arguments for the first emitted signal, as a list of QVariant objects. The \c clicked() signal has a single bool argument, @@ -46,17 +46,17 @@ The example below catches a signal from a custom object: - \snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 1 + \snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 1 \bold {Note:} Non-standard data types need to be registered, using the qRegisterMetaType() function, before you can create a QSignalSpy. For example: - \snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 2 To retrieve the \c QModelIndex, you can use qvariant_cast: - \snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 3 */ /*! \fn QSignalSpy::QSignalSpy(QObject *object, const char *signal) @@ -65,7 +65,7 @@ from the QObject \a object. Neither \a signal nor \a object can be null. Example: - \snippet doc/src/snippets/code/doc_src_qsignalspy.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 4 */ /*! \fn QSignalSpy::isValid() const diff --git a/src/testlib/qtestevent.qdoc b/src/testlib/qtestevent.qdoc index 84e874b..4c695c2 100644 --- a/src/testlib/qtestevent.qdoc +++ b/src/testlib/qtestevent.qdoc @@ -39,7 +39,7 @@ QWidget. Example: - \snippet doc/src/snippets/code/doc_src_qtestevent.qdoc 0 + \snippet doc/src/snippets/code/doc_src_qtestevent.cpp 0 The example above simulates the user entering the character \c a followed by a backspace, waiting for 200 milliseconds and diff --git a/tools/designer/src/lib/sdk/membersheet.qdoc b/tools/designer/src/lib/sdk/membersheet.qdoc index fdd13f2..57a3664 100644 --- a/tools/designer/src/lib/sdk/membersheet.qdoc +++ b/tools/designer/src/lib/sdk/membersheet.qdoc @@ -40,7 +40,7 @@ manipulate the member functions' appearance in \QD's signals and slots editing mode. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 2 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 2 When implementing a custom widget plugin, a pointer to \QD's current QDesignerFormEditorInterface object (\c formEditor in the @@ -69,7 +69,7 @@ made known to the meta object system using the Q_INTERFACES() macro: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 3 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 3 This enables \QD to use qobject_cast() to query for supported interfaces using nothing but a QObject pointer. @@ -101,13 +101,13 @@ QExtensionFactory and reimplement the QExtensionFactory::createExtension() function. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 4 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 4 Or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to make the factory able to create a member sheet extension as well. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 5 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 5 For a complete example using an extension class, see \l {designer/taskmenuextension}{Task Menu Extension example}. The diff --git a/tools/designer/src/lib/sdk/propertysheet.qdoc b/tools/designer/src/lib/sdk/propertysheet.qdoc index d82de88..becc74b 100644 --- a/tools/designer/src/lib/sdk/propertysheet.qdoc +++ b/tools/designer/src/lib/sdk/propertysheet.qdoc @@ -41,7 +41,7 @@ manipulate the properties' appearance in the property editor. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 15 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 15 Note that if you change the value of a property using the QDesignerPropertySheetExtension::setProperty() function, the undo @@ -80,7 +80,7 @@ an interface, we must ensure that it's made known to the meta object system using the Q_INTERFACES() macro: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 16 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 16 This enables \QD to use qobject_cast() to query for supported interfaces using nothing but a QObject pointer. @@ -112,14 +112,14 @@ reimplement the QExtensionFactory::createExtension() function. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 17 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 17 Or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to make the factory able to create a property sheet extension extension as well. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 18 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 18 For a complete example using an extension class, see the \l {designer/taskmenuextension}{Task Menu Extension example}. The diff --git a/tools/designer/src/lib/sdk/taskmenu.qdoc b/tools/designer/src/lib/sdk/taskmenu.qdoc index 06d0b96..c5a3795 100644 --- a/tools/designer/src/lib/sdk/taskmenu.qdoc +++ b/tools/designer/src/lib/sdk/taskmenu.qdoc @@ -51,7 +51,7 @@ inherit from both QObject and QDesignerTaskMenuExtension. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 9 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 9 Since we are implementing an interface, we must ensure that it is made known to the meta-object system using the Q_INTERFACES() @@ -94,13 +94,13 @@ reimplement the QExtensionFactory::createExtension() function. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 10 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 10 Or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to make the factory able to create a task menu extension as well. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 11 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 11 For a complete example using the QDesignerTaskMenuExtension class, see the \l {designer/taskmenuextension}{Task Menu Extension diff --git a/tools/designer/src/lib/uilib/container.qdoc b/tools/designer/src/lib/uilib/container.qdoc index 51d942e..d931051 100644 --- a/tools/designer/src/lib/uilib/container.qdoc +++ b/tools/designer/src/lib/uilib/container.qdoc @@ -44,7 +44,7 @@ To create a container extension, your extension class must inherit from both QObject and QDesignerContainerExtension. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 6 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 6 Since we are implementing an interface, we must ensure that it's made known to the meta object system using the Q_INTERFACES() @@ -88,13 +88,13 @@ reimplement the QExtensionFactory::createExtension() function. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 7 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 7 Or you can use an existing factory, expanding the QExtensionFactory::createExtension() function to make the factory able to create a container extension as well. For example: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 8 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 8 For a complete example using the QDesignerContainerExtension class, see the \l {designer/containerextension}{Container diff --git a/tools/designer/src/lib/uilib/customwidget.qdoc b/tools/designer/src/lib/uilib/customwidget.qdoc index 3410fc6..d5ddaa7 100644 --- a/tools/designer/src/lib/uilib/customwidget.qdoc +++ b/tools/designer/src/lib/uilib/customwidget.qdoc @@ -73,7 +73,7 @@ class called \c MyCustomWidget, we can export it by adding the following line to the file containing the plugin implementation: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 14 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 14 This macro ensures that \QD can access and construct the custom widget. Without this macro, there is no way for \QD to use it. @@ -264,13 +264,13 @@ several custom widgets \c CustomWidgetOne, \c CustomWidgetTwo and \c CustomWidgetThree, the class definition may look like this: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 12 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 12 In the class constructor you add the interfaces to your custom widgets to the list which you return in the customWidgets() function: - \snippet doc/src/snippets/code/doc_src_qtdesigner.qdoc 13 + \snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 13 Note that instead of exporting each custom widget plugin using the Q_EXPORT_PLUGIN2() macro, you export the entire collection. The -- cgit v0.12 From 1ca36f6539ffeb8581d38d677d1972ca4db58bf4 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 8 Feb 2011 16:15:17 +0100 Subject: Rewrote "Importing Reusable Components" documentation. Added snippet code, and replaced the text. Task-number: QTBUG-16071 --- doc/src/declarative/qmlreusablecomponents.qdoc | 74 ++++++++++++++++----- .../declarative/reusablecomponents/Button.qml | 71 ++++++++++++++++++++ .../declarative/reusablecomponents/application.qml | 55 ++++++++++++++++ .../declarative/reusablecomponents/component.qml | 77 ++++++++++++++++++++++ .../snippets/declarative/reusablecomponents/qmldir | 4 ++ 5 files changed, 264 insertions(+), 17 deletions(-) create mode 100644 doc/src/snippets/declarative/reusablecomponents/Button.qml create mode 100644 doc/src/snippets/declarative/reusablecomponents/application.qml create mode 100644 doc/src/snippets/declarative/reusablecomponents/component.qml create mode 100644 doc/src/snippets/declarative/reusablecomponents/qmldir diff --git a/doc/src/declarative/qmlreusablecomponents.qdoc b/doc/src/declarative/qmlreusablecomponents.qdoc index 0d02f4d..0fd5515 100644 --- a/doc/src/declarative/qmlreusablecomponents.qdoc +++ b/doc/src/declarative/qmlreusablecomponents.qdoc @@ -45,35 +45,71 @@ component could use a Text element for its label and other components to implement its functions. Compounding components to form new components (and effectively new interfaces) is the emphasis in QML. +\keyword qml-define-components \section1 Defining New Components Any snippet of QML code may become a component, by placing the code in a QML -file (extension is \c .qml). An inline component definition may also reside in a -\l Component element. - +file (extension is \c .qml). A complete Button component that responds to user +input may be in a Button.qml file. \snippet doc/src/snippets/declarative/reusablecomponents/Button.qml document -For example, one of the simplest and most common components you can build in QML is a -button-type component. Below, we implement this component as a \l Rectangle with a clickable -\l MouseArea, in a file named \c Button.qml: +Alternatively, a \l Component element may encapsulate a QML object to form a +component. +\snippet doc/src/snippets/declarative/reusablecomponents/component.qml parent begin +\snippet doc/src/snippets/declarative/reusablecomponents/component.qml define inline component +\snippet doc/src/snippets/declarative/reusablecomponents/component.qml parent end -\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 +\keyword qml-loading-components +\section1 Loading a Component -Now this component can be reused by another file within the same directory. Since the file is -named \c Button.qml, the component is referred to as \c Button: +The initialization of inline components is different from loading a component +from a \c .qml file. -\table -\row -\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 -\o \image qml-extending-types.png -\endtable +\section2 Importing a Component + +A component defined in a \c .qml file is directly usable by declaring the name +of the component. For example, a button defined in \c Button.qml is created by +declaring a \c Button. The button is defined in the +\l {qml-define-components}{Defining New Components} section. +\snippet doc/src/snippets/declarative/reusablecomponents/application.qml document + +Note that the component name, \c Button, matches the QML filename, \c Button.qml. +Specifically, the first character is in upper case. Matching the names allow +components in the same directory to be in the direct import path of the +application. + +For flexibility, a \c qmldir file is for dictating which additional components, +plugins, or directories should be imported. By using a \c qmldir file, +component names do not need to match the filenames. The \c qmldir file should, +however, in an imported path. +\snippet doc/src/snippets/declarative/reusablecomponents/qmldir document + +\section2 Loading an Inline Component + +A consequence of inline components is that initialization may be deferred or +delayed. A component may be created during a MouseArea event or by using a +\l Loader element. The component can create an object, which is addressable in a +similar way as an \l {qml-id-propert}{id property}. Thus, the created object may +have its bindings set and read like a normal QML object. +\snippet doc/src/snippets/declarative/reusablecomponents/component.qml define inline component +\snippet doc/src/snippets/declarative/reusablecomponents/component.qml create inline component + +\keyword qml-component-properties +\section1 Component Properties + +Initializing a component, either from a .qml file or initializing an inline +component, have several properties to facilitate component execution. +Specifically, there are \l{attached-properties}{attached properties} and +\l{attached-signalhandlers}{attached signal handlers} for setting properties +during the lifetime of a component. + +*/ The root object in \c Button.qml defines the attributes that are available to users of the \c Button component. In this case, the root object is a \l Rectangle, so any properties, methods and signals of \l Rectangle are made available, allowing \c application.qml to customize the \c width, \c height, \c radius and \c color properties of \c Button objects. - If \c Button.qml was not in the same directory, \c application.qml would need to load it as a \l {Modules}{module} from a specific filesystem path or \l{QDeclarativeExtensionPlugin}{plugin}. Also, note the letter case of the component file name is significant on some (notably UNIX) @@ -81,6 +117,10 @@ filesystems. It is recommended the file name case matches the case of the QML co exactly - for example, \c Box.qml and not \c BoX.qml - regardless of the platform to which the QML component will be deployed. -\section1 Loading a Component +\snippet doc/src/snippets/declarative/qml-extending-types/components/Button.qml 0 +\table +\row +\o \snippet doc/src/snippets/declarative/qml-extending-types/components/application.qml 0 +\o \image qml-extending-types.png +\endtable -*/ diff --git a/doc/src/snippets/declarative/reusablecomponents/Button.qml b/doc/src/snippets/declarative/reusablecomponents/Button.qml new file mode 100644 index 0000000..955e73a --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/Button.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +//contents of Button.qml +import QtQuick 1.0 + +Rectangle { + width: 145; height: 60 + color: "blue" + smooth: true; radius: 9 + property alias text: label.text + + border {color: "#B9C5D0"; width: 1} + + gradient: Gradient { + GradientStop {color: "#CFF7FF"; position: 0.0} + GradientStop {color: "#99C0E5"; position: 0.57} + GradientStop {color: "#719FCB"; position: 0.9} + } + + Text { + id: label + anchors.centerIn: parent + text: "Click Me!" + font.pointSize: 12 + color: "blue" + } + + MouseArea { + anchors.fill: parent + onClicked: console.log(text + " clicked") + } +} +//! [document] diff --git a/doc/src/snippets/declarative/reusablecomponents/application.qml b/doc/src/snippets/declarative/reusablecomponents/application.qml new file mode 100644 index 0000000..094134f --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/application.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +import QtQuick 1.0 + +Rectangle { + width: 175; height: 350 + color: "lightgrey" + + Column { + anchors.centerIn: parent + spacing: 15 + Button {} + Button {text: "Click Me Too!"} + Button {text: "Click Me Three!"} + } +} +//! [document] diff --git a/doc/src/snippets/declarative/reusablecomponents/component.qml b/doc/src/snippets/declarative/reusablecomponents/component.qml new file mode 100644 index 0000000..88fc9b1 --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/component.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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: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$ +** +****************************************************************************/ +//! [document] +import QtQuick 1.0 + +//! [parent begin] +Rectangle { +//! [parent begin] + id: screen + width: 175; height: 175 + color: "lightgrey" + +//! [define inline component] + Component { + id: inlinecomponent + Rectangle { + id: display + width: 50; height: 50 + color: "blue" + } + } +//! [define inline component] +//! [create inline component] + MouseArea { + anchors.fill: parent + onClicked: { + inlinecomponent.createObject(screen) + + var second = inlinecomponent.createObject(screen) + + var third = inlinecomponent.createObject(screen) + third.x = second.width + 10 + third.color = "red" + } + } +//! [create inline component] +//! [parent end] +} +//! [parent end] +//! [document] diff --git a/doc/src/snippets/declarative/reusablecomponents/qmldir b/doc/src/snippets/declarative/reusablecomponents/qmldir new file mode 100644 index 0000000..93b53f9 --- /dev/null +++ b/doc/src/snippets/declarative/reusablecomponents/qmldir @@ -0,0 +1,4 @@ +//! [document] +Button ./Button.qml 1.0 +SimpleButton ./simplebutton.qml +//! [document] -- cgit v0.12 From 48f2beeee852bfbb5b99df3c3a91802f58ffef1b Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 8 Feb 2011 22:44:15 +0100 Subject: Doc: correcting typos --- doc/src/getting-started/installation.qdoc | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c906f84..ea3440b 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -1323,7 +1323,7 @@ We hope you will enjoy using Qt. load those that have a matching . \o \row \o \c {-release } \o Compile and link Qt with debugging turned off. \o \row \o \c {-debug } \o Compile and link Qt with debugging turned on. - \o Defualt value. + \o Default value. \row \o \c {-debug-and-release} \o Compile and link two Qt libraries, with and without debugging turned on. \o This option denotes a default value and needs to be evaluated. If the evaluation succeeds, the @@ -1334,28 +1334,28 @@ We hope you will enjoy using Qt. of Qt. \o \row \o \c {-developer-build} \o Compile and link Qt with Qt developer options including auto-tests exporting) \o - \row \o \c {-shared} \o Create and use shared Qt libraries. \o Defualt + \row \o \c {-shared} \o Create and use shared Qt libraries. \o Default value. \row \o \c {-static} \o Create and use static Qt libraries. \o \row \o \c {-ltcg} \o Use Link Time Code Generation. \o Apply to release builds only. - \row \o \c {-no-ltcg} \o Do not use Link Time Code Generation. \o Defualt + \row \o \c {-no-ltcg} \o Do not use Link Time Code Generation. \o Default value. \row \o \c {-no-fast} \o Configure Qt normally by generating Makefiles for - all project files. \o Defualt value. + all project files. \o Default value. \row \o \c {-fast} \o Configure Qt quickly by generating Makefiles only for library and subdirectory targets. \o All other Makefiles are created as wrappers which will in turn run qmake. \row \o \c {-no-exceptions} \o Disable exceptions on platforms that support it. \o \row \o \c {-exceptions} \o Enable exceptions on platforms that support it. - \o Defualt value. + \o Default value. \row \o \c {-no-accessibility} \o Do not compile Windows Active Accessibility support. \o \row \o \c {-accessibility} \o Compile Windows Active Accessibility - support. \o Defualt value. + support. \o Default value. \row \o \c {-no-stl} \o Do not compile STL support. \o - \row \o \c {-stl} \o Compile STL support. \o Defualt value. + \row \o \c {-stl} \o Compile STL support. \o Default value. \row \o \c {-no-sql-} \o Disable SQL entirely, by default none are turned on. \o \row \o \c {-qt-sql-} \o Enable a SQL in the Qt Library. @@ -1371,14 +1371,14 @@ We hope you will enjoy using Qt. version. \o Available values for : desktop - Enable support for Desktop OpenGL (Default), es1 - Enable support for OpenGL ES Common Profile, es2 - Enable support for OpenGL ES 2.0. - \row \o \c {-no-openvg} \o Disables OpenVG functionality \o Defualt value. + \row \o \c {-no-openvg} \o Disables OpenVG functionality \o Default value. \row \o \c {-openvg} \o Enables OpenVG functionality \o Requires EGL support, typically supplied by an OpenGL or other graphics implementation. \row \o \c {-platform } \o The operating system and compiler you are building on. \o The default value is %QMAKESPEC%. \row \o \c {-xplatform } \o The operating system and compiler you - are cross compiling to. \o See the README file for a list of supported + are cross compiling for. \o See the README file for a list of supported operating systems and compilers. \row \o \c {-qtnamespace } \o Wraps all Qt library code in 'namespace name {..} \o @@ -1390,7 +1390,7 @@ We hope you will enjoy using Qt. \row \o \c {-L } \o Add an explicit library path. \o \row \o \c {-l } \o Add an explicit library name, residing in a librarypath. \o - \row \o \c {-graphicssystem } \o Specify which graphicssystem should + \row \o \c {-graphicssystem } \o Specify which graphics system should be used. \o Available values for : * raster - Software rasterizer, opengl - Using OpenGL acceleration, experimental!, openvg - Using OpenVG acceleration, experimental! @@ -1441,10 +1441,10 @@ We hope you will enjoy using Qt. \header \o Option \o Description \o Note \row \o \c {-no-dsp} \o Do not generate VC++ .dsp files. \o \row \o \c {-dsp} \o Generate VC++ .dsp files, only if spec "win32-msvc". - \o Defualt value. + \o Default value. \row \o \c {-no-vcproj} \o Do not generate VC++ .vcproj files. \o \row \o \c {-vcproj} \o Generate VC++ .vcproj files, only if platform - "win32-msvc.net". \o Defualt value. + "win32-msvc.net". \o Default value. \row \o \c {-no-incredibuild-xge} \o Do not add IncrediBuild XGE distribution commands to custom build steps. \o \row \o \c {-incredibuild-xge} \o Add IncrediBuild XGE distribution commands @@ -1455,14 +1455,14 @@ We hope you will enjoy using Qt. If the evaluation succeeds, the feature is included. \row \o \c {-no-plugin-manifests} \o Do not embed manifests in plugins. \o \row \o \c {-plugin-manifests} \o Embed manifests in plugins. - \o Defualt value. + \o Default value. \row \o \c {-no-qmake} \o Do not compile qmake. \o - \row \o \c {-qmake} \o Compile qmake. \o Defualt value + \row \o \c {-qmake} \o Compile qmake. \o Default value \row \o \c {-dont-process} \o Do not generate Makefiles/Project files. This will override -no-fast if specified. \o - \row \o \c {-process} \o Generate Makefiles/Project files. \o Defualt value. + \row \o \c {-process} \o Generate Makefiles/Project files. \o Default value. \row \o \c {-no-rtti} \o Do not compile runtime type information. \o - \row \o \c {-rtti} \o Compile runtime type information. \o Defualt value. + \row \o \c {-rtti} \o Compile runtime type information. \o Default value. \row \o \c {-no-mmx} \o Do not compile with use of MMX instructions \o \row \o \c {-mmx} \o Compile with use of MMX instructions \o This option denotes a default value and needs to be evaluated. If the evaluation @@ -1497,9 +1497,9 @@ We hope you will enjoy using Qt. \row \o \c {-no-phonon-backend} \o Do not compile the platform-specific Phonon backend-plugin \o \row \o \c {-phonon-backend} \o Compile in the platform-specific Phonon - backend-plugin \o Defualt value. + backend-plugin \o Default value. \row \o \c {-no-multimedia} \o Do not compile the multimedia module \o - \row \o \c {-multimedia} \o Compile in multimedia module \o Defualt value. + \row \o \c {-multimedia} \o Compile in multimedia module \o Default value. \row \o \c {-no-audio-backend} \o Do not compile in the platform audio backend into QtMultimedia \o \row \o \c {-audio-backend} \o Compile in the platform audio backend into @@ -1527,7 +1527,7 @@ We hope you will enjoy using Qt. \row \o \c {-no-declarative-debug} \o Do not build the declarative debugging support \o \row \o \c {-declarative-debug} \o Build the declarative debugging support - \o Defualt value. + \o Default value. \row \o \c {-arch } \o Specify an architecture. \o Available values for : * windows, windowsce, symbian, boundschecker, generic. \row \o \c {-no-style-