summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-05 13:42:11 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-05 13:42:11 +0100
commit5e8ae03578ecd0538a774505f2f7e2fc626b0ab7 (patch)
tree3b6f704df4d55d0ed2a5a706acf785541a74a45e /src/corelib
parent7a5fea113ec6088135b0b6a0fc4297e0ef362bc5 (diff)
parentbe3fb9afe50361e4b35d02d28ef30851335b17b6 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: configure qmake/generators/mac/pbuilder_pbx.cpp src/corelib/kernel/qtimerinfo_unix.cpp src/plugins/platforms/cocoa/qcocoabackingstore.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: I8d125fe498f5304874e6976b53f588d3e98a66ac
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp10
-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/timers/analogclock.cpp145
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc4
-rw-r--r--src/corelib/doc/src/timers.qdoc14
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp7
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp4
-rw-r--r--src/corelib/io/qurlquery.cpp1
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp1
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.cpp14
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.h2
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp2
-rw-r--r--src/corelib/kernel/kernel.pri2
-rw-r--r--src/corelib/kernel/qcore_mac_p.h1
-rw-r--r--src/corelib/kernel/qpointer.cpp1
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp5
-rw-r--r--src/corelib/tools/qlocale_mac.mm22
-rw-r--r--src/corelib/tools/qstring.cpp15
-rw-r--r--src/corelib/tools/qvector.h3
22 files changed, 401 insertions, 37 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
index ddb84bcc74..7d7d71ac50 100644
--- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
@@ -598,3 +598,13 @@ bool readConfiguration(const QFile &file)
break;
}
//! [qunreachable-switch]
+
+//! [qt-version-check]
+#include <QtGlobal>
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
+//! [qt-version-check]
diff --git a/src/corelib/doc/snippets/plugins/extrafiltersplugin.h b/src/corelib/doc/snippets/plugins/extrafiltersplugin.h
new file mode 100644
index 0000000000..7add7abb53
--- /dev/null
+++ b/src/corelib/doc/snippets/plugins/extrafiltersplugin.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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
new file mode 100644
index 0000000000..b2261a1eb2
--- /dev/null
+++ b/src/corelib/doc/snippets/plugins/interfaces.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** 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/timers/analogclock.cpp b/src/corelib/doc/snippets/timers/analogclock.cpp
new file mode 100644
index 0000000000..6c0de25397
--- /dev/null
+++ b/src/corelib/doc/snippets/timers/analogclock.cpp
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+
+#include "analogclock.h"
+
+//! [0] //! [1]
+AnalogClock::AnalogClock(QWidget *parent)
+//! [0] //! [2]
+ : QWidget(parent)
+//! [2] //! [3]
+{
+//! [3] //! [4]
+ QTimer *timer = new QTimer(this);
+//! [4] //! [5]
+ connect(timer, SIGNAL(timeout()), this, SLOT(update()));
+//! [5] //! [6]
+ timer->start(1000);
+//! [6]
+
+ setWindowTitle(tr("Analog Clock"));
+ resize(200, 200);
+//! [7]
+}
+//! [1] //! [7]
+
+//! [8] //! [9]
+void AnalogClock::paintEvent(QPaintEvent *)
+//! [8] //! [10]
+{
+ static const QPoint hourHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -40)
+ };
+ static const QPoint minuteHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -70)
+ };
+
+ QColor hourColor(127, 0, 127);
+ QColor minuteColor(0, 127, 127, 191);
+
+ int side = qMin(width(), height());
+ QTime time = QTime::currentTime();
+//! [10]
+
+//! [11]
+ QPainter painter(this);
+//! [11] //! [12]
+ painter.setRenderHint(QPainter::Antialiasing);
+//! [12] //! [13]
+ painter.translate(width() / 2, height() / 2);
+//! [13] //! [14]
+ painter.scale(side / 200.0, side / 200.0);
+//! [9] //! [14]
+
+//! [15]
+ painter.setPen(Qt::NoPen);
+//! [15] //! [16]
+ painter.setBrush(hourColor);
+//! [16]
+
+//! [17] //! [18]
+ painter.save();
+//! [17] //! [19]
+ painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
+ painter.drawConvexPolygon(hourHand, 3);
+ painter.restore();
+//! [18] //! [19]
+
+//! [20]
+ painter.setPen(hourColor);
+//! [20] //! [21]
+
+ for (int i = 0; i < 12; ++i) {
+ painter.drawLine(88, 0, 96, 0);
+ painter.rotate(30.0);
+ }
+//! [21]
+
+//! [22]
+ painter.setPen(Qt::NoPen);
+//! [22] //! [23]
+ painter.setBrush(minuteColor);
+
+//! [24]
+ painter.save();
+ painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
+ painter.drawConvexPolygon(minuteHand, 3);
+ painter.restore();
+//! [23] //! [24]
+
+//! [25]
+ painter.setPen(minuteColor);
+//! [25] //! [26]
+
+//! [27]
+ for (int j = 0; j < 60; ++j) {
+ if ((j % 5) != 0)
+ painter.drawLine(92, 0, 96, 0);
+ painter.rotate(6.0);
+ }
+//! [27]
+}
+//! [26]
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
index af15d94af2..060df8fa18 100644
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ b/src/corelib/doc/src/plugins-howto.qdoc
@@ -184,12 +184,12 @@
For example, here's the definition of an interface class:
- \snippet tools/plugandpaint/interfaces.h 2
+ \snippet plugins/interfaces.h 2
Here's the definition of a plugin class that implements that
interface:
- \snippet tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h 0
+ \snippet plugins/extrafiltersplugin.h 0
The \l{tools/plugandpaint}{Plug & Paint} example documentation
explains this process in detail. See also \l{Creating Custom
diff --git a/src/corelib/doc/src/timers.qdoc b/src/corelib/doc/src/timers.qdoc
index 5e8095ae58..dcff26ea18 100644
--- a/src/corelib/doc/src/timers.qdoc
+++ b/src/corelib/doc/src/timers.qdoc
@@ -102,14 +102,14 @@
QTimer to redraw a widget at regular intervals. From \c{AnalogClock}'s
implementation:
- \snippet analogclock.cpp 0
- \snippet analogclock.cpp 2
- \snippet analogclock.cpp 3
- \snippet analogclock.cpp 4
- \snippet analogclock.cpp 5
- \snippet analogclock.cpp 6
+ \snippet timers/analogclock.cpp 0
+ \snippet timers/analogclock.cpp 2
+ \snippet timers/analogclock.cpp 3
+ \snippet timers/analogclock.cpp 4
+ \snippet timers/analogclock.cpp 5
+ \snippet timers/analogclock.cpp 6
\dots
- \snippet analogclock.cpp 7
+ \snippet timers/analogclock.cpp 7
Every second, QTimer will call the QWidget::update() slot to
refresh the clock's display.
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 67d26301a4..c591cc5b49 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -846,6 +846,10 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can
be compared with another similarly processed version id.
+ Example:
+
+ \snippet code/src_corelib_global_qglobal.cpp qt-version-check
+
\sa QT_VERSION
*/
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 1206b992e6..f0f3c935e6 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -128,7 +128,7 @@ void QFSFileEnginePrivate::init()
#ifdef Q_OS_WIN
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index fecfa7de2b..23ab507dad 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -921,7 +921,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
return 0;
}
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
// get handle to the file
HANDLE handle = fileHandle;
@@ -954,7 +954,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
// first create the file mapping handle
DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY;
mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0);
- if (mapHandle == INVALID_HANDLE_VALUE) {
+ if (mapHandle == NULL) {
q->setError(QFile::PermissionsError, qt_error_string());
#ifdef Q_USE_DEPRECATED_MAP_API
::CloseHandle(handle);
@@ -997,6 +997,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
}
::CloseHandle(mapHandle);
+ mapHandle = NULL;
return 0;
}
@@ -1016,7 +1017,7 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr)
maps.remove(ptr);
if (maps.isEmpty()) {
::CloseHandle(mapHandle);
- mapHandle = INVALID_HANDLE_VALUE;
+ mapHandle = NULL;
}
return true;
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 478db6c299..d4e0779381 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -160,10 +160,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
// Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache
// location for everyone. Most applications seem to be using a
// cache directory located in their AppData directory
- return writableLocation(DataLocation) + QLatin1String("\\cache");
+ return writableLocation(DataLocation) + QLatin1String("/cache");
case GenericCacheLocation:
- return writableLocation(GenericDataLocation) + QLatin1String("\\cache");
+ return writableLocation(GenericDataLocation) + QLatin1String("/cache");
case RuntimeLocation:
case HomeLocation:
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 23c0b948e8..547084840f 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QUrlQuery
\inmodule QtCore
+ \since 5.0
\brief The QUrlQuery class provides a way to manipulate a key-value pairs in
a URL's query.
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 90e9886c90..989456efbb 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -2295,7 +2295,6 @@ void QAbstractItemModel::doSetRoleNames(const QHash<int,QByteArray> &roleNames)
Returns the model's role names.
- \sa setRoleNames()
*/
QHash<int,QByteArray> QAbstractItemModel::roleNames() const
{
diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
index 3dbe93b21a..c36473a21f 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.cpp
+++ b/src/corelib/itemmodels/qidentityproxymodel.cpp
@@ -74,7 +74,7 @@ class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate
void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
- void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last);
void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint);
@@ -371,8 +371,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel)
this, SLOT(_q_sourceModelAboutToBeReset()));
disconnect(sourceModel(), SIGNAL(modelReset()),
this, SLOT(_q_sourceModelReset()));
- disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
+ disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
disconnect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
@@ -412,8 +412,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel)
SLOT(_q_sourceModelAboutToBeReset()));
connect(sourceModel(), SIGNAL(modelReset()),
SLOT(_q_sourceModelReset()));
- connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
+ connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
connect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
connect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
@@ -480,12 +480,12 @@ void QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(const QModelIndex &pare
q->endRemoveColumns();
}
-void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
{
Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true);
Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true);
Q_Q(QIdentityProxyModel);
- q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight));
+ q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles);
}
void QIdentityProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)
diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h
index 4ab125040d..8a416c97bc 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.h
+++ b/src/corelib/itemmodels/qidentityproxymodel.h
@@ -100,7 +100,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))
Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))
- Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex))
+ Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))
Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last))
Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index 3824c02be1..31c9137c79 100644
--- a/src/corelib/itemmodels/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -189,7 +189,7 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value,
if (index.row() >= 0 && index.row() < lst.size()
&& (role == Qt::EditRole || role == Qt::DisplayRole)) {
lst.replace(index.row(), value.toString());
- emit dataChanged(index, index);
+ emit dataChanged(index, index, QVector<int>() << role);
return true;
}
return false;
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index d5a6fa6122..5a8499d723 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -92,6 +92,8 @@ mac {
}
mac:!nacl {
+ HEADERS += \
+ kernel/qcore_mac_p.h
SOURCES += \
kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 361a6c2c67..35688f7463 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -108,6 +108,7 @@ public:
return *this;
}
inline T *operator&() { return &type; }
+ template <typename X> X as() const { return reinterpret_cast<X>(type); }
static QCFType constructFromGet(const T &t)
{
CFRetain(t);
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index eea90be5eb..4fd6cd1779 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -158,6 +158,7 @@
/*!
\fn void QPointer::clear()
+ \since 5.0
Clears this QPointer object.
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index a81fa83f29..0e33fa697a 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -94,8 +94,7 @@ timespec QTimerInfoList::updateCurrentTime()
#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
-template <>
-timespec qAbs(const timespec &t)
+timespec qAbsTimespec(const timespec &t)
{
timespec tmp = t;
if (tmp.tv_sec < 0) {
@@ -144,7 +143,7 @@ bool QTimerInfoList::timeChanged(timespec *delta)
timespec tickGranularity;
tickGranularity.tv_sec = 0;
tickGranularity.tv_nsec = msPerTick * 1000 * 1000;
- return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
+ return elapsedTimeTicks < ((qAbsTimespec(*delta) - tickGranularity) * 10);
}
/*
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index b3dff3a83a..8594cfd40d 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -432,18 +432,26 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case CurrencyToString:
return macFormatCurrency(in.value<QSystemLocale::CurrencyToStringArgument>());
case UILanguages: {
- QCFType<CFArrayRef> languages = (CFArrayRef)CFPreferencesCopyValue(
+ QCFType<CFPropertyListRef> languages = (CFArrayRef)CFPreferencesCopyValue(
CFSTR("AppleLanguages"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
- const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages);
QStringList result;
- result.reserve(cnt);
- for (int i = 0; i < cnt; ++i) {
- const QString lang = QCFString::toQString(
- static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages, i)));
- result.append(lang);
+ CFTypeID typeId = CFGetTypeID(languages);
+ if (typeId == CFArrayGetTypeID()) {
+ const int cnt = CFArrayGetCount(languages.as<CFArrayRef>());
+ result.reserve(cnt);
+ for (int i = 0; i < cnt; ++i) {
+ const QString lang = QCFString::toQString(
+ static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i)));
+ result.append(lang);
+ }
+ } else if (typeId == CFStringGetTypeID()) {
+ result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
+ } else {
+ qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org",
+ qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3089cfef8b..75ef07a96e 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -9553,6 +9553,8 @@ float QStringRef::toFloat(bool *ok) const
*/
/*!
+ \since 5.0
+
Converts a plain text string to an HTML string with
HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML
entities.
@@ -9621,6 +9623,19 @@ QString QString::toHtmlEscaped() const
\code
if (attribute.name() == QLatin1String("http-contents-length")) //...
\endcode
+
+ \note There some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets provided here
+ fail to compile with them.
+ \list
+ \li Concatenated string literals cannot be used with QStringLiteral.
+ \code
+ QString s = QStringLiteral("a" "b");
+ \endcode
+ \li QStringLiteral cannot be used to initialize lists or arrays of QString.
+ \code
+ QString a[] = { QStringLiteral("a"), QStringLiteral("b") };
+ \endcode
+ \endlist
*/
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index c1b20c58e9..7d5cf91324 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -504,8 +504,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
}
if (d != x) {
if (!d->ref.deref()) {
- Q_ASSERT(!isShared);
- if (QTypeInfo<T>::isStatic || !aalloc) {
+ if (QTypeInfo<T>::isStatic || !aalloc || (isShared && QTypeInfo<T>::isComplex)) {
// data was copy constructed, we need to call destructors
// or if !alloc we did nothing to the old 'd'.
freeData(d);