summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:45:32 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-05-12 12:45:32 (GMT)
commit1898c46452beae9e28cf9be7851099b4b4d2779e (patch)
tree00477e689bf1bd867fb3428476029b47817a9db8 /doc/src/snippets/code
parentf15b8a83e2e51955776a3f07cb85ebfc342dd8ef (diff)
parent4d5a5149b716c67f031a3a40e23370f90542c92f (diff)
downloadQt-1898c46452beae9e28cf9be7851099b4b4d2779e.zip
Qt-1898c46452beae9e28cf9be7851099b4b4d2779e.tar.gz
Qt-1898c46452beae9e28cf9be7851099b4b4d2779e.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-statemachine
Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'doc/src/snippets/code')
-rw-r--r--doc/src/snippets/code/doc_src_deployment.qdoc5
-rw-r--r--doc/src/snippets/code/doc_src_installation.qdoc2
-rw-r--r--doc/src/snippets/code/doc_src_properties.qdoc1
-rw-r--r--doc/src/snippets/code/doc_src_qtestlib.qdoc6
-rw-r--r--doc/src/snippets/code/doc_src_qtwebkit.qdoc8
-rw-r--r--doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp35
-rw-r--r--doc/src/snippets/code/src_corelib_global_qglobal.cpp8
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp5
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp2
-rw-r--r--doc/src/snippets/code/src_gui_util_qdesktopservices.cpp5
-rw-r--r--doc/src/snippets/code/src_qdbus_qdbusargument.cpp2
11 files changed, 27 insertions, 52 deletions
diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc
index 844041a..b8bf571 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -407,3 +407,8 @@ Versions/A/QuartzCore libphonon_qt7.dylib
QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
CONFIG+=x86 ppc
//! [53]
+
+
+//! [54]
+qApp->addLibraryPath("C:/customPath/plugins");
+//! [54]
diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc
index 66bb998..e35dad9 100644
--- a/doc/src/snippets/code/doc_src_installation.qdoc
+++ b/doc/src/snippets/code/doc_src_installation.qdoc
@@ -44,7 +44,7 @@ PATH - to locate qmake, moc and other Qt tools
//! [8]
C:
-cd /D C:\Qt\4.4.0-rc1
+cd /D C:\Qt\%VERSION%
configure
//! [8]
diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc
index ba7f79b..377cc9c 100644
--- a/doc/src/snippets/code/doc_src_properties.qdoc
+++ b/doc/src/snippets/code/doc_src_properties.qdoc
@@ -3,6 +3,7 @@ Q_PROPERTY(type name
READ getFunction
[WRITE setFunction]
[RESET resetFunction]
+ [NOTIFY notifySignal]
[DESIGNABLE bool]
[SCRIPTABLE bool]
[STORED bool]
diff --git a/doc/src/snippets/code/doc_src_qtestlib.qdoc b/doc/src/snippets/code/doc_src_qtestlib.qdoc
index a4ef52e..a0e4944 100644
--- a/doc/src/snippets/code/doc_src_qtestlib.qdoc
+++ b/doc/src/snippets/code/doc_src_qtestlib.qdoc
@@ -61,7 +61,7 @@ void TestQString::toUpper()
//! [9]
-/myTestDirectory$ qmake -project "QT += testlib"
+/myTestDirectory$ qmake -project "CONFIG += qtestlib"
/myTestDirectory$ qmake
/myTestDirectory$ make
//! [9]
@@ -69,7 +69,7 @@ void TestQString::toUpper()
//! [10]
********* Start testing of TestQString *********
-Config: Using QTest library 4.1.0, Qt 4.1.0
+Config: Using QTest library %VERSION%, Qt %VERSION%
PASS : TestQString::initTestCase()
PASS : TestQString::toUpper()
PASS : TestQString::cleanupTestCase()
@@ -99,4 +99,4 @@ private slots:
}
}
};
-//! [12] \ No newline at end of file
+//! [12]
diff --git a/doc/src/snippets/code/doc_src_qtwebkit.qdoc b/doc/src/snippets/code/doc_src_qtwebkit.qdoc
deleted file mode 100644
index d4fc2bd..0000000
--- a/doc/src/snippets/code/doc_src_qtwebkit.qdoc
+++ /dev/null
@@ -1,8 +0,0 @@
-//! [0]
-QT += webkit
-//! [0]
-
-
-//! [1]
-#include <QtWebKit>
-//! [1]
diff --git a/doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp b/doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp
deleted file mode 100644
index f04cd29..0000000
--- a/doc/src/snippets/code/src_3rdparty_webkit_WebKit_qt_Api_qwebview.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-
-void wrapInFunction()
-{
-
-//! [0]
- view->page()->history();
-//! [0]
-
-
-//! [1]
- view->page()->settings();
-//! [1]
-
-
-//! [2]
- view->triggerAction(QWebPage::Copy);
-//! [2]
-
-
-//! [3]
- view->page()->triggerPageAction(QWebPage::Stop);
-//! [3]
-
-
-//! [4]
- view->page()->triggerPageAction(QWebPage::GoBack);
-//! [4]
-
-
-//! [5]
- view->page()->triggerPageAction(QWebPage::GoForward);
-//! [5]
-
-}
-
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
index 72663e9..287181a 100644
--- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
@@ -456,3 +456,11 @@ class MyClass : public QObject
//! [45]
QWidget w = QWidget();
//! [45]
+
+//! [46]
+ // Instead of comparing with 0.0
+ qFuzzyCompare(0.0,1.0e-200); // This will return false
+ // Compare adding 1 to both values will fix the problem
+ qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true
+//! [46]
+
diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
index ca18465..c181a40 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp
@@ -71,7 +71,7 @@ for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i)
//! [methodCount]
//! [6]
-int methodIndex = pushButton->metaObject()->indexForMethod("animateClick");
+int methodIndex = pushButton->metaObject()->indexOfMethod("animateClick()");
QMetaMethod method = metaObject->method(methodIndex);
method.invoke(pushButton, Qt::QueuedConnection);
//! [6]
@@ -82,7 +82,8 @@ QMetaMethod::invoke: Unable to handle unregistered datatype 'MyType'
//! [8]
QString retVal;
-int methodIndex = obj->metaObject()->indexForMethod("compute");
+QByteArray normalizedSignature = QMetaObject::normalizedSignature("compute(QString, int, double)");
+int methodIndex = obj->metaObject()->indexOfMethod(normalizedSignature);
QMetaMethod method = metaObject->method(methodIndex);
method.invoke(obj,
Qt::DirectConnection,
diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp
index 355a237..783852b 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qmetatype.cpp
@@ -33,7 +33,7 @@ MyStruct s2 = var.value<MyStruct>();
//! [3]
int id = QMetaType::type("MyClass");
-if (id != -1) {
+if (id == 0) {
void *myClassPtr = QMetaType::construct(id);
...
QMetaType::destroy(id, myClassPtr);
diff --git a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp
index a9c630b..5001984 100644
--- a/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp
+++ b/doc/src/snippets/code/src_gui_util_qdesktopservices.cpp
@@ -11,7 +11,10 @@ public slots:
QDesktopServices::setUrlHandler("help", helpInstance, "showHelp");
//! [0]
-
//! [1]
mailto:user@foo.com?subject=Test&body=Just a test
//! [1]
+
+//! [2]
+QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode));
+//! [2]
diff --git a/doc/src/snippets/code/src_qdbus_qdbusargument.cpp b/doc/src/snippets/code/src_qdbus_qdbusargument.cpp
index b982510..efd54ac 100644
--- a/doc/src/snippets/code/src_qdbus_qdbusargument.cpp
+++ b/doc/src/snippets/code/src_qdbus_qdbusargument.cpp
@@ -4,7 +4,7 @@ struct MyStructure
int count;
QString name;
};
-QT_DECLARE_METATYPE(MyStructure)
+Q_DECLARE_METATYPE(MyStructure)
// Marshall the MyStructure data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const MyStructure &mystruct)