Delegate problem
-
I create item in this way:
@
item = new QStandardItem(reason);
item->setData(reason), ListViewDelegate::reasonRole);
@
The reason string HAS data, sure...
But in the delegate I can't query this data:
@
QString reason = qvariant_cast<QString>(index.data(reasonRole));
@
The reason string is empty...
What can be the problem? -
What is the "reasonRole" in the second snippet? Are you sure it is the same value as ListViewDelegate::reasonRole?
-
[quote author="sierdzio" date="1349096715"]What is the "reasonRole" in the second snippet? Are you sure it is the same value as ListViewDelegate::reasonRole?[/quote]
Yes, in theory, they are equivalent...
But in the second string is empty :( -
Try using ::toString() instead.
@
QString reason = index.data(reasonRole).toString();
@