Hi
I'm trying using QListView to filebrowsing.
I'm trying to make a function to turn back previous directory.Qt Code:
list->setModel(model);To copy to clipboard, switch view to plain text mode
Does anyone have a hint or solution ?
Hi
I'm trying using QListView to filebrowsing.
I'm trying to make a function to turn back previous directory.Qt Code:
list->setModel(model);To copy to clipboard, switch view to plain text mode
Does anyone have a hint or solution ?
your code is populating the list with the lower lever of anything you click on the list. (or, makes the clicked item as root)I'm trying to make a function to turn back previous directory.
Where is a code that should do the "back" functionality?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I found this code on my machine:
Qt Code:
// In constructor... listView->setRootIndex(root); // later... void MainWindow::up_button_clicked() { root = root.parent(); listView->setRootIndex(root); } { { root = index; listView->setRootIndex(root); } else { // do something with clicked file.To copy to clipboard, switch view to plain text mode
Hi
try this
Thanks for reply to this thread.
I tried following code
Qt Code:
list->setModel(model);To copy to clipboard, switch view to plain text mode
and i received following application output message
Object::connect: No such slot QListView::setRootIndex(QDir::cdUp()) in window.h:86
I thought that I must change QlistView:: to another one.
Does this understanding is right??
thanks regard
Last edited by John-P; 26th January 2010 at 12:44.
Look, your problem is that you don't understand C++, and basics of the signal slot machanism and syntax.
When you give a slot in the connect() function, you have to specify the types the slot is taking, you however are CALLING the QDir::cdUp() method.
In addition, cdUp() returns a bool, and your slot expects a QModeIndex.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I write following slot
Qt Code:
view->setRootIndex(index->parent()); }To copy to clipboard, switch view to plain text mode
And I wrote in this slot to following code
Qt Code:
//QListView *list; list->setModel(model);To copy to clipboard, switch view to plain text mode
and i see following Application output
Object::connect: No such slot QListView::up_button(QModelIndex , list)
where page i have to see to understand signal and slot ?
http://doc.trolltech.com/4.6/signalsandslots.htmlwhere page i have to see to understand signal and slot ?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
I write two slot and "double_click" work but up_button doesn't work.
Qt Code:
To copy to clipboard, switch view to plain text modeQt Code:
list->setRootIndex(index.parent()); }To copy to clipboard, switch view to plain text modeQt Code:
list->setRootIndex(index); } }To copy to clipboard, switch view to plain text mode
I write puts("debug"); in up_button() and confirm that up_button works.
I thought that
list->setRootIndex(index.parent());
is wrong way to turn back .
I have no plan .
Bookmarks