Results 1 to 3 of 3

Thread: How to disable a button in a QFileDialog?

  1. #1
    Join Date
    Nov 2009
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default How to disable a button in a QFileDialog?

    Hello,

    I have a FileDialog:
    QString fileName = QFileDialog::getExistingDirectory(this,tr("OPEN DIRECTORY"));
    It's created with three buttons by default (Create a new directory, open and cancel). I would like to eliminate the button "Create a new directory" from the FileDialog. How could I do this? Thanks!

  2. #2
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to disable a button in a QFileDialog?

    You have to write the custom one in this case.

    For reference even style sheet is not applied even if you set it on the main application.

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to disable a button in a QFileDialog?

    Are you using the native dialog ? If so, you will need platform specific code to do that (Call SHBrowseForFolder with BIF_NONEWFOLDERBUTTON flag). If not, then you can subclass.

    Note that BIF_NONEWFOLDERBUTTON is only available on Comdlg V6.0+ (WinXP+)

Similar Threads

  1. Replies: 4
    Last Post: 11th September 2013, 17:32
  2. how to disable the maximize button?
    By zabeehkhan in forum Qt Programming
    Replies: 4
    Last Post: 14th April 2010, 07:26
  3. QFileDialog disable buttons
    By Qt Coder in forum Qt Programming
    Replies: 3
    Last Post: 11th August 2009, 11:02
  4. QFileDialog disable Dir Path
    By user_mail07 in forum Qt Programming
    Replies: 2
    Last Post: 15th April 2008, 19:57
  5. disable floppy reading in a QFileDialog?
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 17th December 2007, 06:43

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.