diff options
authorTopi Reinio <>2014-10-15 13:50:27 +0200
committerTopi Reiniƶ <>2014-10-17 14:57:13 +0200
commitcf8f369f8575dcb9ca4d5116f3afc7cff4a080af (patch)
parent45485d9eb47d3129b8a74c2e9d854c07673161cd (diff)
Move Qt Core examples under a common subdirectory
Qt Core examples were scattered into several subdirectories under qtbase/examples. This caused an issue with the example manifest file generated by QDoc; it expects to find all examples under a common directory in order to produde correct paths to the example .pro files. Qt Creator will not find the examples without a valid manifest file. This change moves the examples and edits the documentation files accordingly. Task-number: QTBUG-41963 Change-Id: I51d86782e0ba21c5c9bae5f15401ec774abe5cf8 Reviewed-by: Friedemann Kleint <> Reviewed-by: Oswald Buddenhagen <> Reviewed-by: Leena Miettinen <>
-rw-r--r--examples/corelib/ipc/README (renamed from examples/ipc/README)0
-rw-r--r--examples/corelib/ipc/doc/images/localfortuneclient-example.png (renamed from examples/ipc/doc/images/localfortuneclient-example.png)bin8402 -> 8402 bytes
-rw-r--r--examples/corelib/ipc/doc/images/localfortuneserver-example.png (renamed from examples/ipc/doc/images/localfortuneserver-example.png)bin5715 -> 5715 bytes
-rw-r--r--examples/corelib/ipc/doc/images/sharedmemory-example_1.png (renamed from examples/ipc/doc/images/sharedmemory-example_1.png)bin14926 -> 14926 bytes
-rw-r--r--examples/corelib/ipc/doc/images/sharedmemory-example_2.png (renamed from examples/ipc/doc/images/sharedmemory-example_2.png)bin21976 -> 21976 bytes
-rw-r--r--examples/corelib/ipc/doc/src/localfortuneclient.qdoc (renamed from examples/ipc/doc/src/localfortuneclient.qdoc)2
-rw-r--r--examples/corelib/ipc/doc/src/localfortuneserver.qdoc (renamed from examples/ipc/doc/src/localfortuneserver.qdoc)2
-rw-r--r--examples/corelib/ipc/doc/src/sharedmemory.qdoc (renamed from examples/ipc/doc/src/sharedmemory.qdoc)14
-rw-r--r--examples/corelib/ipc/ (renamed from examples/ipc/
-rw-r--r--examples/corelib/ipc/localfortuneclient/client.cpp (renamed from examples/ipc/localfortuneclient/client.cpp)0
-rw-r--r--examples/corelib/ipc/localfortuneclient/client.h (renamed from examples/ipc/localfortuneclient/client.h)0
-rw-r--r--examples/corelib/ipc/localfortuneclient/ (renamed from examples/ipc/localfortuneclient/
-rw-r--r--examples/corelib/ipc/localfortuneclient/main.cpp (renamed from examples/ipc/localfortuneclient/main.cpp)0
-rw-r--r--examples/corelib/ipc/localfortuneserver/ (renamed from examples/ipc/localfortuneserver/
-rw-r--r--examples/corelib/ipc/localfortuneserver/main.cpp (renamed from examples/ipc/localfortuneserver/main.cpp)0
-rw-r--r--examples/corelib/ipc/localfortuneserver/server.cpp (renamed from examples/ipc/localfortuneserver/server.cpp)0
-rw-r--r--examples/corelib/ipc/localfortuneserver/server.h (renamed from examples/ipc/localfortuneserver/server.h)0
-rw-r--r--examples/corelib/ipc/sharedmemory/dialog.cpp (renamed from examples/ipc/sharedmemory/dialog.cpp)0
-rw-r--r--examples/corelib/ipc/sharedmemory/dialog.h (renamed from examples/ipc/sharedmemory/dialog.h)0
-rw-r--r--examples/corelib/ipc/sharedmemory/dialog.ui (renamed from examples/ipc/sharedmemory/dialog.ui)0
-rw-r--r--examples/corelib/ipc/sharedmemory/image.png (renamed from examples/ipc/sharedmemory/image.png)bin10199 -> 10199 bytes
-rw-r--r--examples/corelib/ipc/sharedmemory/main.cpp (renamed from examples/ipc/sharedmemory/main.cpp)0
-rw-r--r--examples/corelib/ipc/sharedmemory/qt.png (renamed from examples/ipc/sharedmemory/qt.png)bin2383 -> 2383 bytes
-rw-r--r--examples/corelib/ipc/sharedmemory/ (renamed from examples/ipc/sharedmemory/
-rw-r--r--examples/corelib/json/ (renamed from examples/json/
-rw-r--r--examples/corelib/json/savegame/character.cpp (renamed from examples/json/savegame/character.cpp)0
-rw-r--r--examples/corelib/json/savegame/character.h (renamed from examples/json/savegame/character.h)0
-rw-r--r--examples/corelib/json/savegame/doc/src/savegame.qdoc (renamed from examples/json/savegame/doc/src/savegame.qdoc)30
-rw-r--r--examples/corelib/json/savegame/game.cpp (renamed from examples/json/savegame/game.cpp)0
-rw-r--r--examples/corelib/json/savegame/game.h (renamed from examples/json/savegame/game.h)0
-rw-r--r--examples/corelib/json/savegame/level.cpp (renamed from examples/json/savegame/level.cpp)0
-rw-r--r--examples/corelib/json/savegame/level.h (renamed from examples/json/savegame/level.h)0
-rw-r--r--examples/corelib/json/savegame/main.cpp (renamed from examples/json/savegame/main.cpp)0
-rw-r--r--examples/corelib/json/savegame/ (renamed from examples/json/savegame/
-rw-r--r--examples/corelib/threads/README (renamed from examples/threads/README)0
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot-example.png (renamed from examples/threads/doc/images/mandelbrot-example.png)bin84202 -> 84202 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_scroll1.png (renamed from examples/threads/doc/images/mandelbrot_scroll1.png)bin19615 -> 19615 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_scroll2.png (renamed from examples/threads/doc/images/mandelbrot_scroll2.png)bin13901 -> 13901 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_scroll3.png (renamed from examples/threads/doc/images/mandelbrot_scroll3.png)bin18976 -> 18976 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_zoom1.png (renamed from examples/threads/doc/images/mandelbrot_zoom1.png)bin16000 -> 16000 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_zoom2.png (renamed from examples/threads/doc/images/mandelbrot_zoom2.png)bin8163 -> 8163 bytes
-rw-r--r--examples/corelib/threads/doc/images/mandelbrot_zoom3.png (renamed from examples/threads/doc/images/mandelbrot_zoom3.png)bin9848 -> 9848 bytes
-rw-r--r--examples/corelib/threads/doc/images/queuedcustomtype-example.png (renamed from examples/threads/doc/images/queuedcustomtype-example.png)bin44851 -> 44851 bytes
-rw-r--r--examples/corelib/threads/doc/src/mandelbrot.qdoc (renamed from examples/threads/doc/src/mandelbrot.qdoc)68
-rw-r--r--examples/corelib/threads/doc/src/queuedcustomtype.qdoc (renamed from examples/threads/doc/src/queuedcustomtype.qdoc)24
-rw-r--r--examples/corelib/threads/doc/src/semaphores.qdoc (renamed from examples/threads/doc/src/semaphores.qdoc)16
-rw-r--r--examples/corelib/threads/doc/src/waitconditions.qdoc (renamed from examples/threads/doc/src/waitconditions.qdoc)16
-rw-r--r--examples/corelib/threads/mandelbrot/main.cpp (renamed from examples/threads/mandelbrot/main.cpp)0
-rw-r--r--examples/corelib/threads/mandelbrot/ (renamed from examples/threads/mandelbrot/
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp (renamed from examples/threads/mandelbrot/mandelbrotwidget.cpp)0
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.h (renamed from examples/threads/mandelbrot/mandelbrotwidget.h)0
-rw-r--r--examples/corelib/threads/mandelbrot/renderthread.cpp (renamed from examples/threads/mandelbrot/renderthread.cpp)0
-rw-r--r--examples/corelib/threads/mandelbrot/renderthread.h (renamed from examples/threads/mandelbrot/renderthread.h)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/block.cpp (renamed from examples/threads/queuedcustomtype/block.cpp)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/block.h (renamed from examples/threads/queuedcustomtype/block.h)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/main.cpp (renamed from examples/threads/queuedcustomtype/main.cpp)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/ (renamed from examples/threads/queuedcustomtype/
-rw-r--r--examples/corelib/threads/queuedcustomtype/renderthread.cpp (renamed from examples/threads/queuedcustomtype/renderthread.cpp)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/renderthread.h (renamed from examples/threads/queuedcustomtype/renderthread.h)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/window.cpp (renamed from examples/threads/queuedcustomtype/window.cpp)0
-rw-r--r--examples/corelib/threads/queuedcustomtype/window.h (renamed from examples/threads/queuedcustomtype/window.h)0
-rw-r--r--examples/corelib/threads/semaphores/semaphores.cpp (renamed from examples/threads/semaphores/semaphores.cpp)0
-rw-r--r--examples/corelib/threads/semaphores/ (renamed from examples/threads/semaphores/
-rw-r--r--examples/corelib/threads/ (renamed from examples/threads/
-rw-r--r--examples/corelib/threads/waitconditions/waitconditions.cpp (renamed from examples/threads/waitconditions/waitconditions.cpp)0
-rw-r--r--examples/corelib/threads/waitconditions/ (renamed from examples/threads/waitconditions/
-rw-r--r--examples/corelib/tools/README (renamed from examples/tools/README)0
-rw-r--r--examples/corelib/tools/contiguouscache/ (renamed from examples/tools/contiguouscache/
-rw-r--r--examples/corelib/tools/contiguouscache/main.cpp (renamed from examples/tools/contiguouscache/main.cpp)0
-rw-r--r--examples/corelib/tools/contiguouscache/randomlistmodel.cpp (renamed from examples/tools/contiguouscache/randomlistmodel.cpp)0
-rw-r--r--examples/corelib/tools/contiguouscache/randomlistmodel.h (renamed from examples/tools/contiguouscache/randomlistmodel.h)0
-rw-r--r--examples/corelib/tools/customtype/ (renamed from examples/tools/customtype/
-rw-r--r--examples/corelib/tools/customtype/main.cpp (renamed from examples/tools/customtype/main.cpp)0
-rw-r--r--examples/corelib/tools/customtype/message.cpp (renamed from examples/tools/customtype/message.cpp)0
-rw-r--r--examples/corelib/tools/customtype/message.h (renamed from examples/tools/customtype/message.h)0
-rw-r--r--examples/corelib/tools/customtypesending/ (renamed from examples/tools/customtypesending/
-rw-r--r--examples/corelib/tools/customtypesending/main.cpp (renamed from examples/tools/customtypesending/main.cpp)0
-rw-r--r--examples/corelib/tools/customtypesending/message.cpp (renamed from examples/tools/customtypesending/message.cpp)0
-rw-r--r--examples/corelib/tools/customtypesending/message.h (renamed from examples/tools/customtypesending/message.h)0
-rw-r--r--examples/corelib/tools/customtypesending/window.cpp (renamed from examples/tools/customtypesending/window.cpp)0
-rw-r--r--examples/corelib/tools/customtypesending/window.h (renamed from examples/tools/customtypesending/window.h)0
-rw-r--r--examples/corelib/tools/doc/src/contiguouscache.qdoc (renamed from examples/tools/doc/contiguouscache.qdoc)6
-rw-r--r--examples/corelib/tools/doc/src/customtype.qdoc (renamed from examples/tools/doc/src/customtype.qdoc)20
-rw-r--r--examples/corelib/tools/ (renamed from examples/tools/
89 files changed, 138 insertions, 131 deletions
diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf
index f5a4422601..01950e650c 100644
--- a/doc/global/manifest-meta.qdocconf
+++ b/doc/global/manifest-meta.qdocconf
@@ -255,7 +255,12 @@ manifestmeta.ios.tags = ios
# add a generic thumbnail image to examples that do not have any images in their documentation
manifestmeta.thumbnail.attributes = "imageUrl:qthelp\://org.qt-project.qtdoc.$QT_VERSION_TAG/qtdoc/images/qt-codesample.png"
-manifestmeta.thumbnail.names = "QtConcurrent/Map Example" \
+manifestmeta.thumbnail.names = "QtCore/Contiguous Cache Example" \
+ "QtCore/Custom Type Example" \
+ "QtCore/JSON Save Game Example" \
+ "QtCore/Semaphores Example" \
+ "QtCore/Wait Conditions Example" \
+ "QtConcurrent/Map Example" \
"QtConcurrent/QtConcurrent Word Count Example" \
"QtConcurrent/Run Function Example" \
"QtGui/Raster Window Example" \
diff --git a/examples/corelib/ b/examples/corelib/
new file mode 100644
index 0000000000..ec6e19c2b5
--- /dev/null
+++ b/examples/corelib/
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+CONFIG += no_docs_target
+ ipc \
+ json \
+ threads \
+ tools
diff --git a/examples/ipc/README b/examples/corelib/ipc/README
index 83a157a42e..83a157a42e 100644
--- a/examples/ipc/README
+++ b/examples/corelib/ipc/README
diff --git a/examples/ipc/doc/images/localfortuneclient-example.png b/examples/corelib/ipc/doc/images/localfortuneclient-example.png
index 614784bf0f..614784bf0f 100644
--- a/examples/ipc/doc/images/localfortuneclient-example.png
+++ b/examples/corelib/ipc/doc/images/localfortuneclient-example.png
Binary files differ
diff --git a/examples/ipc/doc/images/localfortuneserver-example.png b/examples/corelib/ipc/doc/images/localfortuneserver-example.png
index 2f04c7528e..2f04c7528e 100644
--- a/examples/ipc/doc/images/localfortuneserver-example.png
+++ b/examples/corelib/ipc/doc/images/localfortuneserver-example.png
Binary files differ
diff --git a/examples/ipc/doc/images/sharedmemory-example_1.png b/examples/corelib/ipc/doc/images/sharedmemory-example_1.png
index 53244d3f52..53244d3f52 100644
--- a/examples/ipc/doc/images/sharedmemory-example_1.png
+++ b/examples/corelib/ipc/doc/images/sharedmemory-example_1.png
Binary files differ
diff --git a/examples/ipc/doc/images/sharedmemory-example_2.png b/examples/corelib/ipc/doc/images/sharedmemory-example_2.png
index fc71aed56e..fc71aed56e 100644
--- a/examples/ipc/doc/images/sharedmemory-example_2.png
+++ b/examples/corelib/ipc/doc/images/sharedmemory-example_2.png
Binary files differ
diff --git a/examples/ipc/doc/src/localfortuneclient.qdoc b/examples/corelib/ipc/doc/src/localfortuneclient.qdoc
index a68f4bad0c..d7a90fd946 100644
--- a/examples/ipc/doc/src/localfortuneclient.qdoc
+++ b/examples/corelib/ipc/doc/src/localfortuneclient.qdoc
@@ -26,7 +26,7 @@
- \example localfortuneclient
+ \example ipc/localfortuneclient
\title Local Fortune Client Example
\ingroup examples-ipc
\brief Demonstrates using QLocalSocket for a simple local service client.
diff --git a/examples/ipc/doc/src/localfortuneserver.qdoc b/examples/corelib/ipc/doc/src/localfortuneserver.qdoc
index 13f7f3ca74..47c28e0eb0 100644
--- a/examples/ipc/doc/src/localfortuneserver.qdoc
+++ b/examples/corelib/ipc/doc/src/localfortuneserver.qdoc
@@ -26,7 +26,7 @@
- \example localfortuneserver
+ \example ipc/localfortuneserver
\title Local Fortune Server Example
\ingroup examples-ipc
\brief Demonstrates using QLocalServer and QLocalSocket for serving a simple local service.
diff --git a/examples/ipc/doc/src/sharedmemory.qdoc b/examples/corelib/ipc/doc/src/sharedmemory.qdoc
index b9f0c86d44..60b949df2d 100644
--- a/examples/ipc/doc/src/sharedmemory.qdoc
+++ b/examples/corelib/ipc/doc/src/sharedmemory.qdoc
@@ -26,7 +26,7 @@
- \example sharedmemory
+ \example ipc/sharedmemory
\title Shared Memory Example
\ingroup examples-ipc
\brief Demonstrates doing inter-process communication using shared memory with
@@ -40,7 +40,7 @@
dialog is displayed and then control is passed to the application in
the standard way.
- \snippet sharedmemory/main.cpp 0
+ \snippet ipc/sharedmemory/main.cpp 0
Two instances of class Dialog appear.
@@ -51,12 +51,12 @@
loadFromFile() and loadFromMemory() that correspond to the two
buttons on the dialog.
- \snippet sharedmemory/dialog.h 0
+ \snippet ipc/sharedmemory/dialog.h 0
The constructor builds the user interface widgets and connects the
clicked() signal of each button to the corresponding slot function.
- \snippet sharedmemory/dialog.cpp 0
+ \snippet ipc/sharedmemory/dialog.cpp 0
Note that "QSharedMemoryExample" is passed to the \l {QSharedMemory}
{QSharedMemory()} constructor to be used as the key. This will be
@@ -69,7 +69,7 @@
that segment is detached from the process, so we can be assured of
starting off the example correctly.
- \snippet sharedmemory/dialog.cpp 1
+ \snippet ipc/sharedmemory/dialog.cpp 1
The user is then asked to select an image file using
QFileDialog::getOpenFileName(). The selected file is loaded into a
@@ -85,7 +85,7 @@
to the image data, which we then use to do a memcopy() from the
QBuffer into the shared memory segment.
- \snippet sharedmemory/dialog.cpp 2
+ \snippet ipc/sharedmemory/dialog.cpp 2
Note that we \l {QSharedMemory::} {lock()} the shared memory segment
before we copy into it, and we \l {QSharedMemory::} {unlock()} it
@@ -117,7 +117,7 @@
then streams the data into a QImage and \l {QSharedMemory::unlock()}
{unlocks} the segment.
- \snippet sharedmemory/dialog.cpp 3
+ \snippet ipc/sharedmemory/dialog.cpp 3
In this case, the function does \l {QSharedMemory::} {detach()} from
the segment, because now we are effectively finished using
diff --git a/examples/ipc/ b/examples/corelib/ipc/
index 4b4b3870a4..4b4b3870a4 100644
--- a/examples/ipc/
+++ b/examples/corelib/ipc/
diff --git a/examples/ipc/localfortuneclient/client.cpp b/examples/corelib/ipc/localfortuneclient/client.cpp
index 267f5329c8..267f5329c8 100644
--- a/examples/ipc/localfortuneclient/client.cpp
+++ b/examples/corelib/ipc/localfortuneclient/client.cpp
diff --git a/examples/ipc/localfortuneclient/client.h b/examples/corelib/ipc/localfortuneclient/client.h
index 61b1cd26a4..61b1cd26a4 100644
--- a/examples/ipc/localfortuneclient/client.h
+++ b/examples/corelib/ipc/localfortuneclient/client.h
diff --git a/examples/ipc/localfortuneclient/ b/examples/corelib/ipc/localfortuneclient/
index c52a173ed5..912c0f3b8e 100644
--- a/examples/ipc/localfortuneclient/
+++ b/examples/corelib/ipc/localfortuneclient/
@@ -4,5 +4,5 @@ SOURCES = client.cpp \
QT += network widgets
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/ipc/localfortuneclient
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/localfortuneclient
INSTALLS += target
diff --git a/examples/ipc/localfortuneclient/main.cpp b/examples/corelib/ipc/localfortuneclient/main.cpp
index f197d7f6cb..f197d7f6cb 100644
--- a/examples/ipc/localfortuneclient/main.cpp
+++ b/examples/corelib/ipc/localfortuneclient/main.cpp
diff --git a/examples/ipc/localfortuneserver/ b/examples/corelib/ipc/localfortuneserver/
index 9eed28ef74..88190c45bd 100644
--- a/examples/ipc/localfortuneserver/
+++ b/examples/corelib/ipc/localfortuneserver/
@@ -4,5 +4,5 @@ SOURCES = server.cpp \
QT += network widgets
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/ipc/localfortuneserver
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/localfortuneserver
INSTALLS += target
diff --git a/examples/ipc/localfortuneserver/main.cpp b/examples/corelib/ipc/localfortuneserver/main.cpp
index 0ae70e14ef..0ae70e14ef 100644
--- a/examples/ipc/localfortuneserver/main.cpp
+++ b/examples/corelib/ipc/localfortuneserver/main.cpp
diff --git a/examples/ipc/localfortuneserver/server.cpp b/examples/corelib/ipc/localfortuneserver/server.cpp
index 6130aaa1c3..6130aaa1c3 100644
--- a/examples/ipc/localfortuneserver/server.cpp
+++ b/examples/corelib/ipc/localfortuneserver/server.cpp
diff --git a/examples/ipc/localfortuneserver/server.h b/examples/corelib/ipc/localfortuneserver/server.h
index 4ec7f9b8ef..4ec7f9b8ef 100644
--- a/examples/ipc/localfortuneserver/server.h
+++ b/examples/corelib/ipc/localfortuneserver/server.h
diff --git a/examples/ipc/sharedmemory/dialog.cpp b/examples/corelib/ipc/sharedmemory/dialog.cpp
index c504f3a202..c504f3a202 100644
--- a/examples/ipc/sharedmemory/dialog.cpp
+++ b/examples/corelib/ipc/sharedmemory/dialog.cpp
diff --git a/examples/ipc/sharedmemory/dialog.h b/examples/corelib/ipc/sharedmemory/dialog.h
index fbc39ed4c0..fbc39ed4c0 100644
--- a/examples/ipc/sharedmemory/dialog.h
+++ b/examples/corelib/ipc/sharedmemory/dialog.h
diff --git a/examples/ipc/sharedmemory/dialog.ui b/examples/corelib/ipc/sharedmemory/dialog.ui
index e99d6fb3c4..e99d6fb3c4 100644
--- a/examples/ipc/sharedmemory/dialog.ui
+++ b/examples/corelib/ipc/sharedmemory/dialog.ui
diff --git a/examples/ipc/sharedmemory/image.png b/examples/corelib/ipc/sharedmemory/image.png
index dd93453063..dd93453063 100644
--- a/examples/ipc/sharedmemory/image.png
+++ b/examples/corelib/ipc/sharedmemory/image.png
Binary files differ
diff --git a/examples/ipc/sharedmemory/main.cpp b/examples/corelib/ipc/sharedmemory/main.cpp
index 0e9f84f3e3..0e9f84f3e3 100644
--- a/examples/ipc/sharedmemory/main.cpp
+++ b/examples/corelib/ipc/sharedmemory/main.cpp
diff --git a/examples/ipc/sharedmemory/qt.png b/examples/corelib/ipc/sharedmemory/qt.png
index 60ef558efe..60ef558efe 100644
--- a/examples/ipc/sharedmemory/qt.png
+++ b/examples/corelib/ipc/sharedmemory/qt.png
Binary files differ
diff --git a/examples/ipc/sharedmemory/ b/examples/corelib/ipc/sharedmemory/
index a392f9542d..c1b634732e 100644
--- a/examples/ipc/sharedmemory/
+++ b/examples/corelib/ipc/sharedmemory/
@@ -11,5 +11,5 @@ FORMS += dialog.ui
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/ipc/sharedmemory
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/sharedmemory
INSTALLS += target
diff --git a/examples/json/ b/examples/corelib/json/
index af4d3e6f0f..af4d3e6f0f 100644
--- a/examples/json/
+++ b/examples/corelib/json/
diff --git a/examples/json/savegame/character.cpp b/examples/corelib/json/savegame/character.cpp
index ef30f0eaf4..ef30f0eaf4 100644
--- a/examples/json/savegame/character.cpp
+++ b/examples/corelib/json/savegame/character.cpp
diff --git a/examples/json/savegame/character.h b/examples/corelib/json/savegame/character.h
index 32369820f4..32369820f4 100644
--- a/examples/json/savegame/character.h
+++ b/examples/corelib/json/savegame/character.h
diff --git a/examples/json/savegame/doc/src/savegame.qdoc b/examples/corelib/json/savegame/doc/src/savegame.qdoc
index 872f2faf42..1de12c38b9 100644
--- a/examples/json/savegame/doc/src/savegame.qdoc
+++ b/examples/corelib/json/savegame/doc/src/savegame.qdoc
@@ -26,7 +26,7 @@
- \example savegame
+ \example json/savegame
\title JSON Save Game Example
\brief The JSON Save Game example demonstrates how to save and load a
@@ -50,12 +50,12 @@
It provides read() and write() functions to serialise its member variables.
- \snippet savegame/character.h 0
+ \snippet json/savegame/character.h 0
Of particular interest to us are the read and write function
- \snippet savegame/character.cpp 0
+ \snippet json/savegame/character.cpp 0
In the read() function, we assign Character's members values from the
QJsonObject argument. You can use either \l QJsonObject::operator[]() or
@@ -64,7 +64,7 @@
could check if the keys are valid before attempting to read them with
QJsonObject::contains(), but we assume that they are.
- \snippet savegame/character.cpp 1
+ \snippet json/savegame/character.cpp 1
In the write() function, we do the reverse of the read() function; assign
values from the Character object to the JSON object. As with accessing
@@ -74,13 +74,13 @@
Next up is the Level class:
- \snippet savegame/level.h 0
+ \snippet json/savegame/level.h 0
We want to have several levels in our game, each with several NPCs, so we
keep a QList of Character objects. We also provide the familiar read() and
write() functions.
- \snippet savegame/level.cpp 0
+ \snippet json/savegame/level.cpp 0
Containers can be written and read to and from JSON using QJsonArray. In our
case, we construct a QJsonArray from the value associated with the key
@@ -94,7 +94,7 @@
element is used as the key to construct the container when reading it back
- \snippet savegame/level.cpp 1
+ \snippet json/savegame/level.cpp 1
Again, the write() function is similar to the read() function, except
@@ -102,7 +102,7 @@
Having established the Character and Level classes, we can move on to
the Game class:
- \snippet savegame/game.h 0
+ \snippet json/savegame/game.h 0
First of all, we define the \c SaveFormat enum. This will allow us to
specify the format in which the game should be saved: \c Json or \c Binary.
@@ -112,12 +112,12 @@
The read() and write() functions are used by saveGame() and loadGame().
- \snippet savegame/game.cpp 0
+ \snippet json/savegame/game.cpp 0
To setup a new game, we create the player and populate the levels and their
- \snippet savegame/game.cpp 1
+ \snippet json/savegame/game.cpp 1
The first thing we do in the read() function is tell the player to read
itself. We then clear the levels list so that calling loadGame() on the same
@@ -125,11 +125,11 @@
We then populate the level list by reading each Level from a QJsonArray.
- \snippet savegame/game.cpp 2
+ \snippet json/savegame/game.cpp 2
We write the game to JSON similarly to how we write Level.
- \snippet savegame/game.cpp 3
+ \snippet json/savegame/game.cpp 3
When loading a saved game in loadGame(), the first thing we do is open the
save file based on which format it was saved to; \c "save.json" for JSON,
@@ -144,7 +144,7 @@
After constructing the QJsonDocument, we instruct the Game object to read
itself and then return \c true to indicate success.
- \snippet savegame/game.cpp 4
+ \snippet json/savegame/game.cpp 4
Not surprisingly, saveGame() looks very much like loadGame(). We determine
the file extension based on the format, print a warning and return \c false
@@ -155,7 +155,7 @@
We are now ready to enter main():
- \snippet savegame/main.cpp 0
+ \snippet json/savegame/main.cpp 0
Since we're only interested in demonstrating \e serialization of a game with
JSON, our game is not actually playable. Therefore, we only need
@@ -163,7 +163,7 @@
the player had a great time and made lots of progress, altering the internal
state of our Character, Level and Game objects.
- \snippet savegame/main.cpp 1
+ \snippet json/savegame/main.cpp 1
When the player has finished, we save their game. For demonstration
purposes, we serialize to both JSON and binary. You can examine the contents
diff --git a/examples/json/savegame/game.cpp b/examples/corelib/json/savegame/game.cpp
index a08071b208..a08071b208 100644
--- a/examples/json/savegame/game.cpp
+++ b/examples/corelib/json/savegame/game.cpp
diff --git a/examples/json/savegame/game.h b/examples/corelib/json/savegame/game.h
index 9216a373d1..9216a373d1 100644
--- a/examples/json/savegame/game.h
+++ b/examples/corelib/json/savegame/game.h
diff --git a/examples/json/savegame/level.cpp b/examples/corelib/json/savegame/level.cpp
index afbd3e0fa0..afbd3e0fa0 100644
--- a/examples/json/savegame/level.cpp
+++ b/examples/corelib/json/savegame/level.cpp
diff --git a/examples/json/savegame/level.h b/examples/corelib/json/savegame/level.h
index 6cdf508c87..6cdf508c87 100644
--- a/examples/json/savegame/level.h
+++ b/examples/corelib/json/savegame/level.h
diff --git a/examples/json/savegame/main.cpp b/examples/corelib/json/savegame/main.cpp
index 1b44306bb0..1b44306bb0 100644
--- a/examples/json/savegame/main.cpp
+++ b/examples/corelib/json/savegame/main.cpp
diff --git a/examples/json/savegame/ b/examples/corelib/json/savegame/
index fd754ace80..6706444506 100644
--- a/examples/json/savegame/
+++ b/examples/corelib/json/savegame/
@@ -8,7 +8,7 @@ CONFIG -= app_bundle
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/json/savegame
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/json/savegame
INSTALLS += target
SOURCES += main.cpp \
diff --git a/examples/threads/README b/examples/corelib/threads/README
index 6c20844564..6c20844564 100644
--- a/examples/threads/README
+++ b/examples/corelib/threads/README
diff --git a/examples/threads/doc/images/mandelbrot-example.png b/examples/corelib/threads/doc/images/mandelbrot-example.png
index f5817834e1..f5817834e1 100644
--- a/examples/threads/doc/images/mandelbrot-example.png
+++ b/examples/corelib/threads/doc/images/mandelbrot-example.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_scroll1.png b/examples/corelib/threads/doc/images/mandelbrot_scroll1.png
index b800455821..b800455821 100644
--- a/examples/threads/doc/images/mandelbrot_scroll1.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_scroll1.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_scroll2.png b/examples/corelib/threads/doc/images/mandelbrot_scroll2.png
index 704ea0a7c1..704ea0a7c1 100644
--- a/examples/threads/doc/images/mandelbrot_scroll2.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_scroll2.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_scroll3.png b/examples/corelib/threads/doc/images/mandelbrot_scroll3.png
index 8b48211444..8b48211444 100644
--- a/examples/threads/doc/images/mandelbrot_scroll3.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_scroll3.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_zoom1.png b/examples/corelib/threads/doc/images/mandelbrot_zoom1.png
index 30190e44eb..30190e44eb 100644
--- a/examples/threads/doc/images/mandelbrot_zoom1.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_zoom1.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_zoom2.png b/examples/corelib/threads/doc/images/mandelbrot_zoom2.png
index 148ac777b8..148ac777b8 100644
--- a/examples/threads/doc/images/mandelbrot_zoom2.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_zoom2.png
Binary files differ
diff --git a/examples/threads/doc/images/mandelbrot_zoom3.png b/examples/corelib/threads/doc/images/mandelbrot_zoom3.png
index a669f4b5fe..a669f4b5fe 100644
--- a/examples/threads/doc/images/mandelbrot_zoom3.png
+++ b/examples/corelib/threads/doc/images/mandelbrot_zoom3.png
Binary files differ
diff --git a/examples/threads/doc/images/queuedcustomtype-example.png b/examples/corelib/threads/doc/images/queuedcustomtype-example.png
index 4399b631d7..4399b631d7 100644
--- a/examples/threads/doc/images/queuedcustomtype-example.png
+++ b/examples/corelib/threads/doc/images/queuedcustomtype-example.png
Binary files differ
diff --git a/examples/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc
index c1393769f1..75d424e6a4 100644
--- a/examples/threads/doc/src/mandelbrot.qdoc
+++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc
@@ -26,7 +26,7 @@
- \example mandelbrot
+ \example threads/mandelbrot
\title Mandelbrot Example
\ingroup qtconcurrent-mtexamples
@@ -101,7 +101,7 @@
We'll start with the definition of the \c RenderThread class:
- \snippet mandelbrot/renderthread.h 0
+ \snippet threads/mandelbrot/renderthread.h 0
The class inherits QThread so that it gains the ability to run in
a separate thread. Apart from the constructor and destructor, \c
@@ -117,7 +117,7 @@
\section1 RenderThread Class Implementation
- \snippet mandelbrot/renderthread.cpp 0
+ \snippet threads/mandelbrot/renderthread.cpp 0
In the constructor, we initialize the \c restart and \c abort
variables to \c false. These variables control the flow of the \c
@@ -126,7 +126,7 @@
We also initialize the \c colormap array, which contains a series
of RGB colors.
- \snippet mandelbrot/renderthread.cpp 1
+ \snippet threads/mandelbrot/renderthread.cpp 1
The destructor can be called at any point while the thread is
active. We set \c abort to \c true to tell \c run() to stop
@@ -147,7 +147,7 @@
until \c run() has exited before the base class destructor is
- \snippet mandelbrot/renderthread.cpp 2
+ \snippet threads/mandelbrot/renderthread.cpp 2
The \c render() function is called by the \c MandelbrotWidget
whenever it needs to generate a new image of the Mandelbrot set.
@@ -161,7 +161,7 @@
computation and start again with the new parameters) and wakes up
the thread, which might be sleeping.
- \snippet mandelbrot/renderthread.cpp 3
+ \snippet threads/mandelbrot/renderthread.cpp 3
\c run() is quite a big function, so we'll break it down into
@@ -177,10 +177,10 @@
The \c forever keyword is, like \c foreach, a Qt pseudo-keyword.
- \snippet mandelbrot/renderthread.cpp 4
- \snippet mandelbrot/renderthread.cpp 5
- \snippet mandelbrot/renderthread.cpp 6
- \snippet mandelbrot/renderthread.cpp 7
+ \snippet threads/mandelbrot/renderthread.cpp 4
+ \snippet threads/mandelbrot/renderthread.cpp 5
+ \snippet threads/mandelbrot/renderthread.cpp 6
+ \snippet threads/mandelbrot/renderthread.cpp 7
Then comes the core of the algorithm. Instead of trying to create
a perfect Mandelbrot set image, we do multiple passes and
@@ -197,15 +197,15 @@
The core algorithm is beyond the scope of this tutorial.
- \snippet mandelbrot/renderthread.cpp 8
- \snippet mandelbrot/renderthread.cpp 9
+ \snippet threads/mandelbrot/renderthread.cpp 8
+ \snippet threads/mandelbrot/renderthread.cpp 9
Once we're done with all the iterations, we call
QWaitCondition::wait() to put the thread to sleep by calling,
unless \c restart is \c true. There's no use in keeping a worker
thread looping indefinitely while there's nothing to do.
- \snippet mandelbrot/renderthread.cpp 10
+ \snippet threads/mandelbrot/renderthread.cpp 10
The \c rgbFromWaveLength() function is a helper function that
converts a wave length to a RGB value compatible with 32-bit
@@ -217,7 +217,7 @@
The \c MandelbrotWidget class uses \c RenderThread to draw the
Mandelbrot set on screen. Here's the class definition:
- \snippet mandelbrot/mandelbrotwidget.h 0
+ \snippet threads/mandelbrot/mandelbrotwidget.h 0
The widget reimplements many event handlers from QWidget. In
addition, it has an \c updatePixmap() slot that we'll connect to
@@ -230,12 +230,12 @@
\section1 MandelbrotWidget Class Implementation
- \snippet mandelbrot/mandelbrotwidget.cpp 0
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 0
The implementation starts with a few contants that we'll need
later on.
- \snippet mandelbrot/mandelbrotwidget.cpp 1
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 1
The interesting part of the constructor is the
qRegisterMetaType() and QObject::connect() calls. Let's start
@@ -258,19 +258,19 @@
template function qRegisterMetaType() before we can use QImage
as parameter in queued connections.
- \snippet mandelbrot/mandelbrotwidget.cpp 2
- \snippet mandelbrot/mandelbrotwidget.cpp 3
- \snippet mandelbrot/mandelbrotwidget.cpp 4
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 2
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 3
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 4
In \l{QWidget::paintEvent()}{paintEvent()}, we start by filling
the background with black. If we have nothing yet to paint (\c
pixmap is null), we print a message on the widget asking the user
to be patient and return from the function immediately.
- \snippet mandelbrot/mandelbrotwidget.cpp 5
- \snippet mandelbrot/mandelbrotwidget.cpp 6
- \snippet mandelbrot/mandelbrotwidget.cpp 7
- \snippet mandelbrot/mandelbrotwidget.cpp 8
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 5
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 6
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 7
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 8
If the pixmap has the right scale factor, we draw the pixmap directly onto
the widget. Otherwise, we scale and translate the \l{Coordinate
@@ -280,12 +280,12 @@
QPainter::save() and QPainter::restore() make sure that any painting
performed afterwards uses the standard coordinate system.
- \snippet mandelbrot/mandelbrotwidget.cpp 9
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 9
At the end of the paint event handler, we draw a text string and
a semi-transparent rectangle on top of the fractal.
- \snippet mandelbrot/mandelbrotwidget.cpp 10
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 10
Whenever the user resizes the widget, we call \c render() to
start generating a new image, with the same \c centerX, \c
@@ -295,13 +295,13 @@
called by Qt when the widget is shown the first time to generate
the image the very first time.
- \snippet mandelbrot/mandelbrotwidget.cpp 11
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 11
The key press event handler provides a few keyboard bindings for
the benefit of users who don't have a mouse. The \c zoom() and \c
scroll() functions will be covered later.
- \snippet mandelbrot/mandelbrotwidget.cpp 12
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 12
The wheel event handler is reimplemented to make the mouse wheel
control the zoom level. QWheelEvent::delta() returns the angle of
@@ -312,18 +312,18 @@
(i.e., +30 degrees), the zoom factor becomes \c ZoomInFactor
to the second power, i.e. 0.8 * 0.8 = 0.64.
- \snippet mandelbrot/mandelbrotwidget.cpp 13
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 13
When the user presses the left mouse button, we store the mouse
pointer position in \c lastDragPos.
- \snippet mandelbrot/mandelbrotwidget.cpp 14
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 14
When the user moves the mouse pointer while the left mouse button
is pressed, we adjust \c pixmapOffset to paint the pixmap at a
shifted position and call QWidget::update() to force a repaint.
- \snippet mandelbrot/mandelbrotwidget.cpp 15
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 15
When the left mouse button is released, we update \c pixmapOffset
just like we did on a mouse move and we reset \c lastDragPos to a
@@ -332,7 +332,7 @@
because areas revealed when dragging the pixmap are drawn in
- \snippet mandelbrot/mandelbrotwidget.cpp 16
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 16
The \c updatePixmap() slot is invoked when the worker thread has
finished rendering an image. We start by checking whether a drag
@@ -349,14 +349,14 @@
be converted into a pixmap. It's better to do the conversion once
and for all here, rather than in \c paintEvent().
- \snippet mandelbrot/mandelbrotwidget.cpp 17
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 17
In \c zoom(), we recompute \c curScale. Then we call
QWidget::update() to draw a scaled pixmap, and we ask the worker
thread to render a new image corresponding to the new \c curScale
- \snippet mandelbrot/mandelbrotwidget.cpp 18
+ \snippet threads/mandelbrot/mandelbrotwidget.cpp 18
\c scroll() is similar to \c zoom(), except that the affected
parameters are \c centerX and \c centerY.
@@ -366,5 +366,5 @@
The application's multithreaded nature has no impact on its \c
main() function, which is as simple as usual:
- \snippet mandelbrot/main.cpp 0
+ \snippet threads/mandelbrot/main.cpp 0
diff --git a/examples/threads/doc/src/queuedcustomtype.qdoc b/examples/corelib/threads/doc/src/queuedcustomtype.qdoc
index 40ec2668de..cca68b4513 100644
--- a/examples/threads/doc/src/queuedcustomtype.qdoc
+++ b/examples/corelib/threads/doc/src/queuedcustomtype.qdoc
@@ -26,7 +26,7 @@
- \example queuedcustomtype
+ \example threads/queuedcustomtype
\title Queued Custom Type Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
@@ -57,7 +57,7 @@
constructor and destructor in the public section of the class that the
meta-object system requires. It describes a colored rectangle.
- \snippet queuedcustomtype/block.h custom type definition and meta-type declaration
+ \snippet threads/queuedcustomtype/block.h custom type definition and meta-type declaration
We will still need to register it with the meta-object system at
run-time by calling the qRegisterMetaType() template function before
@@ -74,7 +74,7 @@
\c Block object. The rest of the class is concerned with managing the
user interface and handling images.
- \snippet queuedcustomtype/window.h Window class definition
+ \snippet threads/queuedcustomtype/window.h Window class definition
The \c Window class also contains a worker thread, provided by a
\c RenderThread object. This will emit signals to send \c Block objects
@@ -87,22 +87,22 @@
interface containing a label and two push buttons that are connected to
slots in the same class.
- \snippet queuedcustomtype/window.cpp Window constructor start
- \snippet queuedcustomtype/window.cpp set up widgets and connections
- \snippet queuedcustomtype/window.cpp connecting signal with custom type
+ \snippet threads/queuedcustomtype/window.cpp Window constructor start
+ \snippet threads/queuedcustomtype/window.cpp set up widgets and connections
+ \snippet threads/queuedcustomtype/window.cpp connecting signal with custom type
In the last of these connections, we connect a signal in the
\c RenderThread object to the \c addBlock(Block) slot in the window.
- \snippet queuedcustomtype/window.cpp Window constructor finish
+ \snippet threads/queuedcustomtype/window.cpp Window constructor finish
The rest of the constructor simply sets up the layout of the window.
The \c addBlock(Block) slot receives blocks from the rendering thread via
the signal-slot connection set up in the constructor:
- \snippet queuedcustomtype/window.cpp Adding blocks to the display
+ \snippet threads/queuedcustomtype/window.cpp Adding blocks to the display
We simply paint these onto the label as they arrive.
@@ -112,7 +112,7 @@
and using the \c sendBlock(Block) signal to send them to other components
in the example.
- \snippet queuedcustomtype/renderthread.h RenderThread class definition
+ \snippet threads/queuedcustomtype/renderthread.h RenderThread class definition
The constructor and destructor are not quoted here. These take care of
setting up the thread's internal state and cleaning up when it is destroyed.
@@ -120,13 +120,13 @@
Processing is started with the \c processImage() function, which calls the
\c RenderThread class's reimplementation of the QThread::run() function:
- \snippet queuedcustomtype/renderthread.cpp processing the image (start)
+ \snippet threads/queuedcustomtype/renderthread.cpp processing the image (start)
Ignoring the details of the way the image is processed, we see that the
signal containing a block is emitted in the usual way:
- \snippet queuedcustomtype/renderthread.cpp processing the image (finish)
+ \snippet threads/queuedcustomtype/renderthread.cpp processing the image (finish)
Each signal that is emitted will be queued and delivered later to the
window's \c addBlock(Block) slot.
@@ -137,7 +137,7 @@
\c Block class as a custom type with the meta-object system by calling the
qRegisterMetaType() template function:
- \snippet queuedcustomtype/main.cpp main function
+ \snippet threads/queuedcustomtype/main.cpp main function
This call is placed here to ensure that the type is registered before any
signal-slot connections are made that use it.
diff --git a/examples/threads/doc/src/semaphores.qdoc b/examples/corelib/threads/doc/src/semaphores.qdoc
index e90045f824..0b1a2e852e 100644
--- a/examples/threads/doc/src/semaphores.qdoc
+++ b/examples/corelib/threads/doc/src/semaphores.qdoc
@@ -26,7 +26,7 @@
- \example semaphores
+ \example threads/semaphores
\title Semaphores Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
@@ -61,7 +61,7 @@
Let's start by reviewing the circular buffer and the associated
- \snippet semaphores/semaphores.cpp 0
+ \snippet threads/semaphores/semaphores.cpp 0
\c DataSize is the amout of data that the producer will generate.
To keep the example as simple as possible, we make it a constant.
@@ -89,8 +89,8 @@
Let's review the code for the \c Producer class:
- \snippet semaphores/semaphores.cpp 1
- \snippet semaphores/semaphores.cpp 2
+ \snippet threads/semaphores/semaphores.cpp 1
+ \snippet threads/semaphores/semaphores.cpp 2
The producer generates \c DataSize bytes of data. Before it
writes a byte to the circular buffer, it must acquire a "free"
@@ -106,8 +106,8 @@
Let's now turn to the \c Consumer class:
- \snippet semaphores/semaphores.cpp 3
- \snippet semaphores/semaphores.cpp 4
+ \snippet threads/semaphores/semaphores.cpp 3
+ \snippet threads/semaphores/semaphores.cpp 4
The code is very similar to the producer, except that this time
we acquire a "used" byte and release a "free" byte, instead of
@@ -118,8 +118,8 @@
In \c main(), we create the two threads and call QThread::wait()
to ensure that both threads get time to finish before we exit:
- \snippet semaphores/semaphores.cpp 5
- \snippet semaphores/semaphores.cpp 6
+ \snippet threads/semaphores/semaphores.cpp 5
+ \snippet threads/semaphores/semaphores.cpp 6
So what happens when we run the program? Initially, the producer
thread is the only one that can do anything; the consumer is
diff --git a/examples/threads/doc/src/waitconditions.qdoc b/examples/corelib/threads/doc/src/waitconditions.qdoc
index 25c9ce88fb..aff6997b55 100644
--- a/examples/threads/doc/src/waitconditions.qdoc
+++ b/examples/corelib/threads/doc/src/waitconditions.qdoc
@@ -26,7 +26,7 @@
- \example waitconditions
+ \example threads/waitconditions
\title Wait Conditions Example
\brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples
@@ -61,7 +61,7 @@
Let's start by reviewing the circular buffer and the associated
synchronization tools:
- \snippet waitconditions/waitconditions.cpp 0
+ \snippet threads/waitconditions/waitconditions.cpp 0
\c DataSize is the amount of data that the producer will generate.
To keep the example as simple as possible, we make it a constant.
@@ -86,8 +86,8 @@
Let's review the code for the \c Producer class:
- \snippet waitconditions/waitconditions.cpp 1
- \snippet waitconditions/waitconditions.cpp 2
+ \snippet threads/waitconditions/waitconditions.cpp 1
+ \snippet threads/waitconditions/waitconditions.cpp 2
The producer generates \c DataSize bytes of data. Before it
writes a byte to the circular buffer, it must first check whether
@@ -110,8 +110,8 @@
Let's turn to the \c Consumer class:
- \snippet waitconditions/waitconditions.cpp 3
- \snippet waitconditions/waitconditions.cpp 4
+ \snippet threads/waitconditions/waitconditions.cpp 3
+ \snippet threads/waitconditions/waitconditions.cpp 4
The code is very similar to the producer. Before we read the
byte, we check whether the buffer is empty (\c numUsedBytes is 0)
@@ -126,8 +126,8 @@
In \c main(), we create the two threads and call QThread::wait()
to ensure that both threads get time to finish before we exit:
- \snippet waitconditions/waitconditions.cpp 5
- \snippet waitconditions/waitconditions.cpp 6
+ \snippet threads/waitconditions/waitconditions.cpp 5
+ \snippet threads/waitconditions/waitconditions.cpp 6
So what happens when we run the program? Initially, the producer
thread is the only one that can do anything; the consumer is
diff --git a/examples/threads/mandelbrot/main.cpp b/examples/corelib/threads/mandelbrot/main.cpp
index 8334d94f9c..8334d94f9c 100644
--- a/examples/threads/mandelbrot/main.cpp
+++ b/examples/corelib/threads/mandelbrot/main.cpp
diff --git a/examples/threads/mandelbrot/ b/examples/corelib/threads/mandelbrot/
index 45f21baf08..5a01a405f2 100644
--- a/examples/threads/mandelbrot/
+++ b/examples/corelib/threads/mandelbrot/
@@ -9,5 +9,5 @@ SOURCES = main.cpp \
unix:!mac:!vxworks:!integrity:LIBS += -lm
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/mandelbrot
INSTALLS += target
diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
index 633d4a1ec5..633d4a1ec5 100644
--- a/examples/threads/mandelbrot/mandelbrotwidget.cpp
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
diff --git a/examples/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h
index 183edf2e26..183edf2e26 100644
--- a/examples/threads/mandelbrot/mandelbrotwidget.h
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h
diff --git a/examples/threads/mandelbrot/renderthread.cpp b/examples/corelib/threads/mandelbrot/renderthread.cpp
index 5779c65c9c..5779c65c9c 100644
--- a/examples/threads/mandelbrot/renderthread.cpp
+++ b/examples/corelib/threads/mandelbrot/renderthread.cpp
diff --git a/examples/threads/mandelbrot/renderthread.h b/examples/corelib/threads/mandelbrot/renderthread.h
index 881870665f..881870665f 100644
--- a/examples/threads/mandelbrot/renderthread.h
+++ b/examples/corelib/threads/mandelbrot/renderthread.h
diff --git a/examples/threads/queuedcustomtype/block.cpp b/examples/corelib/threads/queuedcustomtype/block.cpp
index 07bd58cd97..07bd58cd97 100644
--- a/examples/threads/queuedcustomtype/block.cpp
+++ b/examples/corelib/threads/queuedcustomtype/block.cpp
diff --git a/examples/threads/queuedcustomtype/block.h b/examples/corelib/threads/queuedcustomtype/block.h
index f9930340e2..f9930340e2 100644
--- a/examples/threads/queuedcustomtype/block.h
+++ b/examples/corelib/threads/queuedcustomtype/block.h
diff --git a/examples/threads/queuedcustomtype/main.cpp b/examples/corelib/threads/queuedcustomtype/main.cpp
index 98933c66f3..98933c66f3 100644
--- a/examples/threads/queuedcustomtype/main.cpp
+++ b/examples/corelib/threads/queuedcustomtype/main.cpp
diff --git a/examples/threads/queuedcustomtype/ b/examples/corelib/threads/queuedcustomtype/
index 8b18b13ba6..77421eb638 100644
--- a/examples/threads/queuedcustomtype/
+++ b/examples/corelib/threads/queuedcustomtype/
@@ -8,7 +8,7 @@ SOURCES = main.cpp \
QT += widgets
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/mandelbrot
INSTALLS += target
diff --git a/examples/threads/queuedcustomtype/renderthread.cpp b/examples/corelib/threads/queuedcustomtype/renderthread.cpp
index 50a638987f..50a638987f 100644
--- a/examples/threads/queuedcustomtype/renderthread.cpp
+++ b/examples/corelib/threads/queuedcustomtype/renderthread.cpp
diff --git a/examples/threads/queuedcustomtype/renderthread.h b/examples/corelib/threads/queuedcustomtype/renderthread.h
index 5630926d41..5630926d41 100644
--- a/examples/threads/queuedcustomtype/renderthread.h
+++ b/examples/corelib/threads/queuedcustomtype/renderthread.h
diff --git a/examples/threads/queuedcustomtype/window.cpp b/examples/corelib/threads/queuedcustomtype/window.cpp
index 8afb8b6782..8afb8b6782 100644
--- a/examples/threads/queuedcustomtype/window.cpp
+++ b/examples/corelib/threads/queuedcustomtype/window.cpp
diff --git a/examples/threads/queuedcustomtype/window.h b/examples/corelib/threads/queuedcustomtype/window.h
index cb648f1be2..cb648f1be2 100644
--- a/examples/threads/queuedcustomtype/window.h
+++ b/examples/corelib/threads/queuedcustomtype/window.h
diff --git a/examples/threads/semaphores/semaphores.cpp b/examples/corelib/threads/semaphores/semaphores.cpp
index f519e5f323..f519e5f323 100644
--- a/examples/threads/semaphores/semaphores.cpp
+++ b/examples/corelib/threads/semaphores/semaphores.cpp
diff --git a/examples/threads/semaphores/ b/examples/corelib/threads/semaphores/
index 7dfe7c3ba0..69154e57eb 100644
--- a/examples/threads/semaphores/
+++ b/examples/corelib/threads/semaphores/
@@ -5,5 +5,5 @@ CONFIG -= app_bundle
CONFIG += console
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/threads/semaphores
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/semaphores
INSTALLS += target
diff --git a/examples/threads/ b/examples/corelib/threads/
index e47da84a06..e47da84a06 100644
--- a/examples/threads/
+++ b/examples/corelib/threads/
diff --git a/examples/threads/waitconditions/waitconditions.cpp b/examples/corelib/threads/waitconditions/waitconditions.cpp
index b0336f4c2b..b0336f4c2b 100644
--- a/examples/threads/waitconditions/waitconditions.cpp
+++ b/examples/corelib/threads/waitconditions/waitconditions.cpp
diff --git a/examples/threads/waitconditions/ b/examples/corelib/threads/waitconditions/
index 7f9491a0b1..2dbe7df68a 100644
--- a/examples/threads/waitconditions/
+++ b/examples/corelib/threads/waitconditions/
@@ -5,5 +5,5 @@ CONFIG += console
SOURCES += waitconditions.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/threads/waitconditions
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/waitconditions
INSTALLS += target
diff --git a/examples/tools/README b/examples/corelib/tools/README
index db5c107c82..db5c107c82 100644
--- a/examples/tools/README
+++ b/examples/corelib/tools/README
diff --git a/examples/tools/contiguouscache/ b/examples/corelib/tools/contiguouscache/
index d384a1845a..fb2267fc64 100644
--- a/examples/tools/contiguouscache/
+++ b/examples/corelib/tools/contiguouscache/
@@ -5,5 +5,5 @@ SOURCES = randomlistmodel.cpp \
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/contiguouscache
INSTALLS += target
diff --git a/examples/tools/contiguouscache/main.cpp b/examples/corelib/tools/contiguouscache/main.cpp
index 62fa8dcf42..62fa8dcf42 100644
--- a/examples/tools/contiguouscache/main.cpp
+++ b/examples/corelib/tools/contiguouscache/main.cpp
diff --git a/examples/tools/contiguouscache/randomlistmodel.cpp b/examples/corelib/tools/contiguouscache/randomlistmodel.cpp
index cd1a301dc7..cd1a301dc7 100644
--- a/examples/tools/contiguouscache/randomlistmodel.cpp
+++ b/examples/corelib/tools/contiguouscache/randomlistmodel.cpp
diff --git a/examples/tools/contiguouscache/randomlistmodel.h b/examples/corelib/tools/contiguouscache/randomlistmodel.h
index 3acafc23ff..3acafc23ff 100644
--- a/examples/tools/contiguouscache/randomlistmodel.h
+++ b/examples/corelib/tools/contiguouscache/randomlistmodel.h
diff --git a/examples/tools/customtype/ b/examples/corelib/tools/customtype/
index d05540f403..1bd792db85 100644
--- a/examples/tools/customtype/
+++ b/examples/corelib/tools/customtype/
@@ -4,5 +4,5 @@ SOURCES = main.cpp \
QT += widgets
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/customcompleter
INSTALLS += target
diff --git a/examples/tools/customtype/main.cpp b/examples/corelib/tools/customtype/main.cpp
index 8e97d3db96..8e97d3db96 100644
--- a/examples/tools/customtype/main.cpp
+++ b/examples/corelib/tools/customtype/main.cpp
diff --git a/examples/tools/customtype/message.cpp b/examples/corelib/tools/customtype/message.cpp
index c470ab116e..c470ab116e 100644
--- a/examples/tools/customtype/message.cpp
+++ b/examples/corelib/tools/customtype/message.cpp
diff --git a/examples/tools/customtype/message.h b/examples/corelib/tools/customtype/message.h
index cdc4e39caf..cdc4e39caf 100644
--- a/examples/tools/customtype/message.h
+++ b/examples/corelib/tools/customtype/message.h
diff --git a/examples/tools/customtypesending/ b/examples/corelib/tools/customtypesending/
index faa07bf339..672f6569c2 100644
--- a/examples/tools/customtypesending/
+++ b/examples/corelib/tools/customtypesending/
@@ -6,5 +6,5 @@ SOURCES = main.cpp \
QT += widgets
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/customcompleter
INSTALLS += target
diff --git a/examples/tools/customtypesending/main.cpp b/examples/corelib/tools/customtypesending/main.cpp
index 5f01e2a154..5f01e2a154 100644
--- a/examples/tools/customtypesending/main.cpp
+++ b/examples/corelib/tools/customtypesending/main.cpp
diff --git a/examples/tools/customtypesending/message.cpp b/examples/corelib/tools/customtypesending/message.cpp
index 9b53b8757d..9b53b8757d 100644
--- a/examples/tools/customtypesending/message.cpp
+++ b/examples/corelib/tools/customtypesending/message.cpp
diff --git a/examples/tools/customtypesending/message.h b/examples/corelib/tools/customtypesending/message.h
index 3e5f17db2b..3e5f17db2b 100644
--- a/examples/tools/customtypesending/message.h
+++ b/examples/corelib/tools/customtypesending/message.h
diff --git a/examples/tools/customtypesending/window.cpp b/examples/corelib/tools/customtypesending/window.cpp
index aa4a7eab3c..aa4a7eab3c 100644
--- a/examples/tools/customtypesending/window.cpp
+++ b/examples/corelib/tools/customtypesending/window.cpp
diff --git a/examples/tools/customtypesending/window.h b/examples/corelib/tools/customtypesending/window.h
index 0889800064..0889800064 100644
--- a/examples/tools/customtypesending/window.h
+++ b/examples/corelib/tools/customtypesending/window.h
diff --git a/examples/tools/doc/contiguouscache.qdoc b/examples/corelib/tools/doc/src/contiguouscache.qdoc
index 2f7ea716e6..e88b2629b8 100644
--- a/examples/tools/doc/contiguouscache.qdoc
+++ b/examples/corelib/tools/doc/src/contiguouscache.qdoc
@@ -26,7 +26,7 @@
- \example contiguouscache
+ \example tools/contiguouscache
\title Contiguous Cache Example
\brief The Contiguous Cache example shows how to use QContiguousCache to manage memory usage for
@@ -40,7 +40,7 @@
a view requests an item at row N it is also likely to ask for items at rows near
to N.
- \snippet contiguouscache/randomlistmodel.cpp 0
+ \snippet tools/contiguouscache/randomlistmodel.cpp 0
After getting the row, the class determines if the row is in the bounds
of the contiguous cache's current range. It would have been equally valid to
@@ -74,7 +74,7 @@
to see how the cache range is kept for a local number of rows when running the
- \snippet contiguouscache/randomlistmodel.cpp 1
+ \snippet tools/contiguouscache/randomlistmodel.cpp 1
It is also worth considering pre-fetching items into the cache outside of the
application's paint routine. This can be done either with a separate thread
diff --git a/examples/tools/doc/src/customtype.qdoc b/examples/corelib/tools/doc/src/customtype.qdoc
index e016933e04..f03fafec30 100644
--- a/examples/tools/doc/src/customtype.qdoc
+++ b/examples/corelib/tools/doc/src/customtype.qdoc
@@ -26,7 +26,7 @@
- \example customtype
+ \example tools/customtype
\title Custom Type Example
\brief The Custom Type example shows how to integrate a custom type into Qt's
@@ -56,7 +56,7 @@
of information (a QString and a QStringList), each of which can be read
using trivial getter functions:
- \snippet customtype/message.h custom type definition
+ \snippet tools/customtype/message.h custom type definition
The default constructor, copy constructor and destructor are
all required, and must be public, if the type is to be integrated into the
@@ -67,14 +67,14 @@
To enable the type to be used with QVariant, we declare it using the
- \snippet customtype/message.h custom type meta-type declaration
+ \snippet tools/customtype/message.h custom type meta-type declaration
We do not need to write any additional code to accompany this macro.
To allow us to see a readable description of each \c Message object when it
is sent to the debug output stream, we define a streaming operator:
- \snippet customtype/message.h custom type streaming operator
+ \snippet tools/customtype/message.h custom type streaming operator
This facility is useful if you need to insert tracing statements in your
code for debugging purposes.
@@ -84,11 +84,11 @@
The implementation of the default constructor, copy constructor and destructor
are straightforward for the \c Message class:
- \snippet customtype/message.cpp Message class implementation
+ \snippet tools/customtype/message.cpp Message class implementation
The streaming operator is implemented in the following way:
- \snippet customtype/message.cpp custom type streaming operator
+ \snippet tools/customtype/message.cpp custom type streaming operator
Here, we want to represent each value depending on how many lines are stored
in the message body. We stream text to the QDebug object passed to the
@@ -99,7 +99,7 @@
We include the code for the getter functions for completeness:
- \snippet customtype/message.cpp getter functions
+ \snippet tools/customtype/message.cpp getter functions
With the type fully defined, implemented, and integrated with the
meta-object system, we can now use it.
@@ -109,13 +109,13 @@
In the example's \c{main()} function, we show how a \c Message object can
be printed to the console by sending it to the debug stream:
- \snippet customtype/main.cpp printing a custom type
+ \snippet tools/customtype/main.cpp printing a custom type
You can use the type with QVariant in exactly the same way as you would
use standard Qt value types. Here's how to store a value using the
QVariant::setValue() function:
- \snippet customtype/main.cpp storing a custom value
+ \snippet tools/customtype/main.cpp storing a custom value
Alternatively, the QVariant::fromValue() and qVariantSetValue() functions
can be used if you are using a compiler without support for member template
@@ -124,7 +124,7 @@
The value can be retrieved using the QVariant::value() member template
- \snippet customtype/main.cpp retrieving a custom value
+ \snippet tools/customtype/main.cpp retrieving a custom value
Alternatively, the qVariantValue() template function can be used if
you are using a compiler without support for member template functions.
diff --git a/examples/tools/ b/examples/corelib/tools/
index 36fa776980..36fa776980 100644
--- a/examples/tools/
+++ b/examples/corelib/tools/
diff --git a/examples/ b/examples/
index 052802b803..bcc13704dc 100644
--- a/examples/
+++ b/examples/
@@ -2,18 +2,15 @@ TEMPLATE = subdirs
CONFIG += no_docs_target
+ corelib \
dbus \
embedded \
gui \
- ipc \
- json \
network \
qpa \
qtconcurrent \
qtestlib \
sql \
- threads \
- tools \
touch \
widgets \
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 7c879cbbfd..5a14ba9088 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation
version = $QT_VERSION
-examplesinstallpath = core
+examplesinstallpath = corelib
qhp.projects = QtCore
@@ -35,10 +35,7 @@ sourcedirs += ..
exampledirs += \
../ \
snippets \
- ../../../examples/threads/ \
- ../../../examples/tools/ \
- ../../../examples/ipc/ \
- ../../../examples/json/ \
+ ../../../examples/corelib \
imagedirs += images
diff --git a/src/corelib/doc/src/custom-types.qdoc b/src/corelib/doc/src/custom-types.qdoc
index bac4a90829..81ce698735 100644
--- a/src/corelib/doc/src/custom-types.qdoc
+++ b/src/corelib/doc/src/custom-types.qdoc
@@ -61,7 +61,7 @@
The following \c Message class definition includes these members:
- \snippet customtype/message.h custom type definition
+ \snippet tools/customtype/message.h custom type definition
The class also provides a constructor for normal use and two public member functions
that are used to obtain the private data.
@@ -77,7 +77,7 @@
to this class, we invoke the Q_DECLARE_METATYPE() macro on the class in the header
file where it is defined:
- \snippet customtype/message.h custom type meta-type declaration
+ \snippet tools/customtype/message.h custom type meta-type declaration
This now makes it possible for \c Message values to be stored in QVariant objects
and retrieved later. See the \l{Custom Type Example} for code that demonstrates
@@ -104,19 +104,19 @@
The \l{Queued Custom Type Example} declares a \c Block class which is registered
in the \c{main.cpp} file:
- \snippet queuedcustomtype/main.cpp main start
+ \snippet threads/queuedcustomtype/main.cpp main start
- \snippet queuedcustomtype/main.cpp register meta-type for queued communications
+ \snippet threads/queuedcustomtype/main.cpp register meta-type for queued communications
- \snippet queuedcustomtype/main.cpp main finish
+ \snippet threads/queuedcustomtype/main.cpp main finish
This type is later used in a signal-slot connection in the \c{window.cpp} file:
- \snippet queuedcustomtype/window.cpp Window constructor start
+ \snippet threads/queuedcustomtype/window.cpp Window constructor start
- \snippet queuedcustomtype/window.cpp connecting signal with custom type
+ \snippet threads/queuedcustomtype/window.cpp connecting signal with custom type
- \snippet queuedcustomtype/window.cpp Window constructor finish
+ \snippet threads/queuedcustomtype/window.cpp Window constructor finish
If a type is used in a queued connection without being registered, a warning will be
printed at the console; for example:
@@ -131,18 +131,18 @@
It is often quite useful to make a custom type printable for debugging purposes,
as in the following code:
- \snippet customtype/main.cpp printing a custom type
+ \snippet tools/customtype/main.cpp printing a custom type
This is achieved by creating a streaming operator for the type, which is often
defined in the header file for that type:
- \snippet customtype/message.h custom type streaming operator
+ \snippet tools/customtype/message.h custom type streaming operator
The implementation for the \c Message type in the \l{Custom Type Example}
goes to some effort to make the printable representation as readable as
- \snippet customtype/message.cpp custom type streaming operator
+ \snippet tools/customtype/message.cpp custom type streaming operator
The output sent to the debug stream can, of course, be made as simple or as
complicated as you like. Note that the value returned by this function is