diff --git a/configure b/configure index 6773c9dbfd..39a87b2795 100755 --- a/configure +++ b/configure @@ -6551,10 +6551,10 @@ echo " Configure summary" echo if [ "$XPLATFORM" = "$PLATFORM" ]; then # the missing space before $CFG_FEATURES is intentional - echo "Build type: $PLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES- none detected})" + echo "Build type: $PLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES:- none detected})" else - echo "Building on: $PLATFORM ($CFG_HOST_ARCH, CPU features:${CFG_HOST_CPUFEATURES- none detected})" - echo "Building for: $XPLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES- none detected})" + echo "Building on: $PLATFORM ($CFG_HOST_ARCH, CPU features:${CFG_HOST_CPUFEATURES:- none detected})" + echo "Building for: $XPLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES:- none detected})" fi 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/corelib.pro b/examples/corelib/corelib.pro new file mode 100644 index 0000000000..ec6e19c2b5 --- /dev/null +++ b/examples/corelib/corelib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +CONFIG += no_docs_target + +SUBDIRS = \ + ipc \ + json \ + threads \ + tools diff --git a/examples/ipc/README b/examples/corelib/ipc/README similarity index 100% rename from examples/ipc/README rename to examples/corelib/ipc/README diff --git a/examples/ipc/doc/images/localfortuneclient-example.png b/examples/corelib/ipc/doc/images/localfortuneclient-example.png similarity index 100% rename from examples/ipc/doc/images/localfortuneclient-example.png rename to examples/corelib/ipc/doc/images/localfortuneclient-example.png diff --git a/examples/ipc/doc/images/localfortuneserver-example.png b/examples/corelib/ipc/doc/images/localfortuneserver-example.png similarity index 100% rename from examples/ipc/doc/images/localfortuneserver-example.png rename to examples/corelib/ipc/doc/images/localfortuneserver-example.png diff --git a/examples/ipc/doc/images/sharedmemory-example_1.png b/examples/corelib/ipc/doc/images/sharedmemory-example_1.png similarity index 100% rename from examples/ipc/doc/images/sharedmemory-example_1.png rename to examples/corelib/ipc/doc/images/sharedmemory-example_1.png diff --git a/examples/ipc/doc/images/sharedmemory-example_2.png b/examples/corelib/ipc/doc/images/sharedmemory-example_2.png similarity index 100% rename from examples/ipc/doc/images/sharedmemory-example_2.png rename to examples/corelib/ipc/doc/images/sharedmemory-example_2.png diff --git a/examples/ipc/doc/src/localfortuneclient.qdoc b/examples/corelib/ipc/doc/src/localfortuneclient.qdoc similarity index 97% rename from examples/ipc/doc/src/localfortuneclient.qdoc rename to 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 similarity index 97% rename from examples/ipc/doc/src/localfortuneserver.qdoc rename to 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 similarity index 95% rename from examples/ipc/doc/src/sharedmemory.qdoc rename to 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/ipc.pro b/examples/corelib/ipc/ipc.pro similarity index 100% rename from examples/ipc/ipc.pro rename to examples/corelib/ipc/ipc.pro diff --git a/examples/ipc/localfortuneclient/client.cpp b/examples/corelib/ipc/localfortuneclient/client.cpp similarity index 100% rename from examples/ipc/localfortuneclient/client.cpp rename to examples/corelib/ipc/localfortuneclient/client.cpp diff --git a/examples/ipc/localfortuneclient/client.h b/examples/corelib/ipc/localfortuneclient/client.h similarity index 100% rename from examples/ipc/localfortuneclient/client.h rename to examples/corelib/ipc/localfortuneclient/client.h diff --git a/examples/ipc/localfortuneclient/localfortuneclient.pro b/examples/corelib/ipc/localfortuneclient/localfortuneclient.pro similarity index 67% rename from examples/ipc/localfortuneclient/localfortuneclient.pro rename to examples/corelib/ipc/localfortuneclient/localfortuneclient.pro index c52a173ed5..912c0f3b8e 100644 --- a/examples/ipc/localfortuneclient/localfortuneclient.pro +++ b/examples/corelib/ipc/localfortuneclient/localfortuneclient.pro @@ -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 similarity index 100% rename from examples/ipc/localfortuneclient/main.cpp rename to examples/corelib/ipc/localfortuneclient/main.cpp diff --git a/examples/ipc/localfortuneserver/localfortuneserver.pro b/examples/corelib/ipc/localfortuneserver/localfortuneserver.pro similarity index 67% rename from examples/ipc/localfortuneserver/localfortuneserver.pro rename to examples/corelib/ipc/localfortuneserver/localfortuneserver.pro index 9eed28ef74..88190c45bd 100644 --- a/examples/ipc/localfortuneserver/localfortuneserver.pro +++ b/examples/corelib/ipc/localfortuneserver/localfortuneserver.pro @@ -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 similarity index 100% rename from examples/ipc/localfortuneserver/main.cpp rename to examples/corelib/ipc/localfortuneserver/main.cpp diff --git a/examples/ipc/localfortuneserver/server.cpp b/examples/corelib/ipc/localfortuneserver/server.cpp similarity index 100% rename from examples/ipc/localfortuneserver/server.cpp rename to examples/corelib/ipc/localfortuneserver/server.cpp diff --git a/examples/ipc/localfortuneserver/server.h b/examples/corelib/ipc/localfortuneserver/server.h similarity index 100% rename from examples/ipc/localfortuneserver/server.h rename to examples/corelib/ipc/localfortuneserver/server.h diff --git a/examples/ipc/sharedmemory/dialog.cpp b/examples/corelib/ipc/sharedmemory/dialog.cpp similarity index 100% rename from examples/ipc/sharedmemory/dialog.cpp rename to examples/corelib/ipc/sharedmemory/dialog.cpp diff --git a/examples/ipc/sharedmemory/dialog.h b/examples/corelib/ipc/sharedmemory/dialog.h similarity index 100% rename from examples/ipc/sharedmemory/dialog.h rename to examples/corelib/ipc/sharedmemory/dialog.h diff --git a/examples/ipc/sharedmemory/dialog.ui b/examples/corelib/ipc/sharedmemory/dialog.ui similarity index 100% rename from examples/ipc/sharedmemory/dialog.ui rename to examples/corelib/ipc/sharedmemory/dialog.ui diff --git a/examples/ipc/sharedmemory/image.png b/examples/corelib/ipc/sharedmemory/image.png similarity index 100% rename from examples/ipc/sharedmemory/image.png rename to examples/corelib/ipc/sharedmemory/image.png diff --git a/examples/ipc/sharedmemory/main.cpp b/examples/corelib/ipc/sharedmemory/main.cpp similarity index 100% rename from examples/ipc/sharedmemory/main.cpp rename to examples/corelib/ipc/sharedmemory/main.cpp diff --git a/examples/ipc/sharedmemory/qt.png b/examples/corelib/ipc/sharedmemory/qt.png similarity index 100% rename from examples/ipc/sharedmemory/qt.png rename to examples/corelib/ipc/sharedmemory/qt.png diff --git a/examples/ipc/sharedmemory/sharedmemory.pro b/examples/corelib/ipc/sharedmemory/sharedmemory.pro similarity index 73% rename from examples/ipc/sharedmemory/sharedmemory.pro rename to examples/corelib/ipc/sharedmemory/sharedmemory.pro index a392f9542d..c1b634732e 100644 --- a/examples/ipc/sharedmemory/sharedmemory.pro +++ b/examples/corelib/ipc/sharedmemory/sharedmemory.pro @@ -11,5 +11,5 @@ FORMS += dialog.ui EXAMPLE_FILES = *.png # install -target.path = $$[QT_INSTALL_EXAMPLES]/ipc/sharedmemory +target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/sharedmemory INSTALLS += target diff --git a/examples/json/json.pro b/examples/corelib/json/json.pro similarity index 100% rename from examples/json/json.pro rename to examples/corelib/json/json.pro diff --git a/examples/json/savegame/character.cpp b/examples/corelib/json/savegame/character.cpp similarity index 100% rename from examples/json/savegame/character.cpp rename to examples/corelib/json/savegame/character.cpp diff --git a/examples/json/savegame/character.h b/examples/corelib/json/savegame/character.h similarity index 100% rename from examples/json/savegame/character.h rename to 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 similarity index 92% rename from examples/json/savegame/doc/src/savegame.qdoc rename to 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 implementations: - \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 in. - \snippet savegame/level.cpp 1 + \snippet json/savegame/level.cpp 1 Again, the write() function is similar to the read() function, except reversed. @@ -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 NPCs. - \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 similarity index 100% rename from examples/json/savegame/game.cpp rename to examples/corelib/json/savegame/game.cpp diff --git a/examples/json/savegame/game.h b/examples/corelib/json/savegame/game.h similarity index 100% rename from examples/json/savegame/game.h rename to examples/corelib/json/savegame/game.h diff --git a/examples/json/savegame/level.cpp b/examples/corelib/json/savegame/level.cpp similarity index 100% rename from examples/json/savegame/level.cpp rename to examples/corelib/json/savegame/level.cpp diff --git a/examples/json/savegame/level.h b/examples/corelib/json/savegame/level.h similarity index 100% rename from examples/json/savegame/level.h rename to examples/corelib/json/savegame/level.h diff --git a/examples/json/savegame/main.cpp b/examples/corelib/json/savegame/main.cpp similarity index 100% rename from examples/json/savegame/main.cpp rename to examples/corelib/json/savegame/main.cpp diff --git a/examples/json/savegame/savegame.pro b/examples/corelib/json/savegame/savegame.pro similarity index 80% rename from examples/json/savegame/savegame.pro rename to examples/corelib/json/savegame/savegame.pro index fd754ace80..6706444506 100644 --- a/examples/json/savegame/savegame.pro +++ b/examples/corelib/json/savegame/savegame.pro @@ -8,7 +8,7 @@ CONFIG -= app_bundle TEMPLATE = app # 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 similarity index 100% rename from examples/threads/README rename to examples/corelib/threads/README diff --git a/examples/threads/doc/images/mandelbrot-example.png b/examples/corelib/threads/doc/images/mandelbrot-example.png similarity index 100% rename from examples/threads/doc/images/mandelbrot-example.png rename to examples/corelib/threads/doc/images/mandelbrot-example.png diff --git a/examples/threads/doc/images/mandelbrot_scroll1.png b/examples/corelib/threads/doc/images/mandelbrot_scroll1.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_scroll1.png rename to examples/corelib/threads/doc/images/mandelbrot_scroll1.png diff --git a/examples/threads/doc/images/mandelbrot_scroll2.png b/examples/corelib/threads/doc/images/mandelbrot_scroll2.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_scroll2.png rename to examples/corelib/threads/doc/images/mandelbrot_scroll2.png diff --git a/examples/threads/doc/images/mandelbrot_scroll3.png b/examples/corelib/threads/doc/images/mandelbrot_scroll3.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_scroll3.png rename to examples/corelib/threads/doc/images/mandelbrot_scroll3.png diff --git a/examples/threads/doc/images/mandelbrot_zoom1.png b/examples/corelib/threads/doc/images/mandelbrot_zoom1.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_zoom1.png rename to examples/corelib/threads/doc/images/mandelbrot_zoom1.png diff --git a/examples/threads/doc/images/mandelbrot_zoom2.png b/examples/corelib/threads/doc/images/mandelbrot_zoom2.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_zoom2.png rename to examples/corelib/threads/doc/images/mandelbrot_zoom2.png diff --git a/examples/threads/doc/images/mandelbrot_zoom3.png b/examples/corelib/threads/doc/images/mandelbrot_zoom3.png similarity index 100% rename from examples/threads/doc/images/mandelbrot_zoom3.png rename to examples/corelib/threads/doc/images/mandelbrot_zoom3.png diff --git a/examples/threads/doc/images/queuedcustomtype-example.png b/examples/corelib/threads/doc/images/queuedcustomtype-example.png similarity index 100% rename from examples/threads/doc/images/queuedcustomtype-example.png rename to examples/corelib/threads/doc/images/queuedcustomtype-example.png diff --git a/examples/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc similarity index 88% rename from examples/threads/doc/src/mandelbrot.qdoc rename to 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 invoked. - \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 parts. @@ -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 black.) - \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 value. - \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 similarity index 87% rename from examples/threads/doc/src/queuedcustomtype.qdoc rename to 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. \dots - \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: \dots - \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 similarity index 94% rename from examples/threads/doc/src/semaphores.qdoc rename to 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 semaphores: - \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 similarity index 93% rename from examples/threads/doc/src/waitconditions.qdoc rename to 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 similarity index 100% rename from examples/threads/mandelbrot/main.cpp rename to examples/corelib/threads/mandelbrot/main.cpp diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/corelib/threads/mandelbrot/mandelbrot.pro similarity index 79% rename from examples/threads/mandelbrot/mandelbrot.pro rename to examples/corelib/threads/mandelbrot/mandelbrot.pro index 45f21baf08..5a01a405f2 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/corelib/threads/mandelbrot/mandelbrot.pro @@ -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 similarity index 100% rename from examples/threads/mandelbrot/mandelbrotwidget.cpp rename to examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp diff --git a/examples/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h similarity index 100% rename from examples/threads/mandelbrot/mandelbrotwidget.h rename to examples/corelib/threads/mandelbrot/mandelbrotwidget.h diff --git a/examples/threads/mandelbrot/renderthread.cpp b/examples/corelib/threads/mandelbrot/renderthread.cpp similarity index 100% rename from examples/threads/mandelbrot/renderthread.cpp rename to examples/corelib/threads/mandelbrot/renderthread.cpp diff --git a/examples/threads/mandelbrot/renderthread.h b/examples/corelib/threads/mandelbrot/renderthread.h similarity index 100% rename from examples/threads/mandelbrot/renderthread.h rename to examples/corelib/threads/mandelbrot/renderthread.h diff --git a/examples/threads/queuedcustomtype/block.cpp b/examples/corelib/threads/queuedcustomtype/block.cpp similarity index 100% rename from examples/threads/queuedcustomtype/block.cpp rename to examples/corelib/threads/queuedcustomtype/block.cpp diff --git a/examples/threads/queuedcustomtype/block.h b/examples/corelib/threads/queuedcustomtype/block.h similarity index 100% rename from examples/threads/queuedcustomtype/block.h rename to examples/corelib/threads/queuedcustomtype/block.h diff --git a/examples/threads/queuedcustomtype/main.cpp b/examples/corelib/threads/queuedcustomtype/main.cpp similarity index 100% rename from examples/threads/queuedcustomtype/main.cpp rename to examples/corelib/threads/queuedcustomtype/main.cpp diff --git a/examples/threads/queuedcustomtype/queuedcustomtype.pro b/examples/corelib/threads/queuedcustomtype/queuedcustomtype.pro similarity index 77% rename from examples/threads/queuedcustomtype/queuedcustomtype.pro rename to examples/corelib/threads/queuedcustomtype/queuedcustomtype.pro index 8b18b13ba6..77421eb638 100644 --- a/examples/threads/queuedcustomtype/queuedcustomtype.pro +++ b/examples/corelib/threads/queuedcustomtype/queuedcustomtype.pro @@ -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 similarity index 100% rename from examples/threads/queuedcustomtype/renderthread.cpp rename to examples/corelib/threads/queuedcustomtype/renderthread.cpp diff --git a/examples/threads/queuedcustomtype/renderthread.h b/examples/corelib/threads/queuedcustomtype/renderthread.h similarity index 100% rename from examples/threads/queuedcustomtype/renderthread.h rename to examples/corelib/threads/queuedcustomtype/renderthread.h diff --git a/examples/threads/queuedcustomtype/window.cpp b/examples/corelib/threads/queuedcustomtype/window.cpp similarity index 100% rename from examples/threads/queuedcustomtype/window.cpp rename to examples/corelib/threads/queuedcustomtype/window.cpp diff --git a/examples/threads/queuedcustomtype/window.h b/examples/corelib/threads/queuedcustomtype/window.h similarity index 100% rename from examples/threads/queuedcustomtype/window.h rename to examples/corelib/threads/queuedcustomtype/window.h diff --git a/examples/threads/semaphores/semaphores.cpp b/examples/corelib/threads/semaphores/semaphores.cpp similarity index 100% rename from examples/threads/semaphores/semaphores.cpp rename to examples/corelib/threads/semaphores/semaphores.cpp diff --git a/examples/threads/semaphores/semaphores.pro b/examples/corelib/threads/semaphores/semaphores.pro similarity index 61% rename from examples/threads/semaphores/semaphores.pro rename to examples/corelib/threads/semaphores/semaphores.pro index 7dfe7c3ba0..69154e57eb 100644 --- a/examples/threads/semaphores/semaphores.pro +++ b/examples/corelib/threads/semaphores/semaphores.pro @@ -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/threads.pro b/examples/corelib/threads/threads.pro similarity index 100% rename from examples/threads/threads.pro rename to examples/corelib/threads/threads.pro diff --git a/examples/threads/waitconditions/waitconditions.cpp b/examples/corelib/threads/waitconditions/waitconditions.cpp similarity index 100% rename from examples/threads/waitconditions/waitconditions.cpp rename to examples/corelib/threads/waitconditions/waitconditions.cpp diff --git a/examples/threads/waitconditions/waitconditions.pro b/examples/corelib/threads/waitconditions/waitconditions.pro similarity index 62% rename from examples/threads/waitconditions/waitconditions.pro rename to examples/corelib/threads/waitconditions/waitconditions.pro index 7f9491a0b1..2dbe7df68a 100644 --- a/examples/threads/waitconditions/waitconditions.pro +++ b/examples/corelib/threads/waitconditions/waitconditions.pro @@ -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 similarity index 100% rename from examples/tools/README rename to examples/corelib/tools/README diff --git a/examples/tools/contiguouscache/contiguouscache.pro b/examples/corelib/tools/contiguouscache/contiguouscache.pro similarity index 67% rename from examples/tools/contiguouscache/contiguouscache.pro rename to examples/corelib/tools/contiguouscache/contiguouscache.pro index d384a1845a..fb2267fc64 100644 --- a/examples/tools/contiguouscache/contiguouscache.pro +++ b/examples/corelib/tools/contiguouscache/contiguouscache.pro @@ -5,5 +5,5 @@ SOURCES = randomlistmodel.cpp \ main.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 similarity index 100% rename from examples/tools/contiguouscache/main.cpp rename to examples/corelib/tools/contiguouscache/main.cpp diff --git a/examples/tools/contiguouscache/randomlistmodel.cpp b/examples/corelib/tools/contiguouscache/randomlistmodel.cpp similarity index 100% rename from examples/tools/contiguouscache/randomlistmodel.cpp rename to examples/corelib/tools/contiguouscache/randomlistmodel.cpp diff --git a/examples/tools/contiguouscache/randomlistmodel.h b/examples/corelib/tools/contiguouscache/randomlistmodel.h similarity index 100% rename from examples/tools/contiguouscache/randomlistmodel.h rename to examples/corelib/tools/contiguouscache/randomlistmodel.h diff --git a/examples/tools/customtype/customtype.pro b/examples/corelib/tools/customtype/customtype.pro similarity index 62% rename from examples/tools/customtype/customtype.pro rename to examples/corelib/tools/customtype/customtype.pro index d05540f403..1bd792db85 100644 --- a/examples/tools/customtype/customtype.pro +++ b/examples/corelib/tools/customtype/customtype.pro @@ -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 similarity index 100% rename from examples/tools/customtype/main.cpp rename to examples/corelib/tools/customtype/main.cpp diff --git a/examples/tools/customtype/message.cpp b/examples/corelib/tools/customtype/message.cpp similarity index 100% rename from examples/tools/customtype/message.cpp rename to examples/corelib/tools/customtype/message.cpp diff --git a/examples/tools/customtype/message.h b/examples/corelib/tools/customtype/message.h similarity index 100% rename from examples/tools/customtype/message.h rename to examples/corelib/tools/customtype/message.h diff --git a/examples/tools/customtypesending/customtypesending.pro b/examples/corelib/tools/customtypesending/customtypesending.pro similarity index 70% rename from examples/tools/customtypesending/customtypesending.pro rename to examples/corelib/tools/customtypesending/customtypesending.pro index faa07bf339..672f6569c2 100644 --- a/examples/tools/customtypesending/customtypesending.pro +++ b/examples/corelib/tools/customtypesending/customtypesending.pro @@ -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 similarity index 100% rename from examples/tools/customtypesending/main.cpp rename to examples/corelib/tools/customtypesending/main.cpp diff --git a/examples/tools/customtypesending/message.cpp b/examples/corelib/tools/customtypesending/message.cpp similarity index 100% rename from examples/tools/customtypesending/message.cpp rename to examples/corelib/tools/customtypesending/message.cpp diff --git a/examples/tools/customtypesending/message.h b/examples/corelib/tools/customtypesending/message.h similarity index 100% rename from examples/tools/customtypesending/message.h rename to examples/corelib/tools/customtypesending/message.h diff --git a/examples/tools/customtypesending/window.cpp b/examples/corelib/tools/customtypesending/window.cpp similarity index 100% rename from examples/tools/customtypesending/window.cpp rename to examples/corelib/tools/customtypesending/window.cpp diff --git a/examples/tools/customtypesending/window.h b/examples/corelib/tools/customtypesending/window.h similarity index 100% rename from examples/tools/customtypesending/window.h rename to examples/corelib/tools/customtypesending/window.h diff --git a/examples/tools/doc/contiguouscache.qdoc b/examples/corelib/tools/doc/src/contiguouscache.qdoc similarity index 96% rename from examples/tools/doc/contiguouscache.qdoc rename to 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 example. - \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 similarity index 89% rename from examples/tools/doc/src/customtype.qdoc rename to 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 Q_DECLARE_METATYPE() macro: - \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 function: - \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/tools.pro b/examples/corelib/tools/tools.pro similarity index 100% rename from examples/tools/tools.pro rename to examples/corelib/tools/tools.pro diff --git a/examples/examples.pro b/examples/examples.pro index 052802b803..bcc13704dc 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -2,18 +2,15 @@ TEMPLATE = subdirs CONFIG += no_docs_target SUBDIRS = \ + corelib \ dbus \ embedded \ gui \ - ipc \ - json \ network \ qpa \ qtconcurrent \ qtestlib \ sql \ - threads \ - tools \ touch \ widgets \ xml diff --git a/examples/opengl/threadedqopenglwidget/glwidget.cpp b/examples/opengl/threadedqopenglwidget/glwidget.cpp index d447f0c716..ecf1287045 100644 --- a/examples/opengl/threadedqopenglwidget/glwidget.cpp +++ b/examples/opengl/threadedqopenglwidget/glwidget.cpp @@ -42,8 +42,6 @@ #include #include -const int bubbleNum = 8; - GLWidget::GLWidget(QWidget *parent) : QOpenGLWidget(parent) { diff --git a/examples/opengl/threadedqopenglwidget/glwidget.h b/examples/opengl/threadedqopenglwidget/glwidget.h index 8319faf322..c063e846dc 100644 --- a/examples/opengl/threadedqopenglwidget/glwidget.h +++ b/examples/opengl/threadedqopenglwidget/glwidget.h @@ -100,7 +100,7 @@ class GLWidget : public QOpenGLWidget { Q_OBJECT public: - GLWidget(QWidget *parent); + explicit GLWidget(QWidget *parent = 0); ~GLWidget(); protected: diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp index 75b7f5e46f..2c94469b7c 100644 --- a/examples/opengl/threadedqopenglwidget/main.cpp +++ b/examples/opengl/threadedqopenglwidget/main.cpp @@ -40,10 +40,19 @@ #include #include +#include #include +#include #include "mainwindow.h" #include "glwidget.h" +static QString getGlString(QOpenGLFunctions *functions, GLenum name) +{ + if (const GLubyte *p = functions->glGetString(name)) + return QString::fromLatin1(reinterpret_cast(p)); + return QString(); +} + int main( int argc, char ** argv ) { QApplication a( argc, argv ); @@ -54,20 +63,38 @@ int main( int argc, char ** argv ) // Two top-level windows with two QOpenGLWidget children in each. // The rendering for the four QOpenGLWidgets happens on four separate threads. - MainWindow mw1; - mw1.setMinimumSize(800, 400); - mw1.show(); + GLWidget topLevelGlWidget; + QPoint pos = QApplication::desktop()->availableGeometry(&topLevelGlWidget).topLeft() + QPoint(200, 200); + topLevelGlWidget.setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example top level")); + topLevelGlWidget.resize(200, 200); + topLevelGlWidget.move(pos); + topLevelGlWidget.show(); + + const QString glInfo = getGlString(topLevelGlWidget.context()->functions(), GL_VENDOR) + + QLatin1Char('/') + getGlString(topLevelGlWidget.context()->functions(), GL_RENDERER); + + const bool supportsThreading = !glInfo.contains(QLatin1String("nouveau"), Qt::CaseInsensitive) + && !glInfo.contains(QLatin1String("ANGLE"), Qt::CaseInsensitive); + + const QString toolTip = supportsThreading ? glInfo : glInfo + QStringLiteral("\ndoes not support threaded OpenGL."); + topLevelGlWidget.setToolTip(toolTip); + + QScopedPointer mw1; QScopedPointer mw2; - if (!QApplication::arguments().contains(QStringLiteral("--single"))) { + if (supportsThreading && !QApplication::arguments().contains(QStringLiteral("--single"))) { + pos += QPoint(100, 100); + mw1.reset(new MainWindow); + mw1->setToolTip(toolTip); + mw1->move(pos); + mw1->setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example #1")); + mw1->show(); + pos += QPoint(100, 100); mw2.reset(new MainWindow); - mw2->setMinimumSize(800, 400); + mw2->setToolTip(toolTip); + mw2->move(pos); + mw2->setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example #2")); mw2->show(); - - // And a top-level. - GLWidget *bonus = new GLWidget(0); - bonus->resize(200, 200); - bonus->show(); } return a.exec(); diff --git a/examples/opengl/threadedqopenglwidget/mainwindow.cpp b/examples/opengl/threadedqopenglwidget/mainwindow.cpp index 29c59573cf..de866f5615 100644 --- a/examples/opengl/threadedqopenglwidget/mainwindow.cpp +++ b/examples/opengl/threadedqopenglwidget/mainwindow.cpp @@ -43,6 +43,7 @@ MainWindow::MainWindow() { + setMinimumSize(800, 400); GLWidget *glwidget1 = new GLWidget(this); glwidget1->resize(400, 400); diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 8a70ce041a..3834a55ac5 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -17,6 +17,12 @@ TEMPLATE = lib CONFIG += plugin DESTDIR = $$MODULE_BASE_OUTDIR/plugins/$$PLUGIN_TYPE +win32:CONFIG(shared, static|shared) { + # Embed a VERSIONINFO resource into the plugin's DLL. + isEmpty(VERSION): VERSION = $$QT_VERSION + CONFIG += skip_target_version_ext +} + tool_plugin { !build_pass:contains(QT_CONFIG, build_all): CONFIG += release } else:if(win32|mac):!macx-xcode { diff --git a/mkspecs/macx-clang-32/qmake.conf b/mkspecs/macx-clang-32/qmake.conf index e0c4bd57b7..87c601ee74 100644 --- a/mkspecs/macx-clang-32/qmake.conf +++ b/mkspecs/macx-clang-32/qmake.conf @@ -11,7 +11,7 @@ include(../common/gcc-base-mac.conf) include(../common/clang.conf) include(../common/clang-mac.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_CFLAGS += -arch i386 QMAKE_OBJECTIVE_CFLAGS += -arch i386 diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf index f28b728bd9..d14b11179a 100644 --- a/mkspecs/macx-clang/qmake.conf +++ b/mkspecs/macx-clang/qmake.conf @@ -11,6 +11,6 @@ include(../common/gcc-base-mac.conf) include(../common/clang.conf) include(../common/clang-mac.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 load(qt_config) diff --git a/mkspecs/macx-g++-32/qmake.conf b/mkspecs/macx-g++-32/qmake.conf index 6ef78aacbf..2a8197ebbd 100644 --- a/mkspecs/macx-g++-32/qmake.conf +++ b/mkspecs/macx-g++-32/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_CFLAGS += -arch i386 QMAKE_OBJECTIVE_CFLAGS += -arch i386 diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index a6c075a2ce..9c44f278e9 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -14,6 +14,6 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 load(qt_config) diff --git a/mkspecs/macx-g++40/qmake.conf b/mkspecs/macx-g++40/qmake.conf index f40315a602..0f2dd6bb71 100644 --- a/mkspecs/macx-g++40/qmake.conf +++ b/mkspecs/macx-g++40/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_CC = gcc-4.0 QMAKE_CXX = g++-4.0 diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf index 25383e9cb6..e003193e1b 100644 --- a/mkspecs/macx-g++42/qmake.conf +++ b/mkspecs/macx-g++42/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/g++-macx.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_CC = gcc-4.2 QMAKE_CXX = g++-4.2 diff --git a/mkspecs/macx-icc/qmake.conf b/mkspecs/macx-icc/qmake.conf index 521e64e364..a1783c97ad 100644 --- a/mkspecs/macx-icc/qmake.conf +++ b/mkspecs/macx-icc/qmake.conf @@ -85,7 +85,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_ QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 include(../common/macx.conf) diff --git a/mkspecs/macx-llvm/qmake.conf b/mkspecs/macx-llvm/qmake.conf index 7bdef70943..cf4e00cd61 100644 --- a/mkspecs/macx-llvm/qmake.conf +++ b/mkspecs/macx-llvm/qmake.conf @@ -14,7 +14,7 @@ include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/llvm.conf) -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42 diff --git a/mkspecs/unsupported/linux-libc++-clang/qmake.conf b/mkspecs/unsupported/linux-libc++-clang/qmake.conf deleted file mode 100644 index bf0abb2a54..0000000000 --- a/mkspecs/unsupported/linux-libc++-clang/qmake.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -# qmake configuration for linux-clang -# - -MAKEFILE_GENERATOR = UNIX -CONFIG += incremental - -QMAKE_INCREMENTAL_STYLE = sublib - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/clang.conf) - -QMAKE_CFLAGS_RELEASE = -Os -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE - -QMAKE_CXXFLAGS_CXX11 += -std=c++11 -stdlib=libc++ -QMAKE_LFLAGS_CXX11 += -stdlib=libc++ -lc++abi - -load(qt_config) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 6dad8888ce..ed5be81d80 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -1090,8 +1090,6 @@ public class QtActivityDelegate Log.e(QtNative.QtTAG, "Surface " + id +" not found!"); return; } - - m_layout.requestLayout(); } public void destroySurface(int id) { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java index 6de66fe512..80028e1b02 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java @@ -174,6 +174,9 @@ public class QtInputConnection extends BaseInputConnection QtExtractedText qExtractedText = QtNativeInputConnection.getExtractedText(request.hintMaxChars, request.hintMaxLines, flags); + if (qExtractedText == null) + return null; + ExtractedText extractedText = new ExtractedText(); extractedText.partialEndOffset = qExtractedText.partialEndOffset; extractedText.partialStartOffset = qExtractedText.partialStartOffset; diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index e526c0a210..0c52bc7530 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -99,7 +99,7 @@ import android.view.ActionMode.Callback; public class QtActivity extends Activity { private final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished - private static final int MINISTRO_API_LEVEL = 4; // Ministro api level (check IMinistro.aidl file) + private static final int MINISTRO_API_LEVEL = 5; // Ministro api level (check IMinistro.aidl file) private static final int NECESSITAS_API_LEVEL = 2; // Necessitas api level used by platform plugin private static final int QT_VERSION = 0x050100; // This app requires at least Qt version 5.1.0 diff --git a/src/android/templates/res/values/libs.xml b/src/android/templates/res/values/libs.xml index 664ab0abec..4d68673cb0 100644 --- a/src/android/templates/res/values/libs.xml +++ b/src/android/templates/res/values/libs.xml @@ -1,7 +1,7 @@ - https://download.qt-project.org/ministro/android/qt5/qt-5.3 + https://download.qt-project.org/ministro/android/qt5/qt-5.4