Details
-
Epic
-
Resolution: Done
-
P1: Critical
-
6.0
-
Platform APIs revamp
Description
We currently have many different ways of accessing platform specific functionality in Qt. Let's try to clean up/unify things a bit in Qt 6.
What we have
QPlatformNativeInterface
Non-typed access to platform internals. Private API.
QtPlatformHeaders
Non-source or binary compatible helper functions to maniplulate QWindow (and a few other classes) in platform specific ways. Implemented via many layers of indirection via QPlatformNativeInterface to end up in the platform plugin.
QFooExtras
A kitchen sink / dumping ground for any functionality that didn't fit elsewhere in Qt (at that point). Ends up stale over time, and discourages integrating the concepts in Qt in a cross platform way.
Type conversions
E.g. https://doc.qt.io/qt-5/qtwinextras-overview.html#type-conversion, QPixmap to HBITMAP and back. Similar functions for macOS. Nowadays lives with QImage, as QImage::toNSImage(), etc.
Simple (one-line even) wrappers around native APIs
Should just use native APIs. Don't be afraid to mix and match. Qt can't (and shouldn't) do everything, and using Qt with other platform or 3rd party libraries should be possible and easy.
Helper functions to maniplulate QWindow and friends
Similar to QtPlatformHeaders
QX11Info
Warning: This class is only available on X11. For querying per-screen information in a portable way, use QDesktopWidget.
Yepp, time to modernize
QOpenGLContext's nativeHandle QVariant
The "winId" of QOpenGLContext, but via QVariant, resulting in awkward wrappers like QCocoaNativeContext
QMacNativeWidget and QMacCocoaViewContainer
Should already be possible with winId and fromWinId, and those should Just WorkTM. We don't want wrapper classes with every permutation of QSomePlatformNativeSomeQtFramework, eg QWinNativeQuickItem, QXCBNative3DNode, QWaylandNativeGraphicsViewItem etc etc.
What we want
- Type conversions close to their class for easy discoverability
- A single way to tweak QtGui classes in platform specific ways
- Move "solutions" and nice-to-have helper classes to Qt proper as cross platform APIs if possible
- Allow people to use winId and similar through a unified API to integrate with native APIs
- Remove simple single-line wrappers that people should be able to do easily with native APIs themselves
Possible solution
Type conversions
With the class, QImage::toNSImage.
Platform specific manipulation of QWindow and friends
QPlatformWindow, cast to your platform. No source or binary compat. Requires platform plugin to be a library with headers. Shouldn't be a problem. Platform plugin is just thin loading shim. Or not even needed on platforms with only a single platform plugin.
Window embedding
QWindow::toNSView (or winId), fromWinId.
Attachments
Issue Links
- relates to
-
QTBUG-79244 Function QtAndroid::unbindService doesn't exist
-
- Reported
-
-
QTBUG-84382 QtAndroidExtras in Qt 6
-
- Closed
-
-
QTBUG-72086 Qt for Mobile - Improving the cross-platform usability
-
- Closed
-
-
QTBUG-32967 Android: Application Settings Menu for Preferences
-
- Reported
-
- resulted from
-
QTBUG-81876 Research on how to re-organize the Extras [Spike]
-
- Closed
-
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
Gerrit Reviews
For Gerrit Dashboard: QTBUG-80233 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
295660,16 | Move QMacInternalPasteboardMime to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295662,13 | Move QRasterBackingStore to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295663,14 | Move QtVulkanSupport into QtGui and QtOpenGL | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295664,15 | Move FreeType font engine/database to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295665,15 | Move CoreText font engine/database to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295698,10 | Move QtPlatformCompositorSupport into QtOpenGL | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295701,11 | Move QtAccessibilitySupport into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295717,9 | Move QAbstractFileIconEngine into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295720,12 | Move macOS print support from platform plugin into QtPrintSupport | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295824,11 | macOS: Build print support plugin directly into QtPrintSupport | dev | qt/qtbase | Status: MERGED | +2 | 0 |
295888,9 | macOS: Move platform plugin into QtGui | dev | qt/qtbase | Status: ABANDONED | +1 | 0 |
299982,3 | Remove deprecated functionality | dev | qt/qtmacextras | Status: MERGED | +2 | 0 |
299987,3 | Remove needless indirection via QPlatformNativeInterface | dev | qt/qtmacextras | Status: MERGED | +2 | 0 |
300106,3 | Remove QPlatformNativeInterface functions for CGImage conversion | dev | qt/qtbase | Status: MERGED | +2 | 0 |
300233,6 | Simplify QMainWindow::setUnifiedTitleAndToolBarOnMac | dev | qt/qtbase | Status: MERGED | +2 | 0 |
300245,8 | macOS: Remove QMenu indirection via QPlatformNativeInterface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
300319,5 | macOS: Get rid of QCocoaWindowFunctions | dev | qt/qtbase | Status: MERGED | +2 | 0 |
301717,5 | Move windowsuiautomation API support into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
302149,16 | Move windows font databases into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
302158,10 | Move the Windows Event Dispatcher into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
302253,14 | Windows font databases: Enable DirectWrite for cmake | dev | qt/qtbase | Status: MERGED | +2 | 0 |
302299,8 | Fix Windows Font database code to use configure features | dev | qt/qtbase | Status: MERGED | +2 | 0 |
302300,1 | Windows font databases: Enable DirectWrite for cmake | dev | qt/qtbase | Status: ABANDONED | 0 | 0 |
302337,4 | WIP: Windows QPA: Prepare plugin for moving into QtGui | dev | qt/qtbase | Status: DEFERRED | -2 | 0 |
303820,4 | Move the UNIX event dispatchers into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
303834,4 | Adapt to moving EventDispatchers to QtGui | dev | qt/qtwayland | Status: MERGED | +2 | 0 |
304107,1 | Adapt to moving font databases to QtGui | dev | qt/qtwayland | Status: ABANDONED | 0 | 0 |
304110,2 | Move Unix font databases into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
304346,9 | Move UNIX services into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
304789,2 | sync.profile: Remove obsolete modules | dev | qt/qtbase | Status: MERGED | +2 | 0 |
304815,9 | Move UNIX themes into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
304867,2 | QtGui: Fix duplication of logging category lcQpaFonts | dev | qt/qtbase | Status: MERGED | +2 | 0 |
304980,6 | Adapt to moving of UNIX services/themes into QtGui | dev | qt/qtwayland | Status: MERGED | +2 | 0 |
305191,2 | sync.profile: Remove obsolete modules | wip/qt6_snapshot | qt/qtbase | Status: MERGED | +2 | 0 |
306226,3 | Move the EDID parser into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
306564,8 | Move linuxaccessibility to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
306594,2 | SPI Accessibility: Remove global variable | dev | qt/qtbase | Status: MERGED | +2 | 0 |
306601,19 | Adapt to recent qtbase changes and update dependencies | dev | qt/qtwayland | Status: MERGED | +2 | 0 |
306682,5 | Move xkbcommon to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
307088,2 | Make QGuiApp::platform(Function|NativeInterface) internal | dev | qt/qtbase | Status: MERGED | +2 | 0 |
307242,2 | Move qglxconvenience to QtOpenGL | dev | qt/qtbase | Status: MERGED | +2 | 0 |
307316,12 | Move eglconvenience to QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
307367,2 | Move glxconvenience into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
307700,2 | Remove linuxofono | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308099,5 | Add QPlatformInterface::Private::QWindowsWindow | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308132,4 | Add QXcbScreen platform interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308137,2 | Add QXcbWindow platform interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308140,3 | Add QEvdevKeyMapper platform interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308222,5 | Start the native interface QWindowsApplication | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308347,3 | Windows QPA: Move the touch types API from platformheaders into QtGui | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308358,2 | Add Q_GADGET to QT_DECLARE_PLATFORM_INTERFACE | dev | qt/qtbase | Status: ABANDONED | 0 | 0 |
308368,3 | Manual touch test: Add a settings dialog for windows | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308594,2 | Windows QPA: Move window properties to the new interfaces | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308595,3 | Windows QPA: Move dark mode handling to the new interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308674,8 | Document native interfaces | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308717,5 | Windows QPA: Move some internal functions to the new interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308762,4 | Windows QPA: Move mime-type related classes to the new interface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308764,2 | qtdiag/Windows: Use GPU information from the new native interface | dev | qt/qttools | Status: MERGED | +2 | 0 |
308766,3 | Remove QWinMime | dev | qt/qtwinextras | Status: MERGED | +2 | 0 |
308769,2 | Merge remote-tracking branch 'origin/wip/cmake' into dev | dev | qt/qtwinextras | Status: MERGED | +2 | 0 |
308955,5 | Remove QWaylandWindowFunctions | dev | qt/qtbase | Status: MERGED | +2 | 0 |
308957,10 | Remove last remaining bits of QtPlatformHeaders | dev | qt/qtbase | Status: MERGED | +2 | 0 |
311513,7 | Add QOffScreenSurface platform API abstraction | dev | qt/qtbase | Status: MERGED | +2 | 0 |
311908,4 | Remove QMacNativeWidget and QMacCocoaViewContainer | dev | qt/qtbase | Status: MERGED | +2 | 0 |
313130,2 | Port the asyncExose setting to use the native interface of Qt 6 | dev | qt/qtactiveqt | Status: MERGED | +2 | 0 |
315016,5 | Windows: Build print support plugin directly into QtPrintSupport | dev | qt/qtbase | Status: MERGED | +2 | 0 |
315078,2 | QWindowsPrintDevice: Brush up the code | dev | qt/qtbase | Status: MERGED | +2 | 0 |
315097,2 | QWindowsPrintDevice: Fix signedness warnings | dev | qt/qtbase | Status: MERGED | +2 | 0 |
348530,4 | Move QtX11Extras into QtGui as private API | dev | qt/qtbase | Status: MERGED | +2 | 0 |
348533,6 | Remove module and add note about current status in Qt 6 | dev | qt/qtx11extras | Status: MERGED | +2 | 0 |
348570,2 | macOS: Remove MIME plumbing from QCocoaNativeInterface | dev | qt/qtbase | Status: MERGED | +2 | 0 |
348678,2 | Remove qtmacextras and qtx11extras submodules | dev | qt/qt5 | Status: MERGED | +2 | 0 |
348721,18 | Remove QtAndroidExtras module and add note about its state in Qt 6 | dev | qt/qtandroidextras | Status: MERGED | +2 | 0 |
349552,2 | Remove QtX11Extras, QtMacExtras | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
352214,3 | Expose the native interfaces of QScreen/QWindow | dev | qt/qtbase | Status: MERGED | +2 | 0 |
357145,3 | Remove QtAndroidExtras module and add note about its state in Qt 6 | 6.2 | qt/qtandroidextras | Status: MERGED | +2 | 0 |
360127,9 | Add Extras modules porting guide | dev | qt/qtdoc | Status: MERGED | +2 | 0 |
360621,2 | Add Extras modules porting guide | 6.2 | qt/qtdoc | Status: MERGED | +2 | 0 |
389224,4 | Update docs after removal of QWindowsFunctions::setHasBorderInFullScreen | dev | qt/qtdoc | Status: MERGED | +2 | 0 |
398465,2 | Update docs after removal of QWindowsFunctions::setHasBorderInFullScreen | 6.2 | qt/qtdoc | Status: MERGED | +2 | 0 |
398466,2 | Update docs after removal of QWindowsFunctions::setHasBorderInFullScreen | 6.3 | qt/qtdoc | Status: MERGED | +2 | 0 |