summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 17:56:51 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 17:56:52 +0200
commit881ceeff428c377d02ae3881beccdbb028385075 (patch)
tree65bd4335d7f67b81b04e33f2cbb17a41cf966dd8 /src/corelib
parentb3d2c867ed14cd6337d5e32b8750f198b5b7d331 (diff)
parent106487387d493dab934e19b33bfed55b8df62d67 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/qatomic_mips.h2
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp67
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.pro61
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.qdoc43
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp7
-rw-r--r--src/corelib/doc/snippets/plugins/extrafiltersplugin.h65
-rw-r--r--src/corelib/doc/snippets/plugins/interfaces.h114
-rw-r--r--src/corelib/doc/snippets/qprocess-environment/main.cpp2
-rw-r--r--src/corelib/doc/src/objectmodel/properties.qdoc2
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc11
-rw-r--r--src/corelib/doc/src/plugin-classes.qdoc39
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc333
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/global/qglobalstatic.cpp6
-rw-r--r--src/corelib/global/qlogging.cpp112
-rw-r--r--src/corelib/global/qlogging.h29
-rw-r--r--src/corelib/io/qdatastream.cpp6
-rw-r--r--src/corelib/io/qfileselector.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm1
-rw-r--r--src/corelib/io/qfsfileengine.cpp27
-rw-r--r--src/corelib/io/qloggingcategory.cpp8
-rw-r--r--src/corelib/io/qloggingcategory.h7
-rw-r--r--src/corelib/io/qloggingregistry.cpp6
-rw-r--r--src/corelib/io/qprocess.cpp17
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_win.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp11
-rw-r--r--src/corelib/kernel/qvariant.h3
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/thread/qfuture.qdoc2
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qbitarray.cpp13
-rw-r--r--src/corelib/tools/qdatetime.cpp4
-rw-r--r--src/corelib/tools/qelapsedtimer.cpp2
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qregularexpression.cpp18
-rw-r--r--src/corelib/tools/qscopedpointer.cpp2
-rw-r--r--src/corelib/tools/qshareddata.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer.cpp2
-rw-r--r--src/corelib/tools/qstring.h4
-rw-r--r--src/corelib/tools/qstringiterator.qdoc4
-rw-r--r--src/corelib/tools/qstringlist.cpp6
-rw-r--r--src/corelib/tools/qtimezone.cpp4
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp4
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
47 files changed, 248 insertions, 852 deletions
diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h
index f6e6cf0aef..b8a9665f86 100644
--- a/src/corelib/arch/qatomic_mips.h
+++ b/src/corelib/arch/qatomic_mips.h
@@ -94,7 +94,7 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)>
#if defined(Q_CC_GNU)
-#if defined(_MIPS_ARCH_MIPS1) || (defined(__mips) && __mips - 0 == 1)
+#if defined(_MIPS_ARCH_MIPS1) || (!defined(Q_CC_CLANG) && defined(__mips) && __mips - 0 == 1)
# error "Sorry, the MIPS1 architecture is not supported"
# error "please set '-march=' to your architecture (e.g., -march=mips32)"
#endif
diff --git a/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp b/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp
deleted file mode 100644
index b86f0bbf68..0000000000
--- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-class MyStylePlugin : public QStylePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "mystyleplugin.json")
-public:
- QStyle *create(const QString &key);
-};
-//! [0]
-
-
-//! [1]
-#include "mystyleplugin.h"
-
-QStyle *MyStylePlugin::create(const QString &key)
-{
- if (key.toLower() == "mystyle")
- return new MyStyle;
- return 0;
-}
-
-//! [1]
-
-
-//! [2]
-QApplication::setStyle(QStyleFactory::create("MyStyle"));
-//! [2]
diff --git a/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro b/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
deleted file mode 100644
index dc75c1d9d7..0000000000
--- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#! [3]
-CONFIG += release
-#! [3]
-
-#! [4]
-QTPLUGIN.platforms = qminimal
-#! [4]
-
-#! [5]
-QTPLUGIN += qjpeg \
- qgif \
- qkrcodecs
-#! [5]
-
-#! [6]
-QTPLUGIN.platforms = -
-#! [6]
-
-#! [7]
-CONFIG -= import_plugins
-#! [7]
diff --git a/src/corelib/doc/snippets/code/doc_src_plugins-howto.qdoc b/src/corelib/doc/snippets/code/doc_src_plugins-howto.qdoc
deleted file mode 100644
index 46b8245ba6..0000000000
--- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.qdoc
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [6]
-{ "Keys": [ "mystyleplugin" ] }
-//! [6]
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
index 4b2916a619..7fe4ea191d 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbitarray.cpp
@@ -174,3 +174,10 @@ a[0] = 1; a[1] = 0; a[2] = 1; // a: [ 1, 0, 1 ]
b[0] = 1; b[1] = 1; // b: [ 1, 1 ]
c = a ^ b; // c: [ 0, 1, 1 ]
//! [14]
+
+//! [15]
+QBitArray ba(4);
+ba.fill(true, 1, 2); // ba: [ 0, 1, 0, 0 ]
+ba.fill(true, 1, 3); // ba: [ 0, 1, 1, 0 ]
+ba.fill(true, 1, 4); // ba: [ 0, 1, 1, 1 ]
+//! [15]
diff --git a/src/corelib/doc/snippets/plugins/extrafiltersplugin.h b/src/corelib/doc/snippets/plugins/extrafiltersplugin.h
deleted file mode 100644
index 7add7abb53..0000000000
--- a/src/corelib/doc/snippets/plugins/extrafiltersplugin.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EXTRAFILTERSPLUGIN_H
-#define EXTRAFILTERSPLUGIN_H
-
-//! [0]
-#include <QObject>
-#include <QtPlugin>
-#include <QStringList>
-#include <QImage>
-
-#include <plugandpaint/interfaces.h>
-
-class ExtraFiltersPlugin : public QObject, public FilterInterface
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface" FILE "extrafilters.json")
- Q_INTERFACES(FilterInterface)
-
-public:
- QStringList filters() const;
- QImage filterImage(const QString &filter, const QImage &image,
- QWidget *parent);
-};
-//! [0]
-
-#endif
diff --git a/src/corelib/doc/snippets/plugins/interfaces.h b/src/corelib/doc/snippets/plugins/interfaces.h
deleted file mode 100644
index b2261a1eb2..0000000000
--- a/src/corelib/doc/snippets/plugins/interfaces.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef INTERFACES_H
-#define INTERFACES_H
-
-#include <QtPlugin>
-
-QT_BEGIN_NAMESPACE
-class QImage;
-class QPainter;
-class QWidget;
-class QPainterPath;
-class QPoint;
-class QRect;
-class QString;
-class QStringList;
-QT_END_NAMESPACE
-
-//! [0]
-class BrushInterface
-{
-public:
- virtual ~BrushInterface() {}
-
- virtual QStringList brushes() const = 0;
- virtual QRect mousePress(const QString &brush, QPainter &painter,
- const QPoint &pos) = 0;
- virtual QRect mouseMove(const QString &brush, QPainter &painter,
- const QPoint &oldPos, const QPoint &newPos) = 0;
- virtual QRect mouseRelease(const QString &brush, QPainter &painter,
- const QPoint &pos) = 0;
-};
-//! [0]
-
-//! [1]
-class ShapeInterface
-{
-public:
- virtual ~ShapeInterface() {}
-
- virtual QStringList shapes() const = 0;
- virtual QPainterPath generateShape(const QString &shape,
- QWidget *parent) = 0;
-};
-//! [1]
-
-//! [2]
-class FilterInterface
-{
-public:
- virtual ~FilterInterface() {}
-
- virtual QStringList filters() const = 0;
- virtual QImage filterImage(const QString &filter, const QImage &image,
- QWidget *parent) = 0;
-};
-//! [2]
-
-QT_BEGIN_NAMESPACE
-//! [3] //! [4]
-#define BrushInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface"
-
-Q_DECLARE_INTERFACE(BrushInterface, BrushInterface_iid)
-//! [3]
-
-#define ShapeInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.ShapeInterface"
-
-Q_DECLARE_INTERFACE(ShapeInterface, ShapeInterface_iid)
-//! [5]
-#define FilterInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface"
-
-Q_DECLARE_INTERFACE(FilterInterface, FilterInterface_iid)
-//! [4] //! [5]
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/doc/snippets/qprocess-environment/main.cpp b/src/corelib/doc/snippets/qprocess-environment/main.cpp
index d858746889..2e078eea6d 100644
--- a/src/corelib/doc/snippets/qprocess-environment/main.cpp
+++ b/src/corelib/doc/snippets/qprocess-environment/main.cpp
@@ -47,7 +47,6 @@ void startProcess()
QProcess process;
QStringList env = QProcess::systemEnvironment();
env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable
-env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;C:\\Bin");
process.setEnvironment(env);
process.start("myapp");
//! [0]
@@ -58,7 +57,6 @@ process.start("myapp");
QProcess process;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("TMPDIR", "C:\\MyApp\\temp"); // Add an environment variable
-env.insert("PATH", env.value("Path") + ";C:\\Bin");
process.setProcessEnvironment(env);
process.start("myapp");
//! [1]
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc
index 1a79a622b3..8a6c7f53d9 100644
--- a/src/corelib/doc/src/objectmodel/properties.qdoc
+++ b/src/corelib/doc/src/objectmodel/properties.qdoc
@@ -226,7 +226,7 @@
In the example, the enumeration type that is the property type is
declared in MyClass and registered with the \l{Meta-Object System}
using the Q_ENUMS() macro. This makes the enumeration values
- available as strings for use as in the call to setProperty(). Had
+ available as strings for use as in the call to \l{QObject::}{setProperty()}. Had
the enumeration type been declared in another class, its fully
qualified name (i.e., OtherClass::Priority) would be required, and
that other class would also have to inherit QObject and register
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
index 6dcf567c2e..f79e8a7dca 100644
--- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
+++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
@@ -49,17 +49,14 @@
if a user clicks a \uicontrol{Close} button, we probably want the
window's \l{QWidget::close()}{close()} function to be called.
- Older toolkits achieve this kind of communication using
+ Other toolkits achieve this kind of communication using
callbacks. A callback is a pointer to a function, so if you want
a processing function to notify you about some event you pass a
pointer to another function (the callback) to the processing
function. The processing function then calls the callback when
- appropriate. Callbacks have two fundamental flaws: Firstly, they
- are not type-safe. We can never be certain that the processing
- function will call the callback with the correct arguments.
- Secondly, the callback is strongly coupled to the processing
- function since the processing function must know which callback
- to call.
+ appropriate. While successful frameworks using this method do exist,
+ callbacks can be unintuitive and may suffer from problems in ensuring
+ the type-correctness of callback arguments.
\section1 Signals and Slots
diff --git a/src/corelib/doc/src/plugin-classes.qdoc b/src/corelib/doc/src/plugin-classes.qdoc
new file mode 100644
index 0000000000..745e73151b
--- /dev/null
+++ b/src/corelib/doc/src/plugin-classes.qdoc
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group plugins
+ \title Plugin Classes
+ \ingroup groups
+
+ \brief Plugin related classes.
+
+ These \l{Qt Core} classes deal with shared libraries, (for example, .so and DLL
+ files), and with Qt plugins.
+
+ See the \l{How to Create Qt Plugins} page for more information.
+*/
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
deleted file mode 100644
index 7dc0d01cce..0000000000
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ /dev/null
@@ -1,333 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \group plugins
- \title Plugin Classes
- \ingroup groups
-
- \brief Plugin related classes.
-
- These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL
- files), and with Qt plugins.
-
- See the \l{How to Create Qt Plugins} page for more information.
-*/
-
-/*!
- \page plugins-howto.html
- \title How to Create Qt Plugins
- \brief A guide to creating plugins to extend Qt applications and
- functionality provided by Qt.
-
- \ingroup frameworks-technologies
- \ingroup qt-basic-concepts
-
-
- \keyword QT_DEBUG_PLUGINS
- \keyword QT_NO_PLUGIN_CHECK
-
- Qt provides two APIs for creating plugins:
-
- \list
- \li A higher-level API for writing extensions to Qt itself: custom database
- drivers, image formats, text codecs, custom styles, etc.
- \li A lower-level API for extending Qt applications.
- \endlist
-
- For example, if you want to write a custom QStyle subclass and
- have Qt applications load it dynamically, you would use the
- higher-level API.
-
- Since the higher-level API is built on top of the lower-level API,
- some issues are common to both.
-
- If you want to provide plugins for use with Qt Designer, see the Qt Designer
- module documentation.
-
- Topics:
-
- \tableofcontents
-
- \section1 The Higher-Level API: Writing Qt Extensions
-
- Writing a plugin that extends Qt itself is achieved by
- subclassing the appropriate plugin base class, implementing a few
- functions, and adding a macro.
-
- There are several plugin base classes. Derived plugins are stored
- by default in sub-directories of the standard plugin directory. Qt
- will not find plugins if they are not stored in the right
- directory.
-
- \table
- \header \li Base Class \li Directory Name \li Key Case Sensitivity
- \row \li QAccessibleBridgePlugin \li \c accessiblebridge \li Case Sensitive
- \row \li QAccessiblePlugin \li \c accessible \li Case Sensitive
- \row \li QDecorationPlugin \li \c decorations \li Case Insensitive
- \row \li QFontEnginePlugin \li \c fontengines \li Case Insensitive
- \row \li QIconEnginePlugin \li \c iconengines \li Case Insensitive
- \row \li QImageIOPlugin \li \c imageformats \li Case Sensitive
- \row \li QInputContextPlugin \li \c inputmethods \li Case Sensitive
- \row \li QKbdDriverPlugin \li \c kbddrivers \li Case Insensitive
- \row \li QMouseDriverPlugin \li \c mousedrivers \li Case Insensitive
- \row \li QScreenDriverPlugin \li \c gfxdrivers \li Case Insensitive
- \row \li QScriptExtensionPlugin \li \c script \li Case Sensitive
- \row \li QSqlDriverPlugin \li \c sqldrivers \li Case Sensitive
- \row \li QStylePlugin \li \c styles \li Case Insensitive
- \row \li QTextCodecPlugin \li \c codecs \li Case Sensitive
- \endtable
-
- Suppose that you have a new style class called \c MyStyle that you
- want to make available as a plugin. The required code is
- straightforward, here is the class definition (\c
- mystyleplugin.h):
-
- \snippet code/doc_src_plugins-howto.cpp 0
-
- Ensure that the class implementation is located in a \c .cpp file:
-
- \snippet code/doc_src_plugins-howto.cpp 1
-
- (Note that QStylePlugin is case insensitive, and the lower-case
- version of the key is used in our
- \l{QStylePlugin::create()}{create()} implementation; most other
- plugins are case sensitive.)
-
- In addition a \c mystyleplugin.json file containing meta data
- describing the plugin is required for most plugins. For style
- plugins it simply contains a list of styles that can be created
- by the plugin:
-
- \snippet code/doc_src_plugins-howto.qdoc 6
-
- The type of information that needs to be provided in the json file
- is plugin dependent, please see the class documentation for
- details on the information that needs to be contained in the
- file.
-
- For database drivers, image formats, text codecs, and most other
- plugin types, no explicit object creation is required. Qt will
- find and create them as required. Styles are an exception, since
- you might want to set a style explicitly in code. To apply a
- style, use code like this:
-
- \snippet code/doc_src_plugins-howto.cpp 2
-
- Some plugin classes require additional functions to be
- implemented. See the class documentation for details of the
- virtual functions that must be reimplemented for each type of
- plugin.
-
- The \l{Style Plugin Example} shows how to implement a plugin
- that extends the QStylePlugin base class.
-
- \section1 The Lower-Level API: Extending Qt Applications
-
- Not only Qt itself but also Qt application can be extended
- through plugins. This requires the application to detect and load
- plugins using QPluginLoader. In that context, plugins may provide
- arbitrary functionality and are not limited to database drivers,
- image formats, text codecs, styles, and the other types of plugin
- that extend Qt's functionality.
-
- Making an application extensible through plugins involves the
- following steps:
-
- \list 1
- \li Define a set of interfaces (classes with only pure virtual
- functions) used to talk to the plugins.
- \li Use the Q_DECLARE_INTERFACE() macro to tell Qt's
- \l{meta-object system} about the interface.
- \li Use QPluginLoader in the application to load the plugins.
- \li Use qobject_cast() to test whether a plugin implements a given
- interface.
- \endlist
-
- Writing a plugin involves these steps:
-
- \list 1
- \li Declare a plugin class that inherits from QObject and from the
- interfaces that the plugin wants to provide.
- \li Use the Q_INTERFACES() macro to tell Qt's \l{meta-object
- system} about the interfaces.
- \li Export the plugin using the Q_PLUGIN_METADATA() macro.
- \li Build the plugin using a suitable \c .pro file.
- \endlist
-
- For example, here's the definition of an interface class:
-
- \snippet plugins/interfaces.h 2
-
- Here's the definition of a plugin class that implements that
- interface:
-
- \snippet plugins/extrafiltersplugin.h 0
-
- The \l{tools/plugandpaint}{Plug & Paint} example documentation
- explains this process in detail. See also \l{Creating Custom
- Widgets for Qt Designer} for information about issues that are
- specific to Qt Designer. You can also take a look at the
- \l{Echo Plugin Example} which is a more trivial example on
- how to implement a plugin that extends Qt applications.
- Please note that a QCoreApplication must have been initialized
- before plugins can be loaded.
-
- \section1 Locating Plugins
-
- Qt applications automatically know which plugins are available,
- because plugins are stored in the standard plugin subdirectories.
- Because of this applications don't require any code to find and load
- plugins, since Qt handles them automatically.
-
- During development, the directory for plugins is \c{QTDIR/plugins}
- (where \c QTDIR is the directory where Qt is installed), with each
- type of plugin in a subdirectory for that type, e.g. \c styles. If
- you want your applications to use plugins and you don't want to use
- the standard plugins path, have your installation process
- determine the path you want to use for the plugins, and save the
- path, e.g. using QSettings, for the application to read when it
- runs. The application can then call
- QCoreApplication::addLibraryPath() with this path and your
- plugins will be available to the application. Note that the final
- part of the path (e.g., \c styles) cannot be changed.
-
- If you want the plugin to be loadable then one approach is to
- create a subdirectory under the application and place the plugin
- in that directory. If you distribute any of the plugins that come
- with Qt (the ones located in the \c plugins directory), you must
- copy the sub-directory under \c plugins where the plugin is
- located to your applications root folder (i.e., do not include the
- \c plugins directory).
-
- For more information about deployment,
- see the \l {Deploying Qt Applications} and \l {Deploying Plugins}
- documentation.
-
- \section1 Static Plugins
-
- The normal and most flexible way to include a plugin with an
- application is to compile it into a dynamic library that is shipped
- separately, and detected and loaded at runtime.
-
- Plugins can be linked statically into your application. If you
- build the static version of Qt, this is the only option for
- including Qt's predefined plugins. Using static plugins makes the
- deployment less error-prone, but has the disadvantage that no
- functionality from plugins can be added without a complete rebuild
- and redistribution of the application.
-
- When compiled as a static library, Qt provides the following
- static plugins:
-
- \table
- \header \li Plugin name \li Type \li Description
- \row \li \c qtaccessiblewidgets \li Accessibility \li Accessibility for Qt widgets
- \row \li \c qgif \li Image formats \li GIF
- \row \li \c qjpeg \li Image formats \li JPEG
- \row \li \c qmng \li Image formats \li MNG
- \row \li \c qico \li Image formats \li ICO
- \row \li \c qsvg \li Image formats \li SVG
- \row \li \c qtiff \li Image formats \li TIFF
- \row \li \c qsqldb2 \li SQL driver \li IBM DB2
- \row \li \c qsqlibase \li SQL driver \li Borland InterBase
- \row \li \c qsqlite \li SQL driver \li SQLite version 3
- \row \li \c qsqlite2 \li SQL driver \li SQLite version 2
- \row \li \c qsqlmysql \li SQL driver \li MySQL
- \row \li \c qsqloci \li SQL driver \li Oracle (OCI)
- \row \li \c qsqlodbc \li SQL driver \li Open Database Connectivity (ODBC)
- \row \li \c qsqlpsql \li SQL driver \li PostgreSQL
- \row \li \c qsqltds \li SQL driver \li Sybase Adaptive Server (TDS)
- \endtable
-
- To link those plugins statically, you need to add
- the required plugins to your build using \c QTPLUGIN.
-
- In the \c .pro file for your application, you need the following
- entry:
-
- \snippet code/doc_src_plugins-howto.pro 5
-
- qmake automatically adds the plugins to QTPLUGIN that are typically
- needed by the used Qt modules (see \c QT), while more specialized
- plugins need to be added manually.
- The default list of automatically added plugins can be overridden
- per type.
- For example, to link the minimal plugin instead of the default Qt
- platform adaptation plugin, use:
-
- \snippet code/doc_src_plugins-howto.pro 4
-
- If you want neither the default nor the minimal QPA plugin to be
- linked automatically, use:
-
- \snippet code/doc_src_plugins-howto.pro 6
-
- The defaults are tuned towards an optimal out-of-the-box experience,
- but may unnecessarily bloat the application.
- It is recommended to inspect the linker command line built by qmake
- and eliminate unnecessary plugins.
-
- \section2 Details of Linking Static Plugins
-
- To cause static plugins actually being linked and instantiated,
- Q_IMPORT_PLUGIN() macros are also needed in application code,
- but those are automatically generated by qmake and added to
- your application project.
-
- If you do not want all plugins added to QTPLUGIN to be automatically
- linked, remove \c import_plugins from the \c CONFIG variable:
-
- \snippet code/doc_src_plugins-howto.pro 7
-
- \section2 Creating Static Plugins
-
- It is also possible to create your own static plugins, by
- following these steps:
-
- \list 1
- \li Add \c{CONFIG += static} to your plugin's \c .pro file.
- \li Use the Q_IMPORT_PLUGIN() macro in your application.
- \li Link your application with your plugin library using \c LIBS
- in the \c .pro file.
- \endlist
-
- See the \l{tools/plugandpaint}{Plug & Paint} example and the
- associated \l{tools/plugandpaintplugins/basictools}{Basic Tools}
- plugin for details on how to do this.
-
- \note If you are not using qmake to build your plugin you need
- to make sure that the \c{QT_STATICPLUGIN} preprocessor macro is
- defined.
-
- \section1 Deploying and Debugging Plugins
-
- The \l{Deploying Plugins} document covers the process of deploying
- plugins with applications and debugging them when problems arise.
-
- \sa QPluginLoader, QLibrary, {Plug & Paint Example}
-*/
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 48adc43b77..ac60d47c7e 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -730,7 +730,6 @@
/* C++11 features supported in GCC 4.4: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
-# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
@@ -746,6 +745,7 @@
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_RAW_STRINGS
+# define Q_COMPILER_CLASS_ENUM
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
/* C++11 features supported in GCC 4.6: */
diff --git a/src/corelib/global/qglobalstatic.cpp b/src/corelib/global/qglobalstatic.cpp
index 4e8ad2f837..3f7aea60b8 100644
--- a/src/corelib/global/qglobalstatic.cpp
+++ b/src/corelib/global/qglobalstatic.cpp
@@ -84,7 +84,7 @@
whether the type has already been destroyed, to avoid the
use-after-destruction problem (see QGlobalStatic::isDestroyed()).
- \section1 Constructor and destructor
+ \section1 Constructor and Destructor
For Q_GLOBAL_STATIC, the type \c Type must be publicly
default-constructible and publicly destructible. For
@@ -156,7 +156,7 @@
This macro will work, but it will add unnecessary overhead.
- \section1 Reentrancy, thread-safety, deadlocks, and exception-safety on construction
+ \section1 Reentrancy, Thread-safety, Deadlocks, and Exception-safety on Construction
The Q_GLOBAL_STATIC macro creates an object that initializes itself on
first use in a thread-safe manner: if multiple threads attempt to
@@ -224,7 +224,7 @@
\li the object was always created on the heap.
\endlist
- \section1 Implementation details
+ \section1 Implementation Details
Q_GLOBAL_STATIC is implemented by creating a QBasicAtomicInt called the \c
guard and a free, inline function called \c innerFunction. The guard
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 323c86f511..2a4f2dd4d6 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -2,6 +2,7 @@
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
+** Copyright (C) 2014 Intel Corporation.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,6 +47,7 @@
#include "qcoreapplication.h"
#include "qthread.h"
#include "private/qloggingregistry_p.h"
+#include "private/qcoreapplication_p.h"
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -62,7 +64,12 @@
# define SD_JOURNAL_SUPPRESS_LOCATION
# include <systemd/sd-journal.h>
# include <syslog.h>
+#endif
+#ifdef Q_OS_UNIX
+# include <sys/types.h>
+# include <sys/stat.h>
# include <unistd.h>
+# include "private/qcore_unix_p.h"
#endif
#if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED)
@@ -109,32 +116,54 @@ static bool isFatal(QtMsgType msgType)
return false;
}
-#ifdef Q_OS_WIN
-
-// Do we have stderr for QDebug? - Either there is a console or we are running
-// with redirected stderr.
-# if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-static inline bool hasStdErr()
+static bool willLogToConsole()
{
- if (GetConsoleWindow())
+#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+ // these systems have no stderr, so always log to the system log
+ return false;
+#elif defined(QT_BOOTSTRAPPED)
+ return true;
+#else
+ // rules to determine if we'll log preferably to the console:
+ // 1) if QT_LOGGING_TO_CONSOLE is set, it determines behavior:
+ // - if it's set to 0, we will not log to console
+ // - if it's set to 1, we will log to console
+ // 2) otherwise, we will log to console if we have a console window (Windows)
+ // or a controlling TTY (Unix). This is done even if stderr was redirected
+ // to the blackhole device (NUL or /dev/null).
+
+ bool ok = true;
+ uint envcontrol = qgetenv("QT_LOGGING_TO_CONSOLE").toUInt(&ok);
+ if (ok)
+ return envcontrol;
+
+# ifdef Q_OS_WIN
+ return GetConsoleWindow();
+# elif defined(Q_OS_UNIX)
+ // if /dev/tty exists, we can only open it if we have a controlling TTY
+ int devtty = qt_safe_open("/dev/tty", O_RDONLY);
+ if (devtty == -1 && (errno == ENOENT || errno == EPERM)) {
+ // no /dev/tty, fall back to isatty on stderr
+ return isatty(STDERR_FILENO);
+ } else if (devtty != -1) {
+ // there is a /dev/tty and we could open it: we have a controlling TTY
+ qt_safe_close(devtty);
return true;
- STARTUPINFO info;
- GetStartupInfo(&info);
- return (info.dwFlags & STARTF_USESTDHANDLES) && info.hStdError
- && info.hStdError != INVALID_HANDLE_VALUE;
-}
-# endif // !Q_OS_WINCE && !Q_OS_WINRT
+ }
-Q_CORE_EXPORT bool qWinLogToStderr()
-{
-# if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
- static const bool result = hasStdErr();
- return result;
-# else
+ // no controlling TTY
return false;
+# else
+# error "Not Unix and not Windows?"
# endif
+#endif
+}
+
+Q_CORE_EXPORT bool qt_logging_to_console()
+{
+ static const bool logToConsole = willLogToConsole();
+ return logToConsole;
}
-#endif // Q_OS_WIN
/*!
\class QMessageLogContext
@@ -145,6 +174,9 @@ Q_CORE_EXPORT bool qWinLogToStderr()
The class provides information about the source code location a qDebug(), qWarning(),
qCritical() or qFatal() message was generated.
+ \note By default, this information is recorded only in debug builds. You can overwrite
+ this explicitly by defining \c QT_MESSAGELOGCONTEXT or \c{QT_NO_MESSAGELOGCONTEXT}.
+
\sa QMessageLogger, QtMessageHandler, qInstallMessageHandler()
*/
@@ -156,8 +188,9 @@ Q_CORE_EXPORT bool qWinLogToStderr()
QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses
it through qDebug(), qWarning(), qCritical, or qFatal() functions,
- which are actually macros that expand to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
- et al.
+ which are actually macros: For example qDebug() expands to
+ QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
+ for debug builds, and QMessageLogger(0, 0, 0).debug() for release builds.
One example of direct use is to forward errors that stem from a scripting language, e.g. QML:
@@ -977,7 +1010,7 @@ void QMessagePattern::setPattern(const QString &pattern)
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
if (0)
#elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
- if (!qWinLogToStderr()) {
+ if (!qt_logging_to_console()) {
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
} else
#endif
@@ -1269,44 +1302,25 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
{
QString logMessage = qFormatLogMessage(type, context, buf);
-#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
- if (!qWinLogToStderr()) {
+ if (!qt_logging_to_console()) {
+#if defined(Q_OS_WIN)
OutputDebugString(reinterpret_cast<const wchar_t *>(logMessage.utf16()));
return;
- }
-#endif // Q_OS_WIN
-
- static const bool logToConsole = qEnvironmentVariableIsSet("QT_LOGGING_TO_CONSOLE");
-#if defined(QT_USE_SLOG2)
- if (!logToConsole) {
+#elif defined(QT_USE_SLOG2)
slog2_default_handler(type, logMessage.toLocal8Bit().constData());
- } else {
- fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
- fflush(stderr);
- }
+ return;
#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
- // We support environment variables for Qt Creator use, or more complicated cases
- // like subprocesses.
- if (!logToConsole) {
// remove trailing \n, systemd appears to want them newline-less
logMessage.chop(1);
systemd_default_message_handler(type, context, logMessage);
- } else {
- fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
- fflush(stderr);
- }
+ return;
#elif defined(Q_OS_ANDROID)
- if (!logToConsole) {
android_default_message_handler(type, context, logMessage);
- } else {
- fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
- fflush(stderr);
+ return;
+#endif
}
-#else
fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
fflush(stderr);
-#endif
- Q_UNUSED(logToConsole);
}
/*!
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index b952f999cb..f9bbf7fcce 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -124,13 +124,28 @@ private:
QMessageLogContext context;
};
-/*
- qDebug, qWarning, qCritical, qFatal are redefined to automatically include context information
- */
-#define qDebug QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug
-#define qWarning QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).warning
-#define qCritical QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).critical
-#define qFatal QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).fatal
+#if !defined(QT_MESSAGELOGCONTEXT) && !defined(QT_NO_MESSAGELOGCONTEXT)
+# if defined(QT_NO_DEBUG)
+# define QT_NO_MESSAGELOGCONTEXT
+# else
+# define QT_MESSAGELOGCONTEXT
+# endif
+#endif
+
+#ifdef QT_MESSAGELOGCONTEXT
+ #define QT_MESSAGELOG_FILE __FILE__
+ #define QT_MESSAGELOG_LINE __LINE__
+ #define QT_MESSAGELOG_FUNC Q_FUNC_INFO
+#else
+ #define QT_MESSAGELOG_FILE 0
+ #define QT_MESSAGELOG_LINE 0
+ #define QT_MESSAGELOG_FUNC 0
+#endif
+
+#define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug
+#define qWarning QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).warning
+#define qCritical QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).critical
+#define qFatal QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).fatal
#define QT_NO_QDEBUG_MACRO while (false) QMessageLogger().noDebug
#define QT_NO_QWARNING_MACRO while (false) QMessageLogger().noDebug
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 5dd1e5e126..8d757a7773 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -133,7 +133,7 @@ QT_BEGIN_NAMESPACE
special requirements.
\target raw
- \section1 Reading and writing raw binary data
+ \section1 Reading and Writing Raw Binary Data
You may wish to read/write your own raw binary data to/from the
data stream directly. Data may be read from the stream into a
@@ -149,14 +149,14 @@ QT_BEGIN_NAMESPACE
data, followed by the data. Note that any encoding/decoding of
the data (apart from the length quint32) must be done by you.
- \section1 Reading and writing Qt collection classes
+ \section1 Reading and Writing Qt Collection Classes
The Qt container classes can also be serialized to a QDataStream.
These include QList, QLinkedList, QVector, QSet, QHash, and QMap.
The stream operators are declared as non-members of the classes.
\target Serializing Qt Classes
- \section1 Reading and writing other Qt classes.
+ \section1 Reading and Writing Other Qt Classes
In addition to the overloaded stream operators documented here,
any Qt classes that you might want to serialize to a QDataStream
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index c3c504c1aa..95fa970b2d 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -140,7 +140,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
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
+ \section1 Adding Selectors
Selectors normally available are
\list
@@ -158,7 +158,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
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
+ \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:
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index e713769735..eebca1cfb0 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -149,6 +149,7 @@ bool QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
}
if (dirChanged)
emit emitDirectoryChanged(info.origPath, false);
+ ++it;
}
return needsRestart;
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 674742fbf6..42250b629d 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -160,15 +160,9 @@ QFSFileEngine::~QFSFileEngine()
Q_D(QFSFileEngine);
if (d->closeFileHandle) {
if (d->fh) {
- int ret;
- do {
- ret = fclose(d->fh);
- } while (ret == EOF && errno == EINTR);
+ fclose(d->fh);
} else if (d->fd != -1) {
- int ret;
- do {
- ret = QT_CLOSE(d->fd);
- } while (ret == -1 && errno == EINTR);
+ QT_CLOSE(d->fd);
}
}
d->unmapAll();
@@ -365,15 +359,14 @@ bool QFSFileEnginePrivate::closeFdFh()
// Close the file if we created the handle.
if (closeFileHandle) {
int ret;
- do {
- if (fh) {
- // Close buffered file.
- ret = fclose(fh) != 0 ? -1 : 0;
- } else {
- // Close unbuffered file.
- ret = QT_CLOSE(fd);
- }
- } while (ret == -1 && errno == EINTR);
+
+ if (fh) {
+ // Close buffered file.
+ ret = fclose(fh);
+ } else {
+ // Close unbuffered file.
+ ret = QT_CLOSE(fd);
+ }
// We must reset these guys regardless; calling close again after a
// failed close causes crashes on some systems.
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 0b55f2376a..37503e032c 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -71,14 +71,14 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
boundaries, nor to manipulate the objects directly, nor to inherit from
QLoggingCategory.
- \section1 Creating category objects
+ \section1 Creating Category Objects
The Q_DECLARE_LOGGING_CATEGORY() and Q_LOGGING_CATEGORY() macros
conveniently declare and create QLoggingCategory objects:
\snippet qloggingcategory/main.cpp 1
- \section1 Checking category configuration
+ \section1 Checking Category Configuration
QLoggingCategory provides \l isDebugEnabled(), \l isWarningEnabled(),
\l isCriticalEnabled(), as well as \l isEnabled()
@@ -90,7 +90,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
\snippet qloggingcategory/main.cpp 4
- \section1 Default category configuration
+ \section1 Default Category Configuration
Both the QLoggingCategory constructor and the Q_LOGGING_CATEGORY() macro
accept an optional QtMsgType argument, which disables all message types with
@@ -172,7 +172,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
custom filter via \l installFilter(). All filter rules are ignored in this
case.
- \section1 Printing the category
+ \section1 Printing the Category
Use the \c %{category} place holder to print the category in the default
message handler:
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index cd3a7bf789..c7e242af08 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -110,15 +110,16 @@ private:
static const QLoggingCategory category(__VA_ARGS__); \
return category; \
}
+
#define qCDebug(category, ...) \
for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).debug(__VA_ARGS__)
#define qCWarning(category, ...) \
for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).warning(__VA_ARGS__)
#define qCCritical(category, ...) \
for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).critical(__VA_ARGS__)
#else // defined(Q_COMPILER_VARIADIC_MACROS) || defined(Q_MOC_RUN)
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 4ee3068e27..e9ee8d9458 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -391,9 +391,9 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
Q_ASSERT(reg->categories.contains(cat));
QtMsgType enableForLevel = reg->categories.value(cat);
- bool debug = (enableForLevel == QtDebugMsg) ? true : false;
- bool warning = (enableForLevel <= QtWarningMsg) ? true : false;
- bool critical = (enableForLevel <= QtCriticalMsg) ? true : false;
+ bool debug = (enableForLevel == QtDebugMsg);
+ bool warning = (enableForLevel <= QtWarningMsg);
+ bool critical = (enableForLevel <= QtCriticalMsg);
// hard-wired implementation of
// qt.*.debug=false
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ecb97ef3e9..e009191be9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1659,11 +1659,10 @@ QProcess::ProcessState QProcess::state() const
/*!
\deprecated
- Sets the environment that QProcess will use when starting a process to the
- \a environment specified which consists of a list of key=value pairs.
+ Sets the environment that QProcess will pass to the child process.
+ The parameter \a environment is a list of key=value pairs.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 0
@@ -1679,7 +1678,7 @@ void QProcess::setEnvironment(const QStringList &environment)
/*!
\deprecated
- Returns the environment that QProcess will use when starting a
+ Returns the environment that QProcess will pass to its child
process, or an empty QStringList if no environment has been set
using setEnvironment(). If no environment has been set, the
environment of the calling process will be used.
@@ -1697,11 +1696,9 @@ QStringList QProcess::environment() const
/*!
\since 4.6
- Sets the environment that QProcess will use when starting a process to the
- \a environment object.
+ Sets the \a environment that QProcess will pass to the child process.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows and sets \c{TMPDIR}:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 1
@@ -1717,7 +1714,7 @@ void QProcess::setProcessEnvironment(const QProcessEnvironment &environment)
/*!
\since 4.6
- Returns the environment that QProcess will use when starting a
+ Returns the environment that QProcess will pass to its child
process, or an empty object if no environment has been set using
setEnvironment() or setProcessEnvironment(). If no environment has
been set, the environment of the calling process will be used.
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 01a70720ee..f6cd5aa7c9 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -672,11 +672,11 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
}
}
-inline static void iniChopTrailingSpaces(QString &str)
+inline static void iniChopTrailingSpaces(QString &str, int limit)
{
int n = str.size() - 1;
QChar ch;
- while (n >= 0 && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
+ while (n >= limit && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
str.truncate(n--);
}
@@ -734,6 +734,7 @@ StSkipSpaces:
// fallthrough
StNormal:
+ int chopLimit = stringResult.length();
while (i < to) {
switch (str.at(i)) {
case '\\':
@@ -771,6 +772,7 @@ StNormal:
} else {
// the character is skipped
}
+ chopLimit = stringResult.length();
break;
case '"':
++i;
@@ -782,7 +784,7 @@ StNormal:
case ',':
if (!inQuotedString) {
if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
+ iniChopTrailingSpaces(stringResult, chopLimit);
if (!isStringList) {
isStringList = true;
stringListResult.clear();
@@ -822,6 +824,8 @@ StNormal:
}
}
}
+ if (!currentValueIsQuoted)
+ iniChopTrailingSpaces(stringResult, chopLimit);
goto end;
StHexEscape:
@@ -861,8 +865,6 @@ StOctEscape:
}
end:
- if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
if (isStringList)
stringListResult.append(stringResult);
return isStringList;
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index b22358ed27..481de6ee38 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -88,12 +88,12 @@ QT_BEGIN_NAMESPACE
static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
{
- if (mountDir.startsWith(QStringLiteral("/dev"))
- || mountDir.startsWith(QStringLiteral("/proc"))
- || mountDir.startsWith(QStringLiteral("/run"))
- || mountDir.startsWith(QStringLiteral("/sys"))
- || mountDir.startsWith(QStringLiteral("/var/run"))
- || mountDir.startsWith(QStringLiteral("/var/lock"))) {
+ if (mountDir.startsWith(QLatin1String("/dev"))
+ || mountDir.startsWith(QLatin1String("/proc"))
+ || mountDir.startsWith(QLatin1String("/run"))
+ || mountDir.startsWith(QLatin1String("/sys"))
+ || mountDir.startsWith(QLatin1String("/var/run"))
+ || mountDir.startsWith(QLatin1String("/var/lock"))) {
return true;
}
#if defined(Q_OS_LINUX)
diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp
index aa970778e6..b0d3e7c6da 100644
--- a/src/corelib/io/qstorageinfo_win.cpp
+++ b/src/corelib/io/qstorageinfo_win.cpp
@@ -61,7 +61,7 @@ void QStorageInfoPrivate::initRootPath()
QString path = QDir::toNativeSeparators(rootPath);
rootPath.clear();
- if (path.startsWith(QStringLiteral("\\\\?\\")))
+ if (path.startsWith(QLatin1String("\\\\?\\")))
path.remove(0, 4);
if (path.length() < 2 || path.at(1) != QLatin1Char(':'))
return;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 4cf957089f..d153b2e4f9 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -678,7 +678,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
will remain in the old thread when moveToThread() is called.
\target No copy constructor
- \section1 No copy constructor or assignment operator
+ \section1 No Copy Constructor or Assignment Operator
QObject has neither a copy constructor nor an assignment operator.
This is by design. Actually, they are declared, but in a
@@ -723,7 +723,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
and both standard Qt widgets and user-created forms can be given dynamic
properties.
- \section1 Internationalization (i18n)
+ \section1 Internationalization (I18n)
All QObject subclasses support Qt's translation features, making it possible
to translate an application's user interface into different languages.
@@ -1465,14 +1465,14 @@ void QObject::moveToThread(QThread *targetThread)
}
QThreadData *currentData = QThreadData::current();
- QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0);
+ QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR;
if (d->threadData->thread == 0 && currentData == targetData) {
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
currentData = d->threadData;
} else if (d->threadData != currentData) {
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
- currentData->thread, d->threadData->thread, targetData->thread);
+ currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
#ifdef Q_OS_MAC
qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. "
@@ -1486,6 +1486,9 @@ void QObject::moveToThread(QThread *targetThread)
// prepare to move
d->moveToThread_helper();
+ if (!targetData)
+ targetData = new QThreadData(0);
+
QOrderedMutexLocker locker(&currentData->postEventList.mutex,
&targetData->postEventList.mutex);
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 2d97cf5a6a..bdbd0dd8ef 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -442,7 +442,8 @@ protected:
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
#endif
-#ifndef Q_NO_TEMPLATE_FRIENDS
+// ### Qt6: FIXME: Remove the special Q_CC_MSVC handling, it was introduced to maintain BC for QTBUG-41810 .
+#if !defined(Q_NO_TEMPLATE_FRIENDS) && !defined(Q_CC_MSVC)
template<typename T>
friend inline T qvariant_cast(const QVariant &);
template<typename T> friend struct QtPrivate::QVariantValueHelper;
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 411d1dfdd5..bd5032dcc0 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -290,11 +290,15 @@ void QFactoryLoader::refreshAll()
}
}
+// avoid duplicate QStringLiteral data:
+static inline QString metaDataKeyLiteral() { return QStringLiteral("MetaData"); }
+static inline QString keysKeyLiteral() { return QStringLiteral("Keys"); }
+
QMultiMap<int, QString> QFactoryLoader::keyMap() const
{
QMultiMap<int, QString> result;
- const QString metaDataKey = QStringLiteral("MetaData");
- const QString keysKey = QStringLiteral("Keys");
+ const QString metaDataKey = metaDataKeyLiteral();
+ const QString keysKey = keysKeyLiteral();
const QList<QJsonObject> metaDataList = metaData();
for (int i = 0; i < metaDataList.size(); ++i) {
const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject();
@@ -308,8 +312,8 @@ QMultiMap<int, QString> QFactoryLoader::keyMap() const
int QFactoryLoader::indexOf(const QString &needle) const
{
- const QString metaDataKey = QStringLiteral("MetaData");
- const QString keysKey = QStringLiteral("Keys");
+ const QString metaDataKey = metaDataKeyLiteral();
+ const QString keysKey = keysKeyLiteral();
const QList<QJsonObject> metaDataList = metaData();
for (int i = 0; i < metaDataList.size(); ++i) {
const QJsonObject metaData = metaDataList.at(i).value(metaDataKey).toObject();
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index 6966047c13..92f21fc512 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -89,7 +89,7 @@
/*! \fn QFuture::QFuture()
- Constructs an empty future.
+ Constructs an empty, canceled future.
*/
/*! \fn QFuture::QFuture(const QFuture &other)
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 6bb3f934a1..3caad7c4b2 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -213,7 +213,7 @@ QThreadPrivate::~QThreadPrivate()
\note Care must be taken when interacting with objects across different
threads. See \l{Synchronizing Threads} for details.
- \section1 Managing threads
+ \section1 Managing Threads
QThread will notifiy you via a signal when the thread is
started() and finished(), or you can use isFinished() and
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 2551233aec..5e5a2b42e2 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -144,7 +144,7 @@
QList and QVector's non-const iterator types are random access iterators.
- \section1 Qt and the STL algorithms
+ \section1 Qt and the STL Algorithms
Historically, Qt used to provide functions which were direct equivalents of
many STL algorithmic functions. Starting with Qt 5.0, you are instead
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index 62c77cf10f..5c391d7e4f 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -282,11 +282,18 @@ void QBitArray::resize(int size)
/*!
\overload
- Sets bits at index positions \a begin up to and excluding \a end
+ Sets bits at index positions \a begin up to (but not including) \a end
to \a value.
- \a begin and \a end must be a valid index position in the bit
- array (i.e., 0 <= \a begin <= size() and 0 <= \a end <= size()).
+ \a begin must be a valid index position in the bit array
+ (0 <= \a begin < size()).
+
+ \a end must be either a valid index position or equal to size(), in
+ which case the fill operation runs until the end of the array
+ (0 <= \a end <= size()).
+
+ Example:
+ \snippet code/src_corelib_tools_qbitarray.cpp 15
*/
void QBitArray::fill(bool value, int begin, int end)
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index a0b88a65d0..4fa07b17d4 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -196,7 +196,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
min = rex.cap(5).toInt();
sec = rex.cap(6).toInt();
}
- positiveOffset = (rex.cap(7) == QStringLiteral("+"));
+ positiveOffset = (rex.cap(7) == QLatin1String("+"));
hourOffset = rex.cap(8).toInt();
minOffset = rex.cap(9).toInt();
}
@@ -217,7 +217,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc
min = rex.cap(4).toInt();
sec = rex.cap(5).toInt();
}
- positiveOffset = (rex.cap(7) == QStringLiteral("+"));
+ positiveOffset = (rex.cap(7) == QLatin1String("+"));
hourOffset = rex.cap(8).toInt();
minOffset = rex.cap(9).toInt();
}
diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp
index cf2b3b4c9d..52875bc9fe 100644
--- a/src/corelib/tools/qelapsedtimer.cpp
+++ b/src/corelib/tools/qelapsedtimer.cpp
@@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE
\snippet qelapsedtimer/main.cpp 2
- \section1 Reference clocks
+ \section1 Reference Clocks
QElapsedTimer will use the platform's monotonic reference clock in all
platforms that support it (see QElapsedTimer::isMonotonic()). This has
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 7ab2ffffd4..8e2bed7a7c 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -468,7 +468,7 @@ void **QListData::erase(void **xi)
value that might not be in the valid range, check that it is less
than the value returned by size() but \e not less than 0.
- \section1 More members
+ \section1 More Members
If T is a QByteArray, this class has a couple more members that can be
used. See the documentation for QByteArrayList for more information.
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index cd7b375c8f..228ee5b842 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
\snippet code/src_corelib_tools_qregularexpression.cpp 3
- \section1 Pattern options
+ \section1 Pattern Options
The meaning of the pattern string can be modified by setting one or more
\e{pattern options}. For instance, it is possible to set a pattern to match
@@ -162,7 +162,7 @@ QT_BEGIN_NAMESPACE
Please refer to the QRegularExpression::PatternOption enum documentation for
more information about each pattern option.
- \section1 Match type and match options
+ \section1 Match Type and Match Options
The last two arguments of the match() and the globalMatch() functions set
the match type and the match options. The match type is a value of the
@@ -177,7 +177,7 @@ QT_BEGIN_NAMESPACE
QRegularExpression::MatchOption enum documentation for more details.
\target normal matching
- \section1 Normal matching
+ \section1 Normal Matching
In order to perform a match you can simply invoke the match() function
passing a string to match against. We refer to this string as the
@@ -227,7 +227,7 @@ QT_BEGIN_NAMESPACE
\snippet code/src_corelib_tools_qregularexpression.cpp 12
\target global matching
- \section1 Global matching
+ \section1 Global Matching
\e{Global matching} is useful to find all the occurrences of a given
regular expression inside a subject string. Suppose that we want to extract
@@ -257,7 +257,7 @@ QT_BEGIN_NAMESPACE
the globalMatch() function, exactly like normal matching with match().
\target partial matching
- \section1 Partial matching
+ \section1 Partial Matching
A \e{partial match} is obtained when the end of the subject string is
reached, but more characters are needed to successfully complete the match.
@@ -396,7 +396,7 @@ QT_BEGIN_NAMESPACE
text) would have been \c{"abcabc"}; by matching only against the leading
\c{"abc"} we instead get a partial match.
- \section1 Error handling
+ \section1 Error Handling
It is possible for a QRegularExpression object to be invalid because of
syntax errors in the pattern string. The isValid() function will return
@@ -415,7 +415,7 @@ QT_BEGIN_NAMESPACE
its \l{QRegularExpressionMatch::}{isValid()} function will return false).
The same applies for attempting a global match.
- \section1 Unsupported Perl-compatible regular expressions features
+ \section1 Unsupported Perl-compatible Regular Expressions Features
QRegularExpression does not support all the features available in
Perl-compatible regular expressions. The most notable one is the fact that
@@ -424,7 +424,7 @@ QT_BEGIN_NAMESPACE
This may change in a future version of Qt.
- \section1 Notes for QRegExp users
+ \section1 Notes for QRegExp Users
The QRegularExpression class introduced in Qt 5 is a big improvement upon
QRegExp, in terms of APIs offered, supported pattern syntax and speed of
@@ -517,7 +517,7 @@ QT_BEGIN_NAMESPACE
QRegExp::CaretAtOffset behaviour. There is no equivalent for the other
QRegExp::CaretMode modes.
- \section1 Debugging code that uses QRegularExpression
+ \section1 Debugging Code that Uses QRegularExpression
QRegularExpression internally uses a just in time compiler (JIT) to
optimize the execution of the matching algorithm. The JIT makes extensive
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 1f166bb3c3..57829bdd08 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
\snippet code/src_corelib_tools_qscopedpointer.cpp 2
- \section1 Custom cleanup handlers
+ \section1 Custom Cleanup Handlers
Arrays as well as pointers that have been allocated with \c malloc must
not be deleted using \c delete. QScopedPointer's second template parameter
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index a72a99dbe7..37de091776 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -222,7 +222,7 @@ QT_BEGIN_NAMESPACE
In the member function documentation, \e{d pointer} always refers
to the internal pointer to the shared data object.
- \section1 Optimize performance for usage in Qt Containers
+ \section1 Optimize Performance for Usage in Qt Containers
You should consider marking your implicitly shared class as a movable type
using the Q_DECLARE_TYPEINFO() macro if it resembles the \c Employee class
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index ed557a05c7..666bc107fa 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -103,7 +103,7 @@
does so weakly. QWeakPointer has the same functionality, but its use for
that function is deprecated.
- \section1 Optional pointer tracking
+ \section1 Optional Pointer Tracking
A feature of QSharedPointer that can be enabled at compile-time for
debugging purposes is a pointer tracking mechanism. When enabled,
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index c0bfafc9a7..a84179e1e6 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -163,8 +163,8 @@ Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2,
Q_STATIC_STRING_DATA_HEADER_INITIALIZER(Size), \
QT_UNICODE_LITERAL(str) }; \
QStringDataPtr holder = { qstring_literal.data_ptr() }; \
- const QString s(holder); \
- return s; \
+ const QString qstring_literal_temp(holder); \
+ return qstring_literal_temp; \
}()) \
/**/
diff --git a/src/corelib/tools/qstringiterator.qdoc b/src/corelib/tools/qstringiterator.qdoc
index 9355191d46..ff0a097cb9 100644
--- a/src/corelib/tools/qstringiterator.qdoc
+++ b/src/corelib/tools/qstringiterator.qdoc
@@ -69,7 +69,7 @@
respectively after and behind the iterator's current position, but they
will not return the code point the iterator has moved through.
- \section1 Unicode handling
+ \section1 Unicode Handling
QString and all of its functions work in terms of UTF-16 code units. Unicode code points
that fall outside the Basic Multilingual Plane (U+10000 to U+10FFFF) will therefore
@@ -91,7 +91,7 @@
a decoding problem; please refer to the each function documentation for
more details.
- \section1 Unchecked iteration
+ \section1 Unchecked Iteration
It is possible to optimize iterating over a QString contents by skipping
some checks. This is in general not safe to do, because a QString is allowed
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 0f9d427bab..4e5393e0b0 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE
\tableofcontents
- \section1 Adding strings
+ \section1 Adding Strings
Strings can be added to a list using the \l
{QList::append()}{append()}, \l
@@ -99,7 +99,7 @@ QT_BEGIN_NAMESPACE
\snippet qstringlist/main.cpp 0
- \section1 Iterating over the strings
+ \section1 Iterating Over the Strings
To iterate over a list, you can either use index positions or
QList's Java-style and STL-style iterator types:
@@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE
QMutableStringListIterator class which is a type definition for
QMutableListIterator<QString>.
- \section1 Manipulating the strings
+ \section1 Manipulating the Strings
QStringList provides several functions allowing you to manipulate
the contents of a list. You can concatenate all the strings in a
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 0f8f4937b9..8f3db74131 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -935,7 +935,7 @@ QDataStream &operator>>(QDataStream &ds, QTimeZone &tz)
{
QString ianaId;
ds >> ianaId;
- if (ianaId == QStringLiteral("OffsetFromUtc")) {
+ if (ianaId == QLatin1String("OffsetFromUtc")) {
int utcOffset;
QString name;
QString abbreviation;
@@ -954,7 +954,7 @@ QDataStream &operator>>(QDataStream &ds, QTimeZone &tz)
QDebug operator<<(QDebug dbg, const QTimeZone &tz)
{
//TODO Include backend and data version details?
- dbg.nospace() << QStringLiteral("QTimeZone(") << qPrintable(QString::fromUtf8(tz.id())) << ')';
+ dbg.nospace() << "QTimeZone(" << QString::fromUtf8(tz.id()) << ')';
return dbg.space();
}
#endif
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index f93b17f505..d1ef769414 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -940,9 +940,9 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
QString line;
while (ianaId.isEmpty() && !ts.atEnd() && ts.status() == QTextStream::Ok) {
line = ts.readLine();
- if (line.left(5) == QStringLiteral("ZONE=")) {
+ if (line.startsWith(QLatin1String("ZONE="))) {
ianaId = line.mid(6, line.size() - 7).toUtf8();
- } else if (line.left(9) == QStringLiteral("TIMEZONE=")) {
+ } else if (line.startsWith(QLatin1String("TIMEZONE="))) {
ianaId = line.mid(10, line.size() - 11).toUtf8();
}
}
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 7e03fd4fb5..94f6a8bcde 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -325,7 +325,7 @@ QXmlStreamEntityResolver *QXmlStreamReader::entityResolver() const
namespace prefixes, you can turn off namespace processing completely
with the \l namespaceProcessing property.
- \section1 Incremental parsing
+ \section1 Incremental Parsing
QXmlStreamReader is an incremental parser. It can handle the case
where the document can't be parsed all at once because it arrives in
@@ -349,7 +349,7 @@ QXmlStreamEntityResolver *QXmlStreamReader::entityResolver() const
stream reader using addData(). Then you call your custom parsing
function that reads the XML events from the reader.
- \section1 Performance and memory consumption
+ \section1 Performance and Memory Consumption
QXmlStreamReader is memory-conservative by design, since it doesn't
store the entire XML document tree in memory, but only the current