If qtwidgets are build with USE=gtk, then every Qt application seems to ignore the -display command line option, e.g.: $ DISPLAY="" qtpass -display :0.0 (qtpass:11039): Gtk-WARNING **: 12:38:21.221: cannot open display: $ DISPLAY="" qtpass -display :0 (qtpass:11042): Gtk-WARNING **: 12:38:22.883: cannot open display: $ DISPLAY="foobar" qtpass -display :0 (qtpass:11084): Gtk-WARNING **: 12:39:48.488: cannot open display: foobar $ DISPLAY="" pinentry-qt5 --display :0 (pinentry-qt5:11199): Gtk-WARNING **: 12:45:27.577: cannot open display: $ DISPLAY="foobaz" pinentry-qt5 --display :0.0 (pinentry-qt5:11201): Gtk-WARNING **: 12:45:33.440: cannot open display: foobaz $ equery u qtwidgets [ Legend : U - final flag setting for installation] [ : I - package is installed with flag ] [ Colors : set, unset ] * Found these USE flags for dev-qt/qtwidgets-5.15.2: U I + + X : Add support for X11 - - debug : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces - - gles2-only : Use GLES 2.0 or later instead of full OpenGL + + gtk : Build the GTK platform theme plugin + + png : Add support for libpng (PNG images) - - test : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently) Reproducible: Always Steps to Reproduce: 1. emerge dev-qt/qtwidgets with USE=gtk 2. unset DISPLAY 3. launch any Qt application and pass a valid -display :0.0 or -display :0 commandline option Actual Results: applications exit with an error message: Gtk-WARNING **: 12:46:55.930: cannot open display: Expected Results: applications show their main window on the specified display
are you saying that just by toggling the gtk USE flag the behavior wrt -display handling changes? what's $XDG_SESSION_TYPE set to?
Yes, but just if -display is set to 0: $ DISPLAY="foobar" qtpass -display :0 (qtpass:24807): Gtk-WARNING **: 21:53:51.655: cannot open display: foobar Compare this to: $ DISPLAY="foobar" qtpass -display :1 qt.qpa.xcb: could not connect to display :1 qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: minimal, offscreen, xcb. $ echo $XDG_SESSION_TYPE x11 $ equery u qtwidgets [ Legend : U - final flag setting for installation] [ : I - package is installed with flag ] [ Colors : set, unset ] * Found these USE flags for dev-qt/qtwidgets-5.15.2-r10: U I + + X : Add support for X11 - - debug : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gen too.org/wiki/Project:Quality_Assurance/Backtraces - - gles2-only : Use GLES 2.0 or later instead of full OpenGL + + gtk : Build the GTK platform theme plugin + + png : Add support for libpng (PNG images) - - test : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)