Results 1 to 3 of 3

Thread: Get QFileDialog to display dot folder/files?

  1. #1
    Join Date
    Oct 2015
    Posts
    45
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Get QFileDialog to display dot folder/files?

    I did some searching, but, no luck, and, maybe I don't know how to phrase the search...

    Using QFileDialog, how do I get it to show files and folders that begin with a period (or dot), for example, in a home folder in Linux you typically have:

    /home/user/.config

    In this case a folder.

    or:

    /home/user/.bashrc

    In this case a file.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Get QFileDialog to display dot folder/files?

    You have to tell QFileDialog what to show, by default, hidden files are not shown. Look at the filter options for QFileDialog::setFilters, in particular QDir::Hidden. You probably also want QDir::NoDotAndDotDot, etc.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. The following user says thank you to jefftee for this useful post:

    drmacro (5th March 2017)

  4. #3
    Join Date
    Oct 2015
    Posts
    45
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Get QFileDialog to display dot folder/files?

    Thanks!

    That's the bump I needed.

    For future readers:

    Qt Code:
    1. fdlg = QtWidgets.QFileDialog()
    2. fdlg.setFilter(QDir.AllEntries | QDir.Hidden)
    3. if (fdlg.exec()):
    4. fileNames = fdlg.selectedFiles()
    5. fdlg.close()
    To copy to clipboard, switch view to plain text mode 

    Shows .name, ..name, folder or files.

Similar Threads

  1. QFileDialog to create folder
    By qt_developer in forum Newbie
    Replies: 1
    Last Post: 12th April 2013, 19:48
  2. Replies: 2
    Last Post: 16th November 2012, 02:42
  3. Replies: 0
    Last Post: 13th October 2010, 04:27
  4. QfileDialog new folder creation event
    By vjsharma_30 in forum Qt Programming
    Replies: 0
    Last Post: 9th March 2010, 16:04
  5. Replies: 1
    Last Post: 7th June 2009, 09:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.