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. How can you create a hidden folder using Qt?

How can you create a hidden folder using Qt?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 7 Posters 9.6k Views
  • 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.
  • T Offline
    T Offline
    TwoGunBerg
    wrote on last edited by
    #1

    Hi all;
    in the applictaion i'm working on i would like to have a folder that would contain certain files. i also want to have a subfolder in the main folder that would contain metadata files. I would like to make the subfolder a hidden folder so it will not be viewable by the user. I looked into QDir and i can't see any way to make a folder hidden. i have checked the web and i can't seem to find anything. is Qt capable of this?

    Thanks for any help. :-)
    Shawn

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Felix
      wrote on last edited by
      #2

      well thats very specific for each platform. On a unix simply prepend a "." to the folder name then it is hidden.

      on Windows you have to use the Windows API. Qt doesnt handle hiding of files ad folders unfortunately.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Irfan
        wrote on last edited by
        #3

        Shawn,
        For which particular Platform are you doing this, As Flix said it is different on different platform, we can write code for atleaset two platform which may help you.

        Regards,
        Irfan Omair

        1 Reply Last reply
        0
        • A Offline
          A Offline
          anselmolsm
          wrote on last edited by
          #4

          Although it's so different depending on the platform, I think it would be possible to be part of Qt (there are APIs for other dir operations that are so different across the platforms too). :-)

          Anselmo L. S. Melo (anselmolsm)

          1 Reply Last reply
          0
          • I Offline
            I Offline
            Immii
            wrote on last edited by
            #5

            Well you can implement your own platform independent api for this for all those platform you want it to support, as above said it so largely varies on different platform that I can understand why there is not any api for this in Qt, but you can have your own #ifdef and implement your own code, but you need to know the native api for all those platform you want it to work.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fcrochik
              wrote on last edited by
              #6

              A similar thread on the subject exists here:
              http://developer.qt.nokia.com/forums/viewthread/2709/

              Certified Specialist & Qt Ambassador <a href="http://www.crochik.com">Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop... Qt everywhere!</a>

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                There cannot be a platform independent way of creating hidden files or directories. The concepts are far too way different. While on Windows this is "only" an attribute to the file itself. On Unix/Linux there are no really "hidden" files. It's only by convention that files staring with a dot are not displayed by default. Thus, the lib would have to change the filename and prepend a dot to it. You would be unable to open your file afterwards with the original name since it simply doesn't exist and never has. Or, worse, there already exists a file with the dot in front of it and everything's messed up. On Mac things might go even worse, as it could be with both attributes and dot convention.

                http://www.catb.org/~esr/faqs/smart-questions.html

                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