Merge remote-tracking branch 'origin/5.4' into dev

Change-Id: If7e51514ed6832750e3ad967e4d322ccf920d2bb
This commit is contained in:
Frederik Gladhorn 2014-10-20 19:12:23 +02:00
commit 3361fcbc28
220 changed files with 1620 additions and 804 deletions

6
configure vendored
View File

@ -6551,10 +6551,10 @@ echo " Configure summary"
echo echo
if [ "$XPLATFORM" = "$PLATFORM" ]; then if [ "$XPLATFORM" = "$PLATFORM" ]; then
# the missing space before $CFG_FEATURES is intentional # 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 else
echo "Building on: $PLATFORM ($CFG_HOST_ARCH, CPU features:${CFG_HOST_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})" echo "Building for: $XPLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES:- none detected})"
fi fi

View File

@ -255,7 +255,12 @@ manifestmeta.ios.tags = ios
# add a generic thumbnail image to examples that do not have any images in their documentation # 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.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/QtConcurrent Word Count Example" \
"QtConcurrent/Run Function Example" \ "QtConcurrent/Run Function Example" \
"QtGui/Raster Window Example" \ "QtGui/Raster Window Example" \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
CONFIG += no_docs_target
SUBDIRS = \
ipc \
json \
threads \
tools

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example localfortuneclient \example ipc/localfortuneclient
\title Local Fortune Client Example \title Local Fortune Client Example
\ingroup examples-ipc \ingroup examples-ipc
\brief Demonstrates using QLocalSocket for a simple local service client. \brief Demonstrates using QLocalSocket for a simple local service client.

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example localfortuneserver \example ipc/localfortuneserver
\title Local Fortune Server Example \title Local Fortune Server Example
\ingroup examples-ipc \ingroup examples-ipc
\brief Demonstrates using QLocalServer and QLocalSocket for serving a simple local service. \brief Demonstrates using QLocalServer and QLocalSocket for serving a simple local service.

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example sharedmemory \example ipc/sharedmemory
\title Shared Memory Example \title Shared Memory Example
\ingroup examples-ipc \ingroup examples-ipc
\brief Demonstrates doing inter-process communication using shared memory with \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 dialog is displayed and then control is passed to the application in
the standard way. the standard way.
\snippet sharedmemory/main.cpp 0 \snippet ipc/sharedmemory/main.cpp 0
Two instances of class Dialog appear. Two instances of class Dialog appear.
@ -51,12 +51,12 @@
loadFromFile() and loadFromMemory() that correspond to the two loadFromFile() and loadFromMemory() that correspond to the two
buttons on the dialog. 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 The constructor builds the user interface widgets and connects the
clicked() signal of each button to the corresponding slot function. 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} Note that "QSharedMemoryExample" is passed to the \l {QSharedMemory}
{QSharedMemory()} constructor to be used as the key. This will be {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 that segment is detached from the process, so we can be assured of
starting off the example correctly. 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 The user is then asked to select an image file using
QFileDialog::getOpenFileName(). The selected file is loaded into a 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 to the image data, which we then use to do a memcopy() from the
QBuffer into the shared memory segment. 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 Note that we \l {QSharedMemory::} {lock()} the shared memory segment
before we copy into it, and we \l {QSharedMemory::} {unlock()} it 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()} then streams the data into a QImage and \l {QSharedMemory::unlock()}
{unlocks} the segment. {unlocks} the segment.
\snippet sharedmemory/dialog.cpp 3 \snippet ipc/sharedmemory/dialog.cpp 3
In this case, the function does \l {QSharedMemory::} {detach()} from In this case, the function does \l {QSharedMemory::} {detach()} from
the segment, because now we are effectively finished using the segment, because now we are effectively finished using

View File

@ -4,5 +4,5 @@ SOURCES = client.cpp \
QT += network widgets QT += network widgets
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/ipc/localfortuneclient target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/localfortuneclient
INSTALLS += target INSTALLS += target

View File

@ -4,5 +4,5 @@ SOURCES = server.cpp \
QT += network widgets QT += network widgets
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/ipc/localfortuneserver target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/localfortuneserver
INSTALLS += target INSTALLS += target

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -11,5 +11,5 @@ FORMS += dialog.ui
EXAMPLE_FILES = *.png EXAMPLE_FILES = *.png
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/ipc/sharedmemory target.path = $$[QT_INSTALL_EXAMPLES]/corelib/ipc/sharedmemory
INSTALLS += target INSTALLS += target

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example savegame \example json/savegame
\title JSON Save Game Example \title JSON Save Game Example
\brief The JSON Save Game example demonstrates how to save and load a \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. 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 Of particular interest to us are the read and write function
implementations: implementations:
\snippet savegame/character.cpp 0 \snippet json/savegame/character.cpp 0
In the read() function, we assign Character's members values from the In the read() function, we assign Character's members values from the
QJsonObject argument. You can use either \l QJsonObject::operator[]() or 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 could check if the keys are valid before attempting to read them with
QJsonObject::contains(), but we assume that they are. 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 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 values from the Character object to the JSON object. As with accessing
@ -74,13 +74,13 @@
Next up is the Level class: 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 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 keep a QList of Character objects. We also provide the familiar read() and
write() functions. 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 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 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 element is used as the key to construct the container when reading it back
in. in.
\snippet savegame/level.cpp 1 \snippet json/savegame/level.cpp 1
Again, the write() function is similar to the read() function, except Again, the write() function is similar to the read() function, except
reversed. reversed.
@ -102,7 +102,7 @@
Having established the Character and Level classes, we can move on to Having established the Character and Level classes, we can move on to
the Game class: 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 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. 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(). 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 To setup a new game, we create the player and populate the levels and their
NPCs. 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 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 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. 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. 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 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, 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 After constructing the QJsonDocument, we instruct the Game object to read
itself and then return \c true to indicate success. 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 Not surprisingly, saveGame() looks very much like loadGame(). We determine
the file extension based on the format, print a warning and return \c false 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(): 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 Since we're only interested in demonstrating \e serialization of a game with
JSON, our game is not actually playable. Therefore, we only need 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 the player had a great time and made lots of progress, altering the internal
state of our Character, Level and Game objects. 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 When the player has finished, we save their game. For demonstration
purposes, we serialize to both JSON and binary. You can examine the contents purposes, we serialize to both JSON and binary. You can examine the contents

View File

@ -8,7 +8,7 @@ CONFIG -= app_bundle
TEMPLATE = app TEMPLATE = app
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/json/savegame target.path = $$[QT_INSTALL_EXAMPLES]/corelib/json/savegame
INSTALLS += target INSTALLS += target
SOURCES += main.cpp \ SOURCES += main.cpp \

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example mandelbrot \example threads/mandelbrot
\title Mandelbrot Example \title Mandelbrot Example
\ingroup qtconcurrent-mtexamples \ingroup qtconcurrent-mtexamples
@ -101,7 +101,7 @@
We'll start with the definition of the \c RenderThread class: 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 The class inherits QThread so that it gains the ability to run in
a separate thread. Apart from the constructor and destructor, \c a separate thread. Apart from the constructor and destructor, \c
@ -117,7 +117,7 @@
\section1 RenderThread Class Implementation \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 In the constructor, we initialize the \c restart and \c abort
variables to \c false. These variables control the flow of the \c 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 We also initialize the \c colormap array, which contains a series
of RGB colors. 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 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 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 until \c run() has exited before the base class destructor is
invoked. invoked.
\snippet mandelbrot/renderthread.cpp 2 \snippet threads/mandelbrot/renderthread.cpp 2
The \c render() function is called by the \c MandelbrotWidget The \c render() function is called by the \c MandelbrotWidget
whenever it needs to generate a new image of the Mandelbrot set. 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 computation and start again with the new parameters) and wakes up
the thread, which might be sleeping. 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 \c run() is quite a big function, so we'll break it down into
parts. parts.
@ -177,10 +177,10 @@
The \c forever keyword is, like \c foreach, a Qt pseudo-keyword. The \c forever keyword is, like \c foreach, a Qt pseudo-keyword.
\snippet mandelbrot/renderthread.cpp 4 \snippet threads/mandelbrot/renderthread.cpp 4
\snippet mandelbrot/renderthread.cpp 5 \snippet threads/mandelbrot/renderthread.cpp 5
\snippet mandelbrot/renderthread.cpp 6 \snippet threads/mandelbrot/renderthread.cpp 6
\snippet mandelbrot/renderthread.cpp 7 \snippet threads/mandelbrot/renderthread.cpp 7
Then comes the core of the algorithm. Instead of trying to create Then comes the core of the algorithm. Instead of trying to create
a perfect Mandelbrot set image, we do multiple passes and a perfect Mandelbrot set image, we do multiple passes and
@ -197,15 +197,15 @@
The core algorithm is beyond the scope of this tutorial. The core algorithm is beyond the scope of this tutorial.
\snippet mandelbrot/renderthread.cpp 8 \snippet threads/mandelbrot/renderthread.cpp 8
\snippet mandelbrot/renderthread.cpp 9 \snippet threads/mandelbrot/renderthread.cpp 9
Once we're done with all the iterations, we call Once we're done with all the iterations, we call
QWaitCondition::wait() to put the thread to sleep by calling, QWaitCondition::wait() to put the thread to sleep by calling,
unless \c restart is \c true. There's no use in keeping a worker unless \c restart is \c true. There's no use in keeping a worker
thread looping indefinitely while there's nothing to do. 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 The \c rgbFromWaveLength() function is a helper function that
converts a wave length to a RGB value compatible with 32-bit 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 The \c MandelbrotWidget class uses \c RenderThread to draw the
Mandelbrot set on screen. Here's the class definition: 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 The widget reimplements many event handlers from QWidget. In
addition, it has an \c updatePixmap() slot that we'll connect to addition, it has an \c updatePixmap() slot that we'll connect to
@ -230,12 +230,12 @@
\section1 MandelbrotWidget Class Implementation \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 The implementation starts with a few contants that we'll need
later on. later on.
\snippet mandelbrot/mandelbrotwidget.cpp 1 \snippet threads/mandelbrot/mandelbrotwidget.cpp 1
The interesting part of the constructor is the The interesting part of the constructor is the
qRegisterMetaType() and QObject::connect() calls. Let's start qRegisterMetaType() and QObject::connect() calls. Let's start
@ -258,19 +258,19 @@
template function qRegisterMetaType() before we can use QImage template function qRegisterMetaType() before we can use QImage
as parameter in queued connections. as parameter in queued connections.
\snippet mandelbrot/mandelbrotwidget.cpp 2 \snippet threads/mandelbrot/mandelbrotwidget.cpp 2
\snippet mandelbrot/mandelbrotwidget.cpp 3 \snippet threads/mandelbrot/mandelbrotwidget.cpp 3
\snippet mandelbrot/mandelbrotwidget.cpp 4 \snippet threads/mandelbrot/mandelbrotwidget.cpp 4
In \l{QWidget::paintEvent()}{paintEvent()}, we start by filling In \l{QWidget::paintEvent()}{paintEvent()}, we start by filling
the background with black. If we have nothing yet to paint (\c 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 pixmap is null), we print a message on the widget asking the user
to be patient and return from the function immediately. to be patient and return from the function immediately.
\snippet mandelbrot/mandelbrotwidget.cpp 5 \snippet threads/mandelbrot/mandelbrotwidget.cpp 5
\snippet mandelbrot/mandelbrotwidget.cpp 6 \snippet threads/mandelbrot/mandelbrotwidget.cpp 6
\snippet mandelbrot/mandelbrotwidget.cpp 7 \snippet threads/mandelbrot/mandelbrotwidget.cpp 7
\snippet mandelbrot/mandelbrotwidget.cpp 8 \snippet threads/mandelbrot/mandelbrotwidget.cpp 8
If the pixmap has the right scale factor, we draw the pixmap directly onto If the pixmap has the right scale factor, we draw the pixmap directly onto
the widget. Otherwise, we scale and translate the \l{Coordinate the widget. Otherwise, we scale and translate the \l{Coordinate
@ -280,12 +280,12 @@
QPainter::save() and QPainter::restore() make sure that any painting QPainter::save() and QPainter::restore() make sure that any painting
performed afterwards uses the standard coordinate system. 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 At the end of the paint event handler, we draw a text string and
a semi-transparent rectangle on top of the fractal. 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 Whenever the user resizes the widget, we call \c render() to
start generating a new image, with the same \c centerX, \c 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 called by Qt when the widget is shown the first time to generate
the image the very first time. 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 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 the benefit of users who don't have a mouse. The \c zoom() and \c
scroll() functions will be covered later. 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 The wheel event handler is reimplemented to make the mouse wheel
control the zoom level. QWheelEvent::delta() returns the angle of control the zoom level. QWheelEvent::delta() returns the angle of
@ -312,18 +312,18 @@
(i.e., +30 degrees), the zoom factor becomes \c ZoomInFactor (i.e., +30 degrees), the zoom factor becomes \c ZoomInFactor
to the second power, i.e. 0.8 * 0.8 = 0.64. 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 When the user presses the left mouse button, we store the mouse
pointer position in \c lastDragPos. 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 When the user moves the mouse pointer while the left mouse button
is pressed, we adjust \c pixmapOffset to paint the pixmap at a is pressed, we adjust \c pixmapOffset to paint the pixmap at a
shifted position and call QWidget::update() to force a repaint. 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 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 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 because areas revealed when dragging the pixmap are drawn in
black.) black.)
\snippet mandelbrot/mandelbrotwidget.cpp 16 \snippet threads/mandelbrot/mandelbrotwidget.cpp 16
The \c updatePixmap() slot is invoked when the worker thread has The \c updatePixmap() slot is invoked when the worker thread has
finished rendering an image. We start by checking whether a drag 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 be converted into a pixmap. It's better to do the conversion once
and for all here, rather than in \c paintEvent(). 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 In \c zoom(), we recompute \c curScale. Then we call
QWidget::update() to draw a scaled pixmap, and we ask the worker QWidget::update() to draw a scaled pixmap, and we ask the worker
thread to render a new image corresponding to the new \c curScale thread to render a new image corresponding to the new \c curScale
value. value.
\snippet mandelbrot/mandelbrotwidget.cpp 18 \snippet threads/mandelbrot/mandelbrotwidget.cpp 18
\c scroll() is similar to \c zoom(), except that the affected \c scroll() is similar to \c zoom(), except that the affected
parameters are \c centerX and \c centerY. parameters are \c centerX and \c centerY.
@ -366,5 +366,5 @@
The application's multithreaded nature has no impact on its \c The application's multithreaded nature has no impact on its \c
main() function, which is as simple as usual: main() function, which is as simple as usual:
\snippet mandelbrot/main.cpp 0 \snippet threads/mandelbrot/main.cpp 0
*/ */

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example queuedcustomtype \example threads/queuedcustomtype
\title Queued Custom Type Example \title Queued Custom Type Example
\brief Demonstrates multi-thread programming using Qt \brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples \ingroup qtconcurrent-mtexamples
@ -57,7 +57,7 @@
constructor and destructor in the public section of the class that the constructor and destructor in the public section of the class that the
meta-object system requires. It describes a colored rectangle. 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 We will still need to register it with the meta-object system at
run-time by calling the qRegisterMetaType() template function before 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 \c Block object. The rest of the class is concerned with managing the
user interface and handling images. 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 The \c Window class also contains a worker thread, provided by a
\c RenderThread object. This will emit signals to send \c Block objects \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 interface containing a label and two push buttons that are connected to
slots in the same class. slots in the same class.
\snippet queuedcustomtype/window.cpp Window constructor start \snippet threads/queuedcustomtype/window.cpp Window constructor start
\snippet queuedcustomtype/window.cpp set up widgets and connections \snippet threads/queuedcustomtype/window.cpp set up widgets and connections
\snippet queuedcustomtype/window.cpp connecting signal with custom type \snippet threads/queuedcustomtype/window.cpp connecting signal with custom type
In the last of these connections, we connect a signal in the In the last of these connections, we connect a signal in the
\c RenderThread object to the \c addBlock(Block) slot in the window. \c RenderThread object to the \c addBlock(Block) slot in the window.
\dots \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 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 \c addBlock(Block) slot receives blocks from the rendering thread via
the signal-slot connection set up in the constructor: 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. 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 and using the \c sendBlock(Block) signal to send them to other components
in the example. 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 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. 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 Processing is started with the \c processImage() function, which calls the
\c RenderThread class's reimplementation of the QThread::run() function: \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 Ignoring the details of the way the image is processed, we see that the
signal containing a block is emitted in the usual way: signal containing a block is emitted in the usual way:
\dots \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 Each signal that is emitted will be queued and delivered later to the
window's \c addBlock(Block) slot. 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 \c Block class as a custom type with the meta-object system by calling the
qRegisterMetaType() template function: 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 This call is placed here to ensure that the type is registered before any
signal-slot connections are made that use it. signal-slot connections are made that use it.

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example semaphores \example threads/semaphores
\title Semaphores Example \title Semaphores Example
\brief Demonstrates multi-thread programming using Qt \brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples \ingroup qtconcurrent-mtexamples
@ -61,7 +61,7 @@
Let's start by reviewing the circular buffer and the associated Let's start by reviewing the circular buffer and the associated
semaphores: semaphores:
\snippet semaphores/semaphores.cpp 0 \snippet threads/semaphores/semaphores.cpp 0
\c DataSize is the amout of data that the producer will generate. \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. 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: Let's review the code for the \c Producer class:
\snippet semaphores/semaphores.cpp 1 \snippet threads/semaphores/semaphores.cpp 1
\snippet semaphores/semaphores.cpp 2 \snippet threads/semaphores/semaphores.cpp 2
The producer generates \c DataSize bytes of data. Before it The producer generates \c DataSize bytes of data. Before it
writes a byte to the circular buffer, it must acquire a "free" 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: Let's now turn to the \c Consumer class:
\snippet semaphores/semaphores.cpp 3 \snippet threads/semaphores/semaphores.cpp 3
\snippet semaphores/semaphores.cpp 4 \snippet threads/semaphores/semaphores.cpp 4
The code is very similar to the producer, except that this time The code is very similar to the producer, except that this time
we acquire a "used" byte and release a "free" byte, instead of 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() In \c main(), we create the two threads and call QThread::wait()
to ensure that both threads get time to finish before we exit: to ensure that both threads get time to finish before we exit:
\snippet semaphores/semaphores.cpp 5 \snippet threads/semaphores/semaphores.cpp 5
\snippet semaphores/semaphores.cpp 6 \snippet threads/semaphores/semaphores.cpp 6
So what happens when we run the program? Initially, the producer So what happens when we run the program? Initially, the producer
thread is the only one that can do anything; the consumer is thread is the only one that can do anything; the consumer is

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example waitconditions \example threads/waitconditions
\title Wait Conditions Example \title Wait Conditions Example
\brief Demonstrates multi-thread programming using Qt \brief Demonstrates multi-thread programming using Qt
\ingroup qtconcurrent-mtexamples \ingroup qtconcurrent-mtexamples
@ -61,7 +61,7 @@
Let's start by reviewing the circular buffer and the associated Let's start by reviewing the circular buffer and the associated
synchronization tools: 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. \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. 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: Let's review the code for the \c Producer class:
\snippet waitconditions/waitconditions.cpp 1 \snippet threads/waitconditions/waitconditions.cpp 1
\snippet waitconditions/waitconditions.cpp 2 \snippet threads/waitconditions/waitconditions.cpp 2
The producer generates \c DataSize bytes of data. Before it The producer generates \c DataSize bytes of data. Before it
writes a byte to the circular buffer, it must first check whether writes a byte to the circular buffer, it must first check whether
@ -110,8 +110,8 @@
Let's turn to the \c Consumer class: Let's turn to the \c Consumer class:
\snippet waitconditions/waitconditions.cpp 3 \snippet threads/waitconditions/waitconditions.cpp 3
\snippet waitconditions/waitconditions.cpp 4 \snippet threads/waitconditions/waitconditions.cpp 4
The code is very similar to the producer. Before we read the The code is very similar to the producer. Before we read the
byte, we check whether the buffer is empty (\c numUsedBytes is 0) 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() In \c main(), we create the two threads and call QThread::wait()
to ensure that both threads get time to finish before we exit: to ensure that both threads get time to finish before we exit:
\snippet waitconditions/waitconditions.cpp 5 \snippet threads/waitconditions/waitconditions.cpp 5
\snippet waitconditions/waitconditions.cpp 6 \snippet threads/waitconditions/waitconditions.cpp 6
So what happens when we run the program? Initially, the producer So what happens when we run the program? Initially, the producer
thread is the only one that can do anything; the consumer is thread is the only one that can do anything; the consumer is

View File

@ -9,5 +9,5 @@ SOURCES = main.cpp \
unix:!mac:!vxworks:!integrity:LIBS += -lm unix:!mac:!vxworks:!integrity:LIBS += -lm
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/mandelbrot
INSTALLS += target INSTALLS += target

View File

@ -8,7 +8,7 @@ SOURCES = main.cpp \
QT += widgets QT += widgets
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/mandelbrot
INSTALLS += target INSTALLS += target

View File

@ -5,5 +5,5 @@ CONFIG -= app_bundle
CONFIG += console CONFIG += console
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/threads/semaphores target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/semaphores
INSTALLS += target INSTALLS += target

View File

@ -5,5 +5,5 @@ CONFIG += console
SOURCES += waitconditions.cpp SOURCES += waitconditions.cpp
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/threads/waitconditions target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/waitconditions
INSTALLS += target INSTALLS += target

View File

@ -5,5 +5,5 @@ SOURCES = randomlistmodel.cpp \
main.cpp main.cpp
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/contiguouscache
INSTALLS += target INSTALLS += target

View File

@ -4,5 +4,5 @@ SOURCES = main.cpp \
QT += widgets QT += widgets
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/customcompleter
INSTALLS += target INSTALLS += target

View File

@ -6,5 +6,5 @@ SOURCES = main.cpp \
QT += widgets QT += widgets
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter target.path = $$[QT_INSTALL_EXAMPLES]/corelib/tools/customcompleter
INSTALLS += target INSTALLS += target

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example contiguouscache \example tools/contiguouscache
\title Contiguous Cache Example \title Contiguous Cache Example
\brief The Contiguous Cache example shows how to use QContiguousCache to manage memory usage for \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 a view requests an item at row N it is also likely to ask for items at rows near
to N. 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 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 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 to see how the cache range is kept for a local number of rows when running the
example. 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 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 application's paint routine. This can be done either with a separate thread

View File

@ -26,7 +26,7 @@
****************************************************************************/ ****************************************************************************/
/*! /*!
\example customtype \example tools/customtype
\title Custom Type Example \title Custom Type Example
\brief The Custom Type example shows how to integrate a custom type into Qt's \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 of information (a QString and a QStringList), each of which can be read
using trivial getter functions: 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 The default constructor, copy constructor and destructor are
all required, and must be public, if the type is to be integrated into the 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 To enable the type to be used with QVariant, we declare it using the
Q_DECLARE_METATYPE() macro: 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. 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 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: 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 This facility is useful if you need to insert tracing statements in your
code for debugging purposes. code for debugging purposes.
@ -84,11 +84,11 @@
The implementation of the default constructor, copy constructor and destructor The implementation of the default constructor, copy constructor and destructor
are straightforward for the \c Message class: 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: 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 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 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: 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 With the type fully defined, implemented, and integrated with the
meta-object system, we can now use it. 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 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: 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 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 use standard Qt value types. Here's how to store a value using the
QVariant::setValue() function: 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 Alternatively, the QVariant::fromValue() and qVariantSetValue() functions
can be used if you are using a compiler without support for member template 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 The value can be retrieved using the QVariant::value() member template
function: 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 Alternatively, the qVariantValue() template function can be used if
you are using a compiler without support for member template functions. you are using a compiler without support for member template functions.

View File

@ -2,18 +2,15 @@ TEMPLATE = subdirs
CONFIG += no_docs_target CONFIG += no_docs_target
SUBDIRS = \ SUBDIRS = \
corelib \
dbus \ dbus \
embedded \ embedded \
gui \ gui \
ipc \
json \
network \ network \
qpa \ qpa \
qtconcurrent \ qtconcurrent \
qtestlib \ qtestlib \
sql \ sql \
threads \
tools \
touch \ touch \
widgets \ widgets \
xml xml

View File

@ -42,8 +42,6 @@
#include <math.h> #include <math.h>
#include <QGuiApplication> #include <QGuiApplication>
const int bubbleNum = 8;
GLWidget::GLWidget(QWidget *parent) GLWidget::GLWidget(QWidget *parent)
: QOpenGLWidget(parent) : QOpenGLWidget(parent)
{ {

View File

@ -100,7 +100,7 @@ class GLWidget : public QOpenGLWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GLWidget(QWidget *parent); explicit GLWidget(QWidget *parent = 0);
~GLWidget(); ~GLWidget();
protected: protected:

View File

@ -40,10 +40,19 @@
#include <QApplication> #include <QApplication>
#include <QMainWindow> #include <QMainWindow>
#include <QDesktopWidget>
#include <QSurfaceFormat> #include <QSurfaceFormat>
#include <QOpenGLContext>
#include "mainwindow.h" #include "mainwindow.h"
#include "glwidget.h" #include "glwidget.h"
static QString getGlString(QOpenGLFunctions *functions, GLenum name)
{
if (const GLubyte *p = functions->glGetString(name))
return QString::fromLatin1(reinterpret_cast<const char *>(p));
return QString();
}
int main( int argc, char ** argv ) int main( int argc, char ** argv )
{ {
QApplication a( argc, 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. // Two top-level windows with two QOpenGLWidget children in each.
// The rendering for the four QOpenGLWidgets happens on four separate threads. // 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<MainWindow> mw1;
QScopedPointer<MainWindow> mw2; QScopedPointer<MainWindow> 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.reset(new MainWindow);
mw2->setMinimumSize(800, 400); mw2->setToolTip(toolTip);
mw2->move(pos);
mw2->setWindowTitle(QStringLiteral("Threaded QOpenGLWidget example #2"));
mw2->show(); mw2->show();
// And a top-level.
GLWidget *bonus = new GLWidget(0);
bonus->resize(200, 200);
bonus->show();
} }
return a.exec(); return a.exec();

View File

@ -43,6 +43,7 @@
MainWindow::MainWindow() MainWindow::MainWindow()
{ {
setMinimumSize(800, 400);
GLWidget *glwidget1 = new GLWidget(this); GLWidget *glwidget1 = new GLWidget(this);
glwidget1->resize(400, 400); glwidget1->resize(400, 400);

View File

@ -17,6 +17,12 @@ TEMPLATE = lib
CONFIG += plugin CONFIG += plugin
DESTDIR = $$MODULE_BASE_OUTDIR/plugins/$$PLUGIN_TYPE 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 { tool_plugin {
!build_pass:contains(QT_CONFIG, build_all): CONFIG += release !build_pass:contains(QT_CONFIG, build_all): CONFIG += release
} else:if(win32|mac):!macx-xcode { } else:if(win32|mac):!macx-xcode {

View File

@ -11,7 +11,7 @@ include(../common/gcc-base-mac.conf)
include(../common/clang.conf) include(../common/clang.conf)
include(../common/clang-mac.conf) include(../common/clang-mac.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CFLAGS += -arch i386 QMAKE_CFLAGS += -arch i386
QMAKE_OBJECTIVE_CFLAGS += -arch i386 QMAKE_OBJECTIVE_CFLAGS += -arch i386

View File

@ -11,6 +11,6 @@ include(../common/gcc-base-mac.conf)
include(../common/clang.conf) include(../common/clang.conf)
include(../common/clang-mac.conf) include(../common/clang-mac.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
load(qt_config) load(qt_config)

View File

@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf) include(../common/g++-macx.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CFLAGS += -arch i386 QMAKE_CFLAGS += -arch i386
QMAKE_OBJECTIVE_CFLAGS += -arch i386 QMAKE_OBJECTIVE_CFLAGS += -arch i386

View File

@ -14,6 +14,6 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf) include(../common/g++-macx.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
load(qt_config) load(qt_config)

View File

@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf) include(../common/g++-macx.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CC = gcc-4.0 QMAKE_CC = gcc-4.0
QMAKE_CXX = g++-4.0 QMAKE_CXX = g++-4.0

View File

@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf) include(../common/g++-macx.conf)
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_CC = gcc-4.2 QMAKE_CC = gcc-4.2
QMAKE_CXX = g++-4.2 QMAKE_CXX = g++-4.2

View File

@ -85,7 +85,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_
QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-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) include(../common/macx.conf)

Some files were not shown because too many files have changed in this diff Show More