Replace QPair/qMakePair with std::pair in qtbase/plugins
As a drive-by replace calls to QList::append with emplace_back, to avoid repeating value_type. Task-number: QTBUG-115841 Change-Id: I027d82706f3545dd63c6b8ba89ba66ae938e07f9 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 6ed725b3b93d15a45501fecb6f1fa711ef65e17e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
459f1978ae
commit
cf64c1b042
@ -175,7 +175,7 @@ void QIBusAttributeList::deserializeFrom(const QDBusArgument &arg)
|
||||
|
||||
QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
|
||||
{
|
||||
QHash<QPair<int, int>, QTextCharFormat> rangeAttrs;
|
||||
QHash<std::pair<int, int>, QTextCharFormat> rangeAttrs;
|
||||
const int numAttributes = attributes.size();
|
||||
|
||||
// Merge text formats for identical ranges into a single QTextFormat.
|
||||
@ -184,7 +184,7 @@ QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
|
||||
const QTextCharFormat &format = attr.format();
|
||||
|
||||
if (format.isValid()) {
|
||||
const QPair<int, int> range(attr.start, attr.end);
|
||||
const std::pair<int, int> range(attr.start, attr.end);
|
||||
rangeAttrs[range].merge(format);
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
|
||||
imAttrs += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
|
||||
attr.start,
|
||||
attr.end - attr.start,
|
||||
format.isValid() ? rangeAttrs[QPair<int, int>(attr.start, attr.end)] : format);
|
||||
format.isValid() ? rangeAttrs[std::pair<int, int>(attr.start, attr.end)] : format);
|
||||
}
|
||||
|
||||
return imAttrs;
|
||||
|
@ -362,7 +362,7 @@ void QWindowsUiaMainProvider::fillVariantArrayForRelation(QAccessibleInterface*
|
||||
{
|
||||
Q_ASSERT(accessible);
|
||||
|
||||
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
||||
typedef std::pair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
||||
const QList<RelationPair> relationInterfaces = accessible->relations(relation);
|
||||
if (relationInterfaces.empty())
|
||||
return;
|
||||
|
@ -156,7 +156,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
|
||||
format.setOption(QSurfaceFormat::ResetNotification);
|
||||
}
|
||||
|
||||
if (format.version() < qMakePair(3, 0)) {
|
||||
if (format.version() < std::pair(3, 0)) {
|
||||
format.setOption(QSurfaceFormat::DeprecatedFunctions);
|
||||
return;
|
||||
}
|
||||
@ -169,7 +169,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
|
||||
format.setOption(QSurfaceFormat::DeprecatedFunctions);
|
||||
if (value & GL_CONTEXT_FLAG_DEBUG_BIT)
|
||||
format.setOption(QSurfaceFormat::DebugContext);
|
||||
if (format.version() < qMakePair(3, 2))
|
||||
if (format.version() < std::pair(3, 2))
|
||||
return;
|
||||
|
||||
// Version 3.2 and newer have a profile
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "qxcbatom.h"
|
||||
#include "qxcbexport.h"
|
||||
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
@ -52,7 +51,7 @@ public:
|
||||
bool hasXKB() const { return m_hasXkb; }
|
||||
bool hasXRender(int major = -1, int minor = -1) const {
|
||||
if (m_hasXRender && major != -1 && minor != -1)
|
||||
return m_xrenderVersion >= qMakePair(major, minor);
|
||||
return m_xrenderVersion >= std::pair(major, minor);
|
||||
|
||||
return m_hasXRender;
|
||||
}
|
||||
@ -105,7 +104,7 @@ private:
|
||||
bool m_hasShmFd = false;
|
||||
bool m_hasXSync = false;
|
||||
|
||||
QPair<int, int> m_xrenderVersion;
|
||||
std::pair<int, int> m_xrenderVersion;
|
||||
|
||||
bool m_xi2Enabled = false;
|
||||
int m_xi2Minor = -1;
|
||||
|
@ -185,42 +185,42 @@ void QCupsPrintEnginePrivate::closePrintDevice()
|
||||
}
|
||||
|
||||
// Set up print options.
|
||||
QList<QPair<QByteArray, QByteArray> > options;
|
||||
QList<std::pair<QByteArray, QByteArray> > options;
|
||||
QList<cups_option_t> cupsOptStruct;
|
||||
|
||||
options.append(QPair<QByteArray, QByteArray>("media", m_pageLayout.pageSize().key().toLocal8Bit()));
|
||||
options.emplace_back("media", m_pageLayout.pageSize().key().toLocal8Bit());
|
||||
|
||||
if (copies > 1)
|
||||
options.append(QPair<QByteArray, QByteArray>("copies", QString::number(copies).toLocal8Bit()));
|
||||
options.emplace_back("copies", QString::number(copies).toLocal8Bit());
|
||||
|
||||
if (copies > 1 && collate)
|
||||
options.append(QPair<QByteArray, QByteArray>("Collate", "True"));
|
||||
options.emplace_back("Collate", "True");
|
||||
|
||||
switch (duplex) {
|
||||
case QPrint::DuplexNone:
|
||||
options.append(QPair<QByteArray, QByteArray>("sides", "one-sided"));
|
||||
options.emplace_back("sides", "one-sided");
|
||||
break;
|
||||
case QPrint::DuplexAuto:
|
||||
if (m_pageLayout.orientation() == QPageLayout::Portrait)
|
||||
options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-long-edge"));
|
||||
options.emplace_back("sides", "two-sided-long-edge");
|
||||
else
|
||||
options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-short-edge"));
|
||||
options.emplace_back("sides", "two-sided-short-edge");
|
||||
break;
|
||||
case QPrint::DuplexLongSide:
|
||||
options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-long-edge"));
|
||||
options.emplace_back("sides", "two-sided-long-edge");
|
||||
break;
|
||||
case QPrint::DuplexShortSide:
|
||||
options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-short-edge"));
|
||||
options.emplace_back("sides", "two-sided-short-edge");
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_pageLayout.orientation() == QPageLayout::Landscape)
|
||||
options.append(QPair<QByteArray, QByteArray>("landscape", ""));
|
||||
options.emplace_back("landscape", "");
|
||||
|
||||
QStringList::const_iterator it = cupsOptions.constBegin();
|
||||
Q_ASSERT(cupsOptions.size() % 2 == 0);
|
||||
while (it != cupsOptions.constEnd()) {
|
||||
options.append(QPair<QByteArray, QByteArray>((*it).toLocal8Bit(), (*(it+1)).toLocal8Bit()));
|
||||
options.emplace_back((*it).toLocal8Bit(), (*(it+1)).toLocal8Bit());
|
||||
it += 2;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
virtual void setPaddingLeftToSizeWidth();
|
||||
QSize sizeImage(const QStyleOption *opt) const;
|
||||
private:
|
||||
typedef QPair<int, const AndroidDrawable *> StateType;
|
||||
typedef std::pair<int, const AndroidDrawable *> StateType;
|
||||
QList<StateType> m_states;
|
||||
};
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
AndroidDrawable *layer(int id) const;
|
||||
QSize size() const;
|
||||
private:
|
||||
typedef QPair<int, AndroidDrawable *> LayerType;
|
||||
typedef std::pair<int, AndroidDrawable *> LayerType;
|
||||
QList<LayerType> m_layers;
|
||||
int m_id;
|
||||
double m_factor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user