Qt: Implementation of TListView.OwnerData & TListView.OnData()
Original Reporter info from Mantis: zeljko@holobit.net @zeljan1
-
Reporter name: Zeljan Rikalo
Original Reporter info from Mantis: zeljko@holobit.net @zeljan1
- Reporter name: Zeljan Rikalo
Description:
Qt doesn't have virtual list by default ... well have but we must override QTreeWidgetItem::data() which is virtual method in qt.
Then we can easily change data when qt asks for it.
I've made patch for our bindings and also for pascal part.
Overriden method data() looks like
QVariant QLCLTreeWidgetItem::data() const {
if (ourOverrideProc.func != NULL)
here_we_call_our_override_proc(this, column, role);
// our override proc contains 3 params
// 1.Item (QLCLTreeWidgetItem) - so we know row()
// 2.Column
// 3.Role (QtDisplayRole only in patch, others can be easily added)
return QTreeWidgetItem::data(column, role);
}
I've tested it and it works like a charm.When QTreeWidget needs data from QTreeWidgetItem it calls our overriden proc just before call to inherited data(),so we get correct results in TListView.
Additional information:
Patch is attached.
*Please do not apply it yet (anybody) until we look for other possibilities.*
Mantis conversion info:
- Mantis ID: 15202
- Version: 0.9.29 (SVN)
- Fixed in revision: 22838 (#7071eb88)
- Monitored by: » @JuhaManninen (Juha Manninen)
- Target version: 1.0