PDA

View Full Version : Qtreeview selection highlighted problem?



thefisher
23rd November 2006, 10:17
hello, Now i write a program with qtreeview and subclassing qabstractItemModel ,it works
and display properly .but when I selected a item in treeview , selection item doesn't highlighted? anyone know how to control to highlighted selection?
I write flag function
such as

Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemIsEnabled;

return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}

thefisher
23rd November 2006, 11:05
I foud that similar question :
http://lists.trolltech.com/qt-interest/2005-11/thread00451-0.html

but I still do not know how to slove these problem?

jacek
23rd November 2006, 16:34
Does it work if you change your flags() method to:
Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
{
return QAbstractItemModel::flags( index );
}?

thefisher
24th November 2006, 02:22
thanks, I try it ,but it doesn't work still. Are there other setting can be done?


Does it work if you change your flags() method to:
Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
{
return QAbstractItemModel::flags( index );
}?

jacek
24th November 2006, 09:50
thanks, I try it ,but it doesn't work still. Are there other setting can be done?
If it doesn't work, then the problem might be in some other place. Do you use a custom delegate? What is the value of view's selectionMode property?