Qt: Fails to display drives using QSystemStorageInfo
-
When I click the drive, it doesn't display anything since there is no click event. Lets say i click C:, it should display folders present in the selected drive. Ideally what can be the best way to go ahead with???
[quote author="DRAX" date="1355145519"]This is only part of code.
Your problem is most likely in UI.
Check what are you doing when you click on drive.[/quote] -
Well, it seems that you are missing subelements (not loading) - you just load first level of directory structure (drives).
Take a look this video: "http://www.youtube.com/watch?v=M0PZDrDwdHM":http://www.youtube.com/watch?v=M0PZDrDwdHM
I think that this guy uses much simpler approach. -
Thanks DRAX. Sadly I dont have access to YouTube at Office. Any example or sample which can guide me?
[quote author="DRAX" date="1355146844"]Well, it seems that you are missing subelements (not loading) - you just load first level of directory structure (drives).
Take a look this video: "http://www.youtube.com/watch?v=M0PZDrDwdHM":http://www.youtube.com/watch?v=M0PZDrDwdHM
I think that this guy uses much simpler approach.[/quote] -
Well, from video what I saw he uses QDirModel, and then it sets to tree view.
Like this:
@
...
QDirModel *model = new QDirModel(this);
ui->PrimTreeView->setModel(model);
...
@
You might want to make model as private variable in header instead like this.Any time :)
-
Alright I just had a look at the video through some proxy site (hahaha). I noticed he used QModelIndex and hardcoded F: drive, he also set the expand and other properties..... When he built the app, the F: drive was expanded on startup itself.
What I ideally want to achieve is to click the drive and then expand rather than expanding by default on startup. I hope u got my point :)
[quote author="DRAX" date="1355147597"]Well, from video what I saw he uses QDirModel, and then it sets to tree view.
Like this:
@
...
QDirModel *model = new QDirModel(this);
ui->PrimTreeView->setModel(model);
...
@
You might want to make model as private variable in header instead like this.Any time :)[/quote]
-
Hi DRAX. Well thats because he is setting the model directly without any root node. Let me make it clear :)
Like you said in the above comment "Well, it seems that you are missing subelements (not loading)". By this you exactly got what I was trying to say. My code currently displays C:, D: etc but on clikcing each, it should display folders inside. Thats something which aint happening.
[quote author="DRAX" date="1355162051"]Well, I looked at video again, and at 3:40 it doesn't open at startup.
When it clicks on drive then it opens.Sorry, but it seems that I don't understand what you mean.[/quote]
-
Ok then, you need to implement it.
Give to each drive letter corresponding subelements.This should give you idea how to do it: "http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm":http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm
-
Hey I went through it yesterday itself. It gives me the same thing which my code displays. Damn I am really frustrated with this...... I have been goggling like anything from yesterday and didnt even find ONE post were people have come across this scenario :/
[quote author="DRAX" date="1355234958"]Ok then, you need to implement it.
Give to each drive letter corresponding subelements.This should give you idea how to do it: "http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm":http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm
[/quote]