Skip to content

Commit

Permalink
[Port to Qt6] QVariant::type() => QVariant::typeId()
Browse files Browse the repository at this point in the history
  • Loading branch information
ochurlaud authored and fenuks committed Nov 9, 2024
1 parent 3e24185 commit 420580f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/solid-lite/backends/iokit/cfhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static QVariant q_toVariant(const CFTypeRef &obj)
bool metNonString = false;
for (CFIndex i = 0; i < size; ++i) {
QVariant value = q_toVariant(CFArrayGetValueAtIndex(cfarray, i));
if (value.type() != QVariant::String)
if (value.typeId() != QMetaType::QString)
metNonString = true;
list << value;
}
Expand Down
16 changes: 8 additions & 8 deletions 3rdparty/solid-lite/predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool Solid::Predicate::matches(const Device &device) const
QVariant value = metaProp.isReadable() ? metaProp.read(iface) : QVariant();
QVariant expected = d->value;

if (metaProp.isEnumType() && expected.type()==QVariant::String) {
if (metaProp.isEnumType() && expected.typeId()==QMetaType::QString) {
QMetaEnum metaEnum = metaProp.enumerator();
int value = metaEnum.keysToValue(d->value.toString().toLatin1());
if (value>=0) { // No value found for these keys, resetting expected to invalid
Expand Down Expand Up @@ -287,9 +287,9 @@ QString Solid::Predicate::toString() const

QString value;

switch (d->value.type())
switch (d->value.typeId())
{
case QVariant::StringList:
case QMetaType::QStringList:
{
value = '{';

Expand All @@ -311,13 +311,13 @@ QString Solid::Predicate::toString() const
value+= '}';
break;
}
case QVariant::Bool:
case QMetaType::Bool:
value = (d->value.toBool()?"true":"false");
break;
case QVariant::Int:
case QVariant::UInt:
case QVariant::LongLong:
case QVariant::ULongLong:
case QMetaType::Int:
case QMetaType::UInt:
case QMetaType::LongLong:
case QMetaType::ULongLong:
value = d->value.toString();
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion db/librarydb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class SqlQuery
} else {
// Do integers inline - sqlite seems to get confused when you pass integers
// to bound parameters
if (QVariant::Int==value.type()) {
if (QMetaType::Int==value.typeId()) {
whereClauses << QString("%1 %2 %3").arg(column, op, value.toString());
} else if ("genre"==column) {
QString clause("(");
Expand Down
2 changes: 1 addition & 1 deletion support/urllabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void UrlLabel::setText(const QString &t)

void UrlLabel::setProperty(const char *name, const QVariant &value)
{
if (name && !strcmp(name, "text") && QVariant::String==value.type()) {
if (name && !strcmp(name, "text") && QMetaType::QString==value.typeId()) {
setText(value.toString());
}
}
Expand Down
4 changes: 2 additions & 2 deletions widgets/notelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ NoteLabel::NoteLabel(QWidget *parent)

void NoteLabel::setProperty(const char *name, const QVariant &value)
{
if (name && !strcmp(name, "text") && QVariant::String==value.type()) {
if (name && !strcmp(name, "text") && QMetaType::QString==value.typeId()) {
setText(value.toString());
}
}
Expand All @@ -90,7 +90,7 @@ UrlNoteLabel::UrlNoteLabel(QWidget *parent)

void UrlNoteLabel::setProperty(const char *name, const QVariant &value)
{
if (name && !strcmp(name, "text") && QVariant::String==value.type()) {
if (name && !strcmp(name, "text") && QMetaType::QString==value.typeId()) {
setText(value.toString());
}
}
Expand Down

0 comments on commit 420580f

Please sign in to comment.