diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-01 08:23:47 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-01 08:23:55 +0100 |
commit | 24cd4a71905a481d937cbd5c4cb9fb8bb91532c9 (patch) | |
tree | 67195b6b5fd1a1ddabc0f622082383ad65c94dfb /src/corelib | |
parent | aeb169a48869f4f50237e384e57ccb406228f620 (diff) | |
parent | 1dd0c4bf1af1c90fde1449a81d41acbc62cf1934 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: Ic7aaa06f4a14b1aed61faa1a6e7f527ee0eeb96b
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 3 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 3 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/io/qresource.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qresource.h | 1 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_unix.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qregexp.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qvector.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 2 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream_p.h | 6 |
11 files changed, 29 insertions, 13 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 2441de16cd..5e340dbd27 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -252,10 +252,11 @@ static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const cha if (len + 1 > space) { const size_t skip = len - space + 4; // 4 for "..." + '\0' s += skip; + len -= skip; for (int i = 0; i < 3; ++i) *d++ = L'.'; } - while (*s) + while (len--) *d++ = *s++; *d++ = 0; } diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index b6d8e6fdc8..3cd3f52cff 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1635,7 +1635,8 @@ public: }; enum ScrollPhase { - ScrollBegin = 1, + NoScrollPhase = 0, // Make public in 5.7 or asap + ScrollBegin, ScrollUpdate, ScrollEnd }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b17a1ab48b..aa3fc63833 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3089,6 +3089,8 @@ This enum describes the phase of scrolling. + \omitvalue NoScrollPhase The input device doesn't support scroll phase. + \value ScrollBegin Scrolling is about to begin, but the scrolling distance did not yet change. diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 0303933de8..ad24b43568 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1185,6 +1185,7 @@ QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot) return false; } +#if !defined(QT_BOOTSTRAPPED) //resource engine class QResourceFileEnginePrivate : public QAbstractFileEnginePrivate { @@ -1490,5 +1491,6 @@ bool QResourceFileEnginePrivate::unmap(uchar *ptr) Q_UNUSED(ptr); return true; } +#endif // !defined(QT_BOOTSTRAPPED) QT_END_NAMESPACE diff --git a/src/corelib/io/qresource.h b/src/corelib/io/qresource.h index e84ad03353..a50bbbdaca 100644 --- a/src/corelib/io/qresource.h +++ b/src/corelib/io/qresource.h @@ -44,6 +44,7 @@ #include <QtCore/qlocale.h> #include <QtCore/qstringlist.h> #include <QtCore/qlist.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 7d80cb0e2b..02b1e1c306 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1845,7 +1845,7 @@ bool QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, Q QStringList QAbstractItemModel::mimeTypes() const { QStringList types; - types << QLatin1String("application/x-qabstractitemmodeldatalist"); + types << QStringLiteral("application/x-qabstractitemmodeldatalist"); return types; } diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 64b813bb13..9afbb84abf 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -286,7 +286,7 @@ void QEventDispatcherUNIXPrivate::markPendingSocketNotifiers() } } - pollfds.resize(0); + pollfds.clear(); } int QEventDispatcherUNIXPrivate::activateSocketNotifiers() @@ -480,8 +480,8 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags) if (!canWait || (include_timers && d->timerList.timerWait(wait_tm))) tm = &wait_tm; + d->pollfds.clear(); d->pollfds.reserve(1 + (include_notifiers ? d->socketNotifiers.size() : 0)); - d->pollfds.resize(0); if (include_notifiers) for (auto it = d->socketNotifiers.cbegin(); it != d->socketNotifiers.cend(); ++it) diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index fd67193302..f8f3347786 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -2335,7 +2335,7 @@ QRegExpCharClass::QRegExpCharClass() void QRegExpCharClass::clear() { c = 0; - r.resize(0); + r.clear(); n = false; } diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index b3247b8af5..ef1c9c17b0 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -502,8 +502,19 @@ /*! \fn void QVector::clear() - Removes all the elements from the vector and releases the memory used by - the vector. + Removes all the elements from the vector. + + \note Until Qt 5.6, this also released the memory used by + the vector. From Qt 5.7, the capacity is preserved. To shed + all capacity, swap with a default-constructed vector: + \code + QVector<T> v ...; + QVector<T>().swap(v); + Q_ASSERT(v.capacity() == 0); + \endcode + or call squeeze(). + + \sa squeeze() */ /*! \fn const T &QVector::at(int i) const diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index d60be78ade..13ae121450 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -419,7 +419,7 @@ void QVector<T>::resize(int asize) } template <typename T> inline void QVector<T>::clear() -{ *this = QVector<T>(); } +{ resize(0); } template <typename T> inline const T &QVector<T>::at(int i) const { Q_ASSERT_X(i >= 0 && i < d->size, "QVector<T>::at", "index out of range"); diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 4c6c206bf3..ab0bbba413 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -1020,10 +1020,8 @@ bool QXmlStreamReaderPrivate::parse() prefix.clear(); qualifiedName.clear(); namespaceUri.clear(); - if (publicNamespaceDeclarations.size()) - publicNamespaceDeclarations.clear(); - if (attributes.size()) - attributes.resize(0); + publicNamespaceDeclarations.clear(); + attributes.clear(); if (isEmptyElement) { setType(QXmlStreamReader::EndElement); Tag &tag = tagStack_pop(); |