Merge remote-tracking branch 'origin/5.15' into dev

Change-Id: I68702c9f9680772d332b5bb777ddd2663168abd5
This commit is contained in:
Qt Forward Merge Bot 2020-01-19 01:00:10 +01:00
commit 35a461d026
32 changed files with 423 additions and 319 deletions

View File

@ -387,17 +387,12 @@
\snippet graphicsview/padnavigator/padnavigator.cpp 7
We now create the animations that control the flip-effect when you press
the enter key. The main goal is to rotate the pad by 180 degrees or back,
but we also need to make sure the selection item's tilt rotations are reset
back to 0 when the pad is flipped, and restored back to their original
values when flipped back:
the enter key. The main goal is to rotate the pad by 180 degrees or back.
\list
\li \c smoothFlipRotation: Animates the main 180 degree rotation of the pad.
\li \c smoothFlipScale: Scales the pad out and then in again while the pad is rotating.
\li \c smoothFlipXRotation: Animates the selection item's X-tilt to 0 and back.
\li \c smoothFlipYRotation: Animates the selection item's Y-tilt to 0 and back.
\li \c flipAnimation: A parallel animation group that ensures all the above animations are run in parallel.
\li \c flipAnimation: A parallel animation group that ensures the above animations are run in parallel.
\endlist
All animations are given a 500 millisecond duration and an
@ -447,11 +442,17 @@
Each state assigns specific properties to objects on entry. Most
interesting perhaps is the assignment of the value 0.0 to the pad's \c
flipRotation angle property when in \c frontState, and 180.0 when in \c
backState. At the end of this section we register default animations with
the state engine; these animations will apply to their respective objects
and properties for any state transition. Otherwise it's common to assign
backState.
At the end of this section we register default animations with the state
engine; these animations will apply to their respective objects and
properties for any state transition. Otherwise it's common to assign
animations to specific transitions.
Specifically, we use default animations to control the selection item's
movement and tilt rotations. The tilt rotations are set to 0 when the pad
is flipped, and restored back to their original values when flipped back.
The \c splashState state is set as the initial state. This is required
before we start the state engine. We proceed with creating some
transitions.

View File

@ -142,24 +142,16 @@ PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
// Flip animation setup
QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
QPropertyAnimation *smoothFlipXRotation = new QPropertyAnimation(xRotation, "angle");
QPropertyAnimation *smoothFlipYRotation = new QPropertyAnimation(yRotation, "angle");
QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
smoothFlipScale->setDuration(500);
smoothFlipRotation->setDuration(500);
smoothFlipXRotation->setDuration(500);
smoothFlipYRotation->setDuration(500);
smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
flipAnimation->addAnimation(smoothFlipXRotation);
flipAnimation->addAnimation(smoothFlipYRotation);
//! [7]
//! [8]

View File

@ -47,7 +47,7 @@ depends += \
qtnetwork \
qtopengl \
qtprintsupport \
qtqml \
qtqml qtqmltest \
qtquick \
qtquickcontrols \
qtquickdialogs \

View File

@ -5443,8 +5443,8 @@
\li The exit code of the test will be ignored during \c{make check}.
\endtable
Test cases will often be written with \l{QTest} or \l[QML]{TestCase}, but
that is not a requirement to make use of \c{CONFIG+=testcase} and \c{make check}.
Test cases will often be written with \l{QTest} or \c{TestCase}, but
it is not a requirement to make use of \c{CONFIG+=testcase} and \c{make check}.
The only primary requirement is that the test program exit with a zero exit code
on success, and a non-zero exit code on failure.

View File

@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtcore/qtcore.tags
depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras qtqml
depends += activeqt qtdbus qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake qtwinextras qtqml qtcmake
headerdirs += ..

View File

@ -56,7 +56,7 @@
\include module-use.qdocinc using qt module
\quotefile overview/using-qt-core.cmake
See also the \l[QtDoc]{Build with CMake} overview.
See also the \l{Build with CMake} overview.
\section2 Building with qmake

View File

@ -192,7 +192,6 @@ QT_BEGIN_NAMESPACE
an in-place swap (if necessary). If they are not the same, the memory
regions must not overlap.
\sa qFromLittleEndian()
\sa qToBigEndian()
\sa qToLittleEndian()
*/

View File

@ -181,7 +181,7 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QFileSystemEntry &entry, const QS
#elif QT_CONFIG(regularexpression)
nameRegExps.reserve(nameFilters.size());
for (const auto &filter : nameFilters) {
QString re = QRegularExpression::anchoredPattern(QRegularExpression::wildcardToRegularExpression(filter));
QString re = QRegularExpression::wildcardToRegularExpression(filter);
nameRegExps.append(
QRegularExpression(re, (filters & QDir::CaseSensitive) ? QRegularExpression::NoPatternOption : QRegularExpression::CaseInsensitiveOption));
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@ -106,11 +106,11 @@ struct QSystemLocalePrivate
{
QSystemLocalePrivate();
QChar zeroDigit();
QChar decimalPoint();
QChar groupSeparator();
QChar negativeSign();
QChar positiveSign();
QString zeroDigit();
QString decimalPoint();
QString groupSeparator();
QString negativeSign();
QString positiveSign();
QVariant dateFormat(QLocale::FormatType);
QVariant timeFormat(QLocale::FormatType);
QVariant dateTimeFormat(QLocale::FormatType);
@ -147,12 +147,11 @@ private:
WCHAR lcName[LOCALE_NAME_MAX_LENGTH];
#endif
SubstitutionType substitutionType;
QChar zero;
QString zero; // cached value for zeroDigit()
int getLocaleInfo(LCTYPE type, LPWSTR data, int size);
QString getLocaleInfo(LCTYPE type, int maxlen = 0);
int getLocaleInfo_int(LCTYPE type, int maxlen = 0);
QChar getLocaleInfo_qchar(LCTYPE type);
int getCurrencyFormat(DWORD flags, LPCWSTR value, const CURRENCYFMTW *format, LPWSTR data, int size);
int getDateFormat(DWORD flags, const SYSTEMTIME * date, LPCWSTR format, LPWSTR data, int size);
@ -236,12 +235,6 @@ int QSystemLocalePrivate::getLocaleInfo_int(LCTYPE type, int maxlen)
return ok ? v : 0;
}
QChar QSystemLocalePrivate::getLocaleInfo_qchar(LCTYPE type)
{
QString str = getLocaleInfo(type);
return str.isEmpty() ? QChar() : str.at(0);
}
QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
{
if (substitutionType == SUnknown) {
@ -257,13 +250,12 @@ QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
else if (buf[0] == '2')
substitutionType = QSystemLocalePrivate::SAlways;
else {
wchar_t digits[11];
wchar_t digits[11]; // See zeroDigit() for why 11.
if (!getLocaleInfo(LOCALE_SNATIVEDIGITS, digits, 11)) {
substitutionType = QSystemLocalePrivate::SNever;
return substitutionType;
}
const wchar_t zero = digits[0];
if (buf[0] == zero + 2)
if (buf[0] == digits[0] + 2)
substitutionType = QSystemLocalePrivate::SAlways;
else
substitutionType = QSystemLocalePrivate::SNever;
@ -274,40 +266,75 @@ QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()
QString &QSystemLocalePrivate::substituteDigits(QString &string)
{
ushort zero = zeroDigit().unicode();
ushort *qch = reinterpret_cast<ushort *>(string.data());
for (ushort *end = qch + string.size(); qch != end; ++qch) {
if (*qch >= '0' && *qch <= '9')
*qch = zero + (*qch - '0');
zeroDigit(); // Ensure zero is set.
switch (zero.size()) {
case 1: {
const ushort offset = zero.at(0).unicode() - '0';
if (!offset) // Nothing to do
break;
Q_ASSERT(offset > 9);
ushort *const qch = reinterpret_cast<ushort *>(string.data());
for (int i = 0, stop = string.size(); i < stop; ++i) {
ushort &ch = qch[i];
if (ch >= '0' && ch <= '9')
ch += offset;
}
break;
}
case 2: {
// Surrogate pair (high, low):
uint digit = QChar::surrogateToUcs4(zero.at(0), zero.at(1));
for (int i = 0; i < 10; i++) {
const QChar s[2] = { QChar::highSurrogate(digit + i), QChar::lowSurrogate(digit + i) };
string.replace(QString(QLatin1Char('0' + i)), QString(s, 2));
}
break;
}
default:
Q_ASSERT(!"Expected zero digit to be a single UCS2 code-point or a surrogate pair");
case 0: // Apparently this locale info was not available.
break;
}
return string;
}
QChar QSystemLocalePrivate::zeroDigit()
QString QSystemLocalePrivate::zeroDigit()
{
if (zero.isNull())
zero = getLocaleInfo_qchar(LOCALE_SNATIVEDIGITS);
if (zero.isEmpty()) {
/* Ten digits plus a terminator.
https://docs.microsoft.com/en-us/windows/win32/intl/locale-snative-constants
"Native equivalents of ASCII 0 through 9. The maximum number of
characters allowed for this string is eleven, including a terminating
null character."
*/
wchar_t digits[11];
if (getLocaleInfo(LOCALE_SNATIVEDIGITS, digits, 11)) {
// assert all(digits[i] == i + digits[0] for i in range(1, 10)), assumed above
zero = QString::fromWCharArray(digits, 1);
}
}
return zero;
}
QChar QSystemLocalePrivate::decimalPoint()
QString QSystemLocalePrivate::decimalPoint()
{
return getLocaleInfo_qchar(LOCALE_SDECIMAL);
return getLocaleInfo(LOCALE_SDECIMAL);
}
QChar QSystemLocalePrivate::groupSeparator()
QString QSystemLocalePrivate::groupSeparator()
{
return getLocaleInfo_qchar(LOCALE_STHOUSAND);
return getLocaleInfo(LOCALE_STHOUSAND);
}
QChar QSystemLocalePrivate::negativeSign()
QString QSystemLocalePrivate::negativeSign()
{
return getLocaleInfo_qchar(LOCALE_SNEGATIVESIGN);
return getLocaleInfo(LOCALE_SNEGATIVESIGN);
}
QChar QSystemLocalePrivate::positiveSign()
QString QSystemLocalePrivate::positiveSign()
{
return getLocaleInfo_qchar(LOCALE_SPOSITIVESIGN);
return getLocaleInfo(LOCALE_SPOSITIVESIGN);
}
QVariant QSystemLocalePrivate::dateFormat(QLocale::FormatType type)
@ -677,7 +704,7 @@ void QSystemLocalePrivate::update()
GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH);
#endif
substitutionType = SUnknown;
zero = QChar();
zero.resize(0);
}
QString QSystemLocalePrivate::winToQtFormat(QStringView sys_fmt)
@ -749,7 +776,7 @@ QLocale QSystemLocale::fallbackUiLocale() const
return QLocale(QString::fromLatin1(getWinLocaleName()));
}
QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
QVariant QSystemLocale::query(QueryType type, QVariant in) const
{
QSystemLocalePrivate *d = systemLocalePrivate();
switch(type) {

View File

@ -1915,6 +1915,10 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
\snippet code/src_corelib_tools_qregularexpression.cpp 31
The returned regular expression is already fully anchored. In other
words, there is no need of calling anchoredPattern() again on the
result.
\warning Unlike QRegExp, this implementation follows closely the definition
of wildcard for glob patterns:
\table
@ -1941,12 +1945,12 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
\note The backslash (\\) character is \e not an escape char in this context.
In order to match one of the special characters, place it in square brackets
(for example, "[?]").
(for example, \c{[?]}).
More information about the implementation can be found in:
\list
\li \l {https://en.wikipedia.org/wiki/Glob_(programming)} {The Wikipedia Glob article}
\li \c man 7 glob
\li \c {man 7 glob}
\endlist
\sa escape()

View File

@ -723,7 +723,7 @@ QCalendar::QCalendar(QLatin1String name)
QCalendar::QCalendar(QStringView name)
: d(QCalendarBackend::fromName(name)) {}
/*
/*!
\fn bool QCalendar::isValid() const
Returns true if this is a valid calendar object.

View File

@ -217,7 +217,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
This class includes data obtained from the CLDR data files under the terms
of the Unicode Data Files and Software License. See
\l{Unicode Common Locale Data Repository (CLDR)} for details.
\l{unicode-cldr}{Unicode Common Locale Data Repository (CLDR)} for details.
\sa QDateTime
*/

View File

@ -468,10 +468,9 @@ void QMapDataBase::freeData(QMapDataBase *d)
\snippet code/src_corelib_tools_qmap.cpp 9
However, you can store multiple values per key by using
insertMulti() instead of insert() (or using the convenience
subclass QMultiMap). If you want to retrieve all the values for a
single key, you can use values(const Key &key), which returns a
QList<T>:
using the subclass QMultiMap. If you want
to retrieve all the values for a single key, you can use
values(const Key &key), which returns a QList<T>:
\snippet code/src_corelib_tools_qmap.cpp 10
@ -676,9 +675,8 @@ void QMapDataBase::freeData(QMapDataBase *d)
/*! \fn template <class Key, class T> int QMap<Key, T>::remove(const Key &key)
Removes all the items that have the key \a key from the map.
Returns the number of items removed which is usually 1 but will be
0 if the key isn't in the map, or \> 1 if insertMulti() has been
used with the \a key.
Returns the number of items removed which will be 1 if the key
exists in the map, and 0 otherwise.
\sa clear(), take(), QMultiMap::remove()
*/
@ -742,28 +740,26 @@ void QMapDataBase::freeData(QMapDataBase *d)
/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::uniqueKeys() const
\since 4.2
\obsolete
Returns a list containing all the keys in the map in ascending
order. Keys that occur multiple times in the map (because items
were inserted with insertMulti(), or unite() was used) occur only
once in the returned list.
\sa keys(), values()
\sa QMultiMap::uniqueKeys()
*/
/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys() const
Returns a list containing all the keys in the map in ascending
order. Keys that occur multiple times in the map (because items
were inserted with insertMulti(), or unite() was used) also
occur multiple times in the list.
To obtain a list of unique keys, where each key from the map only
occurs once, use uniqueKeys().
order. Keys that occur multiple times in the map (because the
method is operating on a QMultiMap) also occur multiple times
in the list.
The order is guaranteed to be the same as that used by values().
\sa uniqueKeys(), values(), key()
\sa QMultiMap::uniqueKeys(), values(), key()
*/
/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys(const T &value) const
@ -806,6 +802,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn template <class Key, class T> QList<T> QMap<Key, T>::values(const Key &key) const
\obsolete
\overload
@ -813,14 +810,15 @@ void QMapDataBase::freeData(QMapDataBase *d)
\a key, from the most recently inserted to the least recently
inserted one.
\sa count(), insertMulti()
\sa QMultiMap::values()
*/
/*! \fn template <class Key, class T> int QMap<Key, T>::count(const Key &key) const
\obsolete
Returns the number of items associated with key \a key.
\sa contains(), insertMulti(), QMultiMap::count()
\sa QMultiMap::count()
*/
/*! \fn template <class Key, class T> int QMap<Key, T>::count() const
@ -1118,7 +1116,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
If there are multiple items with the key \a key, the most
recently inserted item's value is replaced with \a value.
\sa insertMulti()
\sa QMultiMap::insert()
*/
/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const Key &key, const T &value)
@ -1147,7 +1145,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\b {Note:} Be careful with the hint. Providing an iterator from an older shared instance might
crash but there is also a risk that it will silently corrupt both the map and the \a pos map.
\sa insertMulti()
\sa QMultiMap::insert()
*/
/*! \fn template <class Key, class T> void QMap<Key, T>::insert(const QMap<Key, T> &map)
@ -1161,10 +1159,11 @@ void QMapDataBase::freeData(QMapDataBase *d)
\note If \a map contains multiple entries with the same key then the
final value of the key is undefined.
\sa insertMulti()
\sa QMultiMap::insert()
*/
/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &key, const T &value)
\obsolete
Inserts a new item with the key \a key and a value of \a value.
@ -1173,12 +1172,13 @@ void QMapDataBase::freeData(QMapDataBase *d)
different from insert(), which overwrites the value of an
existing item.)
\sa insert(), values()
\sa QMultiMap::insert()
*/
/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &key, const T &value)
\overload
\since 5.1
\obsolete
Inserts a new item with the key \a key and value \a value and with hint \a pos
suggesting where to do the insert.
@ -1192,17 +1192,18 @@ void QMapDataBase::freeData(QMapDataBase *d)
\b {Note:} Be careful with the hint. Providing an iterator from an older shared instance might
crash but there is also a risk that it will silently corrupt both the map and the \a pos map.
\sa insert()
\sa QMultiMap::insert()
*/
/*! \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other)
\obsolete
Inserts all the items in the \a other map into this map. If a
key is common to both maps, the resulting map will contain the
key multiple times.
\sa insertMulti()
\sa QMultiMap::unite()
*/
/*! \typedef QMap::Iterator
@ -1285,9 +1286,8 @@ void QMapDataBase::freeData(QMapDataBase *d)
Unlike QHash, which stores its items in an arbitrary order, QMap
stores its items ordered by key. Items that share the same key
(because they were inserted using QMap::insertMulti(), or due to a
unite()) will appear consecutively, from the most recently to the
least recently inserted value.
(because the map is a QMultiMap) will appear consecutively,
from the most recently to the least recently inserted value.
Let's see a few examples of things we can do with a
QMap::iterator that we cannot do with a QMap::const_iterator.
@ -1533,9 +1533,8 @@ void QMapDataBase::freeData(QMapDataBase *d)
Unlike QHash, which stores its items in an arbitrary order, QMap
stores its items ordered by key. Items that share the same key
(because they were inserted using QMap::insertMulti()) will
appear consecutively, from the most recently to the least
recently inserted value.
(because the map is a QMultiMap) will appear consecutively,
from the most recently to the least recently inserted value.
Multiple iterators can be used on the same map. If you add items
to the map, existing iterators will remain valid. If you remove
@ -1907,20 +1906,20 @@ void QMapDataBase::freeData(QMapDataBase *d)
\reentrant
QMultiMap\<Key, T\> is one of Qt's generic \l{container classes}.
It inherits QMap and extends it with a few convenience functions
that make it more suitable than QMap for storing multi-valued
maps. A multi-valued map is a map that allows multiple values
with the same key; QMap normally doesn't allow that, unless you
call QMap::insertMulti().
It inherits QMap and extends it with a few functions
that make it able to store multi-valued maps. A multi-valued map
is a map that allows multiple values with the same key; QMap
doesn't allow that.
Because QMultiMap inherits QMap, all of QMap's functionality also
applies to QMultiMap. For example, you can use isEmpty() to test
whether the map is empty, and you can traverse a QMultiMap using
QMap's iterator classes (for example, QMapIterator). But in
addition, it provides an insert() function that corresponds to
QMap::insertMulti(), and a replace() function that corresponds to
QMap::insert(). It also provides convenient operator+() and
operator+=().
addition, it provides an insert() function that inserts but does
not overwrite any previous value if the key already exists,
and a replace() function that corresponds which does overwite
an existing value if they key is already in the map.
It also provides convenient operator+() and operator+=().
Example:
\snippet code/src_corelib_tools_qmap.cpp 25
@ -2109,4 +2108,24 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QMap::constFind()
*/
/*! \fn template <class Key, class T> QList<T> QMultiMap<Key, T>::values(const Key &key) const
Returns a list containing all the values associated with key
\a key, from the most recently inserted to the least recently
inserted one.
*/
/*! \fn template <class Key, class T> int QMultiMap<Key, T>::count(const Key &key) const
Returns the number of items associated with key \a key.
*/
/*! \fn template <class Key, class T> QList<Key> QMultiMap<Key, T>::uniqueKeys() const
\since 4.2
Returns a list containing all the keys in the map in ascending
order. Keys that occur multiple times in the map occur only
once in the returned list.
*/
QT_END_NAMESPACE

View File

@ -369,12 +369,15 @@ public:
T &operator[](const Key &key);
const T operator[](const Key &key) const;
QList<Key> uniqueKeys() const;
QList<Key> keys() const;
QList<Key> keys(const T &value) const;
QList<T> values() const;
QList<T> values(const Key &key) const;
int count(const Key &key) const;
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") QList<Key> uniqueKeys() const;
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") QList<T> values(const Key &key) const;
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") int count(const Key &key) const;
#endif
inline const Key &firstKey() const { Q_ASSERT(!isEmpty()); return constBegin().key(); }
inline const Key &lastKey() const { Q_ASSERT(!isEmpty()); return (constEnd() - 1).key(); }
@ -436,6 +439,7 @@ public:
inline bool operator==(const const_iterator &o) const { return i == o.i; }
inline bool operator!=(const const_iterator &o) const { return i != o.i; }
friend class QMap<Key, T>;
friend class QMultiMap<Key, T>;
};
friend class iterator;
@ -488,6 +492,7 @@ public:
friend inline const_iterator operator+(int j, const_iterator k) { return k + j; }
friend class QMap<Key, T>;
friend class QMultiMap<Key, T>;
};
friend class const_iterator;
@ -553,9 +558,11 @@ public:
iterator insert(const Key &key, const T &value);
iterator insert(const_iterator pos, const Key &key, const T &value);
void insert(const QMap<Key, T> &map);
iterator insertMulti(const Key &key, const T &value);
iterator insertMulti(const_iterator pos, const Key &akey, const T &avalue);
QMap<Key, T> &unite(const QMap<Key, T> &other);
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") iterator insertMulti(const Key &key, const T &value);
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") iterator insertMulti(const_iterator pos, const Key &akey, const T &avalue);
QT_DEPRECATED_X("Use QMultiMap for maps storing multiple values with the same key.") QMap<Key, T> &unite(const QMap<Key, T> &other);
#endif
// STL compatibility
typedef Key key_type;
@ -584,6 +591,8 @@ private:
return true;
#endif
}
friend class QMultiMap<Key, T>;
};
template <class Key, class T>
@ -645,23 +654,6 @@ Q_INLINE_TEMPLATE T &QMap<Key, T>::operator[](const Key &akey)
return n->value;
}
template <class Key, class T>
Q_INLINE_TEMPLATE int QMap<Key, T>::count(const Key &akey) const
{
Node *firstNode;
Node *lastNode;
d->nodeRange(akey, &firstNode, &lastNode);
const_iterator ci_first(firstNode);
const const_iterator ci_last(lastNode);
int cnt = 0;
while (ci_first != ci_last) {
++cnt;
++ci_first;
}
return cnt;
}
template <class Key, class T>
Q_INLINE_TEMPLATE bool QMap<Key, T>::contains(const Key &akey) const
{
@ -806,75 +798,6 @@ Q_INLINE_TEMPLATE void QMap<Key, T>::insert(const QMap<Key, T> &map)
}
}
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &akey,
const T &avalue)
{
detach();
Node* y = d->end();
Node* x = static_cast<Node *>(d->root());
bool left = true;
while (x != nullptr) {
left = !qMapLessThanKey(x->key, akey);
y = x;
x = left ? x->leftNode() : x->rightNode();
}
Node *z = d->createNode(akey, avalue, y, left);
return iterator(z);
}
template <class Key, class T>
typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &akey, const T &avalue)
{
if (d->ref.isShared())
return this->insertMulti(akey, avalue);
Q_ASSERT_X(isValidIterator(pos), "QMap::insertMulti", "The specified const_iterator argument 'pos' is invalid");
if (pos == constEnd()) {
// Hint is that the Node is larger than (or equal to) the largest value.
Node *n = static_cast<Node *>(pos.i->left);
if (n) {
while (n->right)
n = static_cast<Node *>(n->right);
if (!qMapLessThanKey(n->key, akey))
return this->insertMulti(akey, avalue); // ignore hint
Node *z = d->createNode(akey, avalue, n, false); // insert right most
return iterator(z);
}
return this->insertMulti(akey, avalue);
} else {
// Hint indicates that the node should be less (or equal to) the hint given
// but larger than the previous value.
Node *next = const_cast<Node*>(pos.i);
if (qMapLessThanKey(next->key, akey))
return this->insertMulti(akey, avalue); // ignore hint
if (pos == constBegin()) {
// There is no previous value (insert left most)
Node *z = d->createNode(akey, avalue, begin().i, true);
return iterator(z);
} else {
Node *prev = const_cast<Node*>(pos.i->previousNode());
if (!qMapLessThanKey(prev->key, akey))
return this->insertMulti(akey, avalue); // ignore hint
// Hint is ok - do insert
if (prev->right == nullptr) {
Node *z = d->createNode(akey, avalue, prev, false);
return iterator(z);
}
if (next->left == nullptr) {
Node *z = d->createNode(akey, avalue, next, true);
return iterator(z);
}
Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr.
return this->insertMulti(akey, avalue);
}
}
}
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &akey) const
@ -897,19 +820,6 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::find(const Key &
return iterator(n ? n : d->end());
}
template <class Key, class T>
Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other)
{
QMap<Key, T> copy(other);
const_iterator it = copy.constEnd();
const const_iterator b = copy.constBegin();
while (it != b) {
--it;
insertMulti(it.key(), it.value());
}
return *this;
}
template <class Key, class T>
QPair<typename QMap<Key, T>::iterator, typename QMap<Key, T>::iterator> QMap<Key, T>::equal_range(const Key &akey)
{
@ -1025,26 +935,6 @@ Q_OUTOFLINE_TEMPLATE void QMap<Key, T>::detach_helper()
d->recalcMostLeftNode();
}
template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::uniqueKeys() const
{
QList<Key> res;
res.reserve(size()); // May be too much, but assume short lifetime
const_iterator i = begin();
if (i != end()) {
for (;;) {
const Key &aKey = i.key();
res.append(aKey);
do {
if (++i == end())
goto break_out_of_outer_loop;
} while (!qMapLessThanKey(aKey, i.key())); // loop while (key == i.key())
}
}
break_out_of_outer_loop:
return res;
}
template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QMap<Key, T>::keys() const
{
@ -1097,21 +987,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values() const
return res;
}
template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values(const Key &akey) const
{
QList<T> res;
Node *n = d->findNode(akey);
if (n) {
const_iterator it(n);
do {
res.append(*it);
++it;
} while (it != constEnd() && !qMapLessThanKey<Key>(akey, it.key()));
}
return res;
}
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &akey) const
{
@ -1208,15 +1083,20 @@ public:
QMultiMap(QMap<Key, T> &&other) noexcept : QMap<Key, T>(std::move(other)) {}
void swap(QMultiMap<Key, T> &other) noexcept { QMap<Key, T>::swap(other); }
QList<Key> uniqueKeys() const;
QList<T> values(const Key &key) const;
using typename QMap<Key, T>::iterator;
using typename QMap<Key, T>::const_iterator;
inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value)
{ return QMap<Key, T>::insert(key, value); }
inline typename QMap<Key, T>::iterator insert(const Key &key, const T &value)
{ return QMap<Key, T>::insertMulti(key, value); }
inline typename QMap<Key, T>::iterator insert(typename QMap<Key, T>::const_iterator pos, const Key &key, const T &value)
{ return QMap<Key, T>::insertMulti(pos, key, value); }
iterator insert(const Key &key, const T &value);
iterator insert(const_iterator pos, const Key &key, const T &value);
QMultiMap &unite(const QMultiMap &other);
inline QMultiMap &operator+=(const QMultiMap &other)
{ this->unite(other); return *this; }
{ return unite(other); }
inline QMultiMap operator+(const QMultiMap &other) const
{ QMultiMap result = *this; result += other; return result; }
@ -1225,11 +1105,18 @@ public:
using QMap<Key, T>::count;
using QMap<Key, T>::find;
using QMap<Key, T>::constFind;
using QMap<Key, T>::values;
using QMap<Key, T>::size;
using QMap<Key, T>::detach;
using QMap<Key, T>::erase;
using QMap<Key, T>::isValidIterator;
using typename QMap<Key, T>::Node;
bool contains(const Key &key, const T &value) const;
int remove(const Key &key, const T &value);
int count(const Key &key) const;
int count(const Key &key, const T &value) const;
typename QMap<Key, T>::iterator find(const Key &key, const T &value) {
@ -1259,6 +1146,123 @@ private:
const T operator[](const Key &key) const;
};
template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<Key> QMultiMap<Key, T>::uniqueKeys() const
{
QList<Key> res;
res.reserve(size()); // May be too much, but assume short lifetime
const_iterator i = this->begin();
if (i != this->end()) {
for (;;) {
const Key &aKey = i.key();
res.append(aKey);
do {
if (++i == this->end())
goto break_out_of_outer_loop;
} while (!qMapLessThanKey(aKey, i.key())); // loop while (key == i.key())
}
}
break_out_of_outer_loop:
return res;
}
template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QList<T> QMultiMap<Key, T>::values(const Key &akey) const
{
QList<T> res;
Node *n = this->d->findNode(akey);
if (n) {
const_iterator it(n);
do {
res.append(*it);
++it;
} while (it != this->constEnd() && !qMapLessThanKey<Key>(akey, it.key()));
}
return res;
}
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const Key &akey,
const T &avalue)
{
detach();
Node* y = this->d->end();
Node* x = static_cast<Node *>(this->d->root());
bool left = true;
while (x != nullptr) {
left = !qMapLessThanKey(x->key, akey);
y = x;
x = left ? x->leftNode() : x->rightNode();
}
Node *z = this->d->createNode(akey, avalue, y, left);
return iterator(z);
}
template <class Key, class T>
typename QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const_iterator pos, const Key &akey, const T &avalue)
{
if (this->d->ref.isShared())
return insert(akey, avalue);
Q_ASSERT_X(isValidIterator(pos), "QMap::insert", "The specified const_iterator argument 'pos' is invalid");
if (pos == this->constEnd()) {
// Hint is that the Node is larger than (or equal to) the largest value.
Node *n = static_cast<Node *>(pos.i->left);
if (n) {
while (n->right)
n = static_cast<Node *>(n->right);
if (!qMapLessThanKey(n->key, akey))
return insert(akey, avalue); // ignore hint
Node *z = this->d->createNode(akey, avalue, n, false); // insert right most
return iterator(z);
}
return insert(akey, avalue);
} else {
// Hint indicates that the node should be less (or equal to) the hint given
// but larger than the previous value.
Node *next = const_cast<Node*>(pos.i);
if (qMapLessThanKey(next->key, akey))
return insert(akey, avalue); // ignore hint
if (pos == this->constBegin()) {
// There is no previous value (insert left most)
Node *z = this->d->createNode(akey, avalue, this->begin().i, true);
return iterator(z);
} else {
Node *prev = const_cast<Node*>(pos.i->previousNode());
if (!qMapLessThanKey(prev->key, akey))
return insert(akey, avalue); // ignore hint
// Hint is ok - do insert
if (prev->right == nullptr) {
Node *z = this->d->createNode(akey, avalue, prev, false);
return iterator(z);
}
if (next->left == nullptr) {
Node *z = this->d->createNode(akey, avalue, next, true);
return iterator(z);
}
Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr.
return insert(akey, avalue);
}
}
}
template <class Key, class T>
Q_INLINE_TEMPLATE QMultiMap<Key, T> &QMultiMap<Key, T>::unite(const QMultiMap<Key, T> &other)
{
QMultiMap<Key, T> copy(other);
const_iterator it = copy.constEnd();
const const_iterator b = copy.constBegin();
while (it != b) {
--it;
insert(it.key(), it.value());
}
return *this;
}
template <class Key, class T>
Q_INLINE_TEMPLATE bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const
{
@ -1273,7 +1277,7 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value)
typename QMap<Key, T>::iterator end(QMap<Key, T>::end());
while (i != end && !qMapLessThanKey<Key>(key, i.key())) {
if (i.value() == value) {
i = this->erase(i);
i = erase(i);
++n;
} else {
++i;
@ -1282,6 +1286,23 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value)
return n;
}
template <class Key, class T>
Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &akey) const
{
QMultiMap::Node *firstNode;
QMultiMap::Node *lastNode;
this->d->nodeRange(akey, &firstNode, &lastNode);
const_iterator ci_first(firstNode);
const const_iterator ci_last(lastNode);
int cnt = 0;
while (ci_first != ci_last) {
++cnt;
++ci_first;
}
return cnt;
}
template <class Key, class T>
Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &key, const T &value) const
{
@ -1296,6 +1317,44 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::count(const Key &key, const T &value) c
return n;
}
#if QT_DEPRECATED_SINCE(5, 15)
template<class Key, class T>
QList<Key> QMap<Key, T>::uniqueKeys() const
{
return static_cast<const QMultiMap<Key, T> *>(this)->uniqueKeys();
}
template<class Key, class T>
QList<T> QMap<Key, T>::values(const Key &key) const
{
return static_cast<const QMultiMap<Key, T> *>(this)->values(key);
}
template<class Key, class T>
int QMap<Key, T>::count(const Key &key) const
{
return static_cast<const QMultiMap<Key, T> *>(this)->count(key);
}
template<class Key, class T>
typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &key, const T &value)
{
return static_cast<QMultiMap<Key, T> *>(this)->insert(key, value);
}
template<class Key, class T>
typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &akey, const T &avalue)
{
return static_cast<QMultiMap<Key, T> *>(this)->insert(pos, akey, avalue);
}
template<class Key, class T>
QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other)
{
return static_cast<QMultiMap<Key, T> *>(this)->unite(other);
}
#endif
Q_DECLARE_ASSOCIATIVE_ITERATOR(Map)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Map)

View File

@ -696,7 +696,7 @@ void QDBusAbstractInterface::internalPropSet(const char *propname, const QVarian
*/
/*!
\fn QDBusAbstractInterface::call(const QString &message, Args&&...args)
\fn template <typename...Args> QDBusMessage QDBusAbstractInterface::call(const QString &method, Args&&...args)
Calls the method \a method on this interface and passes \a args to the method.
All \a args must be convertible to QVariant.
@ -745,7 +745,7 @@ QDBusMessage QDBusAbstractInterface::call(const QString &method, const QVariant
*/
/*!
\fn QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &message, Args&&...args)
\fn template <typename...Args> QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &method, Args&&...args)
\overload
@ -827,7 +827,7 @@ QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &m
*/
/*!
\fn QDBusAbstractInterface::asyncCall(const QString &message, Args&&...args)
\fn template <typename...Args> QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, Args&&...args)
Calls the method \a method on this interface and passes \a args to the method.
All \a args must be convertible to QVariant.

View File

@ -82,8 +82,7 @@ QT_BEGIN_NAMESPACE
provide a method of detaching the copies (since they refer
to the same pending call)
\sa QDBusPendingReply, QDBusPendingCallWatcher,
QDBusAbstractInterface::asyncCall()
\sa QDBusPendingReply, QDBusPendingCallWatcher
*/
/*!
@ -115,7 +114,7 @@ QT_BEGIN_NAMESPACE
(one string and one QByteArray), QDBusPendingReply::isError() will
return true.
\sa QDBusPendingReply, QDBusAbstractInterface::asyncCall()
\sa QDBusPendingReply
*/
/*!

View File

@ -91,8 +91,7 @@
QDBusPendingCallWatcher objects, which emit signals when the reply
arrives.
\sa QDBusPendingCallWatcher, QDBusReply,
QDBusAbstractInterface::asyncCall()
\sa QDBusPendingCallWatcher, QDBusReply
*/
/*!

View File

@ -41,6 +41,7 @@ depends += \
qtwidgets \
qtdoc \
qmake \
qtcmake \
qttestlib
headerdirs += ..

View File

@ -2690,7 +2690,6 @@ QOpenGLContext *QWindowPrivate::shareContext() const
platform dependent and untested.
\sa setParent()
\sa setTransientParent()
*/
QWindow *QWindow::fromWinId(WId id)
{

View File

@ -220,8 +220,6 @@ static bool isRasterSurface(QWindow *window)
to the backingstore's top level window.
You should call this function after ending painting with endPaint().
\sa QWindow::transientParent()
*/
void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &offset)
{

View File

@ -74,10 +74,10 @@ public:
QColor(Qt::GlobalColor color) noexcept;
Q_DECL_CONSTEXPR QColor(int r, int g, int b, int a = 255) noexcept
: cspec(isRgbaValid(r, g, b, a) ? Rgb : Invalid),
ct(cspec == Rgb ? a * 0x0101 : 0,
cspec == Rgb ? r * 0x0101 : 0,
cspec == Rgb ? g * 0x0101 : 0,
cspec == Rgb ? b * 0x0101 : 0,
ct(ushort(cspec == Rgb ? a * 0x0101 : 0),
ushort(cspec == Rgb ? r * 0x0101 : 0),
ushort(cspec == Rgb ? g * 0x0101 : 0),
ushort(cspec == Rgb ? b * 0x0101 : 0),
0) {}
QColor(QRgb rgb) noexcept;
QColor(QRgba64 rgba64) noexcept;

View File

@ -1404,8 +1404,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
cases where expensive operations are ok to use, for instance when
the result is cached in a QPixmap.
\sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example},
{Drawing Utility Functions}
\sa QPaintDevice, QPaintEngine, {Qt SVG}, {Basic Drawing Example}, {<qdrawutil.h>}{Drawing Utility Functions}
*/
/*!

View File

@ -122,7 +122,7 @@ QT_BEGIN_NAMESPACE
recording a frame, that is, between a \l{QRhi::beginFrame()}{beginFrame()}
- \l{QRhi::endFrame()}{endFrame()} or
\l{QRhi::beginOffscreenFrame()}{beginOffscreenFrame()} -
\l{QRhi::endOffsrceenFrame()}{endOffscreenFrame()} pair.
\l{QRhi::endOffscreenFrame()}{endOffsrceenFrame()} pair.
\note The command encoder is only valid while recording a pass, that is,
between \l{QRhiCommandBuffer::beginPass()} -

View File

@ -106,12 +106,12 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
These are by necessity slow, and we recommend avoiding them if
possible.
For each character, you can get its width(), leftBearing() and
rightBearing() and find out whether it is in the font using
For each character, you can get its horizontalAdvance(), leftBearing(),
and rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
The string functions include width(), to return the width of a
The string functions include horizontalAdvance(), to return the width of a
string in pixels (or points, for a printer), boundingRect(), to
return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
@ -464,9 +464,9 @@ bool QFontMetrics::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
See width() for a graphical description of this metric.
See horizontalAdvance() for a graphical description of this metric.
\sa rightBearing(), minLeftBearing(), width()
\sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
int QFontMetrics::leftBearing(QChar ch) const
{
@ -495,11 +495,11 @@ int QFontMetrics::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
extend to the right of the width() of the character.
extend to the right of the horizontalAdvance() of the character.
See width() for a graphical description of this metric.
See horizontalAdvance() for a graphical description of this metric.
\sa leftBearing(), minRightBearing(), width()
\sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
int QFontMetrics::rightBearing(QChar ch) const
{
@ -535,7 +535,7 @@ int QFontMetrics::rightBearing(QChar ch) const
\deprecated in Qt 5.11. Use horizontalAdvance() instead.
\sa boundingRect()
\sa boundingRect(), horizontalAdvance()
*/
int QFontMetrics::width(const QString &text, int len) const
{
@ -601,7 +601,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
\sa boundingRect()
\sa boundingRect(), horizontalAdvance()
*/
int QFontMetrics::width(QChar ch) const
{
@ -751,7 +751,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
rectangle might be different than what the horizontalAdvance() method
returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@ -762,7 +763,8 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
The height of the bounding rectangle is at least as large as the
value returned by height().
\sa width(), height(), QPainter::boundingRect(), tightBoundingRect()
\sa horizontalAdvance(), height(), QPainter::boundingRect(),
tightBoundingRect()
*/
QRect QFontMetrics::boundingRect(const QString &text) const
{
@ -790,7 +792,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
\warning The width of the returned rectangle is not the advance width
of the character. Use boundingRect(const QString &) or horizontalAdvance() instead.
\sa width()
\sa horizontalAdvance()
*/
QRect QFontMetrics::boundingRect(QChar ch) const
{
@ -864,7 +866,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
\sa width(), QPainter::boundingRect(), Qt::Alignment
\sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &text, int tabStops,
int *tabArray) const
@ -920,7 +922,8 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
rectangle might be different than what the horizontalAdvance() method
returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@ -930,7 +933,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
\warning Calling this method is very slow on Windows.
\sa width(), height(), boundingRect()
\sa horizontalAdvance(), height(), boundingRect()
*/
QRect QFontMetrics::tightBoundingRect(const QString &text) const
{
@ -1079,12 +1082,12 @@ qreal QFontMetrics::fontDpi() const
These are by necessity slow, and we recommend avoiding them if
possible.
For each character, you can get its width(), leftBearing() and
rightBearing() and find out whether it is in the font using
For each character, you can get its horizontalAdvance(), leftBearing(), and
rightBearing(), and find out whether it is in the font using
inFont(). You can also treat the character as a string, and use
the string functions on it.
The string functions include width(), to return the width of a
The string functions include horizontalAdvance(), to return the width of a
string in pixels (or points, for a printer), boundingRect(), to
return a rectangle large enough to contain the rendered string,
and size(), to return the size of that rectangle.
@ -1434,9 +1437,9 @@ bool QFontMetricsF::inFontUcs4(uint ucs4) const
value is negative if the pixels of the character extend to the
left of the logical origin.
See width() for a graphical description of this metric.
See horizontalAdvance() for a graphical description of this metric.
\sa rightBearing(), minLeftBearing(), width()
\sa rightBearing(), minLeftBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::leftBearing(QChar ch) const
{
@ -1465,11 +1468,11 @@ qreal QFontMetricsF::leftBearing(QChar ch) const
The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
extend to the right of the width() of the character.
extend to the right of the horizontalAdvance() of the character.
See width() for a graphical description of this metric.
See horizontalAdvance() for a graphical description of this metric.
\sa leftBearing(), minRightBearing(), width()
\sa leftBearing(), minRightBearing(), horizontalAdvance()
*/
qreal QFontMetricsF::rightBearing(QChar ch) const
{
@ -1504,7 +1507,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
\deprecated in Qt 5.11. Use horizontalAdvance() instead.
\sa boundingRect()
\sa boundingRect(), horizontalAdvance()
*/
qreal QFontMetricsF::width(const QString &text) const
{
@ -1535,7 +1538,7 @@ qreal QFontMetricsF::width(const QString &text) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
\sa boundingRect()
\sa boundingRect(), horizontalAdvance()
*/
qreal QFontMetricsF::width(QChar ch) const
{
@ -1581,7 +1584,7 @@ qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
ch.
Some of the metrics are described in the image to the right. The
central dark rectangles cover the logical width() of each
central dark rectangles cover the logical horizontalAdvance() of each
character. The outer pale rectangles cover the leftBearing() and
rightBearing() of each character. Notice that the bearings of "f"
in this particular font are both negative, while the bearings of
@ -1632,7 +1635,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
rectangle might be different than what the horizontalAdvance() method returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@ -1643,7 +1646,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const
The height of the bounding rectangle is at least as large as the
value returned height().
\sa width(), height(), QPainter::boundingRect()
\sa horizontalAdvance(), height(), QPainter::boundingRect()
*/
QRectF QFontMetricsF::boundingRect(const QString &text) const
{
@ -1669,7 +1672,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
Note that the rectangle usually extends both above and below the
base line.
\sa width()
\sa horizontalAdvance()
*/
QRectF QFontMetricsF::boundingRect(QChar ch) const
{
@ -1746,7 +1749,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
fontHeight() and lineSpacing() are used to calculate the height,
rather than individual character heights.
\sa width(), QPainter::boundingRect(), Qt::Alignment
\sa horizontalAdvance(), QPainter::boundingRect(), Qt::Alignment
*/
QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString& text,
int tabStops, int *tabArray) const
@ -1805,7 +1808,8 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the width of the returned
rectangle might be different than what the width() method returns.
rectangle might be different than what the horizontalAdvance() method
returns.
If you want to know the advance width of the string (to lay out
a set of strings next to each other), use horizontalAdvance() instead.
@ -1815,7 +1819,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
\warning Calling this method is very slow on Windows.
\sa width(), height(), boundingRect()
\sa horizontalAdvance(), height(), boundingRect()
*/
QRectF QFontMetricsF::tightBoundingRect(const QString &text) const
{

View File

@ -1751,16 +1751,13 @@ void QNetworkAccessManager::setTransferTimeout(int timeout)
d_func()->transferTimeout = timeout;
}
void QNetworkAccessManagerPrivate::_q_replyFinished()
void QNetworkAccessManagerPrivate::_q_replyFinished(QNetworkReply *reply)
{
Q_Q(QNetworkAccessManager);
QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender());
if (reply) {
emit q->finished(reply);
if (reply->request().attribute(QNetworkRequest::AutoDeleteReplyOnFinishAttribute, false).toBool())
QMetaObject::invokeMethod(reply, [reply] { reply->deleteLater(); }, Qt::QueuedConnection);
}
emit q->finished(reply);
if (reply->request().attribute(QNetworkRequest::AutoDeleteReplyOnFinishAttribute, false).toBool())
QMetaObject::invokeMethod(reply, [reply] { reply->deleteLater(); }, Qt::QueuedConnection);
#ifndef QT_NO_BEARERMANAGEMENT
// If there are no active requests, release our reference to the network session.
@ -1772,13 +1769,11 @@ void QNetworkAccessManagerPrivate::_q_replyFinished()
#endif
}
void QNetworkAccessManagerPrivate::_q_replyEncrypted()
void QNetworkAccessManagerPrivate::_q_replyEncrypted(QNetworkReply *reply)
{
#ifndef QT_NO_SSL
Q_Q(QNetworkAccessManager);
QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender());
if (reply)
emit q->encrypted(reply);
emit q->encrypted(reply);
#endif
}
@ -1810,11 +1805,13 @@ QNetworkReply *QNetworkAccessManagerPrivate::postProcess(QNetworkReply *reply)
{
Q_Q(QNetworkAccessManager);
QNetworkReplyPrivate::setManager(reply, q);
q->connect(reply, SIGNAL(finished()), SLOT(_q_replyFinished()));
q->connect(reply, &QNetworkReply::finished, reply,
[this, reply]() { _q_replyFinished(reply); });
#ifndef QT_NO_SSL
/* In case we're compiled without SSL support, we don't have this signal and we need to
* avoid getting a connection error. */
q->connect(reply, SIGNAL(encrypted()), SLOT(_q_replyEncrypted()));
q->connect(reply, &QNetworkReply::encrypted, reply,
[this, reply]() { _q_replyEncrypted(reply); });
q->connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(_q_replySslErrors(QList<QSslError>)));
q->connect(reply, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), SLOT(_q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)));
#endif

View File

@ -207,8 +207,6 @@ private:
friend class QNetworkReplyWasmImpl;
#endif
Q_DECLARE_PRIVATE(QNetworkAccessManager)
Q_PRIVATE_SLOT(d_func(), void _q_replyFinished())
Q_PRIVATE_SLOT(d_func(), void _q_replyEncrypted())
Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>))
Q_PRIVATE_SLOT(d_func(), void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*))
#ifndef QT_NO_BEARERMANAGEMENT

View File

@ -120,8 +120,8 @@ public:
QThread * createThread();
void destroyThread();
void _q_replyFinished();
void _q_replyEncrypted();
void _q_replyFinished(QNetworkReply *reply);
void _q_replyEncrypted(QNetworkReply *reply);
void _q_replySslErrors(const QList<QSslError> &errors);
void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
QNetworkReply *postProcess(QNetworkReply *reply);

View File

@ -28,6 +28,7 @@
/*!
\class QWindowsWindowFunctions
\inmodule QtPlatformHeaders
\inheaderfile QtPlatformHeaders/QWindowsWindowFunctions
\since 5.5
\brief The QWindowsWindowFunctions class is an inline class containing
miscellaneous functionality for Windows window specific functionality.

View File

@ -755,6 +755,12 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
\sa QDialogButtonBox, {fowler}{GUI Design Handbook: Message Box}, {Standard Dialogs Example}, {Application Example}
*/
/*!
\enum QMessageBox::ButtonRole
\include qdialogbuttonbox.cpp buttonrole-enum
*/
/*!
\enum QMessageBox::StandardButton
\since 4.2

View File

@ -923,8 +923,8 @@ QTableWidgetSelectionRange::QTableWidgetSelectionRange(int top, int left, int bo
Constructs a the table selection range by copying the given \a
other table selection range.
*/
QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &other) = default;
QTableWidgetSelectionRange &QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange &other) = default;
QTableWidgetSelectionRange::QTableWidgetSelectionRange(const QTableWidgetSelectionRange &) = default;
QTableWidgetSelectionRange &QTableWidgetSelectionRange::operator=(const QTableWidgetSelectionRange &) = default;
/*!
Destroys the table selection range.

View File

@ -522,8 +522,8 @@ QDialogButtonBox::~QDialogButtonBox()
/*!
\enum QDialogButtonBox::ButtonRole
\enum QMessageBox::ButtonRole
//! [buttonrole-enum]
This enum describes the roles that can be used to describe buttons in
the button box. Combinations of these roles are as flags used to
describe different aspects of their behavior.
@ -546,6 +546,7 @@ QDialogButtonBox::~QDialogButtonBox()
\omitvalue NRoles
\sa StandardButton
//! [buttonrole-enum]
*/
/*!

View File

@ -1,4 +1,5 @@
[writeDatagramToNonExistingPeer]
windows-10 msvc-2019
windows-10 msvc-2017
windows-10 msvc-2015
windows-7sp1