QSqlRelationalDelegate: compile with QT_NO_CAST_FROM_BYTEARRAY
QSqlRelationalDelegate::setEditorData() does not compile when QT_NO_CAST_FROM_BYTEARRAY is defined. Since it's a public header this will break user code. Fix it by calling QByteArray::data() instead of relying on the implicit cast. Fixes: QTBUG-72764 Change-Id: I9c111dd25f48c9c9780d9f9a5b6b75eed0c8d6ed Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
parent
a53500f5bf
commit
ccfd6872ba
@ -109,11 +109,11 @@ QWidget *createEditor(QWidget *aParent,
|
|||||||
// to present the DisplayRole and not the EditRole which
|
// to present the DisplayRole and not the EditRole which
|
||||||
// is the id reference to the related model
|
// is the id reference to the related model
|
||||||
QVariant v = index.data(Qt::DisplayRole);
|
QVariant v = index.data(Qt::DisplayRole);
|
||||||
QByteArray n = editor->metaObject()->userProperty().name();
|
const QByteArray n = editor->metaObject()->userProperty().name();
|
||||||
if (!n.isEmpty()) {
|
if (!n.isEmpty()) {
|
||||||
if (!v.isValid())
|
if (!v.isValid())
|
||||||
v = QVariant(editor->property(n).userType(), nullptr);
|
v = QVariant(editor->property(n.data()).userType(), nullptr);
|
||||||
editor->setProperty(n, v);
|
editor->setProperty(n.data(), v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user