[RFC] Fixing the QT_QPA_PLATFORM dilemma

Martin Flöser mgraesslin at kde.org
Tue Oct 10 17:35:43 UTC 2017


Hi Plasmates,

on Wayland we use QT_QPA_PLATFORM=wayland to force all Qt applications 
to use the Wayland QPA instead of the XCB QPA. This has a huge problem: 
Qt does not ship Wayland in their installers. So any application which 
bundles Qt itself is not going to start on a Plasma/Wayland session.

For example:

----
martin at martin-yoga:~/Apps/Telegram$ ./Telegram
This application failed to start because it could not find or load the 
Qt platform plugin "wayland"
in "".

Available platform plugins are: xcb.

Reinstalling the application may fix this problem.
---

That's the variant when you start through konsole. If you start through 
GUI the reaction is: nothing.

I think that's a show stopper for switching to Wayland. Given that I 
propose that we undo the export of QT_QPA_PLATFORM env variable. But 
that will mean that our own apps will pick xcb instead of Wayland. That 
also sucks.

The obvious thing to do is make Qt pick the proper platform plugin. But 
that won't fix any application out there and also will only help once 
the next Qt developer release becomes stable and reaches our users. And 
that can be measured in C14 as Marco put it the other day.

On the other hand: we do have all the information. There is a very 
simple check to see on which platform we are:
  * XDG_SESSION_TYPE==wayland -> wayland
  * DISPLAY exported -> xcb
  * WAYLAND_DISPLAY exported -> wayland
  * WAYLAND_DISPLAY and DISPLAY exported -> wayland+xwayland or 
xcb+nested wayland

Based on that we can detect whether we are on Wayland and could pick the 
Wayland platform (and should check whether the QPA plugin is installed).

The only problem is how to do it:
  * our platform theme plugin is too late :-(
  * kdeinit could be an option - random Qt apps would stay on XCB
  * we could do LD_PRELOAD hacks - would work but I dislike the approach
  * add API to KGuiAddons and patch all apps
  * any other idea?

In addition we should fix Qt.

So what do you think? Do you agree that we should unset the variable 
again and do you have any preferences on a plan of action?

Cheers
Martin


More information about the Plasma-devel mailing list