Treadstone
14th August 2010, 12:08
It's my first post here, so I would say hello to you!
I've got problem with QListView and QFileSystemModel. I've created a model:
model = new QFileSystemModel;
model->setRootPath(QDir::currentPath());
and connected it with listView:
ui->listView->setModel(model);
ui->listView->setRootIndex(model->index(tr("/home/lukasz/")));
Everything works good but one thing: selecting all of items. When I click ctrl+a, or invoke method selectAll():
ui->listView->selectAll();
method ui->listView->selectionModel()->selectedIndexes() returns number of highlighted files multipled by four. For example when I select manually all, four items, method selectedIndexes() returns number 4. But when I click ctrl+a or invoke selectAll(), selectedIndexes() returns 16.
I tried compiling on linux and on windows too - results are the same.
Here is a very simple project created with Qt Creator: link (http://treadstone.sh.dug.net.pl/badselect.rar). It should help you, if solution of my problem isn't simple.
Regards
I've got problem with QListView and QFileSystemModel. I've created a model:
model = new QFileSystemModel;
model->setRootPath(QDir::currentPath());
and connected it with listView:
ui->listView->setModel(model);
ui->listView->setRootIndex(model->index(tr("/home/lukasz/")));
Everything works good but one thing: selecting all of items. When I click ctrl+a, or invoke method selectAll():
ui->listView->selectAll();
method ui->listView->selectionModel()->selectedIndexes() returns number of highlighted files multipled by four. For example when I select manually all, four items, method selectedIndexes() returns number 4. But when I click ctrl+a or invoke selectAll(), selectedIndexes() returns 16.
I tried compiling on linux and on windows too - results are the same.
Here is a very simple project created with Qt Creator: link (http://treadstone.sh.dug.net.pl/badselect.rar). It should help you, if solution of my problem isn't simple.
Regards