I've a source code snippet of a program written with Qt in C++, running under Linux, that creates a QFileDialog for opening an existing file. If I execute this, everything seems to work alright but when the dialog was created I got a warning saying "Gtk-Message: GtkDialog mapped without a transient parent".
In another thread I figured out that calling this function "gtk_window_set_transient_for()" fixes this error. But this function is part of the GTK library but I use the Qt framework. So are there any solutions to fix this error?
Parent of this dialog is a QMainWindow:
QString filename = QFileDialog::getOpenFileName(this, "Open File");
From what I can tell from reading https://forum.qt.io/topic/85997/gtk-warning-for-native-qfiledialog-under-linux this is an issue within Qt, that we as Qt users can not directly address (and even if, we really would not want to as part of the appeal of Qt is the cross platform support). Even fixing it within in Qt it self appears to be hard, as a QWidget can not be the parent of a GTK dialog.
The only thing that springs to my mind is that it might be possible redirect the error message "somehow" to suppress it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With