Results 1 to 5 of 5

Thread: QFileDialog Question

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question QFileDialog Question

    I have an application running on RHEL 7.3 and in this application the user opens an XML file. They can either pass in this file as a command line argument or through a File Dialog. I use the static function QFileDialog::getOpenFileName() but noticed in the Qt docs it says for Windows and MAC, it uses a native dialog. But in Linux it appears it uses a QtDialog. Is there a way to make the application use the RHEL specific file choosing dialog. The directory it needs to open to has approximately 4000 files in it and the dialog is a bit slow (upwards of a minute) for selecting a file. I thought maybe using a native dialog to RHEL would help speed this up? Has anybody experienced this issue before? These machines have 8 GB or 16 GB of RAM in them. It might be there is no way to make this faster, just thought I would ask other people before telling them they have to deal with the slowness until they clean up their directory.

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFileDialog Question

    The QFileDialog docs say that the native dialog will be used when there is one. (See QFileDialog::DontUseNativeDialog). Maybe the style you are using for the app doesn't have a conforming native dialog. Check the styles available for RHEL in your Qt distribution and maybe there is an alternative.

    Try changing the Options flag for getOpenFilename() to set the DontUseNativeDialog bit and see if you get the same thing.

    There is some mention in the RHEL 7.3 release notes about Qt style changes.
    <=== 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.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileDialog Question

    Quote Originally Posted by d_stranz View Post
    The QFileDialog docs say that the native dialog will be used when there is one. (See QFileDialog::DontUseNativeDialog). Maybe the style you are using for the app doesn't have a conforming native dialog. Check the styles available for RHEL in your Qt distribution and maybe there is an alternative.
    More precisely this is part of the platform integration part of Qt, the the platform theme plugin.

    For example on a KDE Plasma Desktop you will get the KDE File Dialog if the Qt version of the application matches the Qt version of the desktop but you'll get the built-in Qt dialog if there is a version mismatch.

    So it also depends a bit on whether the application uses its own Qt or the system Qt.

    Cheers,
    _

  4. The following 2 users say thank you to anda_skoa for this useful post:

    d_stranz (25th August 2019), ToddAtWSU (26th August 2019)

  5. #4
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileDialog Question

    Okay, so this is starting to make some sense. We are forced to use Gnome and when I run some applications, I get an error: GTK-Message: GTKDialog mapped without a transient parent. This is discouraged.

    So maybe it is trying to use the GTKDialog for the QFileDialog, and I get this error as it doesn't know how to use a QMainWindow for its parent. And then maybe if I don't use the native dialog like you suggest, it will work. I wasn't certain if I was using the native dialog because the documentation wasn't clear in Linux:

    On Windows, and macOS, this static function will use the native file dialog and not a QFileDialog.
    It never mentioned Linux so I assumed it was using the QFileDialog, but I think it is now using the GTKDialog so I will try disabling this and see what happens. Thanks for your help

  6. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileDialog Question

    Quote Originally Posted by ToddAtWSU View Post
    get an error: GTK-Message: GTKDialog mapped without a transient parent. This is discouraged.
    This is probably just a warning, not an error.

    As far as I understand the "transient parent" is the window which the dialog should be placed on top of, otherwise the dialog could theoretically be move "below" the parent.
    It should still work though.

    Quote Originally Posted by d_stranz View Post
    So maybe it is trying to use the GTKDialog for the QFileDialog, and I get this error as it doesn't know how to use a QMainWindow for its parent.
    This kind of window relationship is handled on the level of window system handles, e.g. X11 window IDs, so this shouldn't be a problem.

    But of course there could be limitation on the integration API and/or bugs.

    Cheers,
    _

Similar Threads

  1. QFileDialog question
    By vuletic in forum Newbie
    Replies: 6
    Last Post: 15th March 2015, 00:51
  2. Replies: 7
    Last Post: 5th March 2014, 18:36
  3. QFileDialog Question
    By sgrant327 in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2010, 15:05
  4. Replies: 0
    Last Post: 31st March 2010, 13:40
  5. A question about QFileDialog::getSaveFileName
    By Ali in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2007, 20:46

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.