diff options
Diffstat (limited to 'doc')
66 files changed, 2781 insertions, 409 deletions
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 56ab29f..d89ca53 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -147,4 +147,12 @@ examples for porting} \list \o \l{Qt Quick Licensing Information} \endlist + +\section1 Online Examples + +\list +\o Forum Nokia: +\l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick +examples for porting} +\endlist */ diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 52ece6f..36db628 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -422,3 +422,84 @@ a function in the model, e.g.: updated, and that \e{value} holds the new value. */ + +/*! +\page qml-presenting-data.html +\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. + +\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/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index b35ddc5..0d99287 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -108,7 +108,7 @@ These methods are shown below. Naturally these approaches are not exclusive; you these methods throughout your application as appropriate. -\section2 Loading QML components from C++ +\section2 Loading QML Components from C++ A QML document can be loaded with QDeclarativeComponent or QDeclarativeView. QDeclarativeComponent loads a QML component as a C++ object; QDeclarativeView also does this, @@ -180,7 +180,7 @@ required \c objectName. It is better for the C++ implementation to know as littl the QML user interface implementation and the composition of the QML object tree. -\section2 Embedding C++ objects into QML components +\section2 Embedding C++ Objects into QML Components When loading a QML scene into a C++ application, it can be useful to directly embed C++ data into the QML object. QDeclarativeContext enables this by exposing data to the context of a QML @@ -231,7 +231,7 @@ in QML views. Also see the QDeclarativeContext documentation for more information. -\section2 Defining new QML elements +\section2 Defining New QML Elements While new QML elements can be \l {Defining New Components}{defined in QML}, they can also be defined by C++ classes; in fact, many of the core \l {QML Elements} are implemented through @@ -270,7 +270,7 @@ For more information on defining new QML elements, see the \l {Tutorial: Writing -\section1 Exchanging data between QML and C++ +\section1 Exchanging Data between QML and C++ QML and C++ objects can communicate with one another through signals, slots and property modifications. For a C++ object, any data that is exposed to Qt's \l{The Meta-Object System}{Meta-Object System} @@ -279,7 +279,7 @@ the QML side, all QML object data is automatically made available to the meta-ob be accessed from C++. -\section2 Calling functions +\section2 Calling Functions QML functions can be called from C++ and vice-versa. @@ -314,7 +314,7 @@ same name but different arguments, the correct function will be called according the types of arguments that are provided. -\section2 Receiving signals +\section2 Receiving Signals All QML signals are automatically available to C++, and can be connected to using QObject::connect() like any ordinary Qt C++ signal. In return, any C++ signal can be received by a QML object using @@ -373,7 +373,7 @@ class that is emitting the signal, and that the enum is registered using Q_ENUMS See \l {Using enumerations of a custom type} below for details. -\section2 Modifying properties +\section2 Modifying Properties Any properties declared in a QML object are automatically accessible from C++. Given a QML item like this: @@ -454,7 +454,7 @@ To allow a custom C++ type to be created or used in QML, the C++ class must be r type using qmlRegisterType(), as shown in the \l {Defining new QML elements} section above. -\section2 JavaScript arrays and objects +\section2 JavaScript Arrays and Objects There is built-in support for automatic type conversion between QVariantList and JavaScript arrays, and QVariantMap and JavaScript objects. @@ -465,6 +465,10 @@ below right calls this function, passing a QVariantList and a QVariantMap, which converted to JavaScript array and object values, repectively: \table +\header +\o Type +\o String format +\o Example \row \o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml 0 \o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp 0 @@ -485,7 +489,7 @@ parameter, the value can be created as a JavaScript array or object in the QML side, and is automatically converted to a QVariantList or QVariantMap when it is passed to C++. -\section2 Using enumerations of a custom type +\section2 Using Enumerations of a Custom Type To use an enumeration from a custom C++ component, the enumeration must be declared with Q_ENUMS() to register it with Qt's meta object system. For example, the following C++ type has a \c Status enum: @@ -507,22 +511,22 @@ the \l {Extending QML Functionalities using C++} reference documentation for more information. -\section2 Using enumeration values as signal parameters +\section2 Using Enumeration Values as Signal Parameters C++ signals may pass enumeration values as signal parameters to QML, providing that the enumeration and the signal are declared within the same class, or that the enumeration value is one of those declared in the \l {Qt}{Qt Namespace}. Additionally, if a C++ signal with an enum parameter should be connectable to a QML function using the -\l {Connecting signals to methods and other signals}{connect()} function, the enum type must be -registered using qRegisterMetaType(). +\l{QML Signal and Handler Event System#Connecting Signals to Methods and Signals}{connect()} +function, the enum type must be registered using qRegisterMetaType(). For QML signals, enum values may be used as signal parameters using the \c int type: \snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 1 -\section2 Automatic type conversion from strings +\section2 Automatic Type Conversion from Strings As a convenience, some basic types can be specified in QML using format strings to make it easier to pass simple values from QML to C++. diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 027bb2e..75420d5 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -210,4 +210,4 @@ #include <QtDeclarative> to use this function. Returns the QML type id. - */ +*/ diff --git a/doc/src/declarative/righttoleft.qdoc b/doc/src/declarative/righttoleft.qdoc index 4427798..4f62d2c 100644 --- a/doc/src/declarative/righttoleft.qdoc +++ b/doc/src/declarative/righttoleft.qdoc @@ -106,7 +106,7 @@ Applying mirroring in this manner does not change the actual value of the releva direction of positioners and model views that takes the mirroring into account. Similarly the \l Text, \l TextInput and \l TextEdit elements have gained the read-only property \c effectiveHorizontalAlignment for querying the effective visual alignment of text. For anchors, the read only -\l {Item::anchors}{anchors.mirrored} property reflects whether anchors have been mirrored. +\l {Item::anchors.top}{anchors.mirrored} property reflects whether anchors have been mirrored. Note that application layouts and animations that are defined using \l {Item::}{x} property values (as opposed to anchors or positioner elements) are not affected by the \l LayoutMirroring attached property. diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 9e13e98..9757201 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -26,12 +26,13 @@ ****************************************************************************/ /*! -\title What's new in Qt Quick +\title What's New in Qt Quick \page qtquick-whatsnew.html \section1 Qt 4.7.4 includes QtQuick 1.1 -QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new features. +QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new +features. \section2 PinchArea @@ -39,7 +40,9 @@ PinchArea provides support for the common two finger pinch gesture. \section2 LayoutMirroring attached property -\l {LayoutMirroring}{Layout mirroring} is useful when you need to support both left-to-right and right-to-left layout versions of your application that target different language areas. +\l {LayoutMirroring}{Layout mirroring} is useful when you need to support both +left-to-right and right-to-left layout versions of your application that target +different language areas. \section2 Anchors @@ -150,21 +153,21 @@ Added the following methods and signal handlers: \section2 Component \list -\o The \l{Component::}{createObject()} method now accepts a map of initial property values for -the created object. +\o The \l{Component::}{createObject()} method now accepts a map of initial +property values for the created object. \endlist \section2 Qt \list -\o Added the \l {QML:Qt::application}{Qt.application} object to hold generic global application -properties. +\o Added the \l {QML:Qt::application}{Qt.application} object to hold generic +global application properties. \endlist \section2 Other changes \list -\o Functions can be \l{Binding Properties from JavaScript}{assigned to properties from JavaScript} +\o Functions can be \l{Property Binding#Property Binding}{assigned to properties from JavaScript} to create property bindings. \o QtQuick now supports Right to Left layout in positioners, views, anchors and text elements. \endlist @@ -174,13 +177,14 @@ to create property bindings. \section2 QtQuick namespace -In prior Qt releases, all the Qt Quick elements were available in the \e Qt namespace. -Starting with Qt 4.7.1, the elements are also available in the \e QtQuick namespace, -which improves naming consistency, and allows the development of Qt Quick to occur at -a faster rate than Qt's usual minor release schedule. +In prior Qt releases, all the Qt Quick elements were available in the \e Qt +namespace. Starting with Qt 4.7.1, the elements are also available in the +\e QtQuick namespace, which improves naming consistency, and allows the +development of Qt Quick to occur at a faster rate than Qt's usual minor release +schedule. -The change for developers is very simple - where you previously wrote \e {import Qt 4.7}, -just replace it with \e {import QtQuick 1.0}, like this: +The change for developers is very simple - where you previously wrote +\e {import Qt 4.7}, just replace it with \e {import QtQuick 1.0}, like this: \code import QtQuick 1.0 @@ -190,7 +194,7 @@ Text { } \endcode -\e {import Qt 4.7} continues to work so existing applications wont break even if they -aren't updated, but it is recommended that all import statements be modified to the new -form. +\e {import Qt 4.7} continues to work so existing applications won't break even +if they aren't updated, but it is recommended that all import statements be +modified to the new form. */ diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index 410ca8c..348931f 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -1560,7 +1560,7 @@ \section1 Dock Widgets Since dock widgets are \l{Using Containers in Qt Designer} - {container widgets}, they can be added to a form in the usuasl way. Once + {container widgets}, they can be added to a form in the usual way. Once added to a form, dock widgets are not placed in any particular dock area by default; you need to set the \gui{docked} property to true for each widget and choose an appropriate value for its \gui{dockWidgetArea} property. diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 54ed3a1..184a881 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1291,11 +1291,12 @@ automatically be added to the project. \row \o console \o The target is a Win32 console application (app only). The proper include paths, compiler flags and libraries will - automatically be added to the - project. + automatically be added to the project. \row \o shared \o{1,3} The target is a shared object/DLL. The proper include paths, compiler flags and libraries will automatically be - added to the project. + added to the project. Note that \c dll can also be used on all platforms; + a shared library file with the appropriate suffix for the target platform + (dll, so, dylib) will be created. \row \o dll \o \row \o dylib \o \row \o static \o{1,2} The target is a static library (lib only). The proper @@ -1767,6 +1768,9 @@ executable. If you need to install executable files, you can unset the files' executable flags. + Note that \c qmake will skip files that are executable. If you need to install + executable files, you can unset the files' executable flags. + \target LEXIMPLS \section1 LEXIMPLS @@ -1859,6 +1863,8 @@ \bold{Note:} On the Symbian platform, this variable is ignored. + \bold{Note:} On the Symbian platform, this variable is ignored. + \target MAKEFILE_GENERATOR \section1 MAKEFILE_GENERATOR @@ -3555,11 +3561,11 @@ This can be useful to optionally enable or disable features. For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 157 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 157 And then, in the code: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 158 + \snippet doc/src/snippets/code/doc_src_qmake-manual.pro 158 \section1 basename(variablename) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 80bf838..10ae285 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -751,8 +751,8 @@ Tools for handling and visualizing test data are available as part of the \l {qtestlib-tools} project in the \l{Qt Labs} web site. - These include a tool for comparing performance data obtained from test - runs and a utility to generate Web-based graphs of performance data. + These include a tool for comparing performance data obtained from test + runs and a utility to generate Web-based graphs of performance data. See the \l{qtestlib-tools Announcement}{qtestlib-tools announcement} for more information on these tools and a simple graphing example. diff --git a/doc/src/diagrams/webkit-webplugin.png b/doc/src/diagrams/webkit-webplugin.png Binary files differnew file mode 100644 index 0000000..be17fae --- /dev/null +++ b/doc/src/diagrams/webkit-webplugin.png diff --git a/doc/src/examples/activeqt/dotnet.qdoc b/doc/src/examples/activeqt/dotnet.qdoc index af62b8d..24b9cd1 100644 --- a/doc/src/examples/activeqt/dotnet.qdoc +++ b/doc/src/examples/activeqt/dotnet.qdoc @@ -314,7 +314,7 @@ \l{http://qt.nokia.com/products/qsa/}{QSA}, the cross platform scripting solution for Qt applications, and to COM clients in general. - When using the "IJW" method, in priciple the only limitation is the + When using the "IJW" method, in principle the only limitation is the time required to write the wrapper classes and data type conversion functions. diff --git a/doc/src/examples/applicationicon.qdoc b/doc/src/examples/applicationicon.qdoc new file mode 100644 index 0000000..d03bf36 --- /dev/null +++ b/doc/src/examples/applicationicon.qdoc @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/applicationicon + \group all-examples + \title Application Icon Example + + The example shows how to add an application icon to a mobile application. + + \image appicon_screenshot.png The icon on a Nokia XPressMusic 5800 + + \section1 Creating an icon for Maemo + + Maemo expects the icon of an application to be a 64x64 PNG image file. The + file name of the icon should be the same as the executable with a \c .png + extension. You also need a \c .desktop file that gives the window manager + hints about the application, such as name, type and icon. + + \quotefile examples/widgets/applicationicon/applicationicon.desktop + + The \c Icon field should also contain the name of the executable. On the + device, application icons are stored in the + \c /usr/share/icons/hicolor/64x64/apps directory + and desktop files in the \c /usr/share/applications/hildon directory. + + \section1 Creating an icon for Symbian + + Symbian uses Scalable Vector Graphics (SVG Tiny 1.1+) to render + application icons in the application menu. Therefore icons could be + created manually with a text editor, since SVG files are plain text with + XML syntax, but usually you would use a vector graphics program that is + able to output SVG files. Popular graphics programs such as Adobe + Illustrator or Inkscape are able to do so. + + For best results, the icon should be created on a 44x44 pixel canvas. + Otherwise the image might be scaled in unexpected ways. + + Once you have created your icon, make sure that it is stored according to + the SVG-Tiny 1.1+ standard. Inkscape, for instance, is not able to save + images that way, but there are tools that can convert general SVG files + into the Tiny format. For instance, the svg2svgt tool that is bundled with + Symbian 3rd and 5th editon SDKs under the folder s60tools can do this + conversion to some extent. Another tool to convert SVG to SVG Tiny is SVG + Pony. + + \section1 Adding the icons to the project + + Edit the .pro file and specify the ICON variable for the symbian target. + For Maemo, we need to add that the \c .desktop and icon file should be + installed. + + \quotefile examples/widgets/applicationicon/applicationicon.pro + + Currently, Qt Creator doesn't include the icon and desktop files in the + application package for Maemo, merely the executable file is included. As a + workaround for this, the files can be added manually in the Projects tab. + In the "Create Package" build step for the Maemo target, the \c .desktop + file and icon can be added to be a part of the package contents. + Unfortunately, these additions are only stored as a part of the + \c .pro.user file. This issue will be resolved in a future release of + Qt Creator. + + \image appicon_packagecontents.png Manual addition of files to the "Create Package" build step +*/ diff --git a/doc/src/examples/broadcastreceiver.qdoc b/doc/src/examples/broadcastreceiver.qdoc index e5d4ae0..409b491 100644 --- a/doc/src/examples/broadcastreceiver.qdoc +++ b/doc/src/examples/broadcastreceiver.qdoc @@ -29,7 +29,7 @@ \example network/broadcastreceiver \title Broadcast Receiver Example - The Broadcast Receiever example shows how to receive information that is broadcasted + The Broadcast Receiver example shows how to receive information that is broadcasted over a local network. \image broadcastreceiver-example.png diff --git a/doc/src/examples/codeeditor.qdoc b/doc/src/examples/codeeditor.qdoc index 2b0b6fa..435f650 100644 --- a/doc/src/examples/codeeditor.qdoc +++ b/doc/src/examples/codeeditor.qdoc @@ -190,6 +190,8 @@ used to implement parenthesis matching. In the \c highlightCurrentLine(), the data of the currentBlock() can be fetched with QTextBlock::userData(). Matching parentheses can be - highlighted with an extra selection. + highlighted with an extra selection. The "Matching Parentheses + with QSyntaxHighlighter" article in Qt Quarterly 31 implements + this. You find it here: \l{http://doc.qt.nokia.com/qq/}. */ diff --git a/doc/src/examples/combowidgetmapper.qdoc b/doc/src/examples/combowidgetmapper.qdoc index efd06f6..e852f5e 100644 --- a/doc/src/examples/combowidgetmapper.qdoc +++ b/doc/src/examples/combowidgetmapper.qdoc @@ -29,7 +29,7 @@ \example itemviews/combowidgetmapper \title Combo Widget Mapper Example - The Delegate Widget Mapper example shows how to use a custom delegate to + The Combo Widget Mapper example shows how to use a custom delegate to map information from a model to specific widgets on a form. \image combowidgetmapper-example.png diff --git a/doc/src/examples/cube.qdoc b/doc/src/examples/cube.qdoc new file mode 100644 index 0000000..0603941 --- /dev/null +++ b/doc/src/examples/cube.qdoc @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** 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:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example opengl/cube + \group all-examples + \title Cube OpenGL ES 2.0 example + + The Cube OpenGL ES 2.0 example shows how to write mouse rotateable + textured 3D cube using OpenGL ES 2.0 with Qt. It shows how to handle + polygon geometries efficiently and how to write simple vertex and + fragment shader for programmable graphics pipeline. In addition it + shows how to use quaternions for representing 3D object orientation. + + This example has been written for OpenGL ES 2.0 but it works also on + desktop OpenGL because this example is simple enough and for the + most parts desktop OpenGL API is same. It compiles also without OpenGL + support but then it just shows a label stating that OpenGL support is + required. + + \image cube.png Screenshot of the Cube example running on N900 + + The example consist of two classes: + + \list + \o \c MainWidget extends QGLWidget and contains OpenGL ES 2.0 + initialization and drawing and mouse and timer event handling + \o \c GeometryEngine handles polygon geometries. Transfers polygon geometry + to vertex buffer objects and draws geometries from vertex buffer objects. + \endlist + + We'll start by initializing OpenGL ES 2.0 in \c MainWidget. + + \tableofcontents + + \section1 Initializing OpenGL ES 2.0 + + Since OpenGL ES 2.0 doesn't support fixed graphics pipeline anymore it has to + be implemented by ourselves. This makes graphics pipeline very flexible but + in the same time it becomes more difficult because user has to implement graphics + pipeline to get even the simplest example running. It also makes graphics pipeline + more efficient because user can decide what kind of pipeline is needed for the + application. + + First we have to implement vertex shader. It gets vertex data and + model-view-projection matrix (MVP) as parameters. It transforms vertex position + using MVP matrix to screen space and passes texture coordinate to + fragment shader. Texture coordinate will be automatically interpolated on polygon + faces. + + \snippet examples/opengl/cube/vshader.glsl 0 + + After that we need to implement second part of the graphics pipeline - fragment + shader. For this exercise we need to implement fragment shader that handles + texturing. It gets interpolated texture coordinate as a parameter and looks up + fragment color from the given texture. + + \snippet examples/opengl/cube/fshader.glsl 0 + + Using \c QGLShaderProgram we can compile, link and bind shader code to + graphics pipeline. This code uses Qt Resource files to access shader source code. + + \snippet examples/opengl/cube/mainwidget.cpp 3 + + The following code enables depth buffering and back face culling. + + \snippet examples/opengl/cube/mainwidget.cpp 2 + + \section1 Loading textures from Qt Resource files + + \c QGLWidget interface implements methods for loading textures from QImage to GL + texture memory. We still need to use OpenGL provided functions for specifying + the GL texture unit and configuring texture filtering options. + + \snippet examples/opengl/cube/mainwidget.cpp 4 + + \section1 Cube Geometry + + There are many ways to render polygons in OpenGL but the most efficient way is + to use only triangle strip primitives and render vertices from graphics hardware + memory. OpenGL has a mechanism to create buffer objects to this memory area and + transfer vertex data to these buffers. In OpenGL terminology these are referred + as Vertex Buffer Objects (VBO). + + \image cube_faces.png Cube faces and vertices + + This is how cube faces break down to triangles. Vertices are ordered this way + to get vertex ordering correct using triangle strips. OpenGL determines triangle + front and back face based on vertex ordering. By default OpenGL uses + counter-clockwise order for front faces. This information is used by back face + culling which improves rendering performance by not rendering back faces of the + triangles. This way graphics pipeline can omit rendering sides of the triangle that + aren't facing towards screen. + + Creating vertex buffer objects and transferring data to them is quite simple using + OpenGL provided functions. + + \snippet examples/opengl/cube/geometryengine.cpp 0 + + \snippet examples/opengl/cube/geometryengine.cpp 1 + + Drawing primitives from VBOs and telling programmable graphics pipeline how to + locate vertex data requires few steps. First we need to bind VBOs to be used. + After that we bind shader program attribute names and configure what + kind of data it has in the bound VBO. Finally we'll draw triangle + strip primitives using indices from the other VBO. + + \snippet examples/opengl/cube/geometryengine.cpp 2 + + \section1 Perspective projection + + Using \c QMatrix4x4 helper methods it's really easy to calculate perpective + projection matrix. This matrix is used to project vertices to screen space. + + \snippet examples/opengl/cube/mainwidget.cpp 5 + + \section1 Orientation of the 3D object + + Quaternions are handy way to represent orientation of the 3D object. Quaternions + involve quite complex mathematics but fortunately all the necessary mathematics + behind quaternions is implemented in \c QQuaternion. That allows us to store + cube orientation in quaternion and rotating cube around given axis is quite + simple. + + The following code calculates rotation axis and angular speed based on mouse events. + + \snippet examples/opengl/cube/mainwidget.cpp 0 + + \c QBasicTimer is used to animate scene and update cube orientation. Rotations + can be concatenated simply by multiplying quaternions. + + \snippet examples/opengl/cube/mainwidget.cpp 1 + + Model-view matrix is calculated using the quaternion and by moving world by Z axis. + This matrix is multiplied with the projection matrix to get MVP matrix for shader + program. + + \snippet examples/opengl/cube/mainwidget.cpp 6 + +*/ diff --git a/doc/src/examples/dragdroprobot.qdoc b/doc/src/examples/dragdroprobot.qdoc index 1e3b434..84d8af4 100644 --- a/doc/src/examples/dragdroprobot.qdoc +++ b/doc/src/examples/dragdroprobot.qdoc @@ -29,7 +29,7 @@ \example graphicsview/dragdroprobot \title Drag and Drop Robot Example - This GraphicsView example shows how to implement Drag and Drop in a + The Drag and Drop Robot example shows how to implement Drag and Drop in a QGraphicsItem subclass, as well as how to animate items using Qt's \l{Animation Framework}. diff --git a/doc/src/examples/elasticnodes.qdoc b/doc/src/examples/elasticnodes.qdoc index 6a16cee..e5399b1 100644 --- a/doc/src/examples/elasticnodes.qdoc +++ b/doc/src/examples/elasticnodes.qdoc @@ -29,7 +29,7 @@ \example graphicsview/elasticnodes \title Elastic Nodes Example - This GraphicsView example shows how to implement edges between nodes in a + The Elastic Nodes example shows how to implement edges between nodes in a graph, with basic interaction. You can click to drag a node around, and zoom in and out using the mouse wheel or the keyboard. Hitting the space bar will randomize the nodes. The example is also resolution independent; diff --git a/doc/src/examples/elidedlabel.qdoc b/doc/src/examples/elidedlabel.qdoc new file mode 100644 index 0000000..4c6e8e8 --- /dev/null +++ b/doc/src/examples/elidedlabel.qdoc @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widgets/elidedlabel + \group all-examples + \title Elided Label Example + + This example creates a widget similar to QLabel, that elides the last + visible line, if the text is too long to fit the widget's geometry. + + \image elidedlabel-example.png Elided Label example on XPressMusic 5800 + + When text of varying length has to be displayed in a uniformly sized + area, for instance within a list or grid view where all list items have the + same size, it can be useful to give the user a visual clue when not all + text is visible. QLabel can elide text that doesn't fit within it, but only + in one line. The \c ElidedLabel widget shown in this example word wraps its + text by its width, and elides the last visible line if some text is left + out. \c TestWidget gives control to the features of \c ElidedWidget and + forms the example application. + + + \section1 ElidedLabel Class Definition + + Like QLabel, \c ElidedLabel inherits from QFrame. Here's the definition of + the \c ElidedLabel class: + + + \snippet examples/widgets/elidedlabel/elidedlabel.h 0 + + The \c isElided property depends the font, text content and geometry of the + widget. Whenever any of these change, the \c elisionChanged() signal might + trigger. We cache the current elision value in \c elided, so that it + doesn't have to be recomputed every time it's asked for. + + + \section1 ElidedLabel Class Implementation + + Except for initializing the member variables, the constructor sets the size + policy to be horizontally expanding, since it's meant to fill the width of + its container and grow vertically. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 0 + + Changing the \c content require a repaint of the widget. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 1 + + QTextLayout is used in the \c paintEvent() to divide the \c content into + lines, that wrap on word boundaries. Each line, except the last visible + one, is drawn \c lineSpacing pixels below the previous one. The \c draw() + method of QTextLine will draw the line using the coordinate point as the + top left corner. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 2 + + Unfortunately, QTextLayout does not elide text, so the last visible line + has to be treated differently. This last line is elided if it is too wide. + The \c drawText() method of QPainter draws the text starting from the base + line, which is \c ascecnt() pixels below the last drawn line. + + Finally, one more line is created to see if everything fit on this line. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 3 + + If the text was elided and wasn't before or vice versa, cache it in + \c elided and emit the change. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 4 + + + \section1 TestWidget Class Definition + + \c TestWidget is a QWidget and is the main window of the example. It + contains an \c ElidedLabel which can be resized with two QSlider widgets. + + \snippet examples/widgets/elidedlabel/testwidget.h 0 + + \section1 TestWidget Class Implementation + + The constructor initializes the whole widget. Strings of different length + are stored in \c textSamples. The user is able to switch between these. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 0 + + An \c ElidedLabel is created to contain the first of the sample strings. + The frame is made visible to make it easier to see the actual size of the + widget. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 1 + + The buttons and the elision label are created. By connecting the + \c elisionChanged() signal to the \c setVisible() slot of the \c label, + it will act as an indicator to when the text is elided or not. This signal + could, for instance, be used to make a "More" button visible, or similar. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 2 + + The \c widthSlider and \c heightSlider specify the size of the + \c elidedText. Since the y-axis is inverted, the \c heightSlider has to be + inverted to act appropriately. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 3 + + The components are all stored in a QGridLayout, which is made the layout of + the \c TestWidget. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 4 + + On the Maemo platform, windows are stuck in landscape mode by default. With + this attribute set, the window manager is aware that this window can be + rotated. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 5 + + The \c widthSlider and \c heightSlider have the exact same length as the + dimensions of the \c elidedText. The maximum value for both of them is + thus their lengths, and each tick indicates one pixel. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 6 + + The \c switchText() slot simply cycles through all the available sample + texts. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 7 + + These slots set the width and height of the \c elided text, in response to + changes in the sliders. + + \section1 The \c main() Function + + The \c main() function creates an instance of \c TestWidget fullscreen and + enters the message loop. + + \snippet examples/widgets/elidedlabel/main.cpp 0 +*/ + diff --git a/doc/src/examples/fingerpaint.qdoc b/doc/src/examples/fingerpaint.qdoc index 5aef64c..49078b6 100644 --- a/doc/src/examples/fingerpaint.qdoc +++ b/doc/src/examples/fingerpaint.qdoc @@ -29,8 +29,12 @@ \example touch/fingerpaint \title Finger Paint Example - The Finger Paint example shows the use of touch with a custom widget + The Finger Paint example shows the use of a touchscreen with a custom widget to create a simple painting application. \image touch-fingerpaint-example.png + + This example was specifically designed to work with a touchscreen, using + QTouchEvent instead of QMouseEvent to handle user input over the custom + widget. As a result, it is not possible to draw with the mouse cursor. */ diff --git a/doc/src/examples/maemovibration.qdoc b/doc/src/examples/maemovibration.qdoc new file mode 100644 index 0000000..280dc30 --- /dev/null +++ b/doc/src/examples/maemovibration.qdoc @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widgets/maemovibration + \group all-examples + \title Maemo Vibration Example + + The Maemo Vibration example shows how to tell the Maemo Mode Control Entity + (MCE) to vibrate a maemo device. + + The MCE is a system service on Maemo that, among other things, provides an + D-Bus interface to trigger vibrations. The vibrations are specified as + patterns and are defined in a system configuration file. + + The example program reads the configuration file to look for possible + vibration patterns and display a button for each. Pressing a button will + make the device vibrate accordingly, until the application closes, or + another pattern is started. + + \image maemovibration-example.png Screenshot of the Maemo Vibration Example + + The code makes use of two classes: + + \list + \o \c MceVibrator connects to the MCE service and can start a certain + vibrator pattern. It also is responsible to parse the configuration + file. + + \o \c ButtonWidget provides a button for each pattern. Pressing the button + activates the pattern in question. + \endlist + + + \section1 MceVibrator Class Definition + + \snippet examples/widgets/maemovibration/mcevibrator.h 0 + + The \c MceVibrator class inherits from QObject and provides a specialized + and Qt friendly interface to the MCE vibration facilty. The slot \c vibrate() + can be called to make the device vibrate according to a specific pattern + name. We will connect it to a signal of a \c ButtonWidget object later. The + static method \c ParsePatternNames() can be called to find out which patterns + are available to us. + + \list + \o \c mceInterface is our D-Bus handle to the MCE service. We use it to + invoke methods on the MCE request object. + + \o \c lastPatternName contains the pattern that was activated last time. We + have to keep track of this, because the last pattern has to be + deactivated before activating a new pattern. + \endlist + + + \section1 MceVibrator Class Implementation + + To connect to the service, we initialize the D-Bus interface handle. The + system header \c "mce/dbus-names.h" contains definitions of the D-Bus + service name and request object path and interface. These are passed to the + constructor of the handle, and Qt will automatically establish a connection + to it, if it is possible. + + The MCE expects us to first enable the vibrator before we can use it. This + is done with the call to the \c MCE_ENABLE_VIBRATOR D-Bus method. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 0 + + From now on we can activate vibration patterns. Each time a vibration + pattern is activated, the last pattern has to be deactivated first. In the + vibrate slot we use the MCE interface to call the activation method. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 1 + + The calls to the private method deactivate simply makes sure to deactivate + the last pattern used, if there was one. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 2 + + Calling either the activate or deactivate MCE D-Bus method with invalid + pattern names are ignored. + + Finally, the destructor disables the vibrator. When the destructor of the + MCE interface handle is called, the connection is also closed. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 3 + + The MCE configuration file contains options for many different things. We + are only interested in one line that contains the vibration patterns. It + has the following format: + + + \code + VibratorPatterns=semicolon;separated;list;of;values + \endcode + + The static method \c ParsePatternNames looks for this line and returns a + QStringList containing the values, which are the pattern names we can use. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 4 + + The helper function \c checkError() saves us some code duplication. None of the + called methods return anything of use to us, so we're only interested in + getting error messages for debugging. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 5 + + + \section1 ButtonWidget Class Definition + + \snippet examples/widgets/maemovibration/buttonwidget.h 0 + + The \c ButtonWidget class inherits from QWidget and provides the main user + interface for the application. It creates a grid of buttons, one for each + string in the stringlist passed to the constructor. Pressing a button emits + the \c clicked() signal, where the string is the text of the button that + was pressed. + + This class is taken from the QSignalMapper documentation. The only change + is the number of columns in the grid from three to two, to make the button + labels fit. + + + \section1 ButtonWidget Class Implementation + + \snippet examples/widgets/maemovibration/buttonwidget.cpp 0 + + + \section1 \c main() Function + + The main function begins with looking up the patterns available to us. + + \snippet examples/widgets/maemovibration/main.cpp 0 + + Then we create one instance of both classes, and connects the + \c ButtonWidget's clicked signal to the \c MceVibrator's \c vibrate() slot. + This works, since the button texts are the same as the pattern names. + + \snippet examples/widgets/maemovibration/main.cpp 1 +*/ diff --git a/doc/src/examples/orientation.qdoc b/doc/src/examples/orientation.qdoc new file mode 100644 index 0000000..cfe1757 --- /dev/null +++ b/doc/src/examples/orientation.qdoc @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/orientation + \group all-examples + \title Orientation Example + + The example shows a simple way to use different UIs depending on the screen + orientation of a mobile device. + + \image orientation-landscape.png The UI in landscape mode + \image orientation-portrait.png The UI in portrait mode + + The screen on many mobile devices can be viewed in both portrait and + landscape orientation. The orientation can be swiched with the help of a + hardware or software trigger. Due to the often small physical screen size, + user interfaces has to be very simple and compact to stay usable, and + applications usually occupy the whole screen. Designing a user interface + that works equally well in both landscape and portrait mode is not always + possible, however, so making a different layout for each case usually pays + off. + + The example application makes use of two different UI widgets created with + the Qt Designer, one for portrait and one for landscape orientation. The + application has a widget that contains an image and the user is able to + select one of three images for it to show. In addition to the two UIs, the + application consists of a \c MainWindow class. + + \section1 Landscape UI + + If the screen is in landscape mode, the user probably holds the device with + both hands and is ready to give full attention to the application. The + landscape UI looks like this: + + \image orientation-landscape-ui.png The landscape UI + + To the left is a QWidget called \c choiceWidget, which will show the + current image, and to the right are three QRadioButton instances. The + active radio button specifies the image to show. + + \section1 Portrait UI + + When the device is in portrait mode, it usually means that the user holds + it with one hand, and can comfortably use the thumb for small amounts of + input. The layout is simpler, and is focused on consuming content. The + portrait UI looks like this: + + \image orientation-portrait-ui.png The portrait UI + + Similarly, it contains a QWidget, also called \c choiceWidget, that will + show the current image. In contrast to the landscape UI, this one doesn't + provide any controls to change the image. + + \section1 MainWindow Class Definition + + \c MainWindow inherits from QWidget and acts as the top level widget of the + application. + + \snippet examples/widgets/orientation/mainwindow.h 0 + + The \c resizeEvent() method is re-implemented, and used to check which + UI to show. The \c onRadioButtonClicked() slot is connected to the + landscape UI's radio button group and selects the current image. + + \c landscapeWidget and \c portraitWidget will contain the UI layouts. Only + one of them is visible at a time. + + \section1 MainWindow Class Implementation + + In the constructor, the widgets that will hold the UIs are created and set + up. + + \snippet examples/widgets/orientation/mainwindow.cpp 0 + + Since the exit buttons on the layouts are different from each other, both + of them have to have their \c clicked() signal connected to the \c close() + slot of the main widget. The first image is also made current with the call + to \c onRadioButtonClicked(). + + \snippet examples/widgets/orientation/mainwindow.cpp 1 + + On the Maemo platform, windows are stuck in landscape mode by default. The + application has to explicitly say that rotation is supported. + + \snippet examples/widgets/orientation/mainwindow.cpp 2 + + The \c resizeEvent() is called when the main window is first created, and + also whenever the window has been resized. If the window is shown in + full screen, this is an indication that the orientation of the screen has + changed. + + The dimensions of \c landscapeWidget is the transpose of the dimensions of + \c portraitWidget. When the orientation is known, both are set to the + (possibly transposed) size of the window. Depending on the orientation, one + widget is made visible and the other invisible. + + \snippet examples/widgets/orientation/mainwindow.cpp 3 + + When the user selects one of the radio buttons in the landscape UI, the + current image is changed. The image is displayed by specifying the + background style of the choice widget. Since both \c portrait and + \c landscape have a \c choiceWidget of their own, the change has to be + reflected in both instances. + + \snippet examples/widgets/orientation/mainwindow.cpp 4 + + Synchronizing both UIs like this might become unfeasible when there are + many things that can change. In that case it is better to make use of the + \l{Introduction to Model/View Programming}{Model-View-Controller pattern} + more extensively and share the content between both portrait and landscape + widgets. Then an interface for displaying and manipulating it can be tailor + made for both orientations. + + \section1 The \c main() Function + + The main function creates a \c MainWindow instance and shows it full + screen. + \snippet examples/widgets/orientation/main.cpp 0 +*/ diff --git a/doc/src/examples/portedasteroids.qdoc b/doc/src/examples/portedasteroids.qdoc index 0458125..06428bf 100644 --- a/doc/src/examples/portedasteroids.qdoc +++ b/doc/src/examples/portedasteroids.qdoc @@ -29,8 +29,9 @@ \example graphicsview/portedasteroids \title Ported Asteroids Example - This GraphicsView example is a port of the - Asteroids game, which was based on QCanvas. + The Ported Asteroids example is a port of the + Asteroids game, which was based on QCanvas, to the Graphics View + framework. \image portedasteroids-example.png */ diff --git a/doc/src/examples/portedcanvas.qdoc b/doc/src/examples/portedcanvas.qdoc index 43b3a38..49824de 100644 --- a/doc/src/examples/portedcanvas.qdoc +++ b/doc/src/examples/portedcanvas.qdoc @@ -29,8 +29,8 @@ \example graphicsview/portedcanvas \title Ported Canvas Example - This GraphicsView example is a port of the old - QCanvas example from Qt 3. + The Ported Canvas example is a port of the old + QCanvas example from Qt 3 to the Graphics View framework. \sa {Porting to Graphics View} diff --git a/doc/src/examples/recipes.qdoc b/doc/src/examples/recipes.qdoc index f2665eb..d4128aa 100644 --- a/doc/src/examples/recipes.qdoc +++ b/doc/src/examples/recipes.qdoc @@ -29,7 +29,7 @@ \example xmlpatterns/recipes \title Recipes Example - The recipes example shows how to use QtXmlPatterns to query XML data + The Recipes example shows how to use QtXmlPatterns to query XML data loaded from a file. \tableofcontents diff --git a/doc/src/examples/rsslisting.qdoc b/doc/src/examples/rsslisting.qdoc index 8893325..9554842 100644 --- a/doc/src/examples/rsslisting.qdoc +++ b/doc/src/examples/rsslisting.qdoc @@ -29,7 +29,7 @@ \example xml/rsslisting \title RSS-Listing Example - This example shows how to create a widget that displays news items + The RSS-Listing example shows how to create a widget that displays news items from RDF news sources. \image rsslistingexample.png diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc index 99966a6..77ccaf5 100644 --- a/doc/src/examples/schema.qdoc +++ b/doc/src/examples/schema.qdoc @@ -29,8 +29,8 @@ \example xmlpatterns/schema \title XML Schema Validation Example - This example shows how to use QtXmlPatterns to validate XML with - a W3C XML Schema. + The XML Schema Validation example shows how to use QtXmlPatterns to + validate XML with a W3C XML Schema. \tableofcontents diff --git a/doc/src/examples/simplewebplugin.qdoc b/doc/src/examples/simplewebplugin.qdoc new file mode 100644 index 0000000..9093b9b --- /dev/null +++ b/doc/src/examples/simplewebplugin.qdoc @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** 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: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$ +** +****************************************************************************/ + +/*! + \example webkit/simplewebplugin + \title Simple Web Plugin Example + + The Simple Web Plugin example shows how to embed a regular Qt widget into a + Web page displayed using QWebView. + + \image webkit-simplewebplugin.png A table widget embedded in a Web page. + + In this example, we will show how to include Qt widgets in Web-centric user + interfaces. + + \section1 QtWebKit Basics + + QtWebKit provides integration between Qt and WebKit on two different levels. + On a low level, Qt provides widgets for Web pages to be rendered onto; on a + high level, a set of classes are provided that represent all the key + components of a Web browser. + + QWebView is a widget that is used to display Web pages, QWebPage represents + the content in a page, and QWebFrame represents an individual frame in a + Web page. The code to display a Web page is very simple: + + \snippet webkitsnippets/simple/main.cpp Using QWebView + + The widget provides fundamental Web browsing features, such as Cascading + Style Sheet and JavaScript support. Other technologies can be added to + provide a more comprehensive experience. + + \section1 Adding a Widget to a Page + + Since Qt is used to render pages, it is easy to add both standard and + custom widgets to pages. All we need is some markup to indicate where a + widget is expected in a page and a mechanism that lets us know when it + needs to be created. + + The markup used involves the \c <object> element, described in the HTML 4 + specification, which is used to include generic objects in Web pages. When + describing an object to represent a widget, there are typically three + attributes this element can have: a \c data attribute that indicates where + any relevant data can be obtained; \c width and \c height attributes can + be used to set the size of the widget on the page. + + Here's how we might describe such an object: + + \snippet examples/webkit/simplewebplugin/pages/index.html embedded object + + The mechanism used by QtWebKit to insert widgets into pages is a plugin + factory that is registered with a given WebPage instance. Factories are + subclasses of QWebPluginFactory and can be equipped to supply more than one + type of widget. + + \section1 Creating a Widget to Embed + + To demonstrate how the factory is used, we create a simple widget that can + be used to display Comma-Separated Values (CSV) files. The widget class, + \c CSVView, is just a subclass of QTableView with extra functions to set + up an internal data model. Instances of the factory class, \c CSVFactory, + are responsible for creating \c CSVView widgets and requesting data on + their behalf. + + The \c CSVFactory class is defined in the following way: + + \snippet examples/webkit/simplewebplugin/csvfactory.h plugin factory + + The public functions give a good overview of how QtWebKit will use the + factory to create widgets. We begin by looking at the factory's constructor: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp constructor + + The factory contains a network access manager which we will use to obtain + data for each of the plugin widgets created. + + The \c plugins() function is used to report information + about the kinds of widget plugins it can create; our implementation reports + the MIME type it expects and provides a description of the plugin: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp plugins + + The \c create() function is where most of the action happens. It is + called with a MIME type that describes the kind of data to be displayed, + a URL that refers to the data, and information about any additional + arguments that were specified in the Web page. We begin by checking the + basic MIME type information passed in the \c mimeType parameter, and only + continue if we recognize it. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp begin create + + We construct a view widget + using the fully-specified MIME type, which is guaranteed to be in the list of + arguments if a MIME type has been supplied. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp submit request + + Lastly, we use the network access manager to request the data specified by + the \c url parameter, connecting its \c finished() signal to the view's + \c updateModel() slot so that it can collect the data. The reply object is + intentionally created on the heap; the \c finished() signal is connected to + its \c deleteLater() slot, ensuring that Qt will dispose of it when it is no + longer needed. + + The \c CSVView class provides only minor extensions to the functionality of + QTableView, with a public slot to handle incoming data and a private + variable to record exact MIME type information: + + \snippet examples/webkit/simplewebplugin/csvview.h definition + + The constructor is simply used to record the MIME type of the data: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + To save space, we will only look at parts of the \c updateModel() function, + which begins by obtaining the QNetworkReply object that caused the slot + to be invoked before checking for errors: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model begin + + Assuming that the data is correct, we need to determine whether the + CSV file includes a table header, and to find out which character encoding was + used to store the data. Both these pieces of information may be included in + the complete MIME type information, so we parse this before continuing---this + is shown in the online example code. + + \snippet examples/webkit/simplewebplugin/csvview.cpp read data begin + + Since QNetworkReply is a QIODevice subclass, the reply can be read + using a suitably configured text stream, and the data fed into a standard + model. The mechanics of this can be found in the + \l{webkit/simplewebplugin/csvview.cpp}{code listing}. Here, we skip to the + end of the function where we close the reply object and set the model on + the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model + + Once the reply has been read, and the model populated with data, very little + needs to be done by the plugin. Ownership of the view widget is handled + elsewhere, and we have ensured that the model will be destroyed when it is + no longer needed by making it a child object of the view. + + Let's look quickly at the \c MainWindow implementation: + + \snippet examples/webkit/simplewebplugin/mainwindow.cpp constructor + + Apart from creating and setting a factory on the QWebPage object, the + most important task is to enable Web plugins. If this global setting is not + enabled, plugins will not be used and our \c <object> elements will simply + be ignored. + + \section1 Further Reading + + The \l{Web Plugin Example} extends this example by adding a signal-slot + connection between the embedded widget and a JavaScript function in the + page. +*/ diff --git a/doc/src/examples/symbianvibration.qdoc b/doc/src/examples/symbianvibration.qdoc new file mode 100644 index 0000000..a0de236 --- /dev/null +++ b/doc/src/examples/symbianvibration.qdoc @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/symbianvibration + \group all-examples + \title Symbian Vibration Example + + The Symbian Vibrator example shows how to get fine-grained vibration + control on Symbian devices. + + Native Symbian APIs have to be used to enable vibration, since QtMobility + doesn't provide an interface for it yet. It is, however, planned to be + included in a future release. In anticipation for that, we make use of the + \c XQVibra class that was a part of the Mobile Extensions Technology Preview + API for Qt for Symbian. The pre-compiled libraries are no longer compatible + with Qt 4.6, but we can include the source code itself with the project. + + \image symbianvibration-example.png Screenshot of the Symbian Vibration example + + The example application divides the window into rectangles, which can be + pressed to make the device vibrate. Pressing different rectangles make the + device vibrate with different intensities. Each rectangle has a different + color and its intensity number is drawn on top of it. Moving the cursor + from one rectangle to another changes the vibration intensity to that of + the new one. Vibration stops when the mouse button has been released. It + is also possible to launch a short burst of vibration through the menu. + + The example consists of four classes: + + \list + \o \c XQVibra is the vibration interface class taken from the Mobile + Extensions for Qt for Symbian. + + \o \c XQVibraPrivate is the Symbian specific private implementation of the + vibration implementation. + + \o \c VibrationSurface is a custom widget that uses a XQVibra instance to + vibrate the device depending on where the user presses. + + \o \c MainWindow inherits from QMainWindow and contains a \c VibrationSurface + as its central widget, and also has a menu from which it is possible to + make the phone vibrate. + \endlist + + \section1 XQVibra Class Definition + + The \c XQVibra class uses the pimpl-idiom to hide the platform specific + implementation behind a common interface. Technically it would be possible + to support more target platforms, with only the addition of a private + implementation. The rest of the code would work the same, since only the + common interface is used. + + \snippet examples/widgets/symbianvibration/xqvibra.h 0 + + \c XQVibra provides a very simple interface for us to use. The interesting + part are the three slots \c start(), \c stop() and \c setIntensity(). Calling the start + method initiates vibration for the specified duration. Calling it while the + device is already vibrating causes it to stop the current one and start the + new one, even if the intensities are the same. The \c setIntensity() method + should be called before starting vibration. + + + \section1 VibrationSurface Class Definition + + \c VibrationSurface inherits from QWidget and acts like a controller for a + \c XQVibra object. It responds to mouse events and performs custom painting. + + \snippet examples/widgets/symbianvibration/vibrationsurface.h 0 + + The virtual event methods are reimplemented from QWidget. As can be seen, + there is no public programmable interface beyond what QWidget provides. + + + \section1 VibrationSurface Class Implementation + + Mouse events control the intensity of the vibration. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 0 + \codeline + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 1 + \codeline + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 2 + + Presses starts the vibration, movement changes the intensity and releases + stops the vibration. To set the right amount of vibration, the private + method \c applyIntensity() is used. It sets the vibration intensity according to + which rectangle the mouse currently resides in. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 3 + + We make sure only to change the intensity if it is different than last + time, so that the vibrator isn't stopped and restarted unnecessarily. + + The range of vibration intensity ranges from 0 to XQVibra::MaxIntensity. We + divide this range into a set of levels. The number of levels and the intensity + increase for each level are stored in two constants. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 4 + + Each rectangle has an intensity of one \c IntensityPerLevel more than the + previous one. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 5 + + The rectangles are either put in a row, if the widget's width is greater + than its height (landscape), otherwise they are put in a column (portrait). + Each rectangle's size is thus dependent on the length of the width or the + height of the widget, whichever is longer. The length is then divided by + the number of levels, which gets us either the height or the width of each + rectangle. The dx and dy specify the distance from one rectangle to the + next, which is the same as either the width or height of the rectangle. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 6 + + For each level of intensity, we draw a rectangle with increasing + brightness. On top of the rectangle a text label is drawn, specifying the + intesity of this level. We use the rectangle rect as a template for + drawing, and move it down or right at each iteration. + + The intensity is calculated by dividing the greater of the width and height + into \c NumberOfLevels slices. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 7 + + In case the widget's geometry is too small to fit all the levels, the user + interface will not work. For simplicity, we just return 0. + + When we know the axis along which the rectangles lie, we can find the one + in which the mouse cursor lie. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 8 + + The final clamp of the intensity value at the end is necessary in case the + mouse coordinate lies outside the widget's geometry. + + + \section1 MainWindow Class Definition + + Here's the definition of the \c MainWindow class: + + \snippet examples/widgets/symbianvibration/mainwindow.h 0 + + \c MainWindow is a top level window that uses a \c XQVibra and a + \c VibrationSurface. It also adds a menu option to the menu bar which can + start a short vibration. + + \section1 MainWindow Class Implementation + + In the \c MainWindow constructor the \c XQVibra and the \c VibrationSurface + are created. An action is added to the menu and is connected to the vibrate + slot. + + \snippet examples/widgets/symbianvibration/mainwindow.cpp 0 + + The \c vibrate() slot offers a way to invoke the vibration in case no + mouse is present on the device. + + \snippet examples/widgets/symbianvibration/mainwindow.cpp 1 + + \section1 Symbian Vibration Library + + The \c XQVibra class requires a platform library to be included. It is + included in the \c .pro file for the symbian target. + + \quotefromfile examples/widgets/symbianvibration/symbianvibration.pro + \skipto /^symbian \{/ + \printuntil /^\}/ +*/ diff --git a/doc/src/examples/syntaxhighlighter.qdoc b/doc/src/examples/syntaxhighlighter.qdoc index 703bd62..919d61c 100644 --- a/doc/src/examples/syntaxhighlighter.qdoc +++ b/doc/src/examples/syntaxhighlighter.qdoc @@ -239,4 +239,14 @@ function. The QSyntaxHighlighter class also provides the \l {QSyntaxHighlighter::document()}{document()} function which returns the currently set document. + + \section1 Other Code Editor Features + + It is possible to implement parenthesis matching with + QSyntaxHighlighter. The "Matching Parentheses with + QSyntaxHighlighter" article in Qt Quarterly 31 + (\l{http://doc.qt.nokia.com/qq/}) implements this. We also have + the \l{Code Editor Example}, which shows how to implement line + numbers and how to highlight the current line. + */ diff --git a/doc/src/examples/webftpclient.qdoc b/doc/src/examples/webftpclient.qdoc new file mode 100644 index 0000000..469b645 --- /dev/null +++ b/doc/src/examples/webftpclient.qdoc @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** 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: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$ +** +****************************************************************************/ + +/*! + \example webkit/webftpclient + \title Web FTP Client Example + + The Web FTP Client example shows how to add support for a new protocol + to QtWebKit-based applications. + + \image webkit-webftpclient.png An FTP client displaying the contents of the ftp.qt.nokia.com site. + + \section1 Introduction + + The QtWebKit module presents many ways to integrate the worlds of native + desktop and mobile applications and the Web, making it possible for + developers to extend and combine features found in Qt and WebKit to create + new ones. In this article, we examine the use of Qt's network access API + with WebKit and show how to turn QWebView into a simple FTP client. + + In the \l{Web Plugin Example}, we extended Qt's WebKit integration by + showing how to add custom widgets to Web pages. In the article, we used + QNetworkRequest to ask for content for display in a widget, and we obtained + the data returned by the server by reading from the corresponding + QNetworkReply. + + Qt's network access API is a technology that aims to replace much, but not + all, of the functionality provided by the QHttp and QFtp classes. + Although the network access API is a Qt-specific technology, the QtWebKit + module integrates this Qt technology with WebKit to enable customization of + the browser engine by Qt application developers. It also means that we can + control how the browser engine obtains and renders content. + + Since QNetworkRequest and QNetworkReply are designed to provide a reusable + abstraction for network operations, it seems obvious to use these classes + to add FTP support to browsers written using QtWebKit. To do this, we first + need to examine the network access classes before we see how the QtWebKit + module uses them to manage network operations. + + \section1 Network Access + + The central class in Qt's network access API is QNetworkAccessManager. + This class performs the work of dispatching requests to remote servers and + handling incoming replies. Applications typically construct an instance of + this class and use it for all high level network communication. + + Applications create QNetworkRequest objects, each of them specifying a URL + where the request is to be sent and containing meta-data that will be + understood by the server. Each request is dispatched by passing it to a + function in the network manager \mdash there are different functions + corresponding to different kinds of operations, such as + \l{QNetworkAccessManager::}{get()}, \l{QNetworkAccessManager::}{put()} and + \l{QNetworkAccessManager::}{post()}. Each of these functions returns a + QNetworkReply object which is used to obtain the content sent in the reply, + as well as any meta-data that describes it. + + The QtWebKit module provides the QWebPage class which represents the + content displayed in a QWebView widget. Behind the scenes, this class uses + a default network access manager to handle network communication. This + default manager works perfectly well for fetching content over HTTP from + \tt{http://} URLs, but only supports fetching of files over FTP when using + \tt{ftp://} URLs. + + Fortunately, QWebPage provides the \l{QWebPage::}{setNetworkAccessManager()} + function that allows the default manager to be replaced with one with more + features. This lets us add improved support for FTP quite easily if we can + write a new manager that supports \tt{ftp://} URLs. + + The process of replacing the manager and using a new one with an existing + QWebPage object can be broken up into three steps: + + \list 1 + \o Creating a new QNetworkAccessManager subclass. + \o Creating a new QNetworkReply subclass to deal with the FTP protocol. + \o Setting the new manager on the QWebPage. + \endlist + + Additionally, to provide a reasonable user experience, we should also handle + content that the browser engine cannot display. To do this, we create a + custom \c{Downloader} object. We will briefly return to this topic later. + + \section1 Creating a New Network Manager + + Replacing an existing network manager for a QWebPage is conceptually simple: + we subclass QNetworkAccessManager and reimplement its + \l{QNetworkAccessManager::}{createRequest()} function to check for URLs + with the \tt{ftp} scheme. However, we want to ensure that the manager uses + any existing cache and proxy settings that may have been set up for the + existing manager used by the QWebPage. + + To keep the existing proxy and cache, we give our network manager a + constructor that accepts the old manager as an argument. In the constructor, + we reuse the settings from the old manager. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp constructor + + The \c{createRequest()} function is used to create and dispatch requests to + remote servers for each of the different kinds of operation that the API + presents to the developer. Since we are only interested in performing simple + fetches of resources using the \tt{ftp} scheme, we filter out other schemes + and other kinds of operation, delegating the task of handling these to the + default implementation. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp create request + + Here, we construct and return an instance of the \c FtpReply class. This + class performs most of the work of handling the FTP protocol. + + \section1 Creating a Custom Reply + + The network access API is designed to be simple to use: we set up a request, + dispatch it using the network manager, and obtain a QNetworkReply object. + If we are not interested in the reply's meta-data, we can simply read the + data using its \l{QNetworkReply::}{readAll()} function because QNetworkReply + is a QIODevice subclass. + + In order to keep the API so simple, however, we need to perform some work + behind the scenes. In this case, that means that we must perform a series of + communications with the FTP server. Fortunately, we can use the existing + implementation provided by QFtp to perform the low level work. + + In the \c FtpReply class, we need to reimplement four functions in the + API to ensure that it will work correctly. These functions, + \l{QNetworkReply::}{abort()}, \l{QIODevice::}{bytesAvailable()}, + \l{QIODevice::}{isSequential()}, \l{QIODevice::}{readData()}, + rely on the rest of the implementation to fill a QByteArray with data and + use an integer offset to track how much has been read from the device by + the browser. + + \snippet examples/webkit/webftpclient/ftpreply.h class definition + + The \c{processCommand()}, \c{processListInfo} and \c{processData()} slots + handle interaction with the FTP server. The private \c{setContent()} and + \c{setListContent()} functions are used to add meta-data to the reply and + compose HTML for the browser to display. + + Two of the private variables hold information about the data obtained from + the FTP server: \c items is updated to contain information about each + file found at a given URL, and \c content contains the raw data obtained + from the server. The \c offset variable is used to track how much data has + been read by the browser from the reply. + + In the constructor, we construct a QFtp object and connect the signals and + slots that form the basis of the interaction with the FTP server. The high + level communication is reported by the \l{QFtp::}{commandFinished()} + signal. New data from the server is reported by the + \l{QFtp::}readyRead()} signal. + Individual items in an FTP directory listing are reported by the + \l{QFtp::}{listInfo()} signal. + + \snippet examples/webkit/webftpclient/ftpreply.cpp constructor + + We also initialize the \c offset into the data that represents the number + of bytes that the browser has read from the reply. Additionally, we define + a list of units for use with the \c setListContent() function. + The last two tasks performed in the constructor are to set the URL of the + reply so that the browser can tell where it came from, and to connect to + the FTP server. + + \section2 Fetching Data from the Server + + All communication with the server is handled by the \c processCommand() + slot, which acts on responses from the server and tells us when a command + we have issued has completed. + This slot performs the task of logging in to the server when connection has + occurred (the \l{QFtp::}{ConnectToHost} command has completed), asking for + a list of files when logged in (\l{QFtp::}{Login} has completed), + preparing a page with a listing when all file information has been received + (\l{QFtp::}{List} has completed), and setting the current content for the + reply when data has been fetched from the server + (\l{QFtp::}{Get} has completed). + + \snippet examples/webkit/webftpclient/ftpreply.cpp process command + + The result of the \l{QFtp::}{List} command is handled by looking at the + number of items obtained from the server. + The items themselves are recorded by the \c processListInfo() slot. When a + \l{QFtp::}{List} command is complete, we can count the number of items + received and determine whether or not we should create a file listing, or + try to fetch the file instead by invoking a \l{QFtp::}{Get} command. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process list info + + Since the reply will only be used once, we can simply append items to a list + and never bother to clear it. + + The \c processData() slot simply appends data obtained from the FTP server + to the QByteArray containing the content to be supplied to the browser. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process data + + Data is appended to the \c content array until the connection to the FTP + server is closed, either by the reply or by the server itself. One of the + ways in which this happens is when a \l{QFtp::}{Get} command completes. At + this point, the \c setContent() function is called from within the + \c processCommand() function. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set content + + Here, we prepare the reply for use by the browser by opening it for + unbuffered reading and setting the header that reports the amount of data + held by the reply. We emit signals that indicate that the network operation + has finished and that it has data to be read. Since we are no longer + interested in the FTP server, we close the connection to it. + + \section2 Preparing Content for the Reader + + Another way in which the reply closes the connection to the server is when + the \c setListContent() function is called from the \c processCommand() + function. Most of the implementation of this function involves transforming + the information about the items held in the reply's private \c items + variable to HTML. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set list content + + Once the HTML description of the files has been composed in a QString, we + convert it to a UTF-8 encoded set of bytes which we store in the reply's + private \c content variable. In this case, the QByteArray holds HTML + instead of file data. We set the reply's headers to indicate that it + contains UTF-8 encoded HTML with a certain length, and we emit the + \l{QNetworkReply::}{readyRead()} and \l{QNetworkReply::}{finished()} + signals to let the browser know that it can start reading the content. + + \section2 Supplying Data to the Browser + + We reimplement four QIODevice functions to provide basic read-only behavior, + simply supplying the data held in the \c content array. + + We do not support aborting of the reply, so our \c abort() implementation + is empty. + + \snippet examples/webkit/webftpclient/ftpreply.cpp abort + + Similarly, we do not support random access reading, so \c isSequential() + is reimplemented to always return true. + + \snippet examples/webkit/webftpclient/ftpreply.cpp is sequential + + The \c bytesAvailable() function returns the total number of bytes held by + the reply minus the value of \c offset, which is the number of bytes we + have already supplied to the reader. + + \snippet examples/webkit/webftpclient/ftpreply.cpp bytes available + + \snippet examples/webkit/webftpclient/ftpreply.cpp read data + + The \c readData() reimplementation tries to return as much data to the + reader as it will allow, copying bytes directly to the appropriate location + in memory. The \c offset variable is updated to keep track of how many + bytes have been read. + + \section1 Enabling the Protocol + + Now that we have an FTP-enabled network manager and a reply that can handle + communication with FTP servers, we can now enable the manager for a given + QWebPage. + We derive the \c FtpView class from QWebView and configure its behavior in + its constructor. + + As we mentioned earlier, we pass the original network manager to the + newly-created manager and pass the new manager to the QWebPage belonging to + the browser. This enables our network manager for the content it displays. + + \snippet examples/webkit/webftpclient/ftpview.cpp constructor + + We also go to some effort to handle content that WebKit does not natively + support, using a \c Downloader helper class to manage this and files that + the user downloads via the browser's \gui{Save Link...} context menu entry. + + In the example's \c main() function, we perform the usual steps to + initialize our Qt application. We choose an appropriate starting URL for + the \c FtpView widget to open before running the application's event loop. + + \snippet examples/webkit/webftpclient/main.cpp main + + \section1 Summary + + As we have seen, enabling support for another protocol and URL scheme in + QtWebKit is a fairly simple process involving the creation of a network + manager and custom reply object. The implementation challenges + are mostly related to how the protocol is handled by the custom + QNetworkReply subclass where, in our case, we need to issue the appropriate + commands in the correct order to obtain data from the FTP server. + + We also need to ensure that that the reply emits the appropriate signals to + inform the browser that it has content to be read. Our implementation is + intentionally simple, only notifying the browser with the + \l{QIODevice::}{readyRead()} signal when \e all the content is ready to + read and emitting the \l{QNetworkReply::}{finished()} signal to indicate + that communication is complete; a more sophisticated approach would + interleave the commands sent to the server with the emission of signals, + allowing the browser to read content as data is obtained from the FTP + server. + + The reply also needs to be open for reading. Forgetting to call the + \l{QIODevice::}{open()} function is a common error to make when dealing + with devices, but in this case it is the reply's responsibility to open + itself. + It must indicate how much content it has for the browser to read. As we + have seen, this is done by setting the reply's + \l{QNetworkRequest::}{ContentLengthHeader} header with the appropriate + value. With this information available, the browser can read from the reply + when the content becomes available, displaying a directory listing or + downloading content depending on the type of data supplied. + + We can use the approach described in this article to enable support for + other protocols by writing or extending a network manager to handle URL + schemes such as \tt mailto, \tt sip, \tt news, \tt file and \tt ldap. + Applications that integrate Web content with information from other sources + can also provide custom URL schemes as long as care is taken not to use an + existing public scheme. +*/ diff --git a/doc/src/examples/webplugin.qdoc b/doc/src/examples/webplugin.qdoc new file mode 100644 index 0000000..0410670 --- /dev/null +++ b/doc/src/examples/webplugin.qdoc @@ -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: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$ +** +****************************************************************************/ + +/*! + \example webkit/webplugin + \title Web Plugin Example + + The Web Plugin example shows how to communicate between a Qt widget + embedded in a Web page and the page itself. + + \image webkit-webplugin.png A table widget embedded in a Web page. + + In this example, we will take the widget described in the + \l{Simple Web Plugin Example} and show how to set up communications between + the widget and the Web environment. + + \section1 Setting up Communications + + There are two ways of interacting with the content in a Web page. The first + way involves the use of QWebElement to read and modify the page + content and structure; this is useful for certain types of application, as + demonstrated by the \l{DOM Traversal Example} and the + \l{Simple Selector Example}. + + The second way is to add Qt objects to the page, connecting their signals + to JavaScript functions, and executing the object's slots directly from + JavaScript in the page. We explore this approach in this example. + + To perform this communication, we require an updated \c CSVView widget from + the \l{Simple Web Plugin Example} that can emit a signal whenever a row is + selected, a JavaScript function to modify elements on the page, and some + glue code to make the connection. + + On the page, the plugin is declared like this: + + \snippet examples/webkit/webplugin/pages/index.html embedded object + + As in the previous example, the \c <object> definition includes information + about the data to be displayed, its location, and the dimensions of the + plugin in the page. + + Later in the document, we include a table that we will update with data + from the \c CSVView widget: + + \snippet examples/webkit/webplugin/pages/index.html table + + The \c CSVView widget is similar to the previous version. However, we + wish to obtain and export individual rows of data, so we define the + \c rowSelected() signal and \c exportRow() slot to perform this task. + + \snippet examples/webkit/webplugin/csvview.h definition + + Since we wish to obtain one row of data at a time, the constructor includes + code to restrict how the user can interact with the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + The \c exportRow() slot provides a convenient mechanism for obtaining and + emitting the values found on the current row of the table: + + \snippet examples/webkit/webplugin/csvview.cpp export row + + This slot is connected to a signal belonging to the view's selection model: + \l{QItemSelectionModel::}{currentChanged()}. This can be seen by examining + the \c updateModel() function in the source code. + + \c exportRow() emits the \c rowSelected() signal, passing strings containing + the name, address and quantity in the current table row. To see how this + data is passed to the Web page, we need to look at the \c CSVFactory class. + + \section1 Connecting Components Together + + In the \c CSVFactory class, we reimplement the \l{QWebPluginFactory::}{create()} + function to create instances of the \c CSVView class, as in the previous + example. + + \snippet examples/webkit/webplugin/csvfactory.cpp begin create + + We also expose the view widget to the frame in the page that + contains the elements, and set up a connection between the view and a + JavaScript function defined in the page header: + + \snippet examples/webkit/webplugin/csvfactory.cpp create connection + + The view is added to the Web page as \c view, and the connection code we + evaluate performs a signal-slot connection from the view's \c rowSelected() + signal to a pure JavaScript function: + + \js + view.rowSelected.connect(fillInTable); + \endjs + + \c fillInTable is the name of the JavaScript function to modify the + form's input elements. This function expects three arguments: the name, + address and quantity values for a row of data. + + Whenever the current row changes in the \c view object, the \c exportRow() + slot is called, the data found in the selected row is extracted from the + model and emitted in the \c rowSelected() signal as three strings, and + the above connection ensures that \c fillInTable() will be called with the + current items of data. The appropriate type conversions occur behind the + scenes to ensure that each QString is converted to a JavaScript string + object. + + The rest of the function is the same as in the previous example: + + \snippet examples/webkit/webplugin/csvfactory.cpp submit request + + We now give the JavaScript \c fillInForm() function to show what it does + with the strings it is given. The function itself is defined in the HTML + page header: + + \snippet examples/webkit/webplugin/pages/index.html script + + We obtain the elements in the page that we wish to update by using the HTML + Document Object Model (DOM) API. The values of these elements are updated + with the \c name, \c address and \c quantity strings supplied. + + \section1 Linking Things Together + + Although we have used the widgets to demonstrate the use of signals and + slots for communication between Qt components and JavaScript in the browser, + we do not need to embed widgets in Web pages to be able to do this. By + inserting objects into pages and evaluating JavaScript, Qt applications can + be made to examine and process information found online. + + One additional improvement that can be made to this example is to create + a relation between the embedded widget and the table to be updated. We + could do this by including \c <param> elements within the \c <object> + element that refers to the table cells by their \c id attributes. This + would help us to avoid hard-coding the \c customers_name, + \c customers_address and \c customers_quantity identifiers in the script. +*/ diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 5522082..3187c58 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -483,3 +483,8 @@ \externalpage http://www.symbiansigned.com \title Symbian Signed */ + +/*! + \externalpage http://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/_accessible_event_i_d_8idl.html + \title AccessibleEventID.idl File Reference +*/ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index df53d02..d597890 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -786,6 +786,13 @@ \row \o \l{webkit/simpleselector}{Simple Selector}\raisedaster \o A basic demonstration, showing how to use QWebElement to select elements in a Web page. + \row \o \l{webkit/simplewebplugin}{Simple Web Plugin}\raisedaster + \o Shows how to embed a widget into a Web page displayed using a QWebView + widget. + \row \o \l{webkit/webftpclient}{Web FTP Client}\raisedaster + \o Shows how to add support for a new protocol to QtWebKit-based applications. + \row \o \l{webkit/webplugin}{Web Plugin}\raisedaster + \o Shows how to communicate with a widget embedded into a Web page. \endtable Examples marked with an asterisk (*) are fully documented. diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc index fc9d799..eda5ee1 100644 --- a/doc/src/getting-started/gettingstartedqt.qdoc +++ b/doc/src/getting-started/gettingstartedqt.qdoc @@ -374,7 +374,7 @@ \code 25 Notepad::Notepad() 26 { -27 saveAction = new QAction(tr("&Open"), this); +27 openAction = new QAction(tr("&Open"), this); 28 saveAction = new QAction(tr("&Save"), this); 29 exitAction = new QAction(tr("E&xit"), this); 30 diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index ef010b4..36d63f5 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -47,7 +47,7 @@ for your platform from the following list. \tableofcontents - Qt for X11 has some requirements that are given in more detail + Qt for X11 has some requirements that are given in more detail in the \l{Qt for X11 Requirements} document. \section1 Step 1: Installing the License File (commercial editions only) @@ -79,6 +79,8 @@ for your platform from the following list. \snippet doc/src/snippets/code/doc_src_installation.qdoc 1 Type \c{./configure -help} to get a list of all available options. + The \l{Configuration Options for Qt} page gives a brief overview + of these. To create the library and compile all the demos, examples, tools, and tutorials, type: @@ -90,7 +92,7 @@ for your platform from the following list. place. To do this (as root if necessary), type: \snippet doc/src/snippets/code/doc_src_installation.qdoc 3 - + Note that on some systems the make utility is named differently, e.g. gmake. The configure script tells you which make utility to use. @@ -218,7 +220,8 @@ for your platform from the following list. \snippet doc/src/snippets/code/doc_src_installation.qdoc 8 - Type \c{configure -help} to get a list of all available options. + Type \c{configure -help} to get a list of all available options. The + \l{Configuration Options for Qt} page gives a brief overview of these. If you have multiple compilers installed, and want to build the Qt library using a specific compiler, you must specify a \c qmake specification. @@ -286,7 +289,7 @@ script to uninstall the binary package. The script is located in /Developer/Tool must be run as root. \note Do not run the iPhone simulator while installing Qt. The -\l{http://openradar.appspot.com/7214991} +\l{http://openradar.appspot.com/7214991} {iPhone simulator conflicts with the package installer}. \section1 Step 1: Install the License File (commercial editions only) @@ -433,7 +436,9 @@ in the \l{Qt for Windows CE Requirements} document. If you want to configure Qt for another platform or with other options, type \c{configure -help} to get a list of all available - options. See the \c README file for the list of supported platforms. + options. The \l{Configuration Options for Qt} page gives a brief + overview of these. See the \c README file for the list of supported + platforms. \section1 Step 4: Build Qt Library @@ -562,17 +567,17 @@ Qt for the Symbian platform has some requirements that are given in more detail in the \l{Qt for the Symbian platform Requirements} document. This document describes how to install and configure Qt for -the Symbian platform from scratch. If you are using pre-built binaries, follow -the instructions given in the \l{Installing Qt for the Symbian platform from a +the Symbian platform from scratch. If you are using pre-built binaries, follow +the instructions given in the \l{Installing Qt for the Symbian platform from a Binary Package} document. \section1 Step 1: Set Up the Development Environment - Make sure your Symbian development environment is correctly installed + Make sure your Symbian development environment is correctly installed and patched as explained in the \l{Qt for the Symbian platform Requirements} document. - After you have finished the Symbian development environment setup, it is + After you have finished the Symbian development environment setup, it is good to verify that environment is functional for example by compiling one of the pure Symbian examples for both emulator and HW. This can be done from command prompt as follows: @@ -584,7 +589,7 @@ Binary Package} document. \section1 Step 2: Install Qt - Uncompress the \l{http://qt.nokia.com/downloads}{downloaded} source + Uncompress the \l{http://qt.nokia.com/downloads}{downloaded} source package into the directory you want Qt installed, e.g. \c{C:\Qt\%VERSION%}. \note Qt must be installed on the same drive as the Symbian SDK you are @@ -606,8 +611,8 @@ Binary Package} document. emulator. This is done by locating the Carbide.c++ submenu on the Start menu, and choosing "Configure environment for WINSCW command line". - If you are planning to use \c abld (the default build system that comes with - the S60 SDK) to build Qt, you will also need to set the following + If you are planning to use \c abld (the default build system that comes with + the S60 SDK) to build Qt, you will also need to set the following environment variable: \snippet doc/src/snippets/code/doc_src_installation.qdoc 33 @@ -620,13 +625,17 @@ Binary Package} document. \snippet doc/src/snippets/code/doc_src_installation.qdoc 23 (to build the tools using MinGW, and the libraries using abld) - + \bold or \snippet doc/src/snippets/code/doc_src_installation.qdoc 31 (to build the tools using MinGW, and the libraries using SBSv2) - SBSv2 (also known as \l{http://developer.symbian.org/wiki/index.php/Introduction_to_RAPTOR} {Raptor}) + Type \c{./configure -help} to get a list of all available options. + The \l{Configuration Options for Qt} page gives a brief overview + of these. + + SBSv2 (also known as \l{http://developer.symbian.org/wiki/index.php/Introduction_to_RAPTOR} {Raptor}) is a next-generation Symbian build system. SBSv2 is not officially supported by any of the S60 SDKs currently available from Forum Nokia. @@ -701,7 +710,7 @@ applications using Qt for Symbian can start right away. Qt for the Symbian platform has some requirements on the development platform. The Symbian SDK for Linux as well as a cross compiler for the ARM -processor used on Symbian devices should be present on the development +processor used on Symbian devices should be present on the development machine. See \l{http://qt.gitorious.org/qt/pages/QtCreatorSymbianLinux} for more details. @@ -718,7 +727,7 @@ directory you want Qt installed, e.g. \c{/home/user/qt/%VERSION%}. In order to build and use Qt, the \c PATH environment variable needs to be extended to fine Qt tools and also to find the Symbian platform tools: -First you need to set the \c EPOCROOT environment variable to point to the +First you need to set the \c EPOCROOT environment variable to point to the location of your S60 SDK: \snippet doc/src/snippets/code/doc_src_installation.qdoc 36 @@ -740,6 +749,9 @@ to build the libraries using RVCT or to build the libraries using GCCE. +Type \c{./configure -help} to get a list of all available options. +The \l{Configuration Options for Qt} page gives a brief overview +of these. \section1 Step 5: Build Qt @@ -1014,13 +1026,13 @@ We hope you will enjoy using Qt. Qt from its source code, you will also need to install the development packages for these libraries for your system. - \table 100% + \table 100% \header \o Name \o Library \o Notes \o Configuration options - \o Minimum working version + \o Minimum working version \row {id="OptionalColor"} \o XRender \o libXrender @@ -1028,13 +1040,13 @@ We hope you will enjoy using Qt. \o \tt{-xrender} or auto-detected \o 0.9.0 \row {id="OptionalColor"} - \o Xrandr + \o Xrandr \o libXrandr \o X Resize and Rotate Extension \o \tt{-xrandr} or auto-detected \o 1.0.2 \row {id="OptionalColor"} - \o Xcursor + \o Xcursor \o libXcursor \o X Cursor Extension \o \tt{-xcursor} or auto-detected @@ -1046,7 +1058,7 @@ We hope you will enjoy using Qt. \o \tt{-xfixes} or auto-detected \o 3.0.0 \row {id="OptionalColor"} - \o Xinerama + \o Xinerama \o libXinerama \o Multi-head support \o \tt{-xinerama} or auto-detected @@ -1062,7 +1074,7 @@ We hope you will enjoy using Qt. \o FreeType \o libfreetype \o Font engine - \o + \o \o 2.1.3 \row {id="DefaultColor"} @@ -1115,7 +1127,7 @@ We hope you will enjoy using Qt. \o Multithreading \o \o 2.3.5 - \endtable + \endtable \note You must compile with XRender support to get alpha transparency support for pixmaps and images. @@ -1199,7 +1211,7 @@ We hope you will enjoy using Qt. {Windows Mobile 5 Pocket PC} \o \l{http://www.microsoft.com/downloads/details.aspx?familyid=DC6C00CB-738A-4B97-8910-5CD29AB5F8D9&displaylang=en} {Windows Mobile 5 Smartphone} - \o \l{http://www.microsoft.com/downloads/details.aspx?familyid=06111A3A-A651-4745-88EF-3D48091A390B&displaylang=en } + \o \l{http://www.microsoft.com/downloads/details.aspx?familyid=06111A3A-A651-4745-88EF-3D48091A390B&displaylang=en} {Windows Mobile 6 Professional/Standard} \endlist @@ -1223,7 +1235,7 @@ We hope you will enjoy using Qt. \section3 Requirements \list - \o Development environment: + \o Development environment: \list \o Microsoft Visual Studio 2005 (Standard Edition) or higher \o ActivePerl @@ -1368,287 +1380,297 @@ We hope you will enjoy using Qt. /*! \page configure-options.html - \title Configure options for Qt + \title Configuration Options for Qt \ingroup installation - \brief Brief description of available options building Qt. - - This page gives a brief description of the different options - available when building Qt using configure. To build Qt using - default options, just call configure from the command line like - showed below. If you would like to customize your build, please - use the options listed in the following tables. - - \c {.\configure.exe} - - \section2 Cross platform options: - - \table - \header \o Option \o Description \o Note - \row \o \c {-buildkey } <key> \o Build the Qt library and plugins - using the specified \o - \row \o \c {<key>} \o When the library loads plugins, it will only - load those that have a matching <key>. \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 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 - feature is included. - \row \o \c {-opensource} \o Compile and link the Open-Source Edition - of Qt. \o - \row \o \c {-commercial } \o Compile and link the Commercial Edition - 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 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 Default - value. - \row \o \c {-no-fast} \o Configure Qt normally by generating Makefiles for - 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 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 Default value. - \row \o \c {-no-stl} \o Do not compile STL support. \o - \row \o \c {-stl} \o Compile STL support. \o Default value. - \row \o \c {-no-sql-<driver>} \o Disable SQL <driver> entirely, by default - none are turned on. \o - \row \o \c {-qt-sql-<driver>} \o Enable a SQL <driver> in the Qt Library. - \o - \row \o \c {-plugin-sql-<driver>} \o Enable SQL <driver> as a plugin to be - linked to at run time. \o Available values for <driver>: mysql, psql, - oci, odbc, tds, db2, sqlite, sqlite2, ibase. Drivers marked with a - '+' during configure have been detected as available on this system. - \row \o \c {-system-sqlite} \o Use sqlite from the operating system. \o - \row \o \c {-no-qt3support} \o Disables the Qt 3 support functionality. \o - \row \o \c {-no-opengl} \o Disables OpenGL functionality \o - \row \o \c {-opengl <api>} \o Enable OpenGL support with specified API - version. \o Available values for <api>: 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 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 <spec> } \o The operating system and compiler you - are building on. \o The default value is %QMAKESPEC%. - \row \o \c {-xplatform <spec> } \o The operating system and compiler you - are cross compiling for. \o See the README file for a list of supported - operating systems and compilers. - \row \o \c {-qtnamespace <namespace>} \o Wraps all Qt library code in - 'namespace name {..} \o - \row \o \c {-qtlibinfix <infix>} \o Renames all Qt* libs to Qt*<infix> - \o - \row \o \c {-D <define>} \o Add an explicit define to the preprocessor. - \o - \row \o \c {-I <includepath>} \o Add an explicit include path. \o - \row \o \c {-L <librarypath>} \o Add an explicit library path. \o - \row \o \c {-l <libraryname>} \o Add an explicit library name, residing - in a librarypath. \o - \row \o \c {-graphicssystem <sys>} \o Specify which graphics system should - be used. \o Available values for <sys>: * raster - Software rasterizer, - opengl - Using OpenGL acceleration, experimental!, openvg - Using - OpenVG acceleration, experimental! - \row \o \c {-help, -h, -?} \o Display this information. \o - \endtable - - \section2 Third Party Libraries: - \table - \header \o Option \o Description \o Note - \row \o \c {-qt-zlib} \o Use the zlib bundled with Qt. \o - \row \o \c {-system-zlib} \o Use zlib from the operating system. - \o See http://www.gzip.org/zlib - \row \o \c {-no-gif} \o Do not compile GIF reading support. - \o This option denotes a default value and needs to be evaluated. - If the evaluation succeeds, the feature is included. - \row \o \c {-qt-gif} \o Compile GIF reading support. \o See also - src/gui/image/qgifhandler_p.h - \row \o \c {-no-libpng} \o Do not compile PNG support. \o - \row \o \c {-qt-libpng} \o Use the libpng bundled with Qt. - \o This option denotes a default value and needs to be evaluated. - If the evaluation succeeds, the feature is included. - \row \o \c {-system-libpng} \o Use libpng from the operating system. - \o See http://www.libpng.org/pub/png - \row \o \c {-no-libmng} \o Do not compile MNG support. \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-qt-libmng} \o Use the libmng bundled with Qt. \o - \row \o \c {-system-libmng} \o Use libmng from the operating system. - \o See http://www.libmng.com - \row \o \c {-no-libtiff} \o Do not compile TIFF support. \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-qt-libtiff} \o Use the libtiff bundled with Qt. \o - \row \o \c {-system-libtiff} \o Use libtiff from the operating system. - \o See http://www.libtiff.org - \row \o \c {-no-libjpeg} \o Do not compile JPEG support. \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-qt-libjpeg} \o Use the libjpeg bundled with Qt. \o - \row \o \c {-system-libjpeg} \o Use libjpeg from the operating system. - \o See http://www.ijg.org. This option denotes a default value and - needs to be evaluated. If the evaluation succeeds, the feature is - included. - \endtable - - \section2 Qt for Windows only: - \table - \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 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 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 - to custom build steps. This will distribute MOC and UIC steps, and other - custom buildsteps which are added to the INCREDIBUILD_XGE variable. - \o The IncrediBuild distribution commands are only added to Visual Studio - projects. This option denotes a default value and needs to be evaluated. - 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 Default value. - \row \o \c {-no-qmake} \o Do not compile qmake. \o - \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 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 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 - succeeds, the feature is included. - \row \o \c {-no-3dnow} \o Do not compile with use of 3DNOW instructions \o - \row \o \c {-3dnow} \o Compile with use of 3DNOW instructions \o This - option denotes a default value and needs to be evaluated. If the - evaluation succeeds, the feature is included. - \row \o \c {-no-sse} \o Do not compile with use of SSE instructions \o - \row \o \c {-sse} \o Compile with use of SSE instructions \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-no-sse2} \o Do not compile with use of SSE2 instructions \o - \row \o \c {-sse2} \o Compile with use of SSE2 instructions \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-no-openssl} \o Do not compile in OpenSSL support \o - \row \o \c {-openssl} \o Compile in run-time OpenSSL support \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-openssl-linked} \o Compile in linked OpenSSL support \o - \row \o \c {-no-dbus} \o Do not compile in D-Bus support \o - \row \o \c {-dbus} \o Compile in D-Bus support and load libdbus-1 dynamically. - \o This option denotes a default value and needs to be evaluated. - If the evaluation succeeds, the feature is included. - \row \o \c {-dbus-linked} \o Compile in D-Bus support and link to - libdbus-1 \o - \row \o \c {-no-phonon} \o Do not compile in the Phonon module \o - \row \o \c {-phonon} \o Compile the Phonon module. \o Phonon is built if a - decent C++ compiler is used. This option denotes a default value and needs - to be evaluated. If the evaluation succeeds, the feature is included. - \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 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 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 - QtMultimedia \o This option denotes a default value and needs to be - evaluated. If the evaluation succeeds, the feature is included. - \row \o \c {-no-webkit} \o Do not compile in the WebKit module \o - \row \o \c {-webkit} \o Compile in the WebKit module \o WebKit is built - if a decent C++ compiler is used. This option denotes a default value - and needs to be evaluated. If the evaluation succeeds, the feature is - included. - \row \o \c {-webkit-debug} \o Compile in the WebKit module with debug - symbols. \o - \row \o \c {-no-script} \o Do not build the QtScript module. \o - \row \o \c {-script} \o Build the QtScript module. \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-no-scripttools} \o Do not build the QtScriptTools module. \o - \row \o \c {-scripttools} \o Build the QtScriptTools module. \o This - option denotes a default value and needs to be evaluated. If the - evaluation succeeds, the feature is included. - \row \o \c {-no-declarative} \o Do not build the declarative module \o - \row \o \c {-declarative} \o Build the declarative module \o This option - denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \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 Default value. - \row \o \c {-arch <arch>} \o Specify an architecture. \o Available values for - <arch>: * windows, windowsce, symbian, boundschecker, generic. - \row \o \c {-no-style-<style>} \o Disable <style> entirely. \o - \row \o \c {-qt-style-<style>} \o Enable <style> in the Qt Library. - \o Available styles: * windows, + windowsxp, + windowsvista, - * plastique, * cleanlooks, * motif, * cde, windowsce, windowsmobile, - s60 - \row \o \c {-no-native-gestures} \o Do not use native gestures on Windows 7. - \o - \row \o \c {-native-gestures} \o Use native gestures on Windows 7. - \o Default value. - \row \o \c {-no-mp} \o Do not use multiple processors for compiling with MSVC - \o Default value. - \row \o \c {-mp} \o Use multiple processors for compiling with MSVC (-MP) \o - \row \o \c {-loadconfig <config>} \o Run configure with the parameters from file - configure_<config>.cache. \o - \row \o \c {-saveconfig <config>} \o Run configure and save the parameters in - file configure_<config>.cache. \o - \row \o \c {-redo} \o Run configure with the same parameters as last time. \o -\endtable - -\section2 Qt for Windows CE only: - \table - \header \o Option \o Description \o Note - \row \o \c {-no-iwmmxt} \o Do not compile with use of IWMMXT instructions \o - \row \o \c {-iwmmxt} \o Do compile with use of IWMMXT instructions. \o This is - for Qt for Windows CE on Arm only. This option denotes a default value and - needs to be evaluated. If the evaluation succeeds, the feature is included. - \row \o \c {-no-crt} \o Do not add the C runtime to default deployment rules. - \o Default value. - \row \o \c {-qt-crt} \o Qt identifies C runtime during project generation \o - \row \o \c {-crt <path>} \o Specify path to C runtime used for project - generation. \o - \row \o \c {-no-cetest} \o Do not compile Windows CE remote test application \o - \row \o \c {-cetest} \o Compile Windows CE remote test application \o This - option denotes a default value and needs to be evaluated. If the evaluation - succeeds, the feature is included. - \row \o \c {-signature <file>} \o Use file for signing the target project \o - \row \o \c {-phonon-wince-ds9} \o Enable Phonon Direct Show 9 backend for - Windows CE \o Default value - \endtable - - \section2 Qt for Symbian OS only: - \table - \header \o Option \o Description \o Note - \row \o \c {-no-freetype} \o Do not compile in Freetype2 support. - \o Default value. - \row \o \c {-qt-freetype} \o Use the libfreetype bundled with Qt. \o - \row \o \c {-fpu <flags>} \o VFP type on ARM, supported options: - softvfp(default) |vfpv2 | softvfp+vfpv2 \o - \row \o \c {-no-s60} \o Do not compile in S60 support. \o - \row \o \c {-s60} \o Compile with support for the S60 UI Framework - \o Default value. - \row \o \c {-no-usedeffiles} \o Disable the usage of DEF files. \o - \row \o \c {-usedeffiles} \o Enable the usage of DEF files. \o - \endtable + \brief Brief description of available options for building Qt. + + This page gives a brief description of the different options available when + building Qt using the \c configure script or \c configure.exe binary. + To build Qt using the default options, just call configure from the command + line as shown below. + + When building on Linux, Mac OS X and Unix platforms: + + \c{./configure} + + On Windows, run the corresponding executable: + + \c{.\configure.exe} + + If you would like to customize your build, please use the options listed in + the following tables. To see the full list of options, invoke the configure + tool with the \c -help command line option. + + \section2 Cross platform options: + + \table + \header \o Option \o Description \o Note + \row \o \c {-buildkey} <key> \o Build the Qt library and plugins + using the specified \o + \row \o \c {<key>} \o When the library loads plugins, it will only + load those that have a matching <key>. \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 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 + feature is included. + \row \o \c {-opensource} \o Compile and link the Open-Source Edition + of Qt. \o + \row \o \c {-commercial} \o Compile and link the Commercial Edition + 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 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 Default + value. + \row \o \c {-no-fast} \o Configure Qt normally by generating Makefiles for + 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 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 Default value. + \row \o \c {-no-stl} \o Do not compile STL support. \o + \row \o \c {-stl} \o Compile STL support. \o Default value. + \row \o \c {-no-sql-<driver>} \o Disable SQL <driver> entirely, by default + none are turned on. \o + \row \o \c {-qt-sql-<driver>} \o Enable a SQL <driver> in the Qt Library. + \o + \row \o \c {-plugin-sql-<driver>} \o Enable SQL <driver> as a plugin to be + linked to at run time. \o Available values for <driver>: mysql, psql, + oci, odbc, tds, db2, sqlite, sqlite2, ibase. Drivers marked with a + '+' during configure have been detected as available on this system. + \row \o \c {-system-sqlite} \o Use sqlite from the operating system. \o + \row \o \c {-no-qt3support} \o Disables the Qt 3 support functionality. \o + \row \o \c {-no-opengl} \o Disables OpenGL functionality \o + \row \o \c {-opengl <api>} \o Enable OpenGL support with specified API + version. \o Available values for <api>: 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 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 <spec>} \o The operating system and compiler you + are building on. \o The default value is %QMAKESPEC%. + \row \o \c {-xplatform <spec>} \o The operating system and compiler you + are cross compiling for. \o See the README file for a list of supported + operating systems and compilers. + \row \o \c {-qtnamespace <namespace>} \o Wraps all Qt library code in + 'namespace name {..} \o + \row \o \c {-qtlibinfix <infix>} \o Renames all Qt* libs to Qt*<infix> + \o + \row \o \c {-D <define>} \o Add an explicit define to the preprocessor. + \o + \row \o \c {-I <includepath>} \o Add an explicit include path. \o + \row \o \c {-L <librarypath>} \o Add an explicit library path. \o + \row \o \c {-l <libraryname>} \o Add an explicit library name, residing + in a librarypath. \o + \row \o \c {-graphicssystem <sys>} \o Specify which graphics system should + be used. \o Available values for <sys>: * raster - Software rasterizer, + opengl - Using OpenGL acceleration, experimental!, openvg - Using + OpenVG acceleration, experimental! + \row \o \c {-help, -h, -?} \o Display this information. \o + \endtable + + \section2 Third Party Libraries + + \table + \header \o Option \o Description \o Note + \row \o \c {-qt-zlib} \o Use the zlib bundled with Qt. \o + \row \o \c {-system-zlib} \o Use zlib from the operating system. + \o See http://www.gzip.org/zlib + \row \o \c {-no-gif} \o Do not compile GIF reading support. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-qt-gif} \o Compile GIF reading support. \o See also + src/gui/image/qgifhandler_p.h + \row \o \c {-no-libpng} \o Do not compile PNG support. \o + \row \o \c {-qt-libpng} \o Use the libpng bundled with Qt. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-system-libpng} \o Use libpng from the operating system. + \o See http://www.libpng.org/pub/png + \row \o \c {-no-libmng} \o Do not compile MNG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libmng} \o Use the libmng bundled with Qt. \o + \row \o \c {-system-libmng} \o Use libmng from the operating system. + \o See http://www.libmng.com + \row \o \c {-no-libtiff} \o Do not compile TIFF support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libtiff} \o Use the libtiff bundled with Qt. \o + \row \o \c {-system-libtiff} \o Use libtiff from the operating system. + \o See http://www.libtiff.org + \row \o \c {-no-libjpeg} \o Do not compile JPEG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libjpeg} \o Use the libjpeg bundled with Qt. \o + \row \o \c {-system-libjpeg} \o Use libjpeg from the operating system. + \o See http://www.ijg.org. This option denotes a default value and + needs to be evaluated. If the evaluation succeeds, the feature is + included. + \endtable + + \section2 Qt for Windows only: + \table + \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 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 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 + to custom build steps. This will distribute MOC and UIC steps, and other + custom buildsteps which are added to the INCREDIBUILD_XGE variable. + \o The IncrediBuild distribution commands are only added to Visual Studio + projects. This option denotes a default value and needs to be evaluated. + 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 Default value. + \row \o \c {-no-qmake} \o Do not compile qmake. \o + \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 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 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 + succeeds, the feature is included. + \row \o \c {-no-3dnow} \o Do not compile with use of 3DNOW instructions \o + \row \o \c {-3dnow} \o Compile with use of 3DNOW instructions \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-sse} \o Do not compile with use of SSE instructions \o + \row \o \c {-sse} \o Compile with use of SSE instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-sse2} \o Do not compile with use of SSE2 instructions \o + \row \o \c {-sse2} \o Compile with use of SSE2 instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-openssl} \o Do not compile in OpenSSL support \o + \row \o \c {-openssl} \o Compile in run-time OpenSSL support \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-openssl-linked} \o Compile in linked OpenSSL support \o + \row \o \c {-no-dbus} \o Do not compile in D-Bus support \o + \row \o \c {-dbus} \o Compile in D-Bus support and load libdbus-1 dynamically. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-dbus-linked} \o Compile in D-Bus support and link to + libdbus-1 \o + \row \o \c {-no-phonon} \o Do not compile in the Phonon module \o + \row \o \c {-phonon} \o Compile the Phonon module. \o Phonon is built if a + decent C++ compiler is used. This option denotes a default value and needs + to be evaluated. If the evaluation succeeds, the feature is included. + \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 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 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 + QtMultimedia \o This option denotes a default value and needs to be + evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-webkit} \o Do not compile in the WebKit module \o + \row \o \c {-webkit} \o Compile in the WebKit module \o WebKit is built + if a decent C++ compiler is used. This option denotes a default value + and needs to be evaluated. If the evaluation succeeds, the feature is + included. + \row \o \c {-webkit-debug} \o Compile in the WebKit module with debug + symbols. \o + \row \o \c {-no-script} \o Do not build the QtScript module. \o + \row \o \c {-script} \o Build the QtScript module. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-scripttools} \o Do not build the QtScriptTools module. \o + \row \o \c {-scripttools} \o Build the QtScriptTools module. \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-declarative} \o Do not build the declarative module \o + \row \o \c {-declarative} \o Build the declarative module \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \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 Default value. + \row \o \c {-arch <arch>} \o Specify an architecture. \o Available values for + <arch>: * windows, windowsce, symbian, boundschecker, generic. + \row \o \c {-no-style-<style>} \o Disable <style> entirely. \o + \row \o \c {-qt-style-<style>} \o Enable <style> in the Qt Library. + \o Available styles: * windows, + windowsxp, + windowsvista, + * plastique, * cleanlooks, * motif, * cde, windowsce, windowsmobile, + s60 + \row \o \c {-no-native-gestures} \o Do not use native gestures on Windows 7. + \o + \row \o \c {-native-gestures} \o Use native gestures on Windows 7. + \o Default value. + \row \o \c {-no-mp} \o Do not use multiple processors for compiling with MSVC + \o Default value. + \row \o \c {-mp} \o Use multiple processors for compiling with MSVC (-MP) \o + \row \o \c {-loadconfig <config>} \o Run configure with the parameters from file + configure_<config>.cache. \o + \row \o \c {-saveconfig <config>} \o Run configure and save the parameters in + file configure_<config>.cache. \o + \row \o \c {-redo} \o Run configure with the same parameters as last time. \o + \endtable + + \section2 Qt for Windows CE only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-iwmmxt} \o Do not compile with use of IWMMXT instructions \o + \row \o \c {-iwmmxt} \o Do compile with use of IWMMXT instructions. \o This is + for Qt for Windows CE on Arm only. This option denotes a default value and + needs to be evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-crt} \o Do not add the C runtime to default deployment rules. + \o Default value. + \row \o \c {-qt-crt} \o Qt identifies C runtime during project generation \o + \row \o \c {-crt <path>} \o Specify path to C runtime used for project + generation. \o + \row \o \c {-no-cetest} \o Do not compile Windows CE remote test application \o + \row \o \c {-cetest} \o Compile Windows CE remote test application \o This + option denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-signature <file>} \o Use file for signing the target project \o + \row \o \c {-phonon-wince-ds9} \o Enable Phonon Direct Show 9 backend for + Windows CE \o Default value + \endtable + + \section2 Qt for Symbian OS only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-freetype} \o Do not compile in Freetype2 support. + \o Default value. + \row \o \c {-qt-freetype} \o Use the libfreetype bundled with Qt. \o + \row \o \c {-fpu <flags>} \o VFP type on ARM, supported options: + softvfp(default) |vfpv2 | softvfp+vfpv2 \o + \row \o \c {-no-s60} \o Do not compile in S60 support. \o + \row \o \c {-s60} \o Compile with support for the S60 UI Framework + \o Default value. + \row \o \c {-no-usedeffiles} \o Disable the usage of DEF files. \o + \row \o \c {-usedeffiles} \o Enable the usage of DEF files. \o + \endtable */ diff --git a/doc/src/images/appicon_packagecontents.png b/doc/src/images/appicon_packagecontents.png Binary files differnew file mode 100644 index 0000000..49cb1e4 --- /dev/null +++ b/doc/src/images/appicon_packagecontents.png diff --git a/doc/src/images/appicon_screenshot.png b/doc/src/images/appicon_screenshot.png Binary files differnew file mode 100644 index 0000000..c29dd11 --- /dev/null +++ b/doc/src/images/appicon_screenshot.png diff --git a/doc/src/images/cube.png b/doc/src/images/cube.png Binary files differnew file mode 100644 index 0000000..95dfc98 --- /dev/null +++ b/doc/src/images/cube.png diff --git a/doc/src/images/cube_faces.png b/doc/src/images/cube_faces.png Binary files differnew file mode 100644 index 0000000..2c7102a --- /dev/null +++ b/doc/src/images/cube_faces.png diff --git a/doc/src/images/elidedlabel-example.png b/doc/src/images/elidedlabel-example.png Binary files differnew file mode 100644 index 0000000..741d289 --- /dev/null +++ b/doc/src/images/elidedlabel-example.png diff --git a/doc/src/images/maemovibration-example.png b/doc/src/images/maemovibration-example.png Binary files differnew file mode 100644 index 0000000..be975fc --- /dev/null +++ b/doc/src/images/maemovibration-example.png diff --git a/doc/src/images/orientation-landscape-ui.png b/doc/src/images/orientation-landscape-ui.png Binary files differnew file mode 100644 index 0000000..c591ff1 --- /dev/null +++ b/doc/src/images/orientation-landscape-ui.png diff --git a/doc/src/images/orientation-landscape.png b/doc/src/images/orientation-landscape.png Binary files differnew file mode 100644 index 0000000..e606804 --- /dev/null +++ b/doc/src/images/orientation-landscape.png diff --git a/doc/src/images/orientation-portrait-ui.png b/doc/src/images/orientation-portrait-ui.png Binary files differnew file mode 100644 index 0000000..304835b --- /dev/null +++ b/doc/src/images/orientation-portrait-ui.png diff --git a/doc/src/images/orientation-portrait.png b/doc/src/images/orientation-portrait.png Binary files differnew file mode 100644 index 0000000..3d778e8 --- /dev/null +++ b/doc/src/images/orientation-portrait.png diff --git a/doc/src/images/qml-listview-snippet.png b/doc/src/images/qml-listview-snippet.png Binary files differnew file mode 100644 index 0000000..0ee0ffc --- /dev/null +++ b/doc/src/images/qml-listview-snippet.png diff --git a/doc/src/images/symbianvibration-example.png b/doc/src/images/symbianvibration-example.png Binary files differnew file mode 100644 index 0000000..21461b6 --- /dev/null +++ b/doc/src/images/symbianvibration-example.png diff --git a/doc/src/images/webkit-webftpclient.png b/doc/src/images/webkit-webftpclient.png Binary files differnew file mode 100644 index 0000000..8aa7a12 --- /dev/null +++ b/doc/src/images/webkit-webftpclient.png diff --git a/doc/src/images/webkit-webplugin.png b/doc/src/images/webkit-webplugin.png Binary files differnew file mode 100644 index 0000000..1594163 --- /dev/null +++ b/doc/src/images/webkit-webplugin.png diff --git a/doc/src/platforms/emb-install.qdoc b/doc/src/platforms/emb-install.qdoc index eb12cd4..e5dc6f8 100644 --- a/doc/src/platforms/emb-install.qdoc +++ b/doc/src/platforms/emb-install.qdoc @@ -74,6 +74,9 @@ \snippet doc/src/snippets/code/doc_src_emb-install.qdoc embedded help + The \l{Configuration Options for Qt} page gives a brief overview + of these. + Note that by default, \l{Qt for Embedded Linux} is configured for installation in the \c{/usr/local/Trolltech/QtEmbedded-%VERSION%} directory, but this can be changed by using the \c{-prefix} diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 2a5d5b1..d5d76bc 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -152,9 +152,9 @@ when application \c .sis needs to be separately signed before including it into smart installer \c .sis. \row \o \c unsigned_installer_sis \o Create unsigned \l{Smart Installer}{smart installer} - \c .sis file for project. - Note: The application \c .sis contained in smart installer - \c .sis will also be unsigned. + \c .sis file for project. + Note: The application \c .sis contained in smart installer + \c .sis will also be unsigned. \row \o \c stub_sis \o Create a stub sis to allow upgradability of projects that are deployed in ROM \endtable diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml new file mode 100644 index 0000000..62a444d --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-items.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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: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 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml new file mode 100644 index 0000000..a6ca305 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-no-spacing.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml new file mode 100644 index 0000000..c03cdad --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/listview/listview-snippet.qml new file mode 100644 index 0000000..f2a260d --- /dev/null +++ b/doc/src/snippets/declarative/listview/listview-snippet.qml @@ -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: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 + +ListView { + width: 50; height: 200 + model: 4 + delegate: Text { + text: index; + font.pixelSize: 40 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml index 03473ba..1b9a9ec 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml @@ -47,53 +47,53 @@ Rectangle { width: 500; height: 500 color: "green" -Column { -//! [anchor fill] -Rectangle { - id: button - width: 100; height: 100 + Column { + //! [anchor fill] + Rectangle { + id: button + width: 100; height: 100 - MouseArea { - anchors.fill: parent - onClicked: console.log("button clicked") - } - MouseArea { - width:150; height: 75 - onClicked: console.log("irregular area clicked") - } -} -//! [anchor fill] + MouseArea { + anchors.fill: parent + onClicked: console.log("button clicked") + } + MouseArea { + width:150; height: 75 + onClicked: console.log("irregular area clicked") + } + } + //! [anchor fill] -Rectangle { - id: button - width: 100; height: 100 + Rectangle { + id: button + width: 100; height: 100 -//! [enable handlers] - MouseArea { - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton - onEntered: console.log("mouse entered the area") - onExited: console.log("mouse left the area") - } -//! [enable handlers] -} + //! [enable handlers] + MouseArea { + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") + } + //! [enable handlers] + } -Rectangle { - id: button - width: 100; height: 100 + Rectangle { + id: button + width: 100; height: 100 -//! [mouse handlers] - MouseArea { - anchors.fill: parent - onClicked: console.log("area clicked") - onDoubleClicked: console.log("area double clicked") - onEntered: console.log("mouse entered the area") - onExited: console.log("mouse left the area") - } -//! [mouse handlers] -} + //! [mouse handlers] + MouseArea { + anchors.fill: parent + onClicked: console.log("area clicked") + onDoubleClicked: console.log("area double clicked") + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") + } + //! [mouse handlers] + } -} //end of column + } //end of column //! [parent end] } //! [parent end] diff --git a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg new file mode 100644 index 0000000..8c018be --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + clip-rule="evenodd" + stroke-miterlimit="10" + viewBox="0 0 174.35 209.78" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + width="744.09186" + height="895.29858" + sodipodi:docname="qt-logo.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + version="1.0" + style="stroke-miterlimit:10"> + <metadata + id="metadata29"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + inkscape:window-height="668" + inkscape:window-width="722" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + showgrid="false" + inkscape:zoom="0.12195802" + inkscape:cx="525.6108" + inkscape:cy="-287.87189" + inkscape:window-x="476" + inkscape:window-y="228" + inkscape:current-layer="svg2" /> + <desc + id="desc4">SVG generated by Lineform</desc> + <defs + id="defs6"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective31" /> + </defs> + <g + id="g8" + transform="translate(-1.5304326e-4,-3.775985e-4)"> + <path + d="M 43.08,0.36 C 40.94,0 38.84,-0.08 36.81,0.08 L 36.8,0.08 C 36.8,0.08 22.92,1.02 22.29,1.07 C 9.62,2.08 0,12.5 0,26.89 L 0,196.55 L 14.19,209.78 L 156.79,185.81 C 166.6,184.11 174.35,172.54 174.35,160.04 L 174.35,21.88 L 43.08,0.36" + id="path10" + style="fill:#0c481e" /> + <path + d="M 174.35,160.04 C 174.35,172.54 166.6,184.11 156.79,185.82 L 14.19,209.78 L 14.19,25.99 C 14.19,9.27 27.53,-2.21 43.08,0.36 L 174.35,21.88 L 174.35,160.04" + id="path12" + style="fill:#66b036" /> + <path + d="M 130.42,45.91 L 141.94,47.15 L 141.94,67.36 L 154.9,68.28 L 154.9,80.96 L 141.94,80.36 L 141.94,126.69 C 141.94,130.72 142.38,133.31 143.28,134.48 C 144.08,135.55 145.32,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 155.83,145.4 C 150.69,147.65 145.65,149 140.7,149.42 C 139.99,149.47 139.29,149.5 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 125.65,66.22 L 130.42,45.91" + id="path14" + style="fill:#ffffff" /> + <path + d="M 154.9,80.96 L 141.94,80.36 L 141.94,80.64 L 148.88,80.96 L 154.9,80.96" + id="path16" + style="fill:#0c481e" /> + <path + d="M 144.64,135.6 C 145.3,135.92 146.07,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 149.81,133.75 C 147.99,134.58 146.28,135.21 144.64,135.6" + id="path18" + style="fill:#0c481e" /> + <path + d="M 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 112.05,65.67 L 112.05,68.71 C 112.92,71.98 113.6,75.53 114.11,79.35 L 118.28,79.54 L 118.28,130.9 C 118.28,137.62 119.64,142.52 122.37,145.57 C 124.71,148.2 128.13,149.5 132.61,149.5 L 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 z M 130.42,45.91 L 124.41,45.91 L 119.74,65.79 L 125.65,66.22 L 130.42,45.91" + id="path20" + style="fill:#0c481e" /> + <path + d="M 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 75.26,54.23 71.92,56.77 69.59,61.86 C 67.07,67.4 65.8,78.9 65.8,96.3 C 65.8,113.11 67.04,125.05 69.54,132.05 C 71.89,138.72 75.41,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 M 109.13,136.15 C 105.01,145.86 98.73,152.21 90.14,155.15 C 91.01,159.6 92.32,162.6 94.06,164.17 C 95.41,165.39 97.49,165.99 100.28,165.99 C 101.09,165.99 101.96,165.94 102.87,165.84 L 102.87,178.96 L 96.91,179.75 C 95.16,179.97 93.49,180.09 91.91,180.09 C 86.69,180.09 82.47,178.82 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 77.24,38.78 78.93,38.88 80.66,39.08 C 92.61,40.46 101.28,46.1 106.92,55.87 C 112.46,65.43 115.17,79.14 115.17,97.13 C 115.17,113.62 113.17,126.58 109.13,136.15" + id="path22" + style="fill:#ffffff" /> + <path + d="M 100.28,165.99 C 101.09,165.99 101.95,165.94 102.87,165.84 L 98.04,165.84 C 98.71,165.94 99.49,165.99 100.28,165.99" + id="path24" + style="fill:#0c481e" /> + <path + d="M 84.85,63.98 C 87.19,69.97 88.34,80.9 88.34,96.79 C 88.34,114.49 87.18,126.36 84.82,132.4 C 82.93,137.28 80.3,140.31 76.96,141.48 C 77.93,141.84 78.96,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 78.51,54.23 77.48,54.39 76.52,54.72 L 76.52,54.72 C 80.12,55.83 82.89,58.93 84.85,63.98 z M 82.51,178.25 C 82.4,178.2 82.28,178.15 82.17,178.09 C 82.16,178.09 82.15,178.08 82.14,178.08 C 82.03,178.03 81.93,177.97 81.83,177.92 C 81.81,177.91 81.79,177.9 81.77,177.89 C 81.68,177.84 81.59,177.79 81.49,177.74 C 81.46,177.72 81.44,177.71 81.41,177.69 C 81.33,177.65 81.24,177.6 81.16,177.55 C 81.12,177.53 81.09,177.51 81.05,177.48 C 80.98,177.44 80.91,177.4 80.84,177.36 C 80.79,177.33 80.74,177.3 80.7,177.27 C 80.64,177.23 80.58,177.19 80.52,177.15 C 80.46,177.12 80.41,177.08 80.35,177.04 C 80.3,177.01 80.25,176.98 80.2,176.94 C 80.14,176.9 80.07,176.85 80.01,176.81 C 79.97,176.78 79.93,176.75 79.89,176.72 C 79.82,176.67 79.74,176.61 79.67,176.55 C 79.64,176.54 79.61,176.52 79.59,176.5 C 79.49,176.42 79.39,176.34 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 75.65,38.78 69.27,38.77 69.27,38.77 L 69.27,38.78 C 59.12,38.78 51.05,42.75 45.27,50.81 C 38.41,60.38 34.92,75.46 34.92,95.89 C 34.92,114.83 37.47,129.32 42.47,139.23 C 47.41,148.97 54.53,154.78 63.67,156.73 C 65.65,166.37 68.76,172.89 72.96,176.26 C 76.14,178.82 80.36,180.09 85.58,180.09 C 85.68,180.09 85.78,180.09 85.88,180.09 L 91.42,180.09 C 88.01,180.03 85.04,179.43 82.52,178.26 C 82.51,178.26 82.51,178.26 82.51,178.25" + id="path26" + style="fill:#0c481e" /> + </g> +</svg> diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h index f317d40..763a451 100644 --- a/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/textdocument-listitemstyles/main.cpp b/doc/src/snippets/textdocument-listitemstyles/main.cpp new file mode 100644 index 0000000..6e40492 --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/main.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$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow *window = new MainWindow; + window->resize(640, 480); + window->show(); + return app.exec(); +} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp new file mode 100644 index 0000000..94e98b3 --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +MainWindow::MainWindow() +{ + QMenu *fileMenu = new QMenu(tr("&File")); + + fileMenu->addAction(tr("E&xit"), this, SLOT(close()), + QKeySequence(tr("Ctrl+Q", "File|Exit"))); + + QMenu *insertMenu = new QMenu(tr("&Insert")); + + insertMenu->addAction(tr("&List"), this, SLOT(insertList()), + QKeySequence(tr("Ctrl+L", "Insert|List"))); + + menuBar()->addMenu(fileMenu); + menuBar()->addMenu(insertMenu); + + editor = new QTextEdit(this); + document = new QTextDocument(this); + editor->setDocument(document); + + setCentralWidget(editor); + setWindowTitle(tr("Text Document List Item Styles")); +} + +void MainWindow::insertList() +{ + QTextCursor cursor = editor->textCursor(); + cursor.beginEditBlock(); + + //! [add a styled, ordered list] + QTextListFormat listFormat; + + listFormat.setStyle(QTextListFormat::ListDecimal); + listFormat.setNumberPrefix("("); + listFormat.setNumberSuffix(")"); + + cursor.insertList(listFormat); + //! [add a styled, ordered list] + + cursor.endEditBlock(); +} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.h b/doc/src/snippets/textdocument-listitemstyles/mainwindow.h new file mode 100644 index 0000000..649a47b --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/mainwindow.h @@ -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$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <QMainWindow> + +class QTextDocument; +class QTextEdit; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +public slots: + void insertList(); + +private: + QString currentFile; + QTextEdit *editor; + QTextDocument *document; +}; + +#endif diff --git a/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro b/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro new file mode 100644 index 0000000..5da8d6e --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro @@ -0,0 +1,3 @@ +HEADERS = mainwindow.h +SOURCES = main.cpp \ + mainwindow.cpp diff --git a/doc/src/snippets/xml/streamreader/traverse.cpp b/doc/src/snippets/xml/streamreader/traverse.cpp new file mode 100644 index 0000000..25b64eb --- /dev/null +++ b/doc/src/snippets/xml/streamreader/traverse.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$ +** +****************************************************************************/ + +#include <QCoreApplication> +#include <QFile> +#include <QStringList> +#include <QXmlStreamReader> + +#include <iostream> + +class Traverse +{ + Q_DECLARE_TR_FUNCTIONS(Traverse) +}; + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + + if (app.arguments().count() != 2) { + std::cerr << qPrintable(Traverse::tr("Usage: traverse <XML file>")) << std::endl; + return 1; + } + + QFile file(app.arguments()[1]); + if (!file.open(QFile::ReadOnly)) { + std::cerr << qPrintable(Traverse::tr("Failed to open file: %1").arg(app.arguments()[1])) << std::endl; + return 1; + } + + //! [traverse document] + QXmlStreamReader xs(&file); + while (!xs.atEnd()) { + if (xs.readNextStartElement()) + std::cout << qPrintable(xs.name().toString()) << std::endl; + } + //! [traverse document] + + file.close(); + return 0; +} diff --git a/doc/src/snippets/xml/streamreader/traverse.pro b/doc/src/snippets/xml/streamreader/traverse.pro new file mode 100644 index 0000000..e98e6f3 --- /dev/null +++ b/doc/src/snippets/xml/streamreader/traverse.pro @@ -0,0 +1,2 @@ +QT -= gui +SOURCES = traverse.cpp diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index dcd5a1d..35454f4 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -104,7 +104,6 @@ array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. - This method is very intuitive and useful in many applications, but displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the |