Replace QPair/qMakePair with std::pair in qtbase/gui

Task-number: QTBUG-115841
Pick-to: 6.9
Change-Id: Iebd96760ff7b3d7674816553312ba8dc3229c86a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Isak Fyksen 2024-10-24 14:12:48 +02:00 committed by Volker Hilsheimer
parent 71d114588d
commit caf22e481d
37 changed files with 115 additions and 124 deletions

View File

@ -1707,7 +1707,7 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface)
QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const
{ {
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair; typedef std::pair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
const QList<RelationPair> relationInterfaces = interface->relations(); const QList<RelationPair> relationInterfaces = interface->relations();
QSpiRelationArray relations; QSpiRelationArray relations;

View File

@ -18,7 +18,6 @@
#include <QtGui/private/qtguiglobal_p.h> #include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtDBus/QDBusArgument> #include <QtDBus/QDBusArgument>
#include <QtDBus/QDBusConnection> #include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusObjectPath> #include <QtDBus/QDBusObjectPath>
@ -92,7 +91,7 @@ typedef QList<QSpiEventListener> QSpiEventListenerArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action); QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action); const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry; typedef std::pair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
typedef QList<QSpiRelationArrayEntry> QSpiRelationArray; typedef QList<QSpiRelationArrayEntry> QSpiRelationArray;
//a(iisv) //a(iisv)

View File

@ -162,7 +162,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout); SLOT(notifyKeyboardListenerError(QDBusError,QDBusMessage)), timeout);
if (sent) { if (sent) {
//queue the event and send it after callback //queue the event and send it after callback
keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent))); keyEvents.enqueue(std::pair{QPointer<QObject>(target), copyKeyEvent(keyEvent)});
return true; return true;
} }
break; break;
@ -188,10 +188,10 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage&
} }
Q_ASSERT(message.arguments().size() == 1); Q_ASSERT(message.arguments().size() == 1);
if (message.arguments().at(0).toBool() == true) { if (message.arguments().at(0).toBool() == true) {
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue(); std::pair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
delete event.second; delete event.second;
} else { } else {
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue(); std::pair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
if (event.first) if (event.first)
QCoreApplication::postEvent(event.first.data(), event.second); QCoreApplication::postEvent(event.first.data(), event.second);
} }
@ -201,7 +201,7 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error
{ {
qWarning() << "QSpiApplication::keyEventError " << error.name() << error.message(); qWarning() << "QSpiApplication::keyEventError " << error.name() << error.message();
while (!keyEvents.isEmpty()) { while (!keyEvents.isEmpty()) {
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue(); std::pair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
if (event.first) if (event.first)
QCoreApplication::postEvent(event.first.data(), event.second); QCoreApplication::postEvent(event.first.data(), event.second);
} }

View File

@ -53,7 +53,7 @@ private Q_SLOTS:
private: private:
static QKeyEvent* copyKeyEvent(QKeyEvent*); static QKeyEvent* copyKeyEvent(QKeyEvent*);
QQueue<QPair<QPointer<QObject>, QKeyEvent*> > keyEvents; QQueue<std::pair<QPointer<QObject>, QKeyEvent*> > keyEvents;
QDBusConnection dbusConnection; QDBusConnection dbusConnection;
}; };

View File

@ -362,7 +362,7 @@ Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
interfaces of the calling object, together with the relations interfaces of the calling object, together with the relations
for each object. for each object.
Each entry in the list is a QPair where the \c second member stores Each entry in the list is a std::pair where the \c second member stores
the relation type(s) between the \c returned object represented by the the relation type(s) between the \c returned object represented by the
\c first member and the \c origin (the caller) interface/object. \c first member and the \c origin (the caller) interface/object.

View File

@ -116,7 +116,7 @@ QAccessible::Id QAccessibleCache::insert(QObject *object, QAccessibleInterface *
QObject *obj = iface->object(); QObject *obj = iface->object();
Q_ASSERT(object == obj); Q_ASSERT(object == obj);
if (obj) { if (obj) {
objectToId.insert(obj, qMakePair(id, obj->metaObject())); objectToId.insert(obj, std::pair(id, obj->metaObject()));
connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed); connect(obj, &QObject::destroyed, this, &QAccessibleCache::objectDestroyed);
} }
idToInterface.insert(id, iface); idToInterface.insert(id, iface);

View File

@ -1157,12 +1157,10 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
emit layoutAboutToBeChanged(); emit layoutAboutToBeChanged();
QModelIndexList oldList = persistentIndexList(); QModelIndexList oldList = persistentIndexList();
QList<QPair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes; QList<std::pair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes;
oldNodes.reserve(oldList.size()); oldNodes.reserve(oldList.size());
for (const QModelIndex &oldNode : oldList) { for (const QModelIndex &oldNode : oldList)
QPair<QFileSystemModelPrivate::QFileSystemNode*, int> pair(d->node(oldNode), oldNode.column()); oldNodes.emplace_back(d->node(oldNode), oldNode.column());
oldNodes.append(pair);
}
if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) { if (!(d->sortColumn == column && d->sortOrder != order && !d->forceSort)) {
//we sort only from where we are, don't need to sort all the model //we sort only from where we are, don't need to sort all the model

View File

@ -6,7 +6,6 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qabstractitemmodel.h> #include <QtCore/qabstractitemmodel.h>
#include <QtCore/qpair.h>
#include <QtCore/qdir.h> #include <QtCore/qdir.h>
#include <QtGui/qicon.h> #include <QtGui/qicon.h>

View File

@ -6,7 +6,6 @@
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qmap.h> #include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qvariant.h> #include <QtCore/qvariant.h>
#include <QtCore/qstringlist.h> #include <QtCore/qstringlist.h>
#include <QtCore/qbitarray.h> #include <QtCore/qbitarray.h>
@ -35,8 +34,8 @@ public:
inline QStandardItemModelLessThan() inline QStandardItemModelLessThan()
{ } { }
inline bool operator()(const QPair<QStandardItem*, int> &l, inline bool operator()(const std::pair<QStandardItem*, int> &l,
const QPair<QStandardItem*, int> &r) const const std::pair<QStandardItem*, int> &r) const
{ {
return *(l.first) < *(r.first); return *(l.first) < *(r.first);
} }
@ -48,8 +47,8 @@ public:
inline QStandardItemModelGreaterThan() inline QStandardItemModelGreaterThan()
{ } { }
inline bool operator()(const QPair<QStandardItem*, int> &l, inline bool operator()(const std::pair<QStandardItem*, int> &l,
const QPair<QStandardItem*, int> &r) const const std::pair<QStandardItem*, int> &r) const
{ {
return *(r.first) < *(l.first); return *(r.first) < *(l.first);
} }
@ -58,16 +57,16 @@ public:
/*! /*!
\internal \internal
*/ */
QPair<int, int> QStandardItemPrivate::position() const std::pair<int, int> QStandardItemPrivate::position() const
{ {
if (QStandardItem *par = parent) { if (QStandardItem *par = parent) {
int idx = par->d_func()->childIndex(q_func()); int idx = par->d_func()->childIndex(q_func());
if (idx == -1) if (idx == -1)
return QPair<int, int>(-1, -1); return std::pair<int, int>(-1, -1);
return QPair<int, int>(idx / par->columnCount(), idx % par->columnCount()); return std::pair<int, int>(idx / par->columnCount(), idx % par->columnCount());
} }
// ### support header items? // ### support header items?
return QPair<int, int>(-1, -1); return std::pair<int, int>(-1, -1);
} }
/*! /*!
@ -299,7 +298,7 @@ void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)
if (column >= columnCount()) if (column >= columnCount())
return; return;
QList<QPair<QStandardItem*, int> > sortable; QList<std::pair<QStandardItem*, int> > sortable;
QList<int> unsortable; QList<int> unsortable;
sortable.reserve(rowCount()); sortable.reserve(rowCount());
@ -308,7 +307,7 @@ void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)
for (int row = 0; row < rowCount(); ++row) { for (int row = 0; row < rowCount(); ++row) {
QStandardItem *itm = q->child(row, column); QStandardItem *itm = q->child(row, column);
if (itm) if (itm)
sortable.append(QPair<QStandardItem*,int>(itm, row)); sortable.emplace_back(itm, row);
else else
unsortable.append(row); unsortable.append(row);
} }
@ -1486,7 +1485,7 @@ void QStandardItem::setDropEnabled(bool dropEnabled)
int QStandardItem::row() const int QStandardItem::row() const
{ {
Q_D(const QStandardItem); Q_D(const QStandardItem);
QPair<int, int> pos = d->position(); std::pair<int, int> pos = d->position();
return pos.first; return pos.first;
} }
@ -1499,7 +1498,7 @@ int QStandardItem::row() const
int QStandardItem::column() const int QStandardItem::column() const
{ {
Q_D(const QStandardItem); Q_D(const QStandardItem);
QPair<int, int> pos = d->position(); std::pair<int, int> pos = d->position();
return pos.second; return pos.second;
} }
@ -2332,7 +2331,7 @@ QStandardItem *QStandardItemModel::itemFromIndex(const QModelIndex &index) const
QModelIndex QStandardItemModel::indexFromItem(const QStandardItem *item) const QModelIndex QStandardItemModel::indexFromItem(const QStandardItem *item) const
{ {
if (item && item->d_func()->parent) { if (item && item->d_func()->parent) {
QPair<int, int> pos = item->d_func()->position(); std::pair<int, int> pos = item->d_func()->position();
return createIndex(pos.first, pos.second, item->d_func()->parent); return createIndex(pos.first, pos.second, item->d_func()->parent);
} }
return QModelIndex(); return QModelIndex();

View File

@ -21,7 +21,6 @@
#include "private/qabstractitemmodel_p.h" #include "private/qabstractitemmodel_p.h"
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qstack.h> #include <QtCore/qstack.h>
#include <QtCore/qvariant.h> #include <QtCore/qvariant.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
@ -126,7 +125,7 @@ public:
} }
return childsLastIndexInParent; return childsLastIndexInParent;
} }
QPair<int, int> position() const; std::pair<int, int> position() const;
void setChild(int row, int column, QStandardItem *item, void setChild(int row, int column, QStandardItem *item,
bool emitChanged = false); bool emitChanged = false);
inline int rowCount() const { inline int rowCount() const {

View File

@ -32,7 +32,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcHighDpi);
class QScreen; class QScreen;
class QPlatformScreen; class QPlatformScreen;
typedef QPair<qreal, qreal> QDpi; typedef std::pair<qreal, qreal> QDpi;
#ifndef QT_NO_HIGHDPISCALING #ifndef QT_NO_HIGHDPISCALING
class Q_GUI_EXPORT QHighDpiScaling { class Q_GUI_EXPORT QHighDpiScaling {

View File

@ -152,7 +152,7 @@ QDpi QPlatformScreen::logicalDpi() const
// Helper function for accessing the platform screen logical dpi // Helper function for accessing the platform screen logical dpi
// which accounts for QT_FONT_DPI. // which accounts for QT_FONT_DPI.
QPair<qreal, qreal> QPlatformScreen::overrideDpi(const QPair<qreal, qreal> &in) QDpi QPlatformScreen::overrideDpi(const QDpi &in)
{ {
static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI");
return overrideDpi > 0 ? QDpi(overrideDpi, overrideDpi) : in; return overrideDpi > 0 ? QDpi(overrideDpi, overrideDpi) : in;

View File

@ -37,7 +37,7 @@ class QPlatformCursor;
class QScreen; class QScreen;
class QSurfaceFormat; class QSurfaceFormat;
typedef QPair<qreal, qreal> QDpi; typedef std::pair<qreal, qreal> QDpi;
class Q_GUI_EXPORT QPlatformScreen class Q_GUI_EXPORT QPlatformScreen

View File

@ -625,13 +625,13 @@ int QSurfaceFormat::minorVersion() const
} }
/*! /*!
Returns a QPair<int, int> representing the OpenGL version. Returns a std::pair<int, int> representing the OpenGL version.
Useful for version checks, for example format.version() >= qMakePair(3, 2) Useful for version checks, for example format.version() >= std::pair(3, 2)
*/ */
QPair<int, int> QSurfaceFormat::version() const std::pair<int, int> QSurfaceFormat::version() const
{ {
return qMakePair(d->major, d->minor); return std::pair(d->major, d->minor);
} }
/*! /*!

View File

@ -4,7 +4,6 @@
#define QSURFACEFORMAT_H #define QSURFACEFORMAT_H
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
#include <QtCore/qobjectdefs.h> #include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -99,7 +98,7 @@ public:
void setMinorVersion(int minorVersion); void setMinorVersion(int minorVersion);
int minorVersion() const; int minorVersion() const;
QPair<int, int> version() const; std::pair<int, int> version() const;
void setVersion(int major, int minor); void setVersion(int major, int minor);
bool stereo() const; bool stereo() const;

View File

@ -319,7 +319,7 @@ void QEGLPlatformContext::updateFormatFromGL()
m_format.setOption(QSurfaceFormat::DeprecatedFunctions); m_format.setOption(QSurfaceFormat::DeprecatedFunctions);
if (value & GL_CONTEXT_FLAG_DEBUG_BIT) if (value & GL_CONTEXT_FLAG_DEBUG_BIT)
m_format.setOption(QSurfaceFormat::DebugContext); m_format.setOption(QSurfaceFormat::DebugContext);
if (m_format.version() >= qMakePair(3, 2)) { if (m_format.version() >= std::pair(3, 2)) {
value = 0; value = 0;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
if (value & GL_CONTEXT_CORE_PROFILE_BIT) if (value & GL_CONTEXT_CORE_PROFILE_BIT)

View File

@ -300,11 +300,11 @@ static int qt_gl_resolve_features()
QOpenGLFunctions::NPOTTextureRepeat; QOpenGLFunctions::NPOTTextureRepeat;
} }
const QPair<int, int> version = format.version(); const std::pair<int, int> version = format.version();
if (version < qMakePair(3, 0) if (version < std::pair(3, 0)
|| (version == qMakePair(3, 0) && format.testOption(QSurfaceFormat::DeprecatedFunctions)) || (version == std::pair(3, 0) && format.testOption(QSurfaceFormat::DeprecatedFunctions))
|| (version == qMakePair(3, 1) && extensions.match("GL_ARB_compatibility")) || (version == std::pair(3, 1) && extensions.match("GL_ARB_compatibility"))
|| (version >= qMakePair(3, 2) && format.profile() == QSurfaceFormat::CompatibilityProfile)) { || (version >= std::pair(3, 2) && format.profile() == QSurfaceFormat::CompatibilityProfile)) {
features |= QOpenGLFunctions::FixedFunctionPipeline; features |= QOpenGLFunctions::FixedFunctionPipeline;
} }
return features; return features;
@ -421,10 +421,10 @@ static int qt_gl_resolve_extensions()
| QOpenGLExtensions::MapBuffer | QOpenGLExtensions::MapBuffer
| QOpenGLExtensions::Sized16Formats; | QOpenGLExtensions::Sized16Formats;
if (format.version() >= qMakePair(1, 2)) if (format.version() >= std::pair(1, 2))
extensions |= QOpenGLExtensions::BGRATextureFormat; extensions |= QOpenGLExtensions::BGRATextureFormat;
if (format.version() >= qMakePair(1, 4) || extensionMatcher.match("GL_SGIS_generate_mipmap")) if (format.version() >= std::pair(1, 4) || extensionMatcher.match("GL_SGIS_generate_mipmap"))
extensions |= QOpenGLExtensions::GenerateMipmap; extensions |= QOpenGLExtensions::GenerateMipmap;
if (format.majorVersion() >= 2) if (format.majorVersion() >= 2)
@ -445,13 +445,13 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::PackedDepthStencil; extensions |= QOpenGLExtensions::PackedDepthStencil;
} }
if (format.version() >= qMakePair(3, 2) || extensionMatcher.match("GL_ARB_geometry_shader4")) if (format.version() >= std::pair(3, 2) || extensionMatcher.match("GL_ARB_geometry_shader4"))
extensions |= QOpenGLExtensions::GeometryShaders; extensions |= QOpenGLExtensions::GeometryShaders;
if (format.version() >= qMakePair(3, 3)) if (format.version() >= std::pair(3, 3))
extensions |= QOpenGLExtensions::TextureSwizzle; extensions |= QOpenGLExtensions::TextureSwizzle;
if (format.version() >= qMakePair(4, 3) || extensionMatcher.match("GL_ARB_invalidate_subdata")) if (format.version() >= std::pair(4, 3) || extensionMatcher.match("GL_ARB_invalidate_subdata"))
extensions |= QOpenGLExtensions::DiscardFramebuffer; extensions |= QOpenGLExtensions::DiscardFramebuffer;
if (extensionMatcher.match("GL_ARB_map_buffer_range")) if (extensionMatcher.match("GL_ARB_map_buffer_range"))

View File

@ -1066,7 +1066,7 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b)
s << quint32(stops.size()); s << quint32(stops.size());
for (int i = 0; i < stops.size(); ++i) { for (int i = 0; i < stops.size(); ++i) {
const QGradientStop &stop = stops.at(i); const QGradientStop &stop = stops.at(i);
s << QPair<double, QColor>(double(stop.first), stop.second); s << std::pair<double, QColor>(double(stop.first), stop.second);
} }
} }
@ -1152,7 +1152,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
stops.reserve(numStops); stops.reserve(numStops);
for (quint32 i = 0; i < numStops; ++i) { for (quint32 i = 0; i < numStops; ++i) {
s >> n >> c; s >> n >> c;
stops << QPair<qreal, QColor>(n, c); stops << std::pair<qreal, QColor>(n, c);
} }
} }
@ -2502,7 +2502,7 @@ void QConicalGradient::setAngle(qreal angle)
\typedef QGradientStop \typedef QGradientStop
\relates QGradient \relates QGradient
Typedef for QPair<\l qreal, QColor>. Typedef for std::pair<\l qreal, QColor>.
*/ */
/*! /*!

View File

@ -6,7 +6,6 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h> #include <QtCore/qpoint.h>
#include <QtCore/qscopedpointer.h> #include <QtCore/qscopedpointer.h>
#include <QtGui/qcolor.h> #include <QtGui/qcolor.h>
@ -158,7 +157,7 @@ inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }
*/ */
class QGradientPrivate; class QGradientPrivate;
typedef QPair<qreal, QColor> QGradientStop; typedef std::pair<qreal, QColor> QGradientStop;
typedef QList<QGradientStop> QGradientStops; typedef QList<QGradientStop> QGradientStops;
class Q_GUI_EXPORT QGradient class Q_GUI_EXPORT QGradient

View File

@ -323,14 +323,14 @@ private:
bool equalElements(const Element *e1, const Element *e2); bool equalElements(const Element *e1, const Element *e2);
bool splitLineAt(QDataBuffer<Element *> &elements, BVHNode *node, quint32 pointIndex, bool processAgain); bool splitLineAt(QDataBuffer<Element *> &elements, BVHNode *node, quint32 pointIndex, bool processAgain);
void appendSeparatingAxes(QVarLengthArray<QPoint, 12> &axes, Element *element); void appendSeparatingAxes(QVarLengthArray<QPoint, 12> &axes, Element *element);
QPair<int, int> calculateSeparatingAxisRange(const QPoint &axis, Element *element); std::pair<int, int> calculateSeparatingAxisRange(const QPoint &axis, Element *element);
void splitCurve(QDataBuffer<Element *> &elements, BVHNode *node); void splitCurve(QDataBuffer<Element *> &elements, BVHNode *node);
bool setElementToQuadratic(Element *element, quint32 pointIndex1, const QPoint &ctrl, quint32 pointIndex2); bool setElementToQuadratic(Element *element, quint32 pointIndex1, const QPoint &ctrl, quint32 pointIndex2);
bool setElementToCubic(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2); bool setElementToCubic(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2);
void setElementToCubicAndSimplify(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2); void setElementToCubicAndSimplify(Element *element, quint32 pointIndex1, const QPoint &ctrl1, const QPoint &ctrl2, quint32 pointIndex2);
RBNode *findElementLeftOf(const Element *element, const QPair<RBNode *, RBNode *> &bounds); RBNode *findElementLeftOf(const Element *element, const std::pair<RBNode *, RBNode *> &bounds);
bool elementIsLeftOf(const Element *left, const Element *right); bool elementIsLeftOf(const Element *left, const Element *right);
QPair<RBNode *, RBNode *> outerBounds(const QPoint &point); std::pair<RBNode *, RBNode *> outerBounds(const QPoint &point);
static bool flattenQuadratic(const QPoint &u, const QPoint &v, const QPoint &w); static bool flattenQuadratic(const QPoint &u, const QPoint &v, const QPoint &w);
static bool flattenCubic(const QPoint &u, const QPoint &v, const QPoint &w, const QPoint &q); static bool flattenCubic(const QPoint &u, const QPoint &v, const QPoint &w, const QPoint &q);
static bool splitQuadratic(const QPoint &u, const QPoint &v, const QPoint &w, QPoint *result); static bool splitQuadratic(const QPoint &u, const QPoint &v, const QPoint &w, QPoint *result);
@ -692,12 +692,12 @@ bool PathSimplifier::connectElements()
QPoint eventPoint = event->point; QPoint eventPoint = event->point;
// Find all elements passing through the event point. // Find all elements passing through the event point.
QPair<RBNode *, RBNode *> bounds = outerBounds(eventPoint); std::pair<RBNode *, RBNode *> bounds = outerBounds(eventPoint);
// Special case: single element above and single element below event point. // Special case: single element above and single element below event point.
int eventCount = events.size(); int eventCount = events.size();
if (event->type == Event::Lower && eventCount > 2) { if (event->type == Event::Lower && eventCount > 2) {
QPair<RBNode *, RBNode *> range; std::pair<RBNode *, RBNode *> range;
range.first = bounds.first ? m_elementList.next(bounds.first) range.first = bounds.first ? m_elementList.next(bounds.first)
: m_elementList.front(m_elementList.root); : m_elementList.front(m_elementList.root);
range.second = bounds.second ? m_elementList.previous(bounds.second) range.second = bounds.second ? m_elementList.previous(bounds.second)
@ -1038,8 +1038,8 @@ bool PathSimplifier::intersectNodes(QDataBuffer<Element *> &elements, BVHNode *e
appendSeparatingAxes(axes, elementNode->element); appendSeparatingAxes(axes, elementNode->element);
appendSeparatingAxes(axes, treeNode->element); appendSeparatingAxes(axes, treeNode->element);
for (int i = 0; i < axes.size(); ++i) { for (int i = 0; i < axes.size(); ++i) {
QPair<int, int> range1 = calculateSeparatingAxisRange(axes.at(i), elementNode->element); std::pair<int, int> range1 = calculateSeparatingAxisRange(axes.at(i), elementNode->element);
QPair<int, int> range2 = calculateSeparatingAxisRange(axes.at(i), treeNode->element); std::pair<int, int> range2 = calculateSeparatingAxisRange(axes.at(i), treeNode->element);
if (range1.first >= range2.second || range1.second <= range2.first) { if (range1.first >= range2.second || range1.second <= range2.first) {
return false; // Separating axis found. return false; // Separating axis found.
} }
@ -1195,9 +1195,9 @@ void PathSimplifier::appendSeparatingAxes(QVarLengthArray<QPoint, 12> &axes, Ele
} }
} }
QPair<int, int> PathSimplifier::calculateSeparatingAxisRange(const QPoint &axis, Element *element) std::pair<int, int> PathSimplifier::calculateSeparatingAxisRange(const QPoint &axis, Element *element)
{ {
QPair<int, int> range(0x7fffffff, -0x7fffffff); std::pair<int, int> range(0x7fffffff, -0x7fffffff);
for (int i = 0; i <= element->degree; ++i) { for (int i = 0; i <= element->degree; ++i) {
const QPoint &p = m_points->at(element->indices[i]); const QPoint &p = m_points->at(element->indices[i]);
int dist = dot(axis, p); int dist = dot(axis, p);
@ -1375,7 +1375,7 @@ void PathSimplifier::setElementToCubicAndSimplify(Element *element, quint32 poin
} }
PathSimplifier::RBNode *PathSimplifier::findElementLeftOf(const Element *element, PathSimplifier::RBNode *PathSimplifier::findElementLeftOf(const Element *element,
const QPair<RBNode *, RBNode *> &bounds) const std::pair<RBNode *, RBNode *> &bounds)
{ {
if (!m_elementList.root) if (!m_elementList.root)
return nullptr; return nullptr;
@ -1422,10 +1422,10 @@ bool PathSimplifier::elementIsLeftOf(const Element *left, const Element *right)
return d < 0; return d < 0;
} }
QPair<PathSimplifier::RBNode *, PathSimplifier::RBNode *> PathSimplifier::outerBounds(const QPoint &point) std::pair<PathSimplifier::RBNode *, PathSimplifier::RBNode *> PathSimplifier::outerBounds(const QPoint &point)
{ {
RBNode *current = m_elementList.root; RBNode *current = m_elementList.root;
QPair<RBNode *, RBNode *> result(nullptr, nullptr); std::pair<RBNode *, RBNode *> result(nullptr, nullptr);
while (current) { while (current) {
const Element *element = current->data; const Element *element = current->data;

View File

@ -3077,7 +3077,7 @@ int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
{ {
if (brushAlpha == 255 && penAlpha == 255) if (brushAlpha == 255 && penAlpha == 255)
return 0; return 0;
uint object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0); uint object = alphaCache.value(std::pair<uint, uint>(brushAlpha, penAlpha), 0);
if (!object) { if (!object) {
object = addXrefEntry(-1); object = addXrefEntry(-1);
QByteArray alphaDef; QByteArray alphaDef;
@ -3085,7 +3085,7 @@ int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha)
s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n'; s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n';
s << "/CA " << (penAlpha/qreal(255.)) << "\n>>"; s << "/CA " << (penAlpha/qreal(255.)) << "\n>>";
xprintf("%s\nendobj\n", alphaDef.constData()); xprintf("%s\nendobj\n", alphaDef.constData());
alphaCache.insert(QPair<uint, uint>(brushAlpha, penAlpha), object); alphaCache.insert(std::pair<uint, uint>(brushAlpha, penAlpha), object);
} }
if (currentPage->graphicStates.indexOf(object) < 0) if (currentPage->graphicStates.indexOf(object) < 0)
currentPage->graphicStates.append(object); currentPage->graphicStates.append(object);

View File

@ -358,7 +358,7 @@ private:
int patternColorSpaceCMYK; int patternColorSpaceCMYK;
QList<uint> pages; QList<uint> pages;
QHash<qint64, uint> imageCache; QHash<qint64, uint> imageCache;
QHash<QPair<uint, uint>, uint > alphaCache; QHash<std::pair<uint, uint>, uint > alphaCache;
QList<DestInfo> destCache; QList<DestInfo> destCache;
QList<AttachmentInfo> fileCache; QList<AttachmentInfo> fileCache;
QByteArray xmpDocumentMetadata; QByteArray xmpDocumentMetadata;

View File

@ -605,8 +605,8 @@ public:
bool edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const; bool edgeIsLeftOfEdge(int leftEdgeIndex, int rightEdgeIndex) const;
QRBTree<int>::Node *searchEdgeLeftOf(int edgeIndex) const; QRBTree<int>::Node *searchEdgeLeftOf(int edgeIndex) const;
QRBTree<int>::Node *searchEdgeLeftOf(int edgeIndex, QRBTree<int>::Node *after) const; QRBTree<int>::Node *searchEdgeLeftOf(int edgeIndex, QRBTree<int>::Node *after) const;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> bounds(const QPodPoint &point) const; std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> bounds(const QPodPoint &point) const;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> outerBounds(const QPodPoint &point) const; std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> outerBounds(const QPodPoint &point) const;
void splitEdgeListRange(QRBTree<int>::Node *leftmost, QRBTree<int>::Node *rightmost, int vertex, const QIntersectionPoint &intersectionPoint); void splitEdgeListRange(QRBTree<int>::Node *leftmost, QRBTree<int>::Node *rightmost, int vertex, const QIntersectionPoint &intersectionPoint);
void reorderEdgeListRange(QRBTree<int>::Node *leftmost, QRBTree<int>::Node *rightmost); void reorderEdgeListRange(QRBTree<int>::Node *leftmost, QRBTree<int>::Node *rightmost);
void sortEdgeList(const QPodPoint eventPoint); void sortEdgeList(const QPodPoint eventPoint);
@ -1025,10 +1025,10 @@ QRBTree<int>::Node *QTriangulator<T>::ComplexToSimple::searchEdgeLeftOf(int edge
} }
template <typename T> template <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::bounds(const QPodPoint &point) const std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::bounds(const QPodPoint &point) const
{ {
QRBTree<int>::Node *current = m_edgeList.root; QRBTree<int>::Node *current = m_edgeList.root;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr); std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr);
while (current) { while (current) {
const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower());
const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper());
@ -1074,10 +1074,10 @@ QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSim
} }
template <typename T> template <typename T>
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::outerBounds(const QPodPoint &point) const std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> QTriangulator<T>::ComplexToSimple::outerBounds(const QPodPoint &point) const
{ {
QRBTree<int>::Node *current = m_edgeList.root; QRBTree<int>::Node *current = m_edgeList.root;
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr); std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> result(nullptr, nullptr);
while (current) { while (current) {
const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower());
@ -1271,7 +1271,7 @@ void QTriangulator<T>::ComplexToSimple::calculateIntersections()
sortEdgeList(event.point); sortEdgeList(event.point);
// Find all edges in the edge list that contain the current vertex and mark them to be split later. // Find all edges in the edge list that contain the current vertex and mark them to be split later.
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> range = bounds(event.point); std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> range = bounds(event.point);
QRBTree<int>::Node *leftNode = range.first ? m_edgeList.previous(range.first) : nullptr; QRBTree<int>::Node *leftNode = range.first ? m_edgeList.previous(range.first) : nullptr;
int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower());
QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point);
@ -1424,7 +1424,7 @@ void QTriangulator<T>::ComplexToSimple::removeUnwantedEdgesAndConnect()
//} //}
orderedEdges.clear(); orderedEdges.clear();
QPair<QRBTree<int>::Node *, QRBTree<int>::Node *> b = outerBounds(event.point); std::pair<QRBTree<int>::Node *, QRBTree<int>::Node *> b = outerBounds(event.point);
if (m_edgeList.root) { if (m_edgeList.root) {
QRBTree<int>::Node *current = (b.first ? m_edgeList.next(b.first) : m_edgeList.front(m_edgeList.root)); QRBTree<int>::Node *current = (b.first ? m_edgeList.next(b.first) : m_edgeList.front(m_edgeList.root));
// Process edges that are going to be removed from the edge list at the current event point. // Process edges that are going to be removed from the edge list at the current event point.
@ -1978,7 +1978,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
return; return;
Q_ASSERT(!m_edgeList.root); Q_ASSERT(!m_edgeList.root);
QDataBuffer<QPair<int, int> > diagonals(m_upperVertex.size()); QDataBuffer<std::pair<int, int> > diagonals(m_upperVertex.size());
int i = 0; int i = 0;
for (int index = 1; index < m_edges.size(); ++index) { for (int index = 1; index < m_edges.size(); ++index) {
@ -2014,7 +2014,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
if (m_edges.at(i).node) { if (m_edges.at(i).node) {
Q_ASSERT(!m_edges.at(j).node); Q_ASSERT(!m_edges.at(j).node);
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex) if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(i).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(i).helper));
m_edges.at(j).node = m_edges.at(i).node; m_edges.at(j).node = m_edges.at(i).node;
m_edges.at(i).node = nullptr; m_edges.at(i).node = nullptr;
m_edges.at(j).node->data = j; m_edges.at(j).node->data = j;
@ -2022,7 +2022,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else if (m_edges.at(j).node) { } else if (m_edges.at(j).node) {
Q_ASSERT(!m_edges.at(i).node); Q_ASSERT(!m_edges.at(i).node);
if (m_edges.at(m_edges.at(j).helper).type == MergeVertex) if (m_edges.at(m_edges.at(j).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(j).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(j).helper));
m_edges.at(i).node = m_edges.at(j).node; m_edges.at(i).node = m_edges.at(j).node;
m_edges.at(j).node = nullptr; m_edges.at(j).node = nullptr;
m_edges.at(i).node->data = i; m_edges.at(i).node->data = i;
@ -2034,7 +2034,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from); leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from);
if (leftEdgeNode) { if (leftEdgeNode) {
if (m_edges.at(m_edges.at(leftEdgeNode->data).helper).type == MergeVertex) if (m_edges.at(m_edges.at(leftEdgeNode->data).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(leftEdgeNode->data).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(leftEdgeNode->data).helper));
m_edges.at(leftEdgeNode->data).helper = i; m_edges.at(leftEdgeNode->data).helper = i;
} else { } else {
qWarning("Inconsistent polygon. (#2)"); qWarning("Inconsistent polygon. (#2)");
@ -2044,7 +2044,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
case SplitVertex: case SplitVertex:
leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from); leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from);
if (leftEdgeNode) { if (leftEdgeNode) {
diagonals.add(QPair<int, int>(i, m_edges.at(leftEdgeNode->data).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(leftEdgeNode->data).helper));
m_edges.at(leftEdgeNode->data).helper = i; m_edges.at(leftEdgeNode->data).helper = i;
} else { } else {
qWarning("Inconsistent polygon. (#3)"); qWarning("Inconsistent polygon. (#3)");
@ -2073,7 +2073,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from); leftEdgeNode = searchEdgeLeftOfPoint(m_edges.at(i).from);
if (leftEdgeNode) { if (leftEdgeNode) {
if (m_edges.at(m_edges.at(leftEdgeNode->data).helper).type == MergeVertex) if (m_edges.at(m_edges.at(leftEdgeNode->data).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(leftEdgeNode->data).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(leftEdgeNode->data).helper));
m_edges.at(leftEdgeNode->data).helper = i; m_edges.at(leftEdgeNode->data).helper = i;
} else { } else {
qWarning("Inconsistent polygon. (#4)"); qWarning("Inconsistent polygon. (#4)");
@ -2082,7 +2082,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
case EndVertex: case EndVertex:
if (m_clockwiseOrder) { if (m_clockwiseOrder) {
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex) if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(i).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(i).helper));
if (m_edges.at(i).node) { if (m_edges.at(i).node) {
m_edgeList.deleteNode(m_edges.at(i).node); m_edgeList.deleteNode(m_edges.at(i).node);
Q_ASSERT(m_edgeList.validate()); Q_ASSERT(m_edgeList.validate());
@ -2091,7 +2091,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} }
} else { } else {
if (m_edges.at(m_edges.at(j).helper).type == MergeVertex) if (m_edges.at(m_edges.at(j).helper).type == MergeVertex)
diagonals.add(QPair<int, int>(i, m_edges.at(j).helper)); diagonals.add(std::pair<int, int>(i, m_edges.at(j).helper));
if (m_edges.at(j).node) { if (m_edges.at(j).node) {
m_edgeList.deleteNode(m_edges.at(j).node); m_edgeList.deleteNode(m_edges.at(j).node);
Q_ASSERT(m_edgeList.validate()); Q_ASSERT(m_edgeList.validate());

View File

@ -8267,14 +8267,14 @@ QRhiComputePipeline::QRhiComputePipeline(QRhiImplementation *rhi)
/*! /*!
\typedef QRhiCommandBuffer::DynamicOffset \typedef QRhiCommandBuffer::DynamicOffset
Synonym for QPair<int, quint32>. The first entry is the binding, the second Synonym for std::pair<int, quint32>. The first entry is the binding, the second
is the offset in the buffer. is the offset in the buffer.
*/ */
/*! /*!
\typedef QRhiCommandBuffer::VertexInput \typedef QRhiCommandBuffer::VertexInput
Synonym for QPair<QRhiBuffer *, quint32>. The second entry is an offset in Synonym for std::pair<QRhiBuffer *, quint32>. The second entry is an offset in
the buffer specified by the first. the buffer specified by the first.
*/ */

View File

@ -1708,11 +1708,11 @@ public:
void endPass(QRhiResourceUpdateBatch *resourceUpdates = nullptr); void endPass(QRhiResourceUpdateBatch *resourceUpdates = nullptr);
void setGraphicsPipeline(QRhiGraphicsPipeline *ps); void setGraphicsPipeline(QRhiGraphicsPipeline *ps);
using DynamicOffset = QPair<int, quint32>; // binding, offset using DynamicOffset = std::pair<int, quint32>; // binding, offset
void setShaderResources(QRhiShaderResourceBindings *srb = nullptr, void setShaderResources(QRhiShaderResourceBindings *srb = nullptr,
int dynamicOffsetCount = 0, int dynamicOffsetCount = 0,
const DynamicOffset *dynamicOffsets = nullptr); const DynamicOffset *dynamicOffsets = nullptr);
using VertexInput = QPair<QRhiBuffer *, quint32>; // buffer, offset using VertexInput = std::pair<QRhiBuffer *, quint32>; // buffer, offset
void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings, void setVertexInput(int startBinding, int bindingCount, const VertexInput *bindings,
QRhiBuffer *indexBuf = nullptr, quint32 indexOffset = 0, QRhiBuffer *indexBuf = nullptr, quint32 indexOffset = 0,
IndexFormat indexFormat = IndexUInt16); IndexFormat indexFormat = IndexUInt16);

View File

@ -2283,9 +2283,9 @@ void QRhiD3D11::dispatch(QRhiCommandBuffer *cb, int x, int y, int z)
cmd.args.dispatch.z = UINT(z); cmd.args.dispatch.z = UINT(z);
} }
static inline QPair<int, int> mapBinding(int binding, static inline std::pair<int, int> mapBinding(int binding,
int stageIndex, int stageIndex,
const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[]) const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[])
{ {
const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex]; const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex];
if (!map || map->isEmpty()) if (!map || map->isEmpty())
@ -2392,32 +2392,32 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
// (ByteWidth) is always a multiple of 256. // (ByteWidth) is always a multiple of 256.
const quint32 sizeInConstants = aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256u) / 16; const quint32 sizeInConstants = aligned(b->u.ubuf.maybeSize ? b->u.ubuf.maybeSize : bufD->m_size, 256u) / 16;
if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_VERTEX].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_VERTEX].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationControlStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_HULL].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_HULL].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::TessellationEvaluationStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_DOMAIN].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_DOMAIN].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
if (b->stage.testFlag(QRhiShaderResourceBinding::GeometryStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::GeometryStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_GEOMETRY].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_GEOMETRY].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_FRAGMENT].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_FRAGMENT].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) if (nativeBinding.first >= 0)
res[RBM_COMPUTE].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants }); res[RBM_COMPUTE].buffers.append({ b->binding, nativeBinding.first, bufD->buffer, offsetInConstants, sizeInConstants });
} }
@ -2429,12 +2429,12 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
{ {
const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex; const QRhiShaderResourceBinding::Data::TextureAndOrSamplerData *data = &b->u.stex;
bd.stex.count = data->count; bd.stex.count = data->count;
const QPair<int, int> nativeBindingVert = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingVert = mapBinding(b->binding, RBM_VERTEX, nativeResourceBindingMaps);
const QPair<int, int> nativeBindingHull = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingHull = mapBinding(b->binding, RBM_HULL, nativeResourceBindingMaps);
const QPair<int, int> nativeBindingDomain = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingDomain = mapBinding(b->binding, RBM_DOMAIN, nativeResourceBindingMaps);
const QPair<int, int> nativeBindingGeom = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingGeom = mapBinding(b->binding, RBM_GEOMETRY, nativeResourceBindingMaps);
const QPair<int, int> nativeBindingFrag = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingFrag = mapBinding(b->binding, RBM_FRAGMENT, nativeResourceBindingMaps);
const QPair<int, int> nativeBindingComp = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps); const std::pair<int, int> nativeBindingComp = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
// if SPIR-V binding b is mapped to tN and sN in HLSL, and it // if SPIR-V binding b is mapped to tN and sN in HLSL, and it
// is an array, then it will use tN, tN+1, tN+2, ..., and sN, // is an array, then it will use tN, tN+1, tN+2, ..., and sN,
// sN+1, sN+2, ... // sN+1, sN+2, ...
@ -2508,7 +2508,7 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
bd.simage.id = texD->m_id; bd.simage.id = texD->m_id;
bd.simage.generation = texD->generation; bd.simage.generation = texD->generation;
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) { if (nativeBinding.first >= 0) {
ID3D11UnorderedAccessView *uav = texD->unorderedAccessViewForLevel(b->u.simage.level); ID3D11UnorderedAccessView *uav = texD->unorderedAccessViewForLevel(b->u.simage.level);
if (uav) if (uav)
@ -2527,7 +2527,7 @@ void QRhiD3D11::updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
bd.sbuf.id = bufD->m_id; bd.sbuf.id = bufD->m_id;
bd.sbuf.generation = bufD->generation; bd.sbuf.generation = bufD->generation;
if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) {
QPair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps); std::pair<int, int> nativeBinding = mapBinding(b->binding, RBM_COMPUTE, nativeResourceBindingMaps);
if (nativeBinding.first >= 0) { if (nativeBinding.first >= 0) {
ID3D11UnorderedAccessView *uav = bufD->unorderedAccessView(b->u.sbuf.offset); ID3D11UnorderedAccessView *uav = bufD->unorderedAccessView(b->u.sbuf.offset);
if (uav) if (uav)

View File

@ -2737,7 +2737,7 @@ void QD3D12ShaderVisibleDescriptorHeap::destroyWithDeferredRelease(QD3D12Release
heap.destroyWithDeferredRelease(releaseQueue); heap.destroyWithDeferredRelease(releaseQueue);
} }
static inline QPair<int, int> mapBinding(int binding, const QShader::NativeResourceBindingMap &map) static inline std::pair<int, int> mapBinding(int binding, const QShader::NativeResourceBindingMap &map)
{ {
if (map.isEmpty()) if (map.isEmpty())
return { binding, binding }; // assume 1:1 mapping return { binding, binding }; // assume 1:1 mapping

View File

@ -417,7 +417,7 @@ struct QD3D12ReleaseQueue
int viewCount = 0; int viewCount = 0;
std::function<void(void*)> callback = nullptr; std::function<void(void*)> callback = nullptr;
void *callbackUserData = nullptr; void *callbackUserData = nullptr;
QPair<ID3D12Resource *, D3D12MA::Allocation *> resourceAndAllocation = {}; std::pair<ID3D12Resource *, D3D12MA::Allocation *> resourceAndAllocation = {};
ID3D12DescriptorHeap *descriptorHeap = nullptr; ID3D12DescriptorHeap *descriptorHeap = nullptr;
}; };
QVector<DeferredReleaseEntry> queue; QVector<DeferredReleaseEntry> queue;
@ -995,10 +995,10 @@ struct QD3D12CommandBuffer : public QRhiCommandBuffer
// per-setShaderResources // per-setShaderResources
struct VisitorData { struct VisitorData {
QVarLengthArray<QPair<QD3D12ObjectHandle, quint32>, 4> cbufs[6]; QVarLengthArray<std::pair<QD3D12ObjectHandle, quint32>, 4> cbufs[6];
QVarLengthArray<QD3D12Descriptor, 8> srvs[6]; QVarLengthArray<QD3D12Descriptor, 8> srvs[6];
QVarLengthArray<QD3D12Descriptor, 8> samplers[6]; QVarLengthArray<QD3D12Descriptor, 8> samplers[6];
QVarLengthArray<QPair<QD3D12ObjectHandle, D3D12_UNORDERED_ACCESS_VIEW_DESC>, 4> uavs[6]; QVarLengthArray<std::pair<QD3D12ObjectHandle, D3D12_UNORDERED_ACCESS_VIEW_DESC>, 4> uavs[6];
} visitorData; } visitorData;
void visitUniformBuffer(QD3D12Stage s, void visitUniformBuffer(QD3D12Stage s,

View File

@ -615,7 +615,7 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer
Read = 0x01, Read = 0x01,
Write = 0x02 Write = 0x02
}; };
QHash<QRhiResource *, QPair<int, bool> > writtenResources; QHash<QRhiResource *, std::pair<int, bool> > writtenResources;
void reset() { void reset() {
writtenResources.clear(); writtenResources.clear();
} }

View File

@ -295,7 +295,7 @@ struct QMetalCommandBuffer : public QRhiCommandBuffer
int currentCullMode; int currentCullMode;
int currentTriangleFillMode; int currentTriangleFillMode;
int currentFrontFaceWinding; int currentFrontFaceWinding;
QPair<float, float> currentDepthBiasValues; std::pair<float, float> currentDepthBiasValues;
const QRhiNativeHandles *nativeHandles(); const QRhiNativeHandles *nativeHandles();
void resetState(double lastGpuTime = 0); void resetState(double lastGpuTime = 0);

View File

@ -3513,7 +3513,7 @@ void QRhiVulkan::updateShaderResourceBindings(QRhiShaderResourceBindings *srb, i
using ArrayOfImageDesc = QVarLengthArray<VkDescriptorImageInfo, 8>; using ArrayOfImageDesc = QVarLengthArray<VkDescriptorImageInfo, 8>;
QVarLengthArray<ArrayOfImageDesc, 8> imageInfos; QVarLengthArray<ArrayOfImageDesc, 8> imageInfos;
QVarLengthArray<VkWriteDescriptorSet, 12> writeInfos; QVarLengthArray<VkWriteDescriptorSet, 12> writeInfos;
QVarLengthArray<QPair<int, int>, 12> infoIndices; QVarLengthArray<std::pair<int, int>, 12> infoIndices;
const bool updateAll = descSetIdx < 0; const bool updateAll = descSetIdx < 0;
int frameSlot = updateAll ? 0 : descSetIdx; int frameSlot = updateAll ? 0 : descSetIdx;

View File

@ -393,7 +393,7 @@ struct QVkCommandBuffer : public QRhiCommandBuffer
bool hasShadingRateSet; bool hasShadingRateSet;
struct { struct {
QHash<QRhiResource *, QPair<VkAccessFlags, bool> > writtenResources; QHash<QRhiResource *, std::pair<VkAccessFlags, bool> > writtenResources;
void reset() { void reset() {
writtenResources.clear(); writtenResources.clear();
} }

View File

@ -979,7 +979,7 @@ QDebug operator<<(QDebug dbg, const QShaderVersion &v)
/*! /*!
\typedef QShader::NativeResourceBindingMap \typedef QShader::NativeResourceBindingMap
Synonym for QMap<int, QPair<int, int>>. Synonym for QMap<int, std::pair<int, int>>.
The resource binding model QRhi assumes is based on SPIR-V. This means that The resource binding model QRhi assumes is based on SPIR-V. This means that
uniform buffers, storage buffers, combined image samplers, and storage uniform buffers, storage buffers, combined image samplers, and storage

View File

@ -140,7 +140,7 @@ public:
QByteArray serialized(SerializedFormatVersion version = SerializedFormatVersion::Latest) const; QByteArray serialized(SerializedFormatVersion version = SerializedFormatVersion::Latest) const;
static QShader fromSerialized(const QByteArray &data); static QShader fromSerialized(const QByteArray &data);
using NativeResourceBindingMap = QMap<int, QPair<int, int> >; // binding -> native_binding[, native_binding] using NativeResourceBindingMap = QMap<int, std::pair<int, int>>; // binding -> native_binding[, native_binding]
NativeResourceBindingMap nativeResourceBindingMap(const QShaderKey &key) const; NativeResourceBindingMap nativeResourceBindingMap(const QShaderKey &key) const;
void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map); void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map);
void removeResourceBindingMap(const QShaderKey &key); void removeResourceBindingMap(const QShaderKey &key);

View File

@ -1039,7 +1039,7 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from,
if (length < 0) if (length < 0)
length = text().size(); length = text().size();
QHash<QPair<QFontEngine *, int>, QGlyphRun> glyphRunHash; QHash<std::pair<QFontEngine *, int>, QGlyphRun> glyphRunHash;
for (int i=0; i<d->lines.size(); ++i) { for (int i=0; i<d->lines.size(); ++i) {
if (d->lines.at(i).from > from + length) if (d->lines.at(i).from > from + length)
break; break;
@ -1050,7 +1050,7 @@ QList<QGlyphRun> QTextLayout::glyphRuns(int from,
QFontEngine *fontEngine = rawFont.d->fontEngine; QFontEngine *fontEngine = rawFont.d->fontEngine;
QGlyphRun::GlyphRunFlags flags = glyphRun.flags(); QGlyphRun::GlyphRunFlags flags = glyphRun.flags();
QPair<QFontEngine *, int> key(fontEngine, int(flags)); std::pair<QFontEngine *, int> key(fontEngine, int(flags));
// merge the glyph runs using the same font // merge the glyph runs using the same font
QGlyphRun &oldGlyphRun = glyphRunHash[key]; QGlyphRun &oldGlyphRun = glyphRunHash[key];
if (oldGlyphRun.isEmpty()) { if (oldGlyphRun.isEmpty()) {

View File

@ -1413,7 +1413,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData,
rowStretch = qMax(rowStretch, itemStretch); rowStretch = qMax(rowStretch, itemStretch);
} else { } else {
QGridLayoutMultiCellData &multiCell = QGridLayoutMultiCellData &multiCell =
rowData->multiCellMap[qMakePair(row, itemRowSpan)]; rowData->multiCellMap[std::pair(row, itemRowSpan)];
box = &multiCell.q_box; box = &multiCell.q_box;
multiCell.q_stretch = itemStretch; multiCell.q_stretch = itemStretch;
} }

View File

@ -21,7 +21,6 @@
#include <QtCore/qbitarray.h> #include <QtCore/qbitarray.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qmap.h> #include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qsize.h> #include <QtCore/qsize.h>
#include <QtCore/qrect.h> #include <QtCore/qrect.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
@ -194,7 +193,7 @@ public:
int q_stretch; int q_stretch;
}; };
typedef QMap<QPair<int, int>, QGridLayoutMultiCellData> MultiCellMap; typedef QMap<std::pair<int, int>, QGridLayoutMultiCellData> MultiCellMap;
class QGridLayoutRowInfo; class QGridLayoutRowInfo;