aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/labsmodels
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2019-12-03 20:24:38 +0100
committerOlivier Goffart <ogoffart@woboq.com>2020-01-17 11:31:35 +0100
commitc6899f16389458766904d8d913054f09076e06dd (patch)
treee24f942a01720775391ae04557e24a35839f7361 /src/imports/labsmodels
parent9e674be4fb8c369873a009f58e3152a12d2c4cce (diff)
Replace QVariant::type with QVariant::userType
as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/imports/labsmodels')
-rw-r--r--src/imports/labsmodels/qqmltablemodel.cpp16
-rw-r--r--src/imports/labsmodels/qqmltablemodel_p.h4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/imports/labsmodels/qqmltablemodel.cpp
index f190ad86b1..b6468d760f 100644
--- a/src/imports/labsmodels/qqmltablemodel.cpp
+++ b/src/imports/labsmodels/qqmltablemodel.cpp
@@ -271,7 +271,7 @@ QQmlTableModel::ColumnRoleMetadata QQmlTableModel::fetchColumnRoleData(const QSt
if (columnRoleGetter.isString()) {
// The role is set as a string, so we assume the row is a simple object.
- if (firstRow.type() != QVariant::Map) {
+ if (firstRow.userType() != QMetaType::QVariantMap) {
qmlWarning(this).quote() << "expected row for role "
<< roleNameKey << " of TableModelColumn at index "
<< columnIndex << " to be a simple object, but it's "
@@ -284,7 +284,7 @@ QQmlTableModel::ColumnRoleMetadata QQmlTableModel::fetchColumnRoleData(const QSt
roleData.isStringRole = true;
roleData.name = rolePropertyName;
- roleData.type = roleProperty.type();
+ roleData.type = roleProperty.userType();
roleData.typeName = QString::fromLatin1(roleProperty.typeName());
} else if (columnRoleGetter.isCallable()) {
// The role is provided via a function, which means the row is complex and
@@ -296,7 +296,7 @@ QQmlTableModel::ColumnRoleMetadata QQmlTableModel::fetchColumnRoleData(const QSt
// We don't know the property name since it's provided through the function.
// roleData.name = ???
roleData.isStringRole = false;
- roleData.type = cellData.type();
+ roleData.type = cellData.userType();
roleData.typeName = QString::fromLatin1(cellData.typeName());
} else {
// Invalid role.
@@ -326,7 +326,7 @@ void QQmlTableModel::fetchColumnMetadata()
for (const int builtInRoleKey : builtInRoleKeys) {
const QString builtInRoleName = supportedRoleNames.value(builtInRoleKey);
ColumnRoleMetadata roleData = fetchColumnRoleData(builtInRoleName, column, columnIndex);
- if (roleData.type == QVariant::Invalid) {
+ if (roleData.type == QMetaType::UnknownType) {
// This built-in role was not specified in this column.
continue;
}
@@ -847,7 +847,7 @@ bool QQmlTableModel::setData(const QModelIndex &index, const QVariant &value, in
// If the value set is not of the expected type, we can try to convert it automatically.
const ColumnRoleMetadata roleData = columnMetadata.roles.value(roleName);
QVariant effectiveValue = value;
- if (value.type() != roleData.type) {
+ if (value.userType() != roleData.type) {
if (!value.canConvert(int(roleData.type))) {
qmlWarning(this).nospace() << "setData(): the value " << value
<< " set at row " << row << " column " << column << " with role " << roleName
@@ -933,7 +933,7 @@ QQmlTableModel::ColumnRoleMetadata::ColumnRoleMetadata()
}
QQmlTableModel::ColumnRoleMetadata::ColumnRoleMetadata(
- bool isStringRole, const QString &name, QVariant::Type type, const QString &typeName) :
+ bool isStringRole, const QString &name, int type, const QString &typeName) :
isStringRole(isStringRole),
name(name),
type(type),
@@ -995,7 +995,7 @@ bool QQmlTableModel::validateNewRow(const char *functionName, const QVariant &ro
const QVariant rowAsVariant = operation == SetRowsOperation
? row : row.value<QJSValue>().toVariant();
- if (rowAsVariant.type() != QVariant::Map) {
+ if (rowAsVariant.userType() != QMetaType::QVariantMap) {
qmlWarning(this) << functionName << ": row manipulation functions "
<< "do not support complex rows (row index: " << rowIndex << ")";
return false;
@@ -1028,7 +1028,7 @@ bool QQmlTableModel::validateNewRow(const char *functionName, const QVariant &ro
}
const QVariant rolePropertyValue = rowAsMap.value(roleData.name);
- if (rolePropertyValue.type() != roleData.type) {
+ if (rolePropertyValue.userType() != roleData.type) {
qmlWarning(this).quote() << functionName << ": expected the property named "
<< roleData.name << " to be of type " << roleData.typeName
<< ", but got " << QString::fromLatin1(rolePropertyValue.typeName()) << " instead";
diff --git a/src/imports/labsmodels/qqmltablemodel_p.h b/src/imports/labsmodels/qqmltablemodel_p.h
index 6bf3e6df19..d6e982d19a 100644
--- a/src/imports/labsmodels/qqmltablemodel_p.h
+++ b/src/imports/labsmodels/qqmltablemodel_p.h
@@ -116,14 +116,14 @@ private:
{
public:
ColumnRoleMetadata();
- ColumnRoleMetadata(bool isStringRole, const QString &name, QVariant::Type type, const QString &typeName);
+ ColumnRoleMetadata(bool isStringRole, const QString &name, int type, const QString &typeName);
bool isValid() const;
// If this is false, it's a function role.
bool isStringRole = false;
QString name;
- QVariant::Type type = QVariant::Invalid;
+ int type = QMetaType::UnknownType;
QString typeName;
};