Various documentation fixes ported from 4.8
authorTeemu Katajisto <teemu.katajisto@digia.com>
Wed, 8 Feb 2012 11:42:41 +0000 (13:42 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 9 Feb 2012 11:51:57 +0000 (12:51 +0100)
Selected documentation fixes for qtbase from 4.8 commit
40fb4750910e23d3e7128ca8e0f1c5920b05bd5a

Task-number: QTBUG-8625
Task-number: QTBUG-19808
Task-number: QTBUG-1231
Task-number: QTBUG-21073
Task-number: QTBUG-8939
Task-number: QTBUG-20399
Task-number: QTBUG-20944
Task-number: QTBUG-22095
Task-number: QTBUG-11278
Task-number: QTBUG-15653

Change-Id: Ia4f59fce7c85f04b6da953a3988f705d9d9a658a
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
12 files changed:
doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp
doc/src/snippets/sqldatabase/sqldatabase.cpp
src/corelib/global/qnamespace.qdoc
src/corelib/io/qurl.cpp
src/corelib/kernel/qabstracteventdispatcher.cpp
src/corelib/kernel/qmetaobject.cpp
src/corelib/kernel/qobject.cpp
src/corelib/tools/qlocale.qdoc
src/corelib/tools/qregexp.cpp
src/widgets/graphicsview/qgraphicsitem.cpp
src/widgets/graphicsview/qgraphicslayout.cpp
src/xml/dom/qdom.cpp

index b1e5df9..9d72c42 100644 (file)
@@ -73,7 +73,7 @@ MyStruct s2 = var.value<MyStruct>();
 
 //! [3]
 int id = QMetaType::type("MyClass");
-if (id == 0) {
+if (id != 0) {
     void *myClassPtr = QMetaType::create(id);
     ...
     QMetaType::destroy(id, myClassPtr);
index 305c79e..81f8063 100644 (file)
@@ -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]
 
index ae395a2..da7bcb7 100644 (file)
 
     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()
 */
 
 /*!
index d74e7b8..ecd154b 100644 (file)
@@ -4176,6 +4176,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.
 
     The parsing mode \a parsingMode is used for parsing \a url.
 
index 31a46ad..0348faf 100644 (file)
@@ -135,8 +135,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, QThread
index 7975fc2..5ffa2d8 100644 (file)
@@ -1353,7 +1353,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
index 4377355..252a713 100644 (file)
@@ -2247,7 +2247,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()
 */
 QMetaObject::Connection QObject::connect(const QObject *sender, const char *signal,
                                      const QObject *receiver, const char *method,
index cc335a4..2fff583 100644 (file)
     \value Yugoslavia
     \value Zambia
     \value Zimbabwe
-    \value SerbiaAndMontenegro
     \value Montenegro
     \value Serbia
     \value SaintBarthelemy
index 421d15c..054ec1d 100644 (file)
@@ -426,7 +426,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
index ba3b496..ab03ff7 100644 (file)
@@ -11064,9 +11064,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()
 */
index cec5ba5..63f04f6 100644 (file)
@@ -103,6 +103,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.
 
+    QGraphicsLayout provides the addChildLayoutItem() convenience function to add
+    layout items to a custom layout. The function will automatically reparent
+    graphics items, if required.
+
     \section1 Activating the Layout
 
     When the layout's geometry changes, QGraphicsLayout immediately rearranges
index c84b1f6..f029b72 100644 (file)
@@ -2951,7 +2951,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()