[Qt-interest] weird QTableItem behavior

Andrei Sebastian Cimpean andreiamenta at gmail.com
Fri Sep 11 15:36:47 CEST 2009


Hello everybody.
I have encountered a somewhat weird thing while using QTreeView and 
QTableView. I have a tree structure showing off files, and inside the table i am 
displaying the contents of a selected item from the tree. And i have a 
QLineEdit where i have an editable path. The thing is that i want to make it 
so you can navigate also by typing the path. If i want to return to the "/" 
directory for example from inside "home" i use something like this:

QList<QTreeWidgetItem* >items = m_ui->treeWidget->findItems("/", 
Qt::MatchRecursive | Qt::MatchExactly,0);
QList<QTreeWidgetItem* >selectedShit = m_ui->treeWidget->selectedItems();
selectedShit[0]->setSelected(false);
delete selectedShit[0];
m_ui->treeWidget->setItemSelected(items[0],true);
treeItemClicked(items[0]);

at first it seems to work. every table item that i click opens correctly into a 
subfolder and so on and, the tree items also respond correctly. the thing is 
that i cannot open the table item representing the folder i was inside. It 
just gives me the option to rename it and that's all. I tried various things 
but the issue  somehow survived. Any ideas ? :(



More information about the Qt-interest-old mailing list