summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2011-04-07 09:00:15 (GMT)
committeraavit <qt-info@nokia.com>2011-04-07 09:00:15 (GMT)
commita5416489043c985d62e5d22bf00f81d174f4605d (patch)
treef8ac6fb789a65815e003d789432855da7fa0240e /doc/src/snippets/code
parent2ff409e9eb9c39bcc36c9b0adace2680183af160 (diff)
parent8031eada2f81963865390b4d899631b09d4ca6f3 (diff)
downloadQt-a5416489043c985d62e5d22bf00f81d174f4605d.zip
Qt-a5416489043c985d62e5d22bf00f81d174f4605d.tar.gz
Qt-a5416489043c985d62e5d22bf00f81d174f4605d.tar.bz2
Merge remote branch 'qt-mainline/master'
Diffstat (limited to 'doc/src/snippets/code')
-rw-r--r--doc/src/snippets/code/src_corelib_global_qglobal.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
index 0b54cef..c79a714 100644
--- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
@@ -531,3 +531,27 @@ class MyClass : public QObject
//! [47]
CApaApplication *myApplicationFactory();
//! [47]
+
+//! [qlikely]
+ // the condition inside the "if" will be successful most of the times
+ for (int i = 1; i <= 365; i++) {
+ if (Q_LIKELY(isWorkingDay(i))) {
+ ...
+ }
+ ...
+ }
+//! [qlikely]
+
+//! [qunlikely]
+bool readConfiguration(const QFile &file)
+{
+ // We expect to be asked to read an existing file
+ if (Q_UNLIKELY(!file.exists())) {
+ qWarning() << "File not found";
+ return false;
+ }
+
+ ...
+ return true;
+}
+//! [qunlikely]