Deprecate conversion functions between QList and QSet
Users should use range constructors instead to do the conversion. Keep conversion methods between QList and QVector as these will turn into a no-op in Qt 6, whereas forcing people to use range constructors would lead to deep copies of the data. Change-Id: Id9fc9e4d007044e019826da523e8418857c91283 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
d510e1e7f9
commit
92f9842732
@ -384,7 +384,7 @@ void Widget::renderWindowReady()
|
||||
m_output->append(tr("Qt OpenGL library handle: %1")
|
||||
.arg(QString::number(qintptr(QOpenGLContext::openGLModuleHandle()), 16)));
|
||||
|
||||
QList<QByteArray> extensionList = context->extensions().toList();
|
||||
QList<QByteArray> extensionList = context->extensions().values();
|
||||
std::sort(extensionList.begin(), extensionList.end());
|
||||
m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count()));
|
||||
for (const QByteArray &ext : qAsConst(extensionList))
|
||||
|
@ -611,7 +611,8 @@ bool PathStrokeRenderer::event(QEvent *e)
|
||||
case Qt::TouchPointPressed:
|
||||
{
|
||||
// find the point, move it
|
||||
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
|
||||
const auto mappedPoints = m_fingerPointMapping.values();
|
||||
QSet<int> activePoints = QSet<int>(mappedPoints.begin(), mappedPoints.end());
|
||||
int activePoint = -1;
|
||||
qreal distance = -1;
|
||||
const int pointsCount = m_points.size();
|
||||
|
@ -180,7 +180,8 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
||||
case Qt::TouchPointPressed:
|
||||
{
|
||||
// find the point, move it
|
||||
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
|
||||
const auto mappedPoints = m_fingerPointMapping.values();
|
||||
QSet<int> activePoints = QSet<int>(mappedPoints.begin(), mappedPoints.end());
|
||||
int activePoint = -1;
|
||||
qreal distance = -1;
|
||||
const int pointsCount = m_points.size();
|
||||
|
@ -2696,7 +2696,8 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
|
||||
QSet<QString> recurse;
|
||||
const ProKey rkey(*qut_it + ".recurse");
|
||||
if (project->isSet(rkey)) {
|
||||
recurse = project->values(rkey).toQStringList().toSet();
|
||||
const QStringList values = project->values(rkey).toQStringList();
|
||||
recurse = QSet<QString>(values.begin(), values.end());
|
||||
} else {
|
||||
for(int target = 0; target < targets.size(); ++target)
|
||||
recurse.insert(targets.at(target)->name);
|
||||
|
@ -346,7 +346,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
||||
QHash<QString, QString> fileNames;
|
||||
bool duplicatesFound = false;
|
||||
const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter();
|
||||
QStringList fixifiedSourceDirs = fileFixify(source_directories.toList(), FileFixifyAbsolute);
|
||||
QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute);
|
||||
fixifiedSourceDirs.removeDuplicates();
|
||||
for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) {
|
||||
QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
@ -370,10 +370,11 @@ static QList<QAbstractState *> getEffectiveTargetStates(QAbstractTransition *tra
|
||||
QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(historyState)->configuration;
|
||||
if (!historyConfiguration.isEmpty()) {
|
||||
// There is a saved history, so apply that.
|
||||
targets.unite(historyConfiguration.toSet());
|
||||
targets.unite(QSet<QAbstractState *>(historyConfiguration.constBegin(), historyConfiguration.constEnd()));
|
||||
} else if (QAbstractTransition *defaultTransition = historyState->defaultTransition()) {
|
||||
// No saved history, take all default transition targets.
|
||||
targets.unite(defaultTransition->targetStates().toSet());
|
||||
const auto &targetStates = defaultTransition->targetStates();
|
||||
targets.unite(QSet<QAbstractState *>(targetStates.constBegin(), targetStates.constEnd()));
|
||||
} else {
|
||||
// Woops, we found a history state without a default state. That's not valid!
|
||||
QStateMachinePrivate *m = QStateMachinePrivate::get(historyState->machine());
|
||||
@ -384,7 +385,7 @@ static QList<QAbstractState *> getEffectiveTargetStates(QAbstractTransition *tra
|
||||
}
|
||||
}
|
||||
|
||||
targetsList = targets.toList();
|
||||
targetsList = targets.values();
|
||||
cache->insert(transition, targetsList);
|
||||
return targetsList;
|
||||
}
|
||||
@ -740,7 +741,7 @@ QList<QAbstractState*> QStateMachinePrivate::computeExitSet(const QList<QAbstrac
|
||||
{
|
||||
Q_ASSERT(cache);
|
||||
|
||||
QList<QAbstractState*> statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).toList();
|
||||
QList<QAbstractState*> statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).values();
|
||||
std::sort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan);
|
||||
return statesToExit_sorted;
|
||||
}
|
||||
@ -777,7 +778,7 @@ QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr
|
||||
// makes the state machine invalid.
|
||||
if (error == QStateMachine::NoError)
|
||||
setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState());
|
||||
QList<QAbstractState *> lst = pendingErrorStates.toList();
|
||||
QList<QAbstractState *> lst = pendingErrorStates.values();
|
||||
lst.prepend(t->sourceState());
|
||||
|
||||
domain = findLCCA(lst);
|
||||
@ -879,7 +880,7 @@ QList<QAbstractState*> QStateMachinePrivate::computeEntrySet(const QList<QAbstra
|
||||
pendingErrorStatesForDefaultEntry.clear();
|
||||
}
|
||||
|
||||
QList<QAbstractState*> statesToEnter_sorted = statesToEnter.toList();
|
||||
QList<QAbstractState*> statesToEnter_sorted = statesToEnter.values();
|
||||
std::sort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan);
|
||||
return statesToEnter_sorted;
|
||||
}
|
||||
|
@ -403,13 +403,15 @@ public:
|
||||
inline QList<T> &operator<<(const QList<T> &l)
|
||||
{ *this += l; return *this; }
|
||||
|
||||
QVector<T> toVector() const;
|
||||
QSet<T> toSet() const;
|
||||
|
||||
static QList<T> fromVector(const QVector<T> &vector);
|
||||
static QList<T> fromSet(const QSet<T> &set);
|
||||
QVector<T> toVector() const;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
Q_DECL_DEPRECATED_X("Use QList<T>(set.begin(), set.end()) instead.")
|
||||
static QList<T> fromSet(const QSet<T> &set);
|
||||
Q_DECL_DEPRECATED_X("Use QSet<T>(list.begin(), list.end()) instead.")
|
||||
QSet<T> toSet() const;
|
||||
|
||||
Q_DECL_DEPRECATED_X("Use QList<T>(list.begin(), list.end()) instead.")
|
||||
static inline QList<T> fromStdList(const std::list<T> &list)
|
||||
{ QList<T> tmp; std::copy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
|
||||
|
@ -245,10 +245,13 @@ public:
|
||||
inline QSet<T> operator-(const QSet<T> &other) const
|
||||
{ QSet<T> result = *this; result -= other; return result; }
|
||||
|
||||
QList<T> toList() const;
|
||||
inline QList<T> values() const { return toList(); }
|
||||
|
||||
QList<T> values() const;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
Q_DECL_DEPRECATED_X("Use values() instead.")
|
||||
QList<T> toList() const { return values(); }
|
||||
Q_DECL_DEPRECATED_X("Use QSet<T>(list.begin(), list.end()) instead.")
|
||||
static QSet<T> fromList(const QList<T> &list);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Hash q_hash;
|
||||
@ -368,7 +371,7 @@ Q_INLINE_TEMPLATE bool QSet<T>::contains(const QSet<T> &other) const
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::toList() const
|
||||
Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::values() const
|
||||
{
|
||||
QList<T> result;
|
||||
result.reserve(size());
|
||||
@ -380,6 +383,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::toList() const
|
||||
return result;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
template <typename T>
|
||||
Q_OUTOFLINE_TEMPLATE QSet<T> QList<T>::toSet() const
|
||||
{
|
||||
@ -401,6 +405,7 @@ QList<T> QList<T>::fromSet(const QSet<T> &set)
|
||||
{
|
||||
return set.toList();
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_DECLARE_SEQUENTIAL_ITERATOR(Set)
|
||||
|
||||
|
@ -297,9 +297,8 @@ public:
|
||||
inline QVector<T> &operator<<(T &&t)
|
||||
{ append(std::move(t)); return *this; }
|
||||
|
||||
QList<T> toList() const;
|
||||
|
||||
static QVector<T> fromList(const QList<T> &list);
|
||||
QList<T> toList() const;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
Q_DECL_DEPRECATED_X("Use QVector<T>(vector.begin(), vector.end()) instead.")
|
||||
|
@ -80,7 +80,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
|
||||
if (extensionStr) {
|
||||
QByteArray ba(extensionStr);
|
||||
QList<QByteArray> extensions = ba.split(' ');
|
||||
m_extensions = extensions.toSet();
|
||||
m_extensions = QSet<QByteArray>(extensions.constBegin(), extensions.constEnd());
|
||||
} else {
|
||||
#ifdef QT_OPENGL_3
|
||||
// clear error state
|
||||
|
@ -1007,7 +1007,7 @@ bool QTextOdfWriter::writeAll()
|
||||
|
||||
// add objects for lists, frames and tables
|
||||
const QVector<QTextFormat> allFormats = m_document->allFormats();
|
||||
const QList<int> copy = formats.toList();
|
||||
const QList<int> copy = formats.values();
|
||||
for (auto index : copy) {
|
||||
QTextObject *object = m_document->objectForFormat(allFormats[index]);
|
||||
if (object) {
|
||||
|
@ -693,7 +693,7 @@ static QStringList libraryPathList()
|
||||
// discover paths of already loaded libraries
|
||||
QSet<QString> loadedPaths;
|
||||
dl_iterate_phdr(dlIterateCallback, &loadedPaths);
|
||||
paths.append(loadedPaths.toList());
|
||||
paths.append(loadedPaths.values());
|
||||
#endif
|
||||
|
||||
return paths;
|
||||
|
@ -2607,7 +2607,7 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet<QS
|
||||
return;
|
||||
}
|
||||
|
||||
auto list = directives.toList();
|
||||
auto list = directives.values();
|
||||
// sort (always generate in the same order):
|
||||
std::sort(list.begin(), list.end());
|
||||
|
||||
|
@ -2066,7 +2066,7 @@ QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints)
|
||||
for (auto it = c->variables.cbegin(), end = c->variables.cend(); it != end; ++it)
|
||||
variableSet.insert(static_cast<AnchorData *>(it.key()));
|
||||
}
|
||||
return variableSet.toList();
|
||||
return variableSet.values();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -6352,7 +6352,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
|
||||
<< "delivering override to"
|
||||
<< item.data() << gestures;
|
||||
// send gesture override
|
||||
QGestureEvent ev(gestures.toList());
|
||||
QGestureEvent ev(gestures.values());
|
||||
ev.t = QEvent::GestureOverride;
|
||||
ev.setWidget(event->widget());
|
||||
// mark event and individual gestures as ignored
|
||||
@ -6442,7 +6442,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
|
||||
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
|
||||
<< "delivering to"
|
||||
<< receiver.data() << gestures;
|
||||
QGestureEvent ev(gestures.toList());
|
||||
QGestureEvent ev(gestures.values());
|
||||
ev.setWidget(event->widget());
|
||||
sendEvent(receiver.data(), &ev);
|
||||
QSet<QGesture *> ignoredGestures;
|
||||
@ -6473,7 +6473,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
|
||||
// look for new potential targets for gestures that were ignored
|
||||
// and should be propagated.
|
||||
|
||||
QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet();
|
||||
QSet<QGraphicsObject *> targetsSet(cachedTargetItems.constBegin(), cachedTargetItems.constEnd());
|
||||
|
||||
if (receiver) {
|
||||
// first if the gesture should be propagated to parents only
|
||||
@ -6505,7 +6505,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
|
||||
gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures,
|
||||
&cachedItemGestures, &targetsSet, 0, 0);
|
||||
|
||||
cachedTargetItems = targetsSet.toList();
|
||||
cachedTargetItems = targetsSet.values();
|
||||
std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
|
||||
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
|
||||
<< "new targets:" << cachedTargetItems;
|
||||
@ -6583,7 +6583,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
|
||||
}
|
||||
Q_ASSERT(target);
|
||||
|
||||
const QList<QGesture *> list = gestures.toList();
|
||||
const QList<QGesture *> list = gestures.values();
|
||||
QGestureEvent ev(list);
|
||||
sendEvent(target, &ev);
|
||||
|
||||
|
@ -164,7 +164,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints)
|
||||
for (auto it = v.cbegin(), end = v.cend(); it != end; ++it)
|
||||
variablesSet.insert(it.key());
|
||||
}
|
||||
variables = variablesSet.toList();
|
||||
variables = variablesSet.values();
|
||||
|
||||
// Set Variables reverse mapping
|
||||
// We also need to be able to find the index for a given variable, to do that
|
||||
|
@ -191,7 +191,7 @@ QList<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w,
|
||||
break;
|
||||
--it_y;
|
||||
}
|
||||
return list.toList();
|
||||
return list.values();
|
||||
}
|
||||
|
||||
#undef DEBUG_SPAN_UPDATE
|
||||
@ -875,7 +875,7 @@ void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter,
|
||||
for(int y = firstVisualRow; y <= lastVisualRow; y++)
|
||||
set.insert(spans.spanAt(x,y));
|
||||
set.remove(0);
|
||||
visibleSpans = set.toList();
|
||||
visibleSpans = set.values();
|
||||
}
|
||||
|
||||
for (QSpanCollection::Span *span : qAsConst(visibleSpans)) {
|
||||
|
@ -1721,7 +1721,7 @@ QWidgetList QApplication::topLevelWidgets()
|
||||
QWidgetList QApplication::allWidgets()
|
||||
{
|
||||
if (QWidgetPrivate::allWidgets)
|
||||
return QWidgetPrivate::allWidgets->toList();
|
||||
return QWidgetPrivate::allWidgets->values();
|
||||
return QWidgetList();
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
|
||||
while (iter != m_objectGestures.end()) {
|
||||
ObjectGesture objectGesture = iter.key();
|
||||
if (objectGesture.gesture == type && target == objectGesture.object) {
|
||||
QSet<QGesture *> gestures = iter.value().toSet();
|
||||
QSet<QGesture *> gestures = QSet<QGesture *>(iter.value().constBegin(), iter.value().constEnd());
|
||||
for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
|
||||
it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
|
||||
it.value() -= gestures;
|
||||
|
@ -2531,14 +2531,18 @@ void tst_Collections::conversions()
|
||||
QCOMPARE(list2.size(), 4);
|
||||
QVERIFY(list2 == (QList<QString>() << STUFF));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QSet<QString> set1 = list1.toSet();
|
||||
#else
|
||||
QSet<QString> set1(list1.begin(), list1.end());
|
||||
#endif
|
||||
QCOMPARE(set1.size(), 3);
|
||||
QVERIFY(set1.contains("A"));
|
||||
QVERIFY(set1.contains("B"));
|
||||
QVERIFY(set1.contains("C"));
|
||||
QVERIFY(!set1.contains("D"));
|
||||
|
||||
QList<QString> list3 = set1.toList();
|
||||
QList<QString> list3 = set1.values();
|
||||
QCOMPARE(list3.size(), 3);
|
||||
QVERIFY(list3.contains("A"));
|
||||
QVERIFY(list3.contains("B"));
|
||||
@ -2546,9 +2550,11 @@ void tst_Collections::conversions()
|
||||
QVERIFY(!list3.contains("D"));
|
||||
|
||||
QVERIFY(QList<int>().toVector().isEmpty());
|
||||
QVERIFY(QList<int>().toSet().isEmpty());
|
||||
QVERIFY(QVector<int>().toList().isEmpty());
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QVERIFY(QList<int>().toSet().isEmpty());
|
||||
QVERIFY(QSet<int>().toList().isEmpty());
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
@ -2563,14 +2569,22 @@ void tst_Collections::conversions()
|
||||
QCOMPARE(list2.size(), 4);
|
||||
QVERIFY(list2 == (QList<QString>() << STUFF));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QSet<QString> set1 = QSet<QString>::fromList(list1);
|
||||
#else
|
||||
QSet<QString> set1(list1.begin(), list1.end());
|
||||
#endif
|
||||
QCOMPARE(set1.size(), 3);
|
||||
QVERIFY(set1.contains("A"));
|
||||
QVERIFY(set1.contains("B"));
|
||||
QVERIFY(set1.contains("C"));
|
||||
QVERIFY(!set1.contains("D"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QList<QString> list3 = QList<QString>::fromSet(set1);
|
||||
#else
|
||||
QList<QString> list3 = set1.values();
|
||||
#endif
|
||||
QCOMPARE(list3.size(), 3);
|
||||
QVERIFY(list3.contains("A"));
|
||||
QVERIFY(list3.contains("B"));
|
||||
@ -2578,9 +2592,11 @@ void tst_Collections::conversions()
|
||||
QVERIFY(!list3.contains("D"));
|
||||
|
||||
QVERIFY(QVector<int>::fromList(QList<int>()).isEmpty());
|
||||
QVERIFY(QSet<int>::fromList(QList<int>()).isEmpty());
|
||||
QVERIFY(QList<int>::fromVector(QVector<int>()).isEmpty());
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QVERIFY(QSet<int>::fromList(QList<int>()).isEmpty());
|
||||
QVERIFY(QList<int>::fromSet(QSet<int>()).isEmpty());
|
||||
#endif
|
||||
}
|
||||
#undef STUFF
|
||||
}
|
||||
@ -2776,15 +2792,21 @@ void tst_Collections::vector_stl()
|
||||
for (int i = 0; i < elements.count(); ++i)
|
||||
vector << elements.at(i);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
std::vector<QString> stdVector = vector.toStdVector();
|
||||
|
||||
#else
|
||||
std::vector<QString> stdVector(vector.begin(), vector.end());
|
||||
#endif
|
||||
QCOMPARE(int(stdVector.size()), elements.size());
|
||||
|
||||
std::vector<QString>::const_iterator it = stdVector.begin();
|
||||
for (uint j = 0; j < stdVector.size() && it != stdVector.end(); ++j, ++it)
|
||||
QCOMPARE(*it, vector[j]);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QCOMPARE(QVector<QString>::fromStdVector(stdVector), vector);
|
||||
#endif
|
||||
QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector);
|
||||
}
|
||||
|
||||
void tst_Collections::linkedlist_stl_data()
|
||||
@ -2830,7 +2852,11 @@ void tst_Collections::list_stl()
|
||||
for (int i = 0; i < elements.count(); ++i)
|
||||
list << elements.at(i);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
std::list<QString> stdList = list.toStdList();
|
||||
#else
|
||||
std::list<QString> stdList(list.begin(), list.end());
|
||||
#endif
|
||||
|
||||
QCOMPARE(int(stdList.size()), elements.size());
|
||||
|
||||
@ -2838,7 +2864,10 @@ void tst_Collections::list_stl()
|
||||
for (uint j = 0; j < stdList.size() && it != stdList.end(); ++j, ++it)
|
||||
QCOMPARE(*it, list[j]);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QCOMPARE(QList<QString>::fromStdList(stdList), list);
|
||||
#endif
|
||||
QCOMPARE(QList<QString>(stdList.begin(), stdList.end()), list);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -364,10 +364,10 @@ private slots:
|
||||
void takeLastOptimal() const;
|
||||
void takeLastMovable() const;
|
||||
void takeLastComplex() const;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
void toSetOptimal() const;
|
||||
void toSetMovable() const;
|
||||
void toSetComplex() const;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
void toStdListOptimal() const;
|
||||
void toStdListMovable() const;
|
||||
void toStdListComplex() const;
|
||||
@ -428,8 +428,8 @@ private:
|
||||
template<typename T> void takeAt() const;
|
||||
template<typename T> void takeFirst() const;
|
||||
template<typename T> void takeLast() const;
|
||||
template<typename T> void toSet() const;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
template<typename T> void toSet() const;
|
||||
template<typename T> void toStdList() const;
|
||||
#endif
|
||||
template<typename T> void toVector() const;
|
||||
@ -1599,6 +1599,7 @@ void tst_QList::takeLastComplex() const
|
||||
QCOMPARE(liveCount, Complex::getLiveCount());
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
template<typename T>
|
||||
void tst_QList::toSet() const
|
||||
{
|
||||
@ -1637,7 +1638,6 @@ void tst_QList::toSetComplex() const
|
||||
QCOMPARE(liveCount, Complex::getLiveCount());
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
template<typename T>
|
||||
void tst_QList::toStdList() const
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ static void dumpGlConfiguration(QOpenGLContext &context, QTextStream &str)
|
||||
<< "\nShading language : " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))
|
||||
<< "\nFormat : " << context.format();
|
||||
|
||||
QList<QByteArray> extensionList = context.extensions().toList();
|
||||
QList<QByteArray> extensionList = context.extensions().values();
|
||||
std::sort(extensionList.begin(), extensionList.end());
|
||||
const int extensionCount = extensionList.size();
|
||||
str << "\n\nFound " << extensionCount << " extensions:\n";
|
||||
@ -233,9 +233,9 @@ void tst_QOpenGlConfig::testGlConfiguration()
|
||||
static inline QByteArray msgSetMismatch(const QSet<QString> &expected,
|
||||
const QSet<QString> &actual)
|
||||
{
|
||||
const QString result = QStringList(expected.toList()).join(QLatin1Char(','))
|
||||
const QString result = QStringList(expected.values()).join(QLatin1Char(','))
|
||||
+ QLatin1String(" != ")
|
||||
+ QStringList(actual.toList()).join(QLatin1Char(','));
|
||||
+ QStringList(actual.values()).join(QLatin1Char(','));
|
||||
return result.toLatin1();
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,9 @@ void tst_QApplication::libraryPaths()
|
||||
|
||||
QStringList actual = QApplication::libraryPaths();
|
||||
actual.sort();
|
||||
QStringList expected = QSet<QString>::fromList((QStringList() << testDir << appDirPath)).toList();
|
||||
QStringList expected;
|
||||
expected << testDir << appDirPath;
|
||||
expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values();
|
||||
expected.sort();
|
||||
|
||||
QVERIFY2(isPathListIncluded(actual, expected),
|
||||
@ -925,7 +927,9 @@ void tst_QApplication::libraryPaths()
|
||||
QStringList actual = QApplication::libraryPaths();
|
||||
actual.sort();
|
||||
|
||||
QStringList expected = QSet<QString>::fromList((QStringList() << installPathPlugins << appDirPath)).toList();
|
||||
QStringList expected;
|
||||
expected << installPathPlugins << appDirPath;
|
||||
expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values();
|
||||
expected.sort();
|
||||
|
||||
#ifdef Q_OS_WINRT
|
||||
|
@ -124,13 +124,19 @@ void tst_QAbstractScrollArea::scrollBarWidgets()
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList());
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom), w2List);
|
||||
|
||||
auto sort = [](const QWidgetList l) {
|
||||
QWidgetList list = l;
|
||||
std::sort(list.begin(), list.end());
|
||||
return list;
|
||||
};
|
||||
|
||||
// two widgets at Bottom.
|
||||
area.addScrollBarWidget(w3, Qt::AlignBottom);
|
||||
QCOMPARE(area.scrollBarWidgets(all).toSet(), allList.toSet());
|
||||
QCOMPARE(sort(area.scrollBarWidgets(all)), sort(allList));
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignLeft), w1List);
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignRight), QWidgetList());
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList());
|
||||
QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom).toSet(), (w2List + w3List).toSet());
|
||||
QCOMPARE(sort(area.scrollBarWidgets(Qt::AlignBottom)), sort(w2List + w3List));
|
||||
|
||||
//delete
|
||||
delete w1;
|
||||
|
Loading…
Reference in New Issue
Block a user