summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Caliste <dcaliste@free.fr>2020-09-14 11:29:54 +0200
committerChris Adams <chris.adams@qinetic.com.au>2021-04-08 10:38:41 +1000
commitf53c2885bff3408bf6aa8d89a9cb913980f51e9b (patch)
treee72817c26c8f806cc8ddf2f3c35613adc50f47b2
parent50d52fd569e522b644ac1112eede34f48011d55d (diff)
Adjust to Qt6 QMetaType API changes
Change-Id: I154b232699932a5c721cb7cff4476f20ac196cad Reviewed-by: Christopher Adams <chris.adams@jolla.com> Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
-rw-r--r--src/libraries/qmfclient/qmailstore_p.cpp4
-rw-r--r--src/libraries/qmfclient/support/qcopadaptor.cpp14
-rw-r--r--src/libraries/qmfclient/support/qmailipc.h8
3 files changed, 9 insertions, 17 deletions
diff --git a/src/libraries/qmfclient/qmailstore_p.cpp b/src/libraries/qmfclient/qmailstore_p.cpp
index 9344f19b..4495b8ad 100644
--- a/src/libraries/qmfclient/qmailstore_p.cpp
+++ b/src/libraries/qmfclient/qmailstore_p.cpp
@@ -2859,7 +2859,7 @@ static QString queryText(const QString &query, const QList<QVariant> &values)
int index = result.indexOf(marker);
while ((index != -1) && (it != end)) {
QString substitute((*it).toString());
- if ((*it).type() == QVariant::String)
+ if ((*it).metaType() == QMetaType::fromType<QString>())
substitute.prepend(quote).append(quote);
result.replace(index, 1, substitute);
@@ -2874,7 +2874,7 @@ static QString queryText(const QString &query, const QList<QVariant> &values)
static QString queryText(const QSqlQuery &query)
{
// Note: we currently only handle positional parameters
- return queryText(query.lastQuery().simplified(), query.boundValues().values());
+ return queryText(query.lastQuery().simplified(), query.boundValues());
}
QSqlQuery QMailStorePrivate::prepare(const QString& sql)
diff --git a/src/libraries/qmfclient/support/qcopadaptor.cpp b/src/libraries/qmfclient/support/qcopadaptor.cpp
index a8f84c75..90d07eac 100644
--- a/src/libraries/qmfclient/support/qcopadaptor.cpp
+++ b/src/libraries/qmfclient/support/qcopadaptor.cpp
@@ -193,17 +193,13 @@ QCopAdaptorPrivate::~QCopAdaptorPrivate()
// Get the QVariant type number for a type name.
int QCopAdaptorPrivate::typeFromName( const QByteArray& type )
{
- int id;
if (type.endsWith('*'))
return QMetaType::VoidStar;
else if ( type.size() == 0 || type == "void" )
return QMetaType::Void;
else if ( type == "QVariant" )
return QCopAdaptorPrivate::QVariantId;
- id = QMetaType::type( type.constData() );
- if ( id != (int)QMetaType::Void )
- return id;
- return QVariant::nameToType(type);
+ return QMetaType::fromName(type).id();
}
// Returns the connection types associated with a signal or slot member.
@@ -260,7 +256,7 @@ int QCopAdaptorPrivate::qt_metacall(QMetaObject::Call c, int id, void **a)
QList<QVariant> args;
for (int i = 0; i < info->numArgs; ++i) {
if (info->types[i] != QCopAdaptorPrivate::QVariantId) {
- QVariant arg(info->types[i], a[i + 1]);
+ QVariant arg(QMetaType(info->types[i]), a[i + 1]);
args.append(arg);
} else {
args.append(*((const QVariant *)(a[i + 1])));
@@ -295,12 +291,12 @@ public:
clear();
create(typeOrMetaType, 0);
d.is_null = false;
- QMetaType::load(stream, d.type, const_cast<void *>(constData()));
+ d.type().load(stream, const_cast<void *>(constData()));
}
void save(QDataStream& stream) const
{
- QMetaType::save(stream, d.type, constData());
+ d.type().save(stream, constData());
}
};
@@ -610,7 +606,7 @@ void QCopAdaptor::received(const QString& msg, const QByteArray& data)
QVariant returnValue;
QVarLengthArray<void *, 32> a(info->numArgs + 1);
if (info->returnType != (int)QVariant::Invalid && info->returnType != (int)QMetaType::Void) {
- returnValue = QVariant(info->returnType, (const void *)0);
+ returnValue = QVariant(QMetaType(info->returnType), (const void *)0);
a[0] = returnValue.data();
} else {
a[0] = 0;
diff --git a/src/libraries/qmfclient/support/qmailipc.h b/src/libraries/qmfclient/support/qmailipc.h
index 00a8f963..0f9f2dd5 100644
--- a/src/libraries/qmfclient/support/qmailipc.h
+++ b/src/libraries/qmfclient/support/qmailipc.h
@@ -57,12 +57,9 @@ struct QMetaTypeRegister
template<> \
struct QMetaTypeRegister< TYPE > \
{ \
- static int registerType() \
- { \
+ static int registerType() { \
_QATOMIC_ONCE(); \
- int id = qMetaTypeId<TYPE>(); \
- if ( id >= static_cast<int>(QMetaType::User) ) \
- qRegisterMetaTypeStreamOperators< TYPE >( #TYPE ); \
+ qRegisterMetaType<TYPE>( #TYPE ); \
return 1; \
} \
static int __init_variable__; \
@@ -83,7 +80,6 @@ struct QMetaTypeRegister
static int registerType() { \
_QATOMIC_ONCE(); \
qRegisterMetaType< TYPE >( #TYPE ); \
- qRegisterMetaTypeStreamOperators< TYPE >( #TYPE ); \
return 1; \
} \
static int __init_variable__; \