How to start separate Qt applications on two independent displays

Dear Toradex experts,

I need advices on Wayland/EGLFS/QT. I am using Verdin Development Board with two HDMI display output (HDMI, HDMI via MIPI DSI). The OS is Yocto (Toradex EmbeddedLinux Reference Multimedia Image). My goal is to launch two separate Qt applications as full screen on each of HDMI displays.

After power-up, Weston desktop appears on each display. The two display screens are connected as I can move over the mouse.
To check if I can specify the target display of Qt application, I login to the Linux with putty, and executed /usr/share/qtsmarthome-1.0/smarthome. The program always show up in the default HDMI display (HDMI via DSI - card0-HDMI-A-1) instead of card0-HDMI-A-2.

I tried the followings before launching the program.

  • set Wayland environment variables (WAYLAND_DISPLAY, DISPLAY)
  • set Qt environment variables (QT_QPA_PLATFORM, QT_QPA_EGLFS_KMS_CONFIG)
  • edit Weston configuration file - /etc/xdg/weston/weston.ini
    but nothing seems to be effective.

My questions are

  1. Is there any way to control the target display when Qt program is launched?
  2. What platform should be set for QT_QPA_PLATFORM? Setting eglfs gives error.

Hi @kazu , sorry for the late reply, this fell under my radar. Let me check and we will get back you you. I remember doing this some time ago (but with direct frame buffer and EGLFS).


Hi @kazu, I could check the following:

  1. Because Wayland probably wraps everything together so you should control this within your Qt application. Did you check this example from Qt for multiscreen in Wayland?
  2. You should still use Wayland, so the default QT_QPA_PLATFORM is fine. EGLFS is not added by default to our BSP.

Kind regards,

Hi @alvaro.tx ,

Thank you for response and suggestion. Unfortunately, we use Qt Widget instead of QML for the application program. So, QML example of Qt Wayland is not applicable. It may be possible to select screen or move the screen position in Qt Widget. On Toradex Yocto, wayland, wayland-egl and xcb seem to be supported as QT_QPA_PLATFORM.


Thanks for the answer @kazu. Just to understand the situation, you can create a Qt Widget application that you can move freely between both screens, right? (Like have half of the application in one screen, and another half in the other one).

So it would be a matter to have 2 application start at each screen, correct?

What is the screenWidth and screenHeight value for the following code?

int screenWidth;
int screenHeight;

QApplication *desktop = QApplication::desktop();

screenWidth = desktop->width();
screenHeight = desktop->height();

*In Qt 6, it seems QApplication::desktop() was deprecated…

QList <QScreen*> screens = QGuiApplication::screens();

what value does screens.count return? Does it detect it has 2?

If Qt detects both screens, then you should run the application in each screen with setScreen or setGeometry. Maybe this helps.


Hi @alvaro.tx ,

Thank you for the additional information. I have not tested it myself yet. but saw some discussions like below.

A mouse can be moved across the two HDMI displays now. In the real implementation, the external displays will be LVDS and RGB with different resolution. We have legacy application with Qt5, and Qt6 won’t be used.
I will post it once I successfully experiment it.


1 Like

Hello, I have conducted some testings with Qt5.14 program.
Two HDMI displays of the same resolution are connected to Verdin development board.
By default, Weston desktop appears on each display.


two screens detected. QGuiApplication::screens().size() works.
cannot show a widget in a selected screen. It shows up in a main screen.
setScreen() is executed, but has no effect.
cannot move widget across screens (can do it with a mouse. but not by program).
setGeometry() does not work across the screens.

same as above except that setGeometry() can be used to move a widget from one screen to the other screen.

other findings

showFullScreen is only effective on main screen.
main display seems to be changed by mouse click.

Here are the test programs I use.

use_setScreen_to_show_a_widget_on_selected_screen(not working).cpp (1.7 KB)
move_a_widget_from_a_screen_to_the_other.cpp (1.7 KB)

1 Like

Hi @kazu , thanks for the detailed test information. We will try to do some checks here, but since this seems to be related to the Qt application configuration, did you also publish this on the Qt Forum?

Hopefully they can also help from there:

Kind regards,

Hi @alvaro.tx
I agree. It is more related to Qt 's restriction than how Wayland is configured.
I have posted the same information here as a reply to the existing post.
Choosing startup screen in Weston + Wayland | Qt Forum

Hi @kazu , thanks for the infomation. We have been making some tests and we have replicated your issue. We are also trying to contact Qt from other non-standard channels to see if they have a solution.

So far, it seems xcb might be the solution to go… Any reason why you want to avoid this? The performance might not be as good as wayland-egl, but should be good enough in many cases.

Kind regards,

Hi @alvaro.tx ,

Thank you for testing and contacting Qt team.
setGeometry appears to be quite ad-hoc, and xcb is not yet a final solution until it is fully tested. e.g. - two displays with different resolution, hiding a weston tool bar on the secondary screen, and so on.

Best Regards,

1 Like

Hi @kazu, any improvement so far with this issue from your side?

Unfortunately we don’t bring the best news. We have been asking around and we could compile the following advice:

  • Check with the debug flag (QT_QPA_EGLFS_DEBUG) in case there is something that could help debug the issue.
  • Hire Qt’s professional services
  • Hire a professional consultation with one of our partners.

Let me know if there is something else we can do.

Kind regards,

Hi @alvaro.tx ,

Thank you for all the efforts for my question. We slow down a bit on the this problem recently, but will continue to investigate. If we find something new, I will post it for the community.

Best Regards,

Hi @kazu , just FYI, it seems another customer work-arounded this using weston app-ids:

Kind regards,

Hi @alvaro.tx,

Thank you for the information. I tried with two HDMI displays with different resolutions. The app-id and kiosk-mode perfectly worked without the help of xcb platform. BTW, if only one display is connected and detected, both applications will be launched on the same display regardless of the configuration in weston.ini file.

Best Regards,

1 Like