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

QNativeInterface::QX11Application::display() example missing

    XMLWordPrintable

Details

    • Linux/X11

    Description

      I believe `QGuiApplication::nativeInterface<QNativeInterface::QX11Application>()` does not accurately document how to use this interface to get the XCB Display pointer.

      I looked into the tests and examples for how to use this, and came up empty.

      What I find lacking is that:

      From there, there is a very terse description that just says:

      Accessed through QGuiApplication::nativeInterface().
      

      Then, most importantly (and I still haven't solved this), https://doc.qt.io/qt-6/qnativeinterface-qx11application.html#display does not indicate when this call should return a valid xcb Display *. Whenever I have called this from a test application, it is always nullptr. I would have expected it to return a valid Display * after a window is displayed.

      To test this, I have altered the gui/analogclock example to fetch the Display * and print out it's pointer. I will attach that code to this example.

      I think it would also be good to provide some specific guidance on how to port old Qt 5 code that uses QX11Info::display() from the QtX11Extras to this new API in Qt 6.

      Attachments

        Issue Links

          Activity

            People

              docteam Qt Documentation Team
              kkyzivat Keith Kyzivat
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: