// UChar because it can't decide if it's a character or a number
p = QVariant::fromValue<uchar>(p.toUInt());
} else if (id < int(QMetaType::User) && id != int(QVariant::Map)) {
- p.convert(QVariant::Type(id));
+ p.convert(id);
if (p.type() == QVariant::Invalid) {
fprintf(stderr, "Could not convert '%s' to type '%s'.\n",
qPrintable(argument), types.at(i).constData());
label->setText(caption);
}
-void PropertyDialog::addProperty(const QString &aname, QVariant::Type type)
+void PropertyDialog::addProperty(const QString &aname, int type)
{
int rowCount = propertyTable->rowCount();
propertyTable->setRowCount(rowCount + 1);
if (name.isEmpty())
name = QLatin1String("argument ") + QString::number(rowCount + 1);
name += QLatin1String(" (");
- name += QLatin1String(QVariant::typeToName(type));
+ name += QLatin1String(QMetaType::typeName(type));
name += QLatin1String(")");
QTableWidgetItem *nameItem = new QTableWidgetItem(name);
nameItem->setFlags(nameItem->flags() &
propertyTable->setItem(rowCount, 0, nameItem);
QTableWidgetItem *valueItem = new QTableWidgetItem;
- valueItem->setData(Qt::DisplayRole, QVariant(type));
+ valueItem->setData(Qt::DisplayRole, QVariant(type, /* copy */ 0));
propertyTable->setItem(rowCount, 1, valueItem);
}
public:
explicit PropertyDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
- void addProperty(const QString &name, QVariant::Type type);
+ void addProperty(const QString &name, int type);
void setInfo(const QString &caption);
QList<QVariant> values() const;
// create a D-Bus type signature from QMetaMethod's parameters
QString sig;
for (int i = 0; i < method.parameterTypes().count(); ++i) {
- QVariant::Type type = QVariant::nameToType(method.parameterTypes().at(i));
+ int type = QMetaType::type(method.parameterTypes().at(i));
sig.append(QString::fromLatin1(QDBusMetaType::typeToSignature(type)));
}
return sig;
if (paramType.endsWith('&'))
continue; // ignore OUT parameters
- QVariant::Type type = QVariant::nameToType(paramType);
+ int type = QMetaType::type(paramType);
dialog.addProperty(QString::fromLatin1(paramNames.value(i)), type);
- types.append(QMetaType::type(paramType));
+ types.append(type);
}
if (!types.isEmpty()) {