[Interest] Catching selection in QTreeView
Waitman Gobble
uzimac at da3m0n8t3r.com
Tue Jun 19 08:32:45 CEST 2012
Hi,
I am having an issue with the QTreeView and Key Bindings. It seems when the selection changes from a keyboard event, it does not fire the function bound to the signal. The mouse button causes the function to run as desired. Perhaps I'm missing a setting in the documentation?
http://qt-project.org/doc/qt-4.8/qtreeview.html#signals
Pointers, suggestions appreciated.
Thanks,
Waitman Gobble
San Jose, California USA
QTreeView *tree = new QTreeView;
model = new QFileSystemModel;
//model->setRootPath(QDir::currentPath());
model->setRootPath(QDir::homePath());
model->sort(2,Qt::AscendingOrder);
tree->setModel(model);
tree->setAnimated(false);
tree->setSortingEnabled(true);
tree->sortByColumn(2, Qt::AscendingOrder);
tree->setColumnWidth(0, 250);
tree->setSelectionMode(QAbstractItemView::SingleSelection);
// connect(tree, SIGNAL(entered(QModelIndex)), this, SLOT(changeCurrent(QModelIndex)));
connect(tree, SIGNAL(pressed(QModelIndex)), this, SLOT(changeCurrent(QModelIndex)));
// tree->setRootIndex(model->index(QDir::currentPath()));
--
Waitman Gobble
San Jose California USA
More information about the Interest
mailing list