diff options
author | artoka <arto.katajasalo@digia.com> | 2011-11-28 10:59:12 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-31 16:31:38 (GMT) |
commit | 40fb4750910e23d3e7128ca8e0f1c5920b05bd5a (patch) | |
tree | 3ecce1e68f83c1cbb3e22cf3c74a27f515099d5e | |
parent | 1ac0ae47bd2271149241ae715f03252d7015459c (diff) | |
download | Qt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.zip Qt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.tar.gz Qt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.tar.bz2 |
Various qt documentation fixes (wk 43)
Task-number: QTBUG-12389
Task-number: QTBUG-16667
Task-number: QTBUG-6151
Task-number: QTBUG-8625
Task-number: QTBUG-19808
Task-number: QTBUG-12096
Task-number: QTBUG-1231
Task-number: QTBUG-21073
Task-number: QTBUG-8939
Task-number: QTBUG-20399
Task-number: QTBUG-20944
Task-number: QTBUG-7542
Task-number: QTBUG-22095
Task-number: QTBUG-11278
Task-number: QTBUG-15653
Change-Id: Ibc369998d06e7f2f11b01a1ba4c2fb927e3c065b
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
21 files changed, 173 insertions, 120 deletions
diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 5ef48ec..2107669 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -498,3 +498,8 @@ \externalpage http://www.developer.nokia.com/Community/Wiki/Graphics_memory_handling \title Graphics Out Of Memory monitor */ + +/*! + \externalpage ftp://ftp.qt.nokia.com/pub/qt/solutions/lgpl/qtmotifextension-2.7_1-opensource.tar.gz + \title Motif Extension +*/ diff --git a/doc/src/porting/qt4-threads.qdoc b/doc/src/porting/qt4-threads.qdoc index 17c02f8..bd14d4f 100644 --- a/doc/src/porting/qt4-threads.qdoc +++ b/doc/src/porting/qt4-threads.qdoc @@ -58,7 +58,7 @@ immediately; instead, it is invoked when control returns to the event loop of the thread to which the object belongs. The slot is executed in the thread where the receiver object lives. See - QObject::connect() for details. + \l{signals-and-slots-across-threads} and QObject::connect() for details. Qt 4 also introduces a new synchronization class: QReadWriteLock. It is similar to QMutex, except that it distinguishes between diff --git a/doc/src/snippets/audio/audio.pro b/doc/src/snippets/audio/audio.pro new file mode 100644 index 0000000..cc02dc8 --- /dev/null +++ b/doc/src/snippets/audio/audio.pro @@ -0,0 +1,2 @@ +QT += multimedia +SOURCES += main.cpp diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index 2afd1a4..f8e7991 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -48,29 +48,71 @@ class Window2 : public QWidget { Q_OBJECT -public slots: +public: + +//![0] + void startRecording() + { + outputFile.setFileName("/tmp/test.raw"); + outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate ); + + QAudioFormat format; + // set up the format you want, eg. + format.setFrequency(8000); + format.setChannels(1); + format.setSampleSize(8); + format.setCodec("audio/pcm"); + format.setByteOrder(QAudioFormat::LittleEndian); + format.setSampleType(QAudioFormat::UnSignedInt); + + QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); + if (!info.isFormatSupported(format)) { + qWarning()<<"default format not supported try to use nearest"; + format = info.nearestFormat(format); + } + + audioInput = new QAudioInput(format, this); + QTimer::singleShot(3000, this, SLOT(stopRecording())); + audioInput->start(&outputFile); + // Records audio for 3000ms + } //![0] + +//![1] + void stopRecording() + { + audioInput->stop(); + outputFile.close(); + delete audioInput; + } +//![1] + +public slots: +//![2] void stateChanged(QAudio::State newState) { switch(newState) { - case QAudio::StopState: - if (input->error() != QAudio::NoError) { - // Error handling + case QAudio::StoppedState: + if (audioInput->error() != QAudio::NoError) { + // Perform error handling } else { } break; -//![0] +//![2] default: ; } } private: - QAudioInput *input; - +//![3] + QFile outputFile; // class member. + QAudioInput *audioInput; // class member. +//![3] }; + class Window : public QWidget { Q_OBJECT @@ -78,45 +120,86 @@ class Window : public QWidget public: Window() { - output = new QAudioOutput; - connect(output, SIGNAL(stateChanged(QAudio::State)), + audioOutput = new QAudioOutput; + connect(audioOutput, SIGNAL(stateChanged(QAudio::State)), this, SLOT(stateChanged(QAudio::State))); } +public: + +//![4] + void startPlaying() + { + inputFile.setFileName("/tmp/test.raw"); + inputFile.open(QIODevice::ReadOnly); + + QAudioFormat format; + // Set up the format, eg. + format.setFrequency(8000); + format.setChannels(1); + format.setSampleSize(8); + format.setCodec("audio/pcm"); + format.setByteOrder(QAudioFormat::LittleEndian); + format.setSampleType(QAudioFormat::UnSignedInt); + + QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); + if (!info.isFormatSupported(format)) { + qWarning()<<"raw audio format not supported by backend, cannot play audio."; + return; + } + + audioOutput = new QAudioOutput(format, this); + connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); + audioOutput->start(&inputFile); + } +//![4] + +//![5] + void finishedPlaying(QAudio::State state) + { + if (state == QAudio::IdleState) { + audioOutput->stop(); + inputFile.close(); + delete audioOutput; + } + } +//![5] + private: + void setupFormat() { -//![1] +//![6] QAudioFormat format; format.setFrequency(44100); -//![1] +//![6] format.setChannels(2); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); -//![2] +//![7] format.setSampleType(QAudioFormat::SignedInt); QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (!info.isFormatSupported(format)) format = info.nearestFormat(format); -//![2] +//![7] } public slots: -//![3] +//![8] void stateChanged(QAudio::State newState) { switch (newState) { - case QAudio::StopState: - if (output->error() != QAudio::NoError) { + case QAudio::StoppedState: + if (audioOutput->error() != QAudio::NoError) { // Perform error handling } else { // Normal stop } break; -//![3] +//![8] // Handle case QAudio::ActiveState: @@ -129,7 +212,11 @@ public slots: } private: - QAudioOutput *output; + +//![9] + QFile inputFile; // class member. + QAudioOutput *audioOutput; // class member. +//![9] }; int main(int argv, char **args) diff --git a/doc/src/snippets/code/doc_src_qt4-arthur.cpp b/doc/src/snippets/code/doc_src_qt4-arthur.cpp index 0de11ce..6a24b0f 100644 --- a/doc/src/snippets/code/doc_src_qt4-arthur.cpp +++ b/doc/src/snippets/code/doc_src_qt4-arthur.cpp @@ -74,7 +74,7 @@ painter.drawEllipse(0, 0, 100, 100); painter.setBrush(QColor(255, 0, 0, 127)); painter.drawRect(0, 0, width()/2, height()); -// Specify semi-transparend blue +// Specify semi-transparent blue painter.setBrush(QColor(0, 0, 255, 127)); painter.drawRect(0, 0, width(), height()/2); //! [3] @@ -86,15 +86,16 @@ painter.drawLine(0, 0, width()/2, height()); // One line with anti-aliasing painter.setRenderHint(QPainter::Antialiasing); -painter.drawLine(width()/2, 0, width()/2, height()); +painter.drawLine(width()/2, 0, width(), height()); //! [4] //! [5] QPainterPath path; path.addRect(20, 20, 60, 60); -path.addBezier(0, 0, 99, 0, 50, 50, 99, 99); -path.addBezier(99, 99, 0, 99, 50, 50, 0, 0); +path.moveTo(0, 0); +path.cubicTo(99, 0, 50, 50, 99, 99); +path.cubicTo(0, 99, 50, 50, 0, 0); painter.drawPath(path); //! [5] diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp index 96f0e2e..7454463 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp @@ -73,7 +73,7 @@ MyStruct s2 = var.value<MyStruct>(); //! [3] int id = QMetaType::type("MyClass"); -if (id == 0) { +if (id != 0) { void *myClassPtr = QMetaType::construct(id); ... QMetaType::destroy(id, myClassPtr); diff --git a/doc/src/snippets/sqldatabase/sqldatabase.cpp b/doc/src/snippets/sqldatabase/sqldatabase.cpp index c40b689..e1acdaf 100644 --- a/doc/src/snippets/sqldatabase/sqldatabase.cpp +++ b/doc/src/snippets/sqldatabase/sqldatabase.cpp @@ -284,12 +284,12 @@ void QSqlTableModel_snippets() model->setTable("employee"); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->select(); - model->removeColumn(0); // don't show the ID model->setHeaderData(0, Qt::Horizontal, tr("Name")); model->setHeaderData(1, Qt::Horizontal, tr("Salary")); QTableView *view = new QTableView; view->setModel(model); + view->hideColumn(0); // don't show the ID view->show(); //! [24] diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 84db2e0..ffa4d07 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -527,7 +527,7 @@ When using signals and slots with multiple threads, see \l{Signals and Slots Across Threads}. - \sa {Thread Support in Qt}, QObject::connect(), qRegisterMetaType() + \sa {Thread Support in Qt}, QObject::connect(), qRegisterMetaType(), Q_DECLARE_METATYPE() */ /*! diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index c03d1f6..4de8fe8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4190,6 +4190,7 @@ QString QUrlPrivate::createErrorString() Constructs a URL by parsing \a url. \a url is assumed to be in human readable representation, with no percent encoding. QUrl will automatically percent encode all characters that are not allowed in a URL. + The default parsing mode is TolerantMode. Example: @@ -4211,6 +4212,7 @@ QUrl::QUrl(const QString &url) : d(0) \overload Parses the \a url using the parser mode \a parsingMode. + The default parsing mode is TolerantMode. \sa setUrl() */ diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 27c5b7d..3f73e61 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -265,8 +265,8 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) QAbstractEventDispatcher also allows the integration of an external event loop with the Qt event loop. For example, the - \l{Qt Solutions}{Motif Extension Qt Solution} includes a - reimplementation of QAbstractEventDispatcher that merges Qt and + \l{Motif Extension} + includes a reimplementation of QAbstractEventDispatcher that merges Qt and Motif events together. \sa QEventLoop, QCoreApplication diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 140a2c3..d02b477 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1369,7 +1369,30 @@ const char *QMetaMethod::typeName() const Returns the tag associated with this method. Tags are special macros recognized by \c moc that make it - possible to add extra information about a method. For the moment, + possible to add extra information about a method. + + Tag information can be added in the following + way in the function declaration: + + \code + #define THISISTESTTAG // tag text + ... + private slots: + THISISTESTTAG void testFunc(); + \endcode + + and the information can be accessed by using: + + \code + MainWindow win; + win.show(); + + int functionIndex = win.metaObject()->indexOfSlot("testFunc()"); + QMetaMethod mm = metaObject()->method(functionIndex); + qDebug() << mm.tag(); // prints THISISTESTTAG + \endcode + + For the moment, \c moc doesn't support any special tags. */ const char *QMetaMethod::tag() const diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a95d492..5102154 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2513,7 +2513,7 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM call qRegisterMetaType() to register the data type before you establish the connection. - \sa disconnect(), sender(), qRegisterMetaType() + \sa disconnect(), sender(), qRegisterMetaType(), Q_DECLARE_METATYPE() */ bool QObject::connect(const QObject *sender, const char *signal, diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc index a4ae146..770ad04 100644 --- a/src/corelib/tools/qlocale.qdoc +++ b/src/corelib/tools/qlocale.qdoc @@ -595,7 +595,6 @@ \value Yugoslavia \value Zambia \value Zimbabwe - \value SerbiaAndMontenegro \value Montenegro \value Serbia \value SaintBarthelemy diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 109ae94..b306fd2 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -425,7 +425,7 @@ int qFindString(const QChar *haystack, int haystackLen, int from, For historical reasons, quantifiers (e.g. \bold{*}) that apply to capturing parentheses are more "greedy" than other quantifiers. - For example, \bold{a*(a)*} will match "aaa" with cap(1) == "aaa". + For example, \bold{a*(a*)} will match "aaa" with cap(1) == "aaa". This behavior is different from what other regexp engines do (notably, Perl). To obtain a more intuitive capturing behavior, specify QRegExp::RegExp2 to the QRegExp constructor or call diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 6f9a091..3e1dd61 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -79,7 +79,7 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value AllPages All pages should be printed. \value Selection Only the selection should be printed. \value PageRange The specified page range should be printed. - \value CurrentPage Only the currently visible page should be printed. + \value CurrentPage Only the currently visible page should be printed. (This value was introduced in 4.7.) \sa QPrinter::PrintRange */ @@ -95,7 +95,7 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \value PrintPageRange The page range selection option is enabled. \value PrintShowPageSize Show the page size + margins page only if this is enabled. \value PrintCollateCopies The collate copies option is enabled - \value PrintCurrentPage The print current page option is enabled + \value PrintCurrentPage The print current page option is enabled (This value was introduced in 4.7.) This value is obsolete and does nothing since Qt 4.5: diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2b8b625..d4109ca 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -11068,9 +11068,9 @@ QGraphicsItemGroup::~QGraphicsItemGroup() } /*! - Adds the given \a item to this item group. The item will be - reparented to this group, but its position and transformation - relative to the scene will stay intact. + Adds the given \a item and item's child items to this item group. + The item and child items will be reparented to this group, but its + position and transformation relative to the scene will stay intact. \sa removeFromGroup(), QGraphicsScene::createItemGroup() */ diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 80896ec..1b38dfb 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -102,6 +102,10 @@ QT_BEGIN_NAMESPACE any way, but for a linear layout, the order is essential. When writing your own layout subclass, you are free to choose the API that best suits your layout. + For adding layout items to the custom layout, the QGraphicsLayout provides + convenience function addChildLayoutItem(). The function will take care of + automatically reparenting graphics items, if needed. + \section1 Activating the Layout When the layout's geometry changes, QGraphicsLayout immediately rearranges diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index 2f1b86c..31c45b6 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -114,9 +114,9 @@ public: supported format that is as close as possible to the format with nearestFormat(). For instance: - \snippet doc/src/snippets/audio/main.cpp 1 + \snippet doc/src/snippets/audio/main.cpp 6 \dots 8 - \snippet doc/src/snippets/audio/main.cpp 2 + \snippet doc/src/snippets/audio/main.cpp 7 A QAudioDeviceInfo is used by Qt to construct classes that communicate with the device--such as diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 2fdee31..f13705c 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -76,37 +76,9 @@ QT_BEGIN_NAMESPACE with a QIODevice opened for writing. For instance, to record to a file, you can: - \code - QFile outputFile; // class member. - QAudioInput* audio; // class member. - \endcode - - \code - { - outputFile.setFileName("/tmp/test.raw"); - outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate ); - - QAudioFormat format; - // set up the format you want, eg. - format.setFrequency(8000); - format.setChannels(1); - format.setSampleSize(8); - format.setCodec("audio/pcm"); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleType(QAudioFormat::UnSignedInt); - - QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); - if (!info.isFormatSupported(format)) { - qWarning()<<"default format not supported try to use nearest"; - format = info.nearestFormat(format); - } - - audio = new QAudioInput(format, this); - QTimer::singleShot(3000, this, SLOT(stopRecording())); - audio->start(&outputFile); - // Records audio for 3000ms - } - \endcode + \snippet doc/src/snippets/audio/main.cpp 3 + \dots 4 + \snippet doc/src/snippets/audio/main.cpp 0 This will start recording if the format specified is supported by the input device (you can check this with @@ -114,14 +86,7 @@ QT_BEGIN_NAMESPACE snags, use the error() function to check what went wrong. We stop recording in the \c stopRecording() slot. - \code - void stopRecording() - { - audio->stop(); - outputFile->close(); - delete audio; - } - \endcode + \snippet doc/src/snippets/audio/main.cpp 1 At any point in time, QAudioInput will be in one of four states: active, suspended, stopped, or idle. These states are specified by @@ -143,7 +108,7 @@ QT_BEGIN_NAMESPACE an error is encountered. Connect to the stateChanged() signal to handle the error: - \snippet doc/src/snippets/audio/main.cpp 0 + \snippet doc/src/snippets/audio/main.cpp 2 \sa QAudioOutput, QAudioDeviceInfo diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 290394c..1db1443 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -72,35 +72,9 @@ QT_BEGIN_NAMESPACE needs from the io device. So playing back an audio file is as simple as: - \code - QFile inputFile; // class member. - QAudioOutput* audio; // class member. - \endcode - - \code - inputFile.setFileName("/tmp/test.raw"); - inputFile.open(QIODevice::ReadOnly); - - QAudioFormat format; - // Set up the format, eg. - format.setFrequency(8000); - format.setChannels(1); - format.setSampleSize(8); - format.setCodec("audio/pcm"); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleType(QAudioFormat::UnSignedInt); - - QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); - if (!info.isFormatSupported(format)) { - qWarning()<<"raw audio format not supported by backend, cannot play audio."; - return; - } - - audio = new QAudioOutput(format, this); - connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State))); - audio->start(&inputFile); - - \endcode + \snippet doc/src/snippets/audio/main.cpp 9 + \dots 4 + \snippet doc/src/snippets/audio/main.cpp 4 The file will start playing assuming that the audio system and output device support it. If you run out of luck, check what's @@ -108,16 +82,7 @@ QT_BEGIN_NAMESPACE After the file has finished playing, we need to stop the device: - \code - void finishedPlaying(QAudio::State state) - { - if(state == QAudio::IdleState) { - audio->stop(); - inputFile.close(); - delete audio; - } - } - \endcode + \snippet doc/src/snippets/audio/main.cpp 5 At any given time, the QAudioOutput will be in one of four states: active, suspended, stopped, or idle. These states are described @@ -145,7 +110,7 @@ QT_BEGIN_NAMESPACE You can check for errors by connecting to the stateChanged() signal: - \snippet doc/src/snippets/audio/main.cpp 3 + \snippet doc/src/snippets/audio/main.cpp 8 \sa QAudioInput, QAudioDeviceInfo */ diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 8bd41a7..6c9bd54 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -2959,7 +2959,7 @@ QDomElement QDomNode::firstChildElement(const QString &tagName) const /*! Returns the last child element with tag name \a tagName if tagName is non-empty; - otherwise returns the first child element. Returns a null element if no + otherwise returns the last child element. Returns a null element if no such child exists. \sa firstChildElement() previousSiblingElement() nextSiblingElement() |