Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-103856

Add replacement for some QX11Info alternatives to Qt6 porting guide

XMLWordPrintable

    • Linux/X11
    • c4ce5d64ed (qt/qtdoc/dev) 86cead92ae (qt/qtdoc/6.4) 86cead92ae (qt/tqtc-qtdoc/6.4) c4ce5d64ed (qt/tqtc-qtdoc/dev) 7f4e611401 (qt/tqtc-qtdoc/6.2) 86cead92ae (qt/qtdoc/6.4.1) 86cead92ae (qt/tqtc-qtdoc/6.4.1)

      The porting guide at https://doc.qt.io/qt-6/extras-changes-qt6.html#changes-to-qt-x11-extras is only talking about including the QtGui/private/qtx11extras_p.h private header to be able to use QX11Info.

      However, as we (thanks to David Redondo ) found out while porting the KDE Frameworks to Qt6, there are viable alternatives to some of the functionality of QX11Info that can be used instead of relying on private API:

      • QX11Info::isPlatformX11() can be replaced by checking `QGuiApplication::platformName() == "xcb"
      • QX11Info::display() and QX11Info::connection() can be replaced by using QGuiApplication::nativeInterface():
        auto *nativeInterface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
        if (nativeInterface) { auto *xdisplay = nativeInterface->display(); auto *xconnection = nativeInterface->connection(); .... .... }

        For Gerrit Dashboard: QTBUG-103856
        # Subject Branch Project Status CR V

            docteam Qt Documentation Team
            ahmad.samir Ahmad Samir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes