8

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");
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
0x1C1B
  • 1,204
  • 11
  • 40

1 Answers1

7

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.

Abdelilah El Aissaoui
  • 4,204
  • 2
  • 27
  • 47
sarowie
  • 86
  • 1
  • 3
  • Yea seems to be logical, but my real problem wasn't the error message itself, I believe in consequence of this it distorted the size of the dialog, this was the real problem... But it does't matter, now I write this software in Java with Swing... But thanks! – 0x1C1B May 05 '18 at 09:32