Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt 5.7 How can I check value of variable QT_QPA_PLATFORM at runtime?

I know how to check default platform, but I need to check in my application if it run on X11 or Wayland. I try this:

QString platform = qgetenv("QT_QPA_PLATFORM");

but it returns an empty string.

On Weston when I run my application I set QT_QPA_PLATFORM to Wayland:

./myApp -platform wayland

but my QString platform is still empty, and default platform name doesn't change either.

like image 994
Magda Aarsman Avatar asked Mar 11 '23 15:03

Magda Aarsman


1 Answers

You're looking for QGuiApplication::platformName().

like image 90
peppe Avatar answered Apr 07 '23 06:04

peppe