[Qt-interest] QTreeWidgetItem test if findItems exists

Andrei Sebastian Cimpean andreiamenta at gmail.com
Sun Sep 13 11:07:40 CEST 2009


Hello... how do i test if a a supplied item exists in the a QTreeView?
this is what i am doing :
QList<QTreeWidgetItem* >items = m_ui->treeWidget->findItems(oPRepl.at(j), 
Qt::MatchRecursive | Qt::MatchExactly,0);

where oPRepl.at(j) is a String cotaining a name. I am trying to achieve this 
effect:
if i am in //media and want to travel to //home/andrei/bla , where bla doesn't 
exist i want the program to go through //home/andrei and stop there.

firstly i was thinking of a try and catch but as i understand(read on a few 
internet pages -> try catch and throw are not supported!? ).

the program crashes when it discovers that it cannot pick a tree item, and 
that's what i'm trying to fix. how to check if an item with that name exists or 
is null ? 

thank you,

Andrei



More information about the Qt-interest-old mailing list