diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-10 01:00:25 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-04-10 01:00:26 +0200 |
commit | e027c7241f073f5fc8c1db88700cc83635b6454f (patch) | |
tree | 69920e408b5eeb1547c0241696cfa845af85e4be /src/corelib | |
parent | b2035d38e8dfdfe2ba8da96df5c1174f01dfbb5b (diff) | |
parent | 3b85d53913741660473dbc242a48c2ee65d51421 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I0120f804522c0c652e9537b6e9fe08189f071ed2
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 91 | ||||
-rw-r--r-- | src/corelib/thread/qsemaphore.cpp | 10 |
2 files changed, 55 insertions, 46 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 369405c7cd..b41a883e80 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2386,7 +2386,7 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han \l QMetaType::QVariantList of a type that can be converted to QString; otherwise returns an empty list. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QStringList QVariant::toStringList() const { @@ -2394,14 +2394,19 @@ QStringList QVariant::toStringList() const } /*! - Returns the variant as a QString if the variant has userType() \l - QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray, + Returns the variant as a QString if the variant has a userType() + including, but not limited to: + + \l QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::QDate, \l QMetaType::QDateTime, \l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or - \l QMetaType::ULongLong; otherwise returns an empty string. + \l QMetaType::ULongLong. + + Calling QVariant::toString() on an unsupported variant returns an empty + string. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QString QVariant::toString() const { @@ -2412,7 +2417,7 @@ QString QVariant::toString() const Returns the variant as a QMap<QString, QVariant> if the variant has type() \l QMetaType::QVariantMap; otherwise returns an empty map. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantMap QVariant::toMap() const { @@ -2423,7 +2428,7 @@ QVariantMap QVariant::toMap() const Returns the variant as a QHash<QString, QVariant> if the variant has type() \l QMetaType::QVariantHash; otherwise returns an empty map. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantHash QVariant::toHash() const { @@ -2440,7 +2445,7 @@ QVariantHash QVariant::toHash() const If the type() is \l QMetaType::QString, an invalid date will be returned if the string cannot be parsed as a Qt::ISODate format date. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QDate QVariant::toDate() const { @@ -2457,7 +2462,7 @@ QDate QVariant::toDate() const If the type() is \l QMetaType::QString, an invalid time will be returned if the string cannot be parsed as a Qt::ISODate format time. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QTime QVariant::toTime() const { @@ -2474,7 +2479,7 @@ QTime QVariant::toTime() const If the type() is \l QMetaType::QString, an invalid date/time will be returned if the string cannot be parsed as a Qt::ISODate format date/time. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QDateTime QVariant::toDateTime() const { @@ -2488,7 +2493,7 @@ QDateTime QVariant::toDateTime() const Returns the variant as a QEasingCurve if the variant has userType() \l QMetaType::QEasingCurve; otherwise returns a default easing curve. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ #ifndef QT_BOOTSTRAPPED QEasingCurve QVariant::toEasingCurve() const @@ -2504,7 +2509,7 @@ QEasingCurve QVariant::toEasingCurve() const \l QMetaType::QByteArray or \l QMetaType::QString (converted using QString::fromUtf8()); otherwise returns an empty byte array. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QByteArray QVariant::toByteArray() const { @@ -2519,7 +2524,7 @@ QByteArray QVariant::toByteArray() const \l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QPoint. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QPoint QVariant::toPoint() const { @@ -2532,7 +2537,7 @@ QPoint QVariant::toPoint() const Returns the variant as a QRect if the variant has userType() \l QMetaType::QRect; otherwise returns an invalid QRect. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRect QVariant::toRect() const { @@ -2545,7 +2550,7 @@ QRect QVariant::toRect() const Returns the variant as a QSize if the variant has userType() \l QMetaType::QSize; otherwise returns an invalid QSize. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QSize QVariant::toSize() const { @@ -2558,7 +2563,7 @@ QSize QVariant::toSize() const Returns the variant as a QSizeF if the variant has userType() \l QMetaType::QSizeF; otherwise returns an invalid QSizeF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QSizeF QVariant::toSizeF() const { @@ -2572,7 +2577,7 @@ QSizeF QVariant::toSizeF() const \l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid QRectF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRectF QVariant::toRectF() const { @@ -2585,7 +2590,7 @@ QRectF QVariant::toRectF() const Returns the variant as a QLineF if the variant has userType() \l QMetaType::QLineF; otherwise returns an invalid QLineF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLineF QVariant::toLineF() const { @@ -2598,7 +2603,7 @@ QLineF QVariant::toLineF() const Returns the variant as a QLine if the variant has userType() \l QMetaType::QLine; otherwise returns an invalid QLine. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLine QVariant::toLine() const { @@ -2612,7 +2617,7 @@ QLine QVariant::toLine() const QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null QPointF. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QPointF QVariant::toPointF() const { @@ -2628,7 +2633,7 @@ QPointF QVariant::toPointF() const Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an invalid QUrl. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QUrl QVariant::toUrl() const { @@ -2642,7 +2647,7 @@ QUrl QVariant::toUrl() const Returns the variant as a QLocale if the variant has userType() \l QMetaType::QLocale; otherwise returns an invalid QLocale. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QLocale QVariant::toLocale() const { @@ -2656,7 +2661,7 @@ QLocale QVariant::toLocale() const Returns the variant as a QRegExp if the variant has userType() \l QMetaType::QRegExp; otherwise returns an empty QRegExp. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ #ifndef QT_NO_REGEXP QRegExp QVariant::toRegExp() const @@ -2673,7 +2678,7 @@ QRegExp QVariant::toRegExp() const Returns the variant as a QRegularExpression if the variant has userType() \l QRegularExpression; otherwise returns an empty QRegularExpression. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QRegularExpression QVariant::toRegularExpression() const { @@ -2688,7 +2693,7 @@ QRegularExpression QVariant::toRegularExpression() const Returns the variant as a QModelIndex if the variant has userType() \l QModelIndex; otherwise returns a default constructed QModelIndex. - \sa canConvert(), convert(), toPersistentModelIndex() + \sa canConvert(int targetTypeId), convert(), toPersistentModelIndex() */ QModelIndex QVariant::toModelIndex() const { @@ -2701,7 +2706,7 @@ QModelIndex QVariant::toModelIndex() const Returns the variant as a QPersistentModelIndex if the variant has userType() \l QPersistentModelIndex; otherwise returns a default constructed QPersistentModelIndex. - \sa canConvert(), convert(), toModelIndex() + \sa canConvert(int targetTypeId), convert(), toModelIndex() */ QPersistentModelIndex QVariant::toPersistentModelIndex() const { @@ -2717,7 +2722,7 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const \l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString; otherwise returns a default-constructed QUuid. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QUuid QVariant::toUuid() const { @@ -2730,7 +2735,7 @@ QUuid QVariant::toUuid() const Returns the variant as a QJsonValue if the variant has userType() \l QJsonValue; otherwise returns a default constructed QJsonValue. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonValue QVariant::toJsonValue() const { @@ -2743,7 +2748,7 @@ QJsonValue QVariant::toJsonValue() const Returns the variant as a QJsonObject if the variant has userType() \l QJsonObject; otherwise returns a default constructed QJsonObject. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonObject QVariant::toJsonObject() const { @@ -2756,7 +2761,7 @@ QJsonObject QVariant::toJsonObject() const Returns the variant as a QJsonArray if the variant has userType() \l QJsonArray; otherwise returns a default constructed QJsonArray. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonArray QVariant::toJsonArray() const { @@ -2769,7 +2774,7 @@ QJsonArray QVariant::toJsonArray() const Returns the variant as a QJsonDocument if the variant has userType() \l QJsonDocument; otherwise returns a default constructed QJsonDocument. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QJsonDocument QVariant::toJsonDocument() const { @@ -2784,7 +2789,7 @@ QJsonDocument QVariant::toJsonDocument() const \l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise returns an invalid QChar. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QChar QVariant::toChar() const { @@ -2795,7 +2800,7 @@ QChar QVariant::toChar() const Returns the variant as a QBitArray if the variant has userType() \l QMetaType::QBitArray; otherwise returns an empty bit array. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QBitArray QVariant::toBitArray() const { @@ -2838,7 +2843,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d, will not be reflected in \a ok. A simple workaround is to use QString::toInt(). - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ int QVariant::toInt(bool *ok) const { @@ -2860,7 +2865,7 @@ int QVariant::toInt(bool *ok) const overflow will not be reflected in \a ok. A simple workaround is to use QString::toUInt(). - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ uint QVariant::toUInt(bool *ok) const { @@ -2877,7 +2882,7 @@ uint QVariant::toUInt(bool *ok) const If \a ok is non-null: \c{*}\c{ok} is set to true if the value could be converted to an int; otherwise \c{*}\c{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qlonglong QVariant::toLongLong(bool *ok) const { @@ -2894,7 +2899,7 @@ qlonglong QVariant::toLongLong(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to an int; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qulonglong QVariant::toULongLong(bool *ok) const { @@ -2911,7 +2916,7 @@ qulonglong QVariant::toULongLong(bool *ok) const \l QMetaType::QByteArray and its lower-case content is not one of the following: empty, "0" or "false"; otherwise returns \c false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ bool QVariant::toBool() const { @@ -2934,7 +2939,7 @@ bool QVariant::toBool() const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ double QVariant::toDouble(bool *ok) const { @@ -2953,7 +2958,7 @@ double QVariant::toDouble(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ float QVariant::toFloat(bool *ok) const { @@ -2972,7 +2977,7 @@ float QVariant::toFloat(bool *ok) const If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be converted to a double; otherwise \c{*}\a{ok} is set to false. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ qreal QVariant::toReal(bool *ok) const { @@ -2984,7 +2989,7 @@ qreal QVariant::toReal(bool *ok) const \l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns an empty list. - \sa canConvert(), convert() + \sa canConvert(int targetTypeId), convert() */ QVariantList QVariant::toList() const { @@ -3366,7 +3371,7 @@ bool QVariant::canConvert(int targetTypeId) const failed a previous conversion will always fail, changing the type, remaining null, and returning \c false. - \sa canConvert(), clear() + \sa canConvert(int targetTypeId), clear() */ bool QVariant::convert(int targetTypeId) diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index 9a5505bd1e..f418ac1205 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -291,10 +291,14 @@ public: QSemaphore::QSemaphore(int n) { Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative"); - if (futexAvailable()) - u.store(n); - else + if (futexAvailable()) { + quintptr nn = unsigned(n); + if (futexHasWaiterCount) + nn |= quint64(nn) << 32; // token count replicated in high word + u.store(nn); + } else { d = new QSemaphorePrivate(n); + } } /*! |