Make the setData() accessor take a QVariant as payload.
The implementation now specifically tries to support byte arrays being passed in, which is what the base class speaks. To try and retain the previous behavior anything else is attempted to be converted to a string and failing that, silently dropped. REVIEW:111748 CCBUG:322567
This commit is contained in:
parent
0368d7423c
commit
f63357bd29
@ -118,9 +118,13 @@ void DeclarativeMimeData::setColor(const QColor &color)
|
||||
}
|
||||
}
|
||||
|
||||
void DeclarativeMimeData::setData(const QString &mimeType, const QString &data)
|
||||
void DeclarativeMimeData::setData(const QString &mimeType, const QVariant &data)
|
||||
{
|
||||
QMimeData::setData(mimeType, data.toLatin1());
|
||||
if (data.type() == QVariant::ByteArray) {
|
||||
QMimeData::setData(mimeType, data.toByteArray());
|
||||
} else if (data.canConvert(QVariant::String)) {
|
||||
QMimeData::setData(mimeType, data.toString().toLatin1());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
QColor color() const;
|
||||
void setColor(const QColor &color);
|
||||
|
||||
Q_INVOKABLE void setData(const QString &mimeType, const QString &data);
|
||||
Q_INVOKABLE void setData(const QString &mimeType, const QVariant &data);
|
||||
|
||||
QQuickItem* source() const;
|
||||
void setSource(QQuickItem* source);
|
||||
|
Loading…
x
Reference in New Issue
Block a user