Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt: Fails to display drives using QSystemStorageInfo
Forum Updated to NodeBB v4.3 + New Features

Qt: Fails to display drives using QSystemStorageInfo

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DRAX
    wrote on last edited by
    #2

    This is only part of code.
    Your problem is most likely in UI.
    Check what are you doing when you click on drive.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Stoned Jesus
      wrote on last edited by
      #3

      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]

      --
      Thanks & Regards,
      Stoned Jesus

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DRAX
        wrote on last edited by
        #4

        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.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Stoned Jesus
          wrote on last edited by
          #5

          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]

          --
          Thanks & Regards,
          Stoned Jesus

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DRAX
            wrote on last edited by
            #6

            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 :)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Stoned Jesus
              wrote on last edited by
              #7

              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]

              --
              Thanks & Regards,
              Stoned Jesus

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DRAX
                wrote on last edited by
                #8

                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.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Stoned Jesus
                  wrote on last edited by
                  #9

                  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]

                  --
                  Thanks & Regards,
                  Stoned Jesus

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DRAX
                    wrote on last edited by
                    #10

                    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

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Stoned Jesus
                      wrote on last edited by
                      #11

                      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]

                      --
                      Thanks & Regards,
                      Stoned Jesus

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved