Selecting one of multiple screens for displaying a dialog window

Hello together,

I am working with multiple screens, and would like to control, which screen a native dialog to display in, when starting it up. The Dialog Window is being created by means of a Qt ui-File and the QtFormBuilder and I am trying to figure out, how to display it on a screen of my choice, but haven't found a way of doing it so far. Any hint is greatly appreciated.

Here's the example code:

ui_file = QFile::new(QFileInfo::new($0).dir.filePath("GUI.ui"))
$mDialog = QFormBuilder::new.load(ui_file, Application::instance.main_window)

screens = QGuiApplication.screens


Kind Regards


  • Hi Thomas,

    according to the Qt documentation (Qt5 and later) that should work by assigning a QScreen object to the dialog before you show it:

    dialog.screen = the_screen_you_want_to_show_it

    However, I have never used that feature myself, not even in plain C++ Qt.


Sign In or Register to comment.