summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-03 14:29:41 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-01-03 14:30:21 +0100
commitb5ab7ee0d78a30863e3d11bd2ba10ba5f4854bf5 (patch)
treed4ab3471f9f92e153fe320e0435a5740c794746b /src/corelib
parentad9554a7f2d4b8a2af3efabc7bc69b9a0ae3751d (diff)
parentaff3e3c4a20aae52fdafaede8dfcbde2bc990104 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qnamespace.qdoc20
-rw-r--r--src/corelib/io/qfileselector.cpp67
-rw-r--r--src/corelib/kernel/qmetatype.h6
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qtimezone.cpp4
6 files changed, 56 insertions, 45 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index e33fd085f2..851b6609ea 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -509,15 +509,14 @@
delivery at a later time.
\value AutoConnection
- (default) If the signal is emitted from a different thread than the
- receiving object, the signal is queued, behaving as
- Qt::QueuedConnection. Otherwise, the slot is invoked directly,
- behaving as Qt::DirectConnection. The type of connection is
+ \b (Default) If the receiver \l{QObject#Thread Affinity}{lives in} the
+ thread that emits the signal, Qt::DirectConnection is used. Otherwise,
+ Qt::QueuedConnection is used. The connection type is
determined when the signal is emitted.
\value DirectConnection
- The slot is invoked immediately, when the signal is
- emitted.
+ The slot is invoked immediately when the signal is
+ emitted. The slot is executed in the signalling thread.
\value QueuedConnection
The slot is invoked when control returns to the event loop
@@ -525,11 +524,10 @@
receiver's thread.
\value BlockingQueuedConnection
- Same as QueuedConnection, except the current thread blocks
- until the slot returns. This connection type should only be
- used where the emitter and receiver are in different
- threads. \note Violating this rule can cause your
- application to deadlock.
+ Same as Qt::QueuedConnection, except that the signalling thread blocks
+ until the slot returns. This connection must \e not be used if the
+ receiver lives in the signalling thread, or else the application
+ will deadlock.
\value UniqueConnection
This is a flag that can be combined with any one of the above
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 72e4198fb0..92d3564a0f 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -51,6 +51,10 @@
#include <QtCore/QLocale>
#include <QtCore/QDebug>
+#ifdef Q_OS_UNIX
+#include <sys/utsname.h>
+#endif
+
QT_BEGIN_NAMESPACE
//Environment variable to allow tooling full control of file selectors
@@ -69,7 +73,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
/*!
\class QFileSelector
\inmodule QtCore
- \brief QFileSelector provides a convenient way of selecting file variants
+ \brief QFileSelector provides a convenient way of selecting file variants.
\since 5.2
QFileSelector is a convenience for selecting file variants based on platform or device
@@ -77,6 +81,10 @@ QFileSelectorPrivate::QFileSelectorPrivate()
different variants more easily in some circumstances, such as when the correct variant cannot
be determined during the deploy step.
+ \section1 Using QFileSelector
+
+ If you always use the same file you do not need to use QFileSelector.
+
Consider the following example usage, where you want to use different settings files on
different locales. You might select code between locales like this:
@@ -115,7 +123,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
QFile defaultsFile(selector.select("data/defaults.conf"));
\endcode
- The files to be selected are placed in directories named with a '+' and a selector name. In the above
+ The files to be selected are placed in directories named with a \c'+' and a selector name. In the above
example you could have the platform configurations selected by placing them in the following locations:
\code
data/defaults.conf
@@ -124,8 +132,6 @@ QFileSelectorPrivate::QFileSelectorPrivate()
data/+ios/+en_GB/defaults.conf
\endcode
- If you always use the same file you do not need to use QFileSelector.
-
To find selected files, QFileSelector looks in the same directory as the base file. If there are
any directories of the form +<selector> with an active selector, QFileSelector will prefer a file
with the same file name from that directory over the base file. These directories can be nested to
@@ -138,33 +144,43 @@ QFileSelectorPrivate::QFileSelectorPrivate()
With those files available, you would select a different file on android and blackberry platforms,
but only if the locale was en_GB.
+ QFileSelector will not attempt to select if the base file does not exist. For error handling in
+ the case no valid selectors are present, it is recommended to have a default or error-handling
+ file in the base file location even if you expect selectors to be present for all deployments.
+
+ In a future version, some may be marked as deploy-time static and be moved during the
+ deployment step as an optimization. As selectors come with a performance cost, it is
+ recommended to avoid their use in circumstances involving performance-critical code.
+
+ \section1 Adding selectors
+
Selectors normally available are
\list
- \li platform, one of: android, blackberry, ios, windows, osx, linux, generic_unix or unknown.
+ \li platform, any of the following strings which match the platform the application is running
+ on: android, blackberry, ios, mac, linux, wince, unix, windows.
\li locale, same as QLocale::system().name().
\endlist
- Further selectors will be added from the QT_FILE_SELECTORS environment variable, which when
- set should be a set of colon (semi-colon on windows) separated selectors. Note that this
- variable will only be read once, selectors may not update if the variable changes while the
- application is running.
+ Further selectors will be added from the \c QT_FILE_SELECTORS environment variable, which
+ when set should be a set of comma separated selectors. Note that this variable will only be
+ read once; selectors may not update if the variable changes while the application is running.
+ The initial set of selectors are evaluated only once, on first use.
- The initial set of selectors are evaluated only once, on first use. In a future
- version, some may be marked as deploy-time static and be moved during the deployment step as an
- optimization. As selectors come with a performance cost, it is recommended to avoid their use
- in circumstances involving performance-critical code.
+ You can also add extra selectors at runtime for custom behavior. These will be used in any
+ future calls to select(). If the extra selectors list has been changed, calls to select() will
+ use the new list and may return differently.
- Additionally you can add extra selectors at runtime to customize behavior further. These will
- be used in any future calls to select(). If the extra selectors list has been changed, calls to
- select() will use the new list and may return differently.
+ \section1 Conflict resolution when multiple selectors apply
When multiple selectors could be applied to the same file, the first matching selector is chosen.
The order selectors are checked in are:
- 1. Selectors set via setExtraSelectors(), in the order they are in the list
- 2. Selectors in the QT_FILE_SELECTORS environment variable, from left to right
- 3. Locale
- 4. Platform
+ \list 1
+ \li Selectors set via setExtraSelectors(), in the order they are in the list
+ \li Selectors in the \c QT_FILE_SELECTORS environment variable, from left to right
+ \li Locale
+ \li Platform
+ \endlist
Here is an example involving multiple selectors matching at the same time. It uses platform
selectors, plus an extra selector named "admin" is set by the application based on user
@@ -179,14 +195,11 @@ QFileSelectorPrivate::QFileSelectorPrivate()
images/+admin/+linux/background.png
\endcode
- Because extra selectors are checked before platform the +admin/background.png will be chosen
- on windows when the admin selector is set, and +windows/background.png will be chosen on
- windows when the admin selector is not set. On linux, the +admin/+linux/background.png will be
- chosen when admin is set, and the +linux/background.png when it is not.
+ Because extra selectors are checked before platform the \c{+admin/background.png} will be chosen
+ on Windows when the admin selector is set, and \c{+windows/background.png} will be chosen on
+ Windows when the admin selector is not set. On Linux, the \c{+admin/+linux/background.png} will be
+ chosen when admin is set, and the \c{+linux/background.png} when it is not.
- QFileSelector will not attempt to select if the base file does not exist. For error handling in
- the case no valid selectors are present, it is recommended to have a default or error-handling
- file in the base file location even if you expect selectors to be present for all deployments.
*/
/*!
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 745487627e..83801a20c5 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -876,7 +876,7 @@ struct CapabilitiesImpl<T, std::random_access_iterator_tag>
template<typename T>
struct ContainerAPI : CapabilitiesImpl<T>
{
- static int size(const T *t) { return std::distance(t->begin(), t->end()); }
+ static int size(const T *t) { return int(std::distance(t->begin(), t->end())); }
};
template<typename T>
@@ -1102,8 +1102,8 @@ public:
template<class T>
static int sizeImpl(const void *p)
- { return std::distance(static_cast<const T*>(p)->begin(),
- static_cast<const T*>(p)->end()); }
+ { return int(std::distance(static_cast<const T*>(p)->begin(),
+ static_cast<const T*>(p)->end())); }
template<class T>
static void findImpl(const void *container, const void *p, void **iterator)
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 412b9cf3b2..40eb2ed41d 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -534,7 +534,7 @@
Use std::lower_bound instead.
Performs a binary search of the range [\a begin, \a end) and
- returns the position of the first ocurrence of \a value. If no
+ returns the position of the first occurrence of \a value. If no
such item is found, returns the position where it should be
inserted.
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 333ce72849..16f058b001 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -262,7 +262,7 @@ public:
inline const_iterator &operator-=(int j) { i-=j; return *this; }
inline const_iterator operator+(int j) const { return const_iterator(i+j); }
inline const_iterator operator-(int j) const { return const_iterator(i-j); }
- inline int operator-(const_iterator j) const { return i - j.i; }
+ inline int operator-(const_iterator j) const { return int(i - j.i); }
};
friend class const_iterator;
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 24c20b46c7..d48c8da978 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -187,7 +187,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
The method systemTimeZoneId() returns the current system IANA time zone
ID which on OSX and Linux will always be correct. On Windows this ID is
- translated from the the Windows system ID using an internal translation
+ translated from the Windows system ID using an internal translation
table and the user's selected country. As a consequence there is a small
chance any Windows install may have IDs not known by Qt, in which case
"UTC" will be returned.
@@ -773,7 +773,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime,
/*!
Returns the current system time zone IANA ID.
- On Windows this ID is translated from the the Windows ID using an internal
+ On Windows this ID is translated from the Windows ID using an internal
translation table and the user's selected country. As a consequence there
is a small chance any Windows install may have IDs not known by Qt, in
which case "UTC" will be returned.