summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-09-15 13:29:48 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-09-15 13:29:48 (GMT)
commit9d96ff055390cea8996b68dc4aef39512fbd9c96 (patch)
tree525c1afc933bba0f3f00bbcbfc560d10db439179 /doc/src
parentb13365187b58ecc2d259589ab523a7d0da84dc83 (diff)
parentf42f5c457b3368adb4c92e521dc56969f138bdd3 (diff)
downloadQt-9d96ff055390cea8996b68dc4aef39512fbd9c96.zip
Qt-9d96ff055390cea8996b68dc4aef39512fbd9c96.tar.gz
Qt-9d96ff055390cea8996b68dc4aef39512fbd9c96.tar.bz2
Merge commit 'qt-mainline/4.6' into kinetic-declarativeui
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/frameworks-technologies/gestures.qdoc41
-rw-r--r--doc/src/snippets/audio/main.cpp109
2 files changed, 130 insertions, 20 deletions
diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc
index 57f25ba..a0eab21 100644
--- a/doc/src/frameworks-technologies/gestures.qdoc
+++ b/doc/src/frameworks-technologies/gestures.qdoc
@@ -58,21 +58,21 @@
\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}
- section.
-
- \section1 Using Standard Gestures with Widgets
+ 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 section \l{Using Standard Gestures
+ With Widgets}.
+
+ 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 section
+ \l{Creating Your Own Gesture Recognizer}.
+
+ \section1 Using Standard Gestures With Widgets
Gesture objects are applied directly to widgets and other controls that accept
user input \mdash these are the \e{target objects}. When a gesture object is
@@ -91,10 +91,11 @@
\snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture
- Here, the \l{QGesture::}{triggered()} signal is used to inform the application
- that a gesture was used. More precise monitoring of a gesture can be implemented
- by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and
- \l{QGesture::}{finished()} signals to slots.
+ Here, the \l{QGesture::} {triggered()} signal is used to inform
+ the application that a gesture was used. More precise monitoring
+ of a gesture can be implemented by connecting its \l{QGesture::}
+ {started()}, \l{QGesture::} {canceled()} and \l{QGesture::}
+ {finished()} signals to slots.
Responding to a signal is simply a matter of obtaining the gesture that sent
it and examining the information it contains.
@@ -141,7 +142,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()}
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"
+