简体   繁体   中英

How to determine if application is running on X11 platform on Qt6?

I am working to port a Qt5 application to Qt6. Since Qt X11 Extras module is removed in Qt6 and I have to check if the platform is X11 , how do I do that?

This is what the current implementation is using.

 if (QX11Info::isPlatformX11())
    {
        ...
        ...
    }

I have other use cases of QX11Info class as well. How do I port this? I don't seem to find any other solution.

QGuiApplication::platformName() check should be fine, see https://doc.qt.io/qt-6/qguiapplication.html#platformName-prop

BTW, QX11Info and other things in QtX11Extras were moved into QtGui(dev branch, 6.2), see also https://codereview.qt-project.org/c/qt/qtbase/+/348530 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM