PDA

View Full Version : Hidden field in QTreeView



YuriyRusinov
29th June 2006, 08:51
Hello, Everyone !

I wrote SearchTreeModel as same as examples simpletreemodel and put it to QTreeView, screenshot is in attached file. Just now I have to add integer field, that will not show on form, but will be returned if I choice any workspace from list. What's classes and functions I have to modify and which way I have to choice this field from model ?

--
Best regards,
Sincerely yours,
Yuriy Rusinov.

wysota
29th June 2006, 17:41
I guess you forgot to post the screenshot.

YuriyRusinov
29th June 2006, 17:55
I guess you forgot to post the screenshot.
It is in attachment.

eriwik
30th June 2006, 08:10
Hmm, don't know about Qt4 but in Qt3 you could set the text of a column that was not visible and use it as a "tag" or whatever to identify an item. In your case that would be something like this when creating the item:


QListViewItem* item = new QListViewItem(parent);
// Add the other fields
item->setText(4, QString::number(yourNumber)); // 4 = the fifth column (not visible)

YuriyRusinov
30th June 2006, 13:00
All works fine, thanks a lot.