summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/src/development/designer-manual.qdoc274
-rw-r--r--doc/src/diagrams/designer-manual/designer-adding-actions.txt (renamed from doc/src/diagrams/designer-adding-actions.txt)0
-rw-r--r--doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png (renamed from doc/src/diagrams/designer-adding-dynamic-property.png)bin9568 -> 9568 bytes
-rw-r--r--doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.pngbin14911 -> 21640 bytes
-rw-r--r--doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk5
-rw-r--r--doc/src/frameworks-technologies/gestures.qdoc43
-rw-r--r--doc/src/getting-started/examples.qdoc53
-rw-r--r--doc/src/images/designer-action-editor.pngbin46233 -> 28378 bytes
-rw-r--r--doc/src/images/designer-adding-menu-action.pngbin6168 -> 9962 bytes
-rw-r--r--doc/src/images/designer-adding-toolbar-action.pngbin5644 -> 7428 bytes
-rw-r--r--doc/src/images/designer-creating-toolbar.pngbin0 -> 18194 bytes
-rw-r--r--doc/src/images/designer-removing-toolbar-action.pngbin0 -> 15500 bytes
-rw-r--r--doc/src/images/designer-removing-toolbar.pngbin0 -> 13074 bytes
-rw-r--r--doc/src/images/qt-embedded-linux-architecture.pngbin22979 -> 23199 bytes
-rw-r--r--doc/src/snippets/audio/main.cpp109
-rw-r--r--doc/src/snippets/code/src_opengl_qglshaderprogram.cpp92
16 files changed, 438 insertions, 138 deletions
diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc
index ff05228..65b6baa 100644
--- a/doc/src/development/designer-manual.qdoc
+++ b/doc/src/development/designer-manual.qdoc
@@ -1520,26 +1520,34 @@
\target CreatingAMenu
- \table
- \row
- \i \inlineimage designer-creating-menu1.png
- \i \inlineimage designer-creating-menu2.png
- \i \bold{Creating a Menu}
-
- Double-click the placeholder item to begin editing. The menu text,
- displayed using a line edit, can be modified.
-
- \row
- \i \inlineimage designer-creating-menu3.png
- \i \inlineimage designer-creating-menu4.png
- \i Insert the required text for the new menu. Inserting an
- ampersand character (&) causes the letter following it to be
- used as a mnemonic for the menu.
-
- Press \key Return or \key Enter to accept the new text, or press
- \key Escape to reject it. You can undo the editing operation later if
- required.
- \endtable
+ \raw HTML
+ <div style="float: left; margin-right: 2em">
+ \endraw
+ \inlineimage designer-creating-menu1.png
+ \inlineimage designer-creating-menu2.png
+ \br
+ \inlineimage designer-creating-menu3.png
+ \inlineimage designer-creating-menu4.png
+ \raw HTML
+ </div>
+ \endraw
+
+ \section2 Creating a Menu
+
+ Double-click the placeholder item to begin editing. The menu text,
+ displayed using a line edit, can be modified.
+
+ Insert the required text for the new menu. Inserting an
+ ampersand character (&) causes the letter following it to be
+ used as a mnemonic for the menu.
+
+ Press \key Return or \key Enter to accept the new text, or press
+ \key Escape to reject it. You can undo the editing operation later if
+ required.
+
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
Menus can also be rearranged in the menu bar simply by dragging and
dropping them in the preferred location. A vertical red line indicates the
@@ -1550,31 +1558,39 @@
navigating the menu structure in the usual way.
\target CreatingAMenuEntry
- \table
- \row
- \i \inlineimage designer-creating-menu-entry1.png
- \i \inlineimage designer-creating-menu-entry2.png
- \i \bold{Creating a Menu Entry}
-
- Double-click the \gui{new action} placeholder to begin editing, or
- double-click \gui{new separator} to insert a new separator line after
- the last entry in the menu.
-
- The menu entry's text is displayed using a line edit, and can be
- modified.
-
- \row
- \i \inlineimage designer-creating-menu-entry3.png
- \i \inlineimage designer-creating-menu-entry4.png
- \i Insert the required text for the new entry, optionally using
- the ampersand character (&) to mark the letter to use as a
- mnemonic for the entry.
-
- Press \key Return or \key Enter to accept the new text, or press
- \key Escape to reject it. The action created for this menu entry will
- be accessible via the \l{#TheActionEditor}{Action Editor}, and any
- associated keyboard shortcut can be set there.
- \endtable
+ \raw HTML
+ <div style="float: right; margin-left: 2em">
+ \endraw
+ \inlineimage designer-creating-menu-entry1.png
+ \inlineimage designer-creating-menu-entry2.png
+ \br
+ \inlineimage designer-creating-menu-entry3.png
+ \inlineimage designer-creating-menu-entry4.png
+ \raw HTML
+ </div>
+ \endraw
+
+ \section2 Creating a Menu Entry
+
+ Double-click the \gui{Type Here} placeholder to begin editing, or
+ double-click \gui{Add Separator} to insert a new separator line after
+ the last entry in the menu.
+
+ The menu entry's text is displayed using a line edit, and can be
+ modified.
+
+ Insert the required text for the new entry, optionally using
+ the ampersand character (&) to mark the letter to use as a
+ mnemonic for the entry.
+
+ Press \key Return or \key Enter to accept the new text, or press
+ \key Escape to reject it. The action created for this menu entry will
+ be accessible via the \l{#TheActionEditor}{Action Editor}, and any
+ associated keyboard shortcut can be set there.
+
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
Just like with menus, entries can be moved around simply by dragging and
dropping them in the preferred location. When an entry is dragged over a
@@ -1582,53 +1598,91 @@
menu entries are based on actions, they can also be dropped onto toolbars,
where they will be displayed as toolbar buttons.
-
\section1 Toolbars
+ \raw HTML
+ <div style="float: left; margin-right: 2em">
+ \endraw
+ \inlineimage designer-creating-toolbar.png
+ \raw HTML
+ </div>
+ \endraw
- ### SCREENSHOT
+ \section2 Creating and Removing a Toolbar
- Toolbars ared added to a main window in a similar way to the menu bar:
+ Toolbars are added to a main window in a similar way to the menu bar:
Select the \gui{Add Tool Bar} option from the form's context menu.
Alternatively, if there is an existing toolbar in the main window, you can
click the arrow on its right end to create a new toolbar.
- Toolbar buttons are created using the action system to populate each
- toolbar, rather than by using specific button widgets from the widget box.
- Since actions can be represented by menu entries and toolbar buttons, they
- can be moved between menus and toolbars. To share an action between a menu
- and a toolbar, drag its icon from the \l{#TheActionEditor}{Action Editor}
- to the toolbar rather than from the menu where its entry is located.
+ Toolbars are removed from the form via an entry in the toolbar's context
+ menu.
+
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
+
+ \section2 Adding and Removing Toolbar Buttons
- New actions for menus and toolbars can be created in the
- \l{#TheActionEditor}{Action Editor}.
+ Toolbar buttons are created as actions in the
+ \l{#TheActionEditor}{Action Editor} and dragged onto the toolbar.
+ Since actions can be represented by menu entries and toolbar buttons,
+ they can be moved between menus and toolbars.
+ \raw HTML
+ <div style="float: right; margin-left: 2em">
+ \endraw
+ \inlineimage designer-adding-toolbar-action.png
+ \inlineimage designer-removing-toolbar-action.png
+ \raw HTML
+ </div>
+ \endraw
+
+ To share an action between a menu and a toolbar, drag its icon from the
+ action editor to the toolbar rather than from the menu where its entry is
+ located. See \l{#Adding an Action}{Adding an Action} for more information
+ about this process.
+
+ Toolbar buttons are removed via the toolbar's context menu.
+
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
\section1 Actions
With the menu bar and the toolbars in place, it's time to populate them
- with action: \QD provides an action editor to simplify the creation and
- management of actions.
-
+ with actions. New actions for both menus and toolbars are created in the
+ action editor window, simplifying the creation and management of actions.
\target TheActionEditor
- \table
- \row
- \i \inlineimage designer-action-editor.png
- \i \bold{The Action Editor}
+ \raw HTML
+ <div style="float: left; margin-right: 2em">
+ \endraw
+ \inlineimage designer-action-editor.png
+ \raw HTML
+ </div>
+ \endraw
- Enable the action editor by opening the \gui Tools menu, and switching
- on the \gui{Action Editor} option.
+ \section2 The Action Editor
- The action editor allows you to create \gui New actions and \gui Delete
- actions. It also provides a search function, \gui Filter, using the
- action's text.
+ Enable the action editor by opening the \gui Tools menu, and switching
+ on the \gui{Action Editor} option.
- \QD's action editor can be viewed in the classic \gui{Icon View} and
- \gui{Detailed View}. The screenshot below shows the action editor in
- \gui{Detailed View}. You can also copy and paste actions between menus,
- toolbars and forms.
- \endtable
+ The action editor allows you to create \gui New actions and \gui Delete
+ actions. It also provides a search function, \gui Filter, using the
+ action's text.
+
+ \QD's action editor can be viewed in the classic \gui{Icon View} and
+ \gui{Detailed View}. The screenshot below shows the action editor in
+ \gui{Detailed View}. You can also copy and paste actions between menus,
+ toolbars and forms.
+
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
+
+ \section2 Creating an Action
To create an action, use the action editor's \gui New button, which will
then pop up an input dialog. Provide the new action with a \gui Text --
@@ -1641,23 +1695,33 @@
Once the action is created, it can be used wherever actions are applicable.
+ \raw HTML
+ <div style="clear: left" />
+ \endraw
\target AddingAnAction
- \table
- \row
- \i \inlineimage designer-adding-menu-action.png
- \i \inlineimage designer-adding-toolbar-action.png
- \i \bold{Adding an Action}
+ \raw HTML
+ <div style="float: right; margin-left: 2em">
+ \endraw
+ \inlineimage designer-adding-menu-action.png
+ \inlineimage designer-adding-toolbar-action.png
+ \raw HTML
+ </div>
+ \endraw
- To add an action to a menu or a toolbar, simply press the left mouse
- button over the action in the action editor, and drag it to the
- preferred location.
+ \section2 Adding an Action
- \QD provides highlighted guide lines that tell you where the action
- will be added. Release the mouse button to add the action when you have
- found the right spot.
- \endtable
+ To add an action to a menu or a toolbar, simply press the left mouse
+ button over the action in the action editor, and drag it to the
+ preferred location.
+ \QD provides highlighted guide lines that tell you where the action
+ will be added. Release the mouse button to add the action when you have
+ found the right spot.
+
+ \raw HTML
+ <div style="clear: right" />
+ \endraw
\section1 Dock Widgets
@@ -1668,21 +1732,35 @@
and choose an appropriate value for its \gui{dockWidgetArea} property.
\target AddingADockWidget
- \table
- \row
- \i \inlineimage designer-adding-dockwidget.png
- \i \bold{Adding a Dock Widget}
-
- To add a dock widget, simply drag one from the \gui Containers section
- of the widget box, and drop it onto the main form area. Just like other
- widgets, its properties can be modified with the \gui{Property Editor}.
- Dock widgets can be optionally floated as indpendent tool windows.
- Hence, it is useful to give them window titles by setting their
- \gui{windowTitle} property. This also helps to identify them on the
- form.
+ \raw HTML
+ <div style="float: left; margin-right: 2em">
+ \endraw
+ \inlineimage designer-adding-dockwidget.png
+ \raw HTML
+ </div>
+ \endraw
+
+ \section2 Adding a Dock Widget
+
+ To add a dock widget to a form, drag one from the \gui Containers section
+ of the widget box, and drop it onto the main form area. Do not add the
+ dock widget to an existing layout. Instead, open the \gui{Property Editor}
+ and enable the \gui{docked} property to place it in a dock area.
+
+ Note that it is sometimes easier to configure a dock widget if it is added
+ to a form before a layout is applied to the central widget. For example,
+ it is possible to undock it and resize it, making it more convenient to
+ add child widgets.
+
+ Dock widgets can be optionally floated as independent tool windows.
+ Hence, it is useful to give them window titles by setting their
+ \l{QDockWidget::}{windowTitle} property. This also helps to identify them on the
+ form.
- \endtable
+ \raw HTML
+ <div style="clear: both" />
+ \endraw
*/
diff --git a/doc/src/diagrams/designer-adding-actions.txt b/doc/src/diagrams/designer-manual/designer-adding-actions.txt
index 4124ecc..4124ecc 100644
--- a/doc/src/diagrams/designer-adding-actions.txt
+++ b/doc/src/diagrams/designer-manual/designer-adding-actions.txt
diff --git a/doc/src/diagrams/designer-adding-dynamic-property.png b/doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png
index 8e81dd9..8e81dd9 100644
--- a/doc/src/diagrams/designer-adding-dynamic-property.png
+++ b/doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png
Binary files differ
diff --git a/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png b/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png
index 6b82373..4d28722 100644
--- a/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png
+++ b/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png
Binary files differ
diff --git a/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk b/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk
index ee60589..3c00b17 100644
--- a/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk
+++ b/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk
@@ -295,6 +295,9 @@ txt('Graphics',(222.876,42.6))
G_()
fp((1,1,1))
Fn('Helvetica')
-txt('Qt for Embedded Linux',(85.802,85.126))
+txt('Qt for Embedded Linux',(85.802,86.934))
+le()
+lw(1)
+r(280,0,0,-125,7.5,157.5)
guidelayer('Guide Lines',1,0,0,1,(0,0,1))
grid((0,0,2.5,2.5),1,(0,0,1),'Grid')
diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc
index 57f25ba..b9b7771 100644
--- a/doc/src/frameworks-technologies/gestures.qdoc
+++ b/doc/src/frameworks-technologies/gestures.qdoc
@@ -58,20 +58,20 @@
\section1 Overview
- QGesture is the central class in Qt's gesture framework, providing the API
- used by classes that represent specific gestures, such as QPanGesture,
- QPinchGesture, and QSwipeGesture. These standard classes are ready to use,
- and each exposes functions and properties that give gesture-specific
- information about the user's input. This is described in the
- \l{#Using Standard Gestures}{Using Standard Gestures} section.
-
- QGesture is also designed to be subclassed and extended so that support for
- new gestures can be implemented by developers. Adding support for a new
- gesture involves implementing code to recognize the gesture from incoming
- events. This is described in the
- \l{#Creating Your Own Gesture Recognizer}{Creating Your Own Gesture Recognizer}
+ QGesture is the central class in Qt's gesture framework, providing
+ the API used by classes that represent specific gestures, such as
+ QPanGesture, QPinchGesture, and QSwipeGesture. These standard
+ classes are ready to use, and each exposes functions and
+ properties that give gesture-specific information about the user's
+ input. This is described in the \l{Using Standard Gestures With Widgets}
section.
+ QGesture is also designed to be subclassed and extended so that
+ support for new gestures can be implemented by developers. Adding
+ support for a new gesture involves implementing code to recognize
+ the gesture from incoming events. This is described in the
+ \l{Creating Your Own Gesture Recognizer} section.
+
\section1 Using Standard Gestures with Widgets
Gesture objects are applied directly to widgets and other controls that accept
@@ -131,9 +131,18 @@
likely scenario. To find how to connect a source of events to automatically
feed into the recognizer see the QGesture documentation.
- Recognizers based on QGesture can emit any of the following signals:
+ Recognizers based on QGesture can emit any of the following signals to
+ indicate their progress in recognizing user input:
- \snippet doc/src/snippets/gestures/qgesture.h qgesture-signals
+ \list
+ \o \l{QGesture::}{triggered()} is emitted when a gesture is recognized.
+ \o \l{QGesture::}{started()} indicates that the gesture object has started
+ to recognize user input.
+ \o \l{QGesture::}{finished()} is emitted when the gesture object has
+ recognized the user input as a gesture, and finished handling it.
+ \o \l{QGesture::}{canceled()} indicates that the gesture was canceled,
+ either by the user or by the application.
+ \endlist
These signals are emitted when the state changes with the call to
\l{QGesture::}{updateState()}, more than one signal may
@@ -141,7 +150,7 @@
\table
\header \o New State \o Description \o QGesture Actions on Entering this State
- \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{cancelled()}
+ \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()}
\row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()}
\row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()}
\row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()}
@@ -223,8 +232,4 @@
\o The signals are caught by the defined slots in ImageWidget
\o The widget logic changes and an update() results in a paint event.
\endlist
-
-
-
*/
-
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index 81a8363..1ed1b30 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -1051,7 +1051,7 @@
\previouspage State Machine Examples
\contentspage Qt Examples
- \nextpage Qt for Embedded Linux Examples
+ \nextpage Gestures Examples
\image animation-examples.png Animation
@@ -1066,10 +1066,40 @@
*/
/*!
+ \page examples-gestures.html
+ \title Gestures Examples
+
+ \previouspage Animation Framework Examples
+ \contentspage Qt Examples
+ \nextpage D-Bus Examples
+
+ \list
+ \o \l{gestures/imageviewer}{Image Viewer}
+ \endlist
+*/
+
+/*!
+ \page examples-dbus.html
+ \title D-Bus Examples
+
+ \previouspage Gestures Examples
+ \contentspage Qt Examples
+ \nextpage Qt for Embedded Linux Examples
+
+ \list
+ \o \l{dbus/dbus-chat}{Chat}
+ \o \l{dbus/complexpingpong}{Complex Ping Pong}
+ \o \l{dbus/listnames}{List Names}
+ \o \l{dbus/pingpong}{Ping Pong}
+ \o \l{dbus/remotecontrolledcar}{Remote Controlled Car}
+ \endlist
+*/
+
+/*!
\page examples-embeddedlinux.html
\title Qt for Embedded Linux Examples
- \previouspage Animation Framework Examples
+ \previouspage D-Bus Examples
\contentspage Qt Examples
\nextpage ActiveQt Examples
@@ -1094,7 +1124,7 @@
\previouspage Qt for Embedded Linux Examples
\contentspage Qt Examples
- \nextpage D-Bus Examples
+ \nextpage Qt Quarterly
\image activeqt-examples.png ActiveQt
@@ -1111,20 +1141,3 @@
\o \l{activeqt/wrapper}{Wrapper}\raisedaster
\endlist
*/
-
-/*!
- \page examples-dbus.html
- \title D-Bus Examples
-
- \previouspage ActiveQt Examples
- \contentspage Qt Examples
- \nextpage Qt Quarterly
-
- \list
- \o \l{dbus/dbus-chat}{Chat}
- \o \l{dbus/complexpingpong}{Complex Ping Pong}
- \o \l{dbus/listnames}{List Names}
- \o \l{dbus/pingpong}{Ping Pong}
- \o \l{dbus/remotecontrolledcar}{Remote Controlled Car}
- \endlist
-*/
diff --git a/doc/src/images/designer-action-editor.png b/doc/src/images/designer-action-editor.png
index 7d17573..1e99706 100644
--- a/doc/src/images/designer-action-editor.png
+++ b/doc/src/images/designer-action-editor.png
Binary files differ
diff --git a/doc/src/images/designer-adding-menu-action.png b/doc/src/images/designer-adding-menu-action.png
index cf2a9c9..595dd8e 100644
--- a/doc/src/images/designer-adding-menu-action.png
+++ b/doc/src/images/designer-adding-menu-action.png
Binary files differ
diff --git a/doc/src/images/designer-adding-toolbar-action.png b/doc/src/images/designer-adding-toolbar-action.png
index e2201cb..404ad0d 100644
--- a/doc/src/images/designer-adding-toolbar-action.png
+++ b/doc/src/images/designer-adding-toolbar-action.png
Binary files differ
diff --git a/doc/src/images/designer-creating-toolbar.png b/doc/src/images/designer-creating-toolbar.png
new file mode 100644
index 0000000..32a949a
--- /dev/null
+++ b/doc/src/images/designer-creating-toolbar.png
Binary files differ
diff --git a/doc/src/images/designer-removing-toolbar-action.png b/doc/src/images/designer-removing-toolbar-action.png
new file mode 100644
index 0000000..12c68a1
--- /dev/null
+++ b/doc/src/images/designer-removing-toolbar-action.png
Binary files differ
diff --git a/doc/src/images/designer-removing-toolbar.png b/doc/src/images/designer-removing-toolbar.png
new file mode 100644
index 0000000..a65b170
--- /dev/null
+++ b/doc/src/images/designer-removing-toolbar.png
Binary files differ
diff --git a/doc/src/images/qt-embedded-linux-architecture.png b/doc/src/images/qt-embedded-linux-architecture.png
index abf5bd8..b5e3b6c 100644
--- a/doc/src/images/qt-embedded-linux-architecture.png
+++ b/doc/src/images/qt-embedded-linux-architecture.png
Binary files differ
diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp
new file mode 100644
index 0000000..a215d43
--- /dev/null
+++ b/doc/src/snippets/audio/main.cpp
@@ -0,0 +1,109 @@
+
+#include <QtGui>
+
+#include <QAudioOutput>
+#include <QAudioDeviceInfo>
+#include <QAudioInput>
+
+class Window2 : public QWidget
+{
+ Q_OBJECT
+
+public slots:
+//![0]
+ void stateChanged(QAudio::State newState)
+ {
+ switch(newState) {
+ case QAudio::StopState:
+ if (input->error() != QAudio::NoError) {
+ // Error handling
+ } else {
+
+ }
+ break;
+//![0]
+ default:
+ ;
+ }
+ }
+
+private:
+ QAudioInput *input;
+
+};
+
+class Window : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Window()
+ {
+ output = new QAudioOutput;
+ connect(output, SIGNAL(stateChanged(QAudio::State)),
+ this, SLOT(stateChanged(QAudio::State)));
+ }
+
+private:
+ void setupFormat()
+ {
+//![1]
+ QAudioFormat format;
+ format.setFrequency(44100);
+//![1]
+ format.setChannels(2);
+ format.setSampleSize(16);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+//![2]
+ format.setSampleType(QAudioFormat::SignedInt);
+
+ QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice();
+ QAudioDeviceInfo info(id);
+
+ if (!info.isFormatSupported(format))
+ format = info.nearestFormat(format);
+//![2]
+ }
+
+public slots:
+//![3]
+ void stateChanged(QAudio::State newState)
+ {
+ switch (newState) {
+ case QAudio::StopState:
+ if (output->error() != QAudio::NoError) {
+ // Do your error handlin
+ } else {
+ // Normal stop
+ }
+ break;
+//![3]
+
+ // Handle
+ case QAudio::ActiveState:
+ // Handle active state...
+ break;
+ break;
+ default:
+ ;
+ }
+ }
+
+private:
+ QAudioOutput *output;
+};
+
+int main(int argv, char **args)
+{
+ QApplication app(argv, args);
+
+ Window window;
+ window.show();
+
+ return app.exec();
+}
+
+
+#include "main.moc"
+
diff --git a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp
new file mode 100644
index 0000000..2997297
--- /dev/null
+++ b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 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$
+**
+****************************************************************************/
+
+//! [0]
+QGLShader shader(QGLShader::VertexShader);
+shader.compile(code);
+
+QGLShaderProgram program(context);
+program.addShader(shader);
+program.link();
+
+program.enable();
+//! [0]
+
+//! [1]
+program.addShader(QGLShader::VertexShader,
+ "attribute highp vec4 vertex;\n"
+ "attribute mediump mat4 matrix;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_Position = matrix * vertex;\n"
+ "}");
+program.addShader(QGLShader::FragmentShader,
+ "uniform mediump vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " gl_FragColor = color;\n"
+ "}");
+program.link();
+program.enable();
+
+int vertexLocation = program.attributeLocation("vertex");
+int matrixLocation = program.attributeLocation("matrix");
+int colorLocation = program.uniformLocation("color");
+//! [1]
+
+//! [2]
+static GLfloat const triangleVertices[] = {
+ 60.0f, 10.0f, 0.0f,
+ 110.0f, 110.0f, 0.0f,
+ 10.0f, 110.0f, 0.0f
+};
+
+QColor color(0, 255, 0, 255);
+
+QMatrix4x4 pmvMatrix;
+pmvMatrix.ortho(rect());
+
+program.setAttributeArray(vertexLocation, triangleVertices, 3);
+program.setUniformValue(matrixLocation, pmvMatrix);
+program.setUniformValue(colorLocation, color);
+
+glDrawArrays(GL_TRIANGLES, 0, 3);
+//! [2]