Replace QVariant::typeToName usage by QMetaType::typeName call.
Type information is kept in QMetaType class. QVariant is delegating operations, so it is better to use QMetaType directly. Change-Id: I91209fa1c9dc4303d6bd47c96824d3cd64ce5291 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
cebcfcc66b
commit
db06953ca1
@ -185,8 +185,8 @@ void Browser::showMetaData(const QString &t)
|
||||
QSqlField fld = rec.field(i);
|
||||
model->setData(model->index(i, 0), fld.name());
|
||||
model->setData(model->index(i, 1), fld.typeID() == -1
|
||||
? QString(QVariant::typeToName(fld.type()))
|
||||
: QString("%1 (%2)").arg(QVariant::typeToName(fld.type())).arg(fld.typeID()));
|
||||
? QString(QMetaType::typeName(fld.type()))
|
||||
: QString("%1 (%2)").arg(QMetaType::typeName(fld.type())).arg(fld.typeID()));
|
||||
model->setData(model->index(i, 2), fld.length());
|
||||
model->setData(model->index(i, 3), fld.precision());
|
||||
model->setData(model->index(i, 4), fld.requiredStatus() == -1 ? QVariant("?")
|
||||
|
@ -1563,7 +1563,7 @@ void QVariant::detach()
|
||||
*/
|
||||
const char *QVariant::typeName() const
|
||||
{
|
||||
return typeToName(d.type);
|
||||
return QMetaType::typeName(d.type);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -238,9 +238,9 @@ inline QDBusMarshaller *QDBusMarshaller::beginArray(int id)
|
||||
if (!signature) {
|
||||
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
|
||||
"Use qDBusRegisterMetaType to register it",
|
||||
QVariant::typeToName( QVariant::Type(id) ), id);
|
||||
QMetaType::typeName(id), id);
|
||||
error(QString::fromLatin1("Unregistered type %1 passed in arguments")
|
||||
.arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
|
||||
.arg(QLatin1String(QMetaType::typeName(id))));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -253,22 +253,22 @@ inline QDBusMarshaller *QDBusMarshaller::beginMap(int kid, int vid)
|
||||
if (!ksignature) {
|
||||
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
|
||||
"Use qDBusRegisterMetaType to register it",
|
||||
QVariant::typeToName( QVariant::Type(kid) ), kid);
|
||||
QMetaType::typeName(kid), kid);
|
||||
error(QString::fromLatin1("Unregistered type %1 passed in arguments")
|
||||
.arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
|
||||
.arg(QLatin1String(QMetaType::typeName(kid))));
|
||||
return this;
|
||||
}
|
||||
if (ksignature[1] != 0 || !QDBusUtil::isValidBasicType(*ksignature)) {
|
||||
qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.",
|
||||
QVariant::typeToName( QVariant::Type(kid) ), kid);
|
||||
QMetaType::typeName(kid), kid);
|
||||
error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map")
|
||||
.arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
|
||||
.arg(QLatin1String(QMetaType::typeName(kid))));
|
||||
return this;
|
||||
}
|
||||
|
||||
const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) );
|
||||
if (!vsignature) {
|
||||
const char *typeName = QVariant::typeToName(QVariant::Type(vid));
|
||||
const char *typeName = QMetaType::typeName(vid);
|
||||
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
|
||||
"Use qDBusRegisterMetaType to register it",
|
||||
typeName, vid);
|
||||
@ -397,9 +397,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
if (!signature) {
|
||||
qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
|
||||
"Use qDBusRegisterMetaType to register it",
|
||||
QVariant::typeToName( QVariant::Type(id) ), id);
|
||||
QMetaType::typeName(id), id);
|
||||
error(QString::fromLatin1("Unregistered type %1 passed in arguments")
|
||||
.arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
|
||||
.arg(QLatin1String(QMetaType::typeName(id))));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
type = -1;
|
||||
}
|
||||
} else {
|
||||
result.name = QVariant::typeToName( QVariant::Type(type) );
|
||||
result.name = QMetaType::typeName(type);
|
||||
}
|
||||
|
||||
result.id = type;
|
||||
|
@ -215,7 +215,7 @@ void qDBusReplyFill(const QDBusMessage &reply, QDBusError &error, QVariant &data
|
||||
} else {
|
||||
// not an argument and doesn't match?
|
||||
int type = reply.arguments().at(0).userType();
|
||||
receivedType = QVariant::typeToName(QVariant::Type(type));
|
||||
receivedType = QMetaType::typeName(type);
|
||||
receivedSignature = QDBusMetaType::typeToSignature(type);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
.arg(QLatin1String(accessvalues[access]));
|
||||
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
const char *typeName = QVariant::typeToName(QVariant::Type(typeId));
|
||||
const char *typeName = QMetaType::typeName(typeId);
|
||||
retval += QString::fromLatin1(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
|
||||
.arg(typeNameToXml(typeName));
|
||||
} else {
|
||||
@ -158,7 +158,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
|
||||
.arg(typeNameToXml(QVariant::typeToName(QVariant::Type(typeId))));
|
||||
.arg(typeNameToXml(QMetaType::typeName(typeId)));
|
||||
} else
|
||||
continue;
|
||||
}
|
||||
@ -200,7 +200,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
const char *typeName = QVariant::typeToName( QVariant::Type(types.at(j)) );
|
||||
const char *typeName = QMetaType::typeName(types.at(j));
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n")
|
||||
.arg(isOutput ? QLatin1String("Out") : QLatin1String("In"))
|
||||
.arg(isOutput && !isSignal ? j - inputCount : j - 1)
|
||||
|
@ -517,7 +517,7 @@ bool QSqlField::isValid() const
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, const QSqlField &f)
|
||||
{
|
||||
dbg.nospace() << "QSqlField(" << f.name() << ", " << QVariant::typeToName(f.type());
|
||||
dbg.nospace() << "QSqlField(" << f.name() << ", " << QMetaType::typeName(f.type());
|
||||
if (f.length() >= 0)
|
||||
dbg.nospace() << ", length: " << f.length();
|
||||
if (f.precision() >= 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user