Two-monitor UI application
-
wrote on 8 Sept 2016, 13:21 last edited by StasU 9 Aug 2016, 13:22
Hey Guys,
I'm writing an application using two screens. The main idea is that one screen shows in fullscreen and on top of every other component (eg. OSD from OS is not allowed) an image. The controls of this view should be displayed on another display.
Several problems occured till now:- How to figure out which screen is the one I need (figure out the model name would be a solution).
- Set the displaying ui component in fullscreen to this particular screen.
- Forbid anything to go ontop of the display.
We're working with QtQuick 2 on an linux OS.
For the first problem: I could assure the monitor for controlling is accessed via displayPort and the other one via HDMI so I would have to figure out which screen is connected to HDMI.
For the second problem: I tried to use QWindow::setScreen() but no matter which screen I choose the window is displayed on the screen marked as main.
I could configure another X11-Server for the displaying screen. Is there a way to choose which XServer should be used to display the image? (This should also work for disallowing OSD etc. problems mentioned at point 3).For the last point I thought of setting the Qt::X11BypassWindowManagerHint flag.
Edit:
It's also an option to use QtWidget for the display and QtQuick for the controls if there's a solution for Widgets.I'm very happy about any suggestion and every hint I get.
Thanks in advance,
Stas -
Hi and welcome to devnet,
As a small test you could build an application that use QDesktopWidget to gather the screens information and put one widget on each desktop.
Also, what desktop environment are you running on ? What would be your target ? The distribution you are using ?
-
wrote on 10 Sept 2016, 14:34 last edited by
Hi SGaist,
Thanks for the quick response.
I ran the test with setScreen on Mint 18 and WIndows 7. The target destribution will be either Mint or Ubuntu. I'll try your suggestion on monday. -
wrote on 19 Sept 2016, 16:38 last edited by
It didn't work. Right now I'm trying to get it via two separate xserver sessions (one on each screen) running. When trying to set a QWindow to the other screen the application output tells me:
Xlib: extension "NV-GLX" missing on display ":0".
I'm running a GTX980 with nvidia-361 drivers from the repo and let nvidia-xconfig configure the xserver.
For running separate xserver on each screen I chose to add another XServer in the nvidia-settings dialog for display configuration.
It would be ok if I start two different applications on each screens and setup an IPC or use a second video card for the second display.Btw: here a more detailed SW/HW description:
$ lsb_release -a Distributor ID: LinuxMint Description: Linux Mint 18 Sarah Release: 18 Codename: sarah $ lspci | grep VGA 05:00.0 VGA compatible controller: NVIDIA Corporation GM204 [GeForce GTX 980] (rev a1) $ lsmod Module Size Used by pci_stub 16384 1 vboxpci 24576 0 vboxnetadp 28672 0 vboxnetflt 28672 0 vboxdrv 454656 3 vboxnetadp,vboxnetflt,vboxpci binfmt_misc 20480 1 snd_hda_codec_hdmi 53248 1 nvidia_uvm 749568 0 nvidia_modeset 745472 6 hp_wmi 16384 0 sparse_keymap 16384 1 hp_wmi x86_pkg_temp_thermal 16384 0 intel_powerclamp 16384 0 coretemp 16384 0 kvm_intel 172032 0 kvm 536576 1 kvm_intel irqbypass 16384 1 kvm crct10dif_pclmul 16384 0 crc32_pclmul 16384 0 snd_hda_codec_realtek 81920 1 nvidia 10182656 144 nvidia_modeset,nvidia_uvm snd_usb_audio 176128 3 snd_hda_codec_generic 77824 1 snd_hda_codec_realtek aesni_intel 167936 0 snd_usbmidi_lib 36864 1 snd_usb_audio input_leds 16384 0 aes_x86_64 20480 1 aesni_intel lrw 16384 1 aesni_intel snd_hda_intel 36864 5 gf128mul 16384 1 lrw glue_helper 16384 1 aesni_intel ablk_helper 16384 1 aesni_intel cryptd 20480 2 aesni_intel,ablk_helper snd_hda_codec 135168 4 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel snd_hda_core 73728 5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel snd_hwdep 16384 2 snd_usb_audio,snd_hda_codec serio_raw 16384 0 snd_pcm 106496 6 snd_usb_audio,snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_core sb_edac 32768 0 edac_core 53248 1 sb_edac snd_seq_midi 16384 0 snd_seq_midi_event 16384 1 snd_seq_midi snd_rawmidi 32768 2 snd_usbmidi_lib,snd_seq_midi snd_seq 69632 2 snd_seq_midi_event,snd_seq_midi lpc_ich 24576 0 snd_seq_device 16384 3 snd_seq,snd_rawmidi,snd_seq_midi snd_timer 32768 2 snd_pcm,snd_seq mei_me 36864 0 drm 360448 3 nvidia mei 98304 1 mei_me snd 81920 28 snd_hda_codec_realtek,snd_usb_audio,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec_generic,snd_usbmidi_lib,snd_hda_codec,snd_hda_intel,snd_seq_device soundcore 16384 1 snd ioatdma 53248 0 shpchp 36864 0 dca 16384 1 ioatdma wmi 20480 1 hp_wmi tpm_infineon 20480 0 8250_fintek 16384 0 mac_hid 16384 0 parport_pc 32768 0 ppdev 20480 0 lp 20480 0 parport 49152 3 lp,ppdev,parport_pc autofs4 40960 2 btrfs 987136 0 xor 24576 1 btrfs raid6_pq 102400 1 btrfs dm_mirror 24576 0 dm_region_hash 24576 1 dm_mirror dm_log 20480 2 dm_region_hash,dm_mirror uas 24576 0 usb_storage 69632 1 uas hid_generic 16384 0 usbhid 49152 0 hid 118784 2 hid_generic,usbhid psmouse 126976 0 ahci 36864 2 libahci 32768 1 ahci firewire_ohci 40960 0 firewire_core 65536 1 firewire_ohci isci 135168 0 e1000e 237568 0 crc_itu_t 16384 1 firewire_core libsas 77824 1 isci ptp 20480 1 e1000e pps_core 20480 1 ptp scsi_transport_sas 40960 2 isci,libsas pata_acpi 16384 0 fjes 28672 0
-
What do you mean by "it didn't work" ? What result did you got ?
-
wrote on 20 Sept 2016, 10:04 last edited by
It didn't work in terms of it doesn't matter which display I chose the application window always appears on the primary screen. Though I can move the application on another screen via the move method. Then if I want to set the application to fullscreen it appears in fullscreen on the primary display again.
-
What did QDesktopWidget return as information about your setup ? What window manager are you using ?
-
wrote on 22 Sept 2016, 10:00 last edited by
I'm using a workaround:
first of all I put my screen far away from the main screen (virtual screen position offset to at least one screen size in any dimension so I don't accidentally get tooltips on top of my image).
Then I put the secondary window to this screen via moveframe and set it to the screen resolution imitating a borderless fullscreen mode.
Finally I set the SplashScreen flag so nothing gets on top of the image. Still, it's not the solution I hoped for since I have to figure out the position and the resolution of the second screen myself instead of put the window to a specific screen and tell it to be fullscreen there but it works.Thank you for your help,
Stas