PDA

View Full Version : getting Itemtext



LordQt
17th January 2008, 12:13
Hello friends,

how can I get the itemtext from my Teeview??

I´am searching now about 1 hour. Have any an idea???

marcel
17th January 2008, 12:21
You can use QAbstractItemModel::data with the QAbstractItemView::currentIndex model index and a display role to get the text of the current item.



QString txt;
if(tree->currentIndex().isValid())
{
txt = tree->model()->data(tree->currentIndex(), Qt::DisplayRole).toString();
}

LordQt
17th January 2008, 13:10
Thank you!!! It rocks!