Results 1 to 6 of 6

Thread: QFile Dialog doesn't display on the Top

  1. #1
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default QFile Dialog doesn't display on the Top

    I have several Dialogs with window Flags as WindowStaysonTopHint. When I open QFileDialog it displays at the bottom of these dialogs. How to set window Flag for QFileDialog. I use the following code to display the dialog at the top but it doesn't work.

    > QFileDialog *dialog=new QFileDialog();
    >
    > dialog->setWindowModality(Qt::ApplicationModal);
    >
    > dialog->setModal(true);
    > dialog->setWindowFlags(Qt::WindowStaysonTopHint);
    > dialog->getExisitngDirectory(this,tr("Directory"),"\home" ,QFileDialog::ShowDirsOnly);

    Simply, I am looking for a non static get existing directory function.
    Last edited by Veera; 27th September 2017 at 16:18.

  2. #2
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    379
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFile Dialog doesn't display on the Top

    Try to use dialog->exec() rather than dialog->show()

  3. #3
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFile Dialog doesn't display on the Top

    I am using dialog->exec() but it doesn't work. there is no parent for the QFileDialog that I am using.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,972
    Thanks
    277
    Thanked 808 Times in 797 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFile Dialog doesn't display on the Top

    I have several Dialogs with window Flags as WindowStaysonTopHint.
    You can't have it both ways. You have told the windowing system that these dialogs must stay on top of other windows, so it will keep them on top. You can't now say, "Oh, but I want them on top except when I post my file dialog. Put that on top instead for a short time."

    You can try using QWidget::raise() but this may not work for top-level widgets (i.e. parentless).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFile Dialog doesn't display on the Top

    When I use the same code for a dialog with parent as mainwindow it displays on top of all other toplevelwidgets. I want to implement same with the dialog with no parent.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,972
    Thanks
    277
    Thanked 808 Times in 797 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFile Dialog doesn't display on the Top

    *Sigh* Re-read my previous answer.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Native QFile Dialog
    By lumpy69 in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2017, 17:44
  2. QFile::remove doesn't work
    By mentalmushroom in forum Qt Programming
    Replies: 10
    Last Post: 25th June 2017, 11:54
  3. qfile dialog error
    By SirJonas in forum Newbie
    Replies: 3
    Last Post: 2nd November 2016, 15:08
  4. Replies: 2
    Last Post: 6th May 2013, 08:06
  5. QFile dialog, native view
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2010, 04:15

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.