Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.5.0
-
None
-
Qt 5.5.0, Ubuntu 14.04
-
edc24e3cd75eaf02a587f50b14dbd0288447179d
Description
If setup role in TableViewColumn to "self" and declare custom delegate to column than we get run time error message:
".../qml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml:103:19: Unable to assign Object to QString"
or
".../qml/QtQuick/Controls/Styles/Base/BasicTableViewStyle.qml:146:19: Unable to assign Object to QString"
For example:
TableViewColumn { title: "Column1" role: "self" delegate: Text { text: styleData.value.title + " " + styleData.value.author } }
In this example we want to show two object fields in one column, but we get run time error message.
Full example code:
import QtQuick 2.5 import QtQuick.Controls 1.4 ApplicationWindow { title: "TableView Test" width: 640 height: 480 visible: true TableView { anchors.fill: parent property QtObject book1: QtObject { property string title: "A Masterpiece" property string author: "Gabriel" } property QtObject book2: QtObject { property string title: "Brilliance" property string author: "Jens" } property QtObject book3: QtObject { property string title: "Outstanding" property string author: "Frederik" } model: [book1, book2, book3] TableViewColumn { title: "Column1" role: "self" delegate: Text { text: styleData.value.title + " " + styleData.value.author } } } }