Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道如何检查默认平台,但我需要检查我的应用程序是否在 X11 或 Wayland 上运行。我试试这个:
QString platform = qgetenv("QT_QPA_PLATFORM");
但它返回一个空字符串。
在 Weston 上,当我运行我的应用程序时,我将 QT_QPA_PLATFORM 设置为 Wayland:
./myApp -platform wayland
但我的 QString 平台仍然是空的,默认平台名称也没有改变。
你正在寻找QGuiApplication::platformName().
QGuiApplication::platformName()