diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-01-08 13:35:28 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-28 16:52:41 +0100 |
| commit | 6d17bd91312bc1b37d7d591f849f733bb16e1cda (patch) | |
| tree | 2641022589909c3d2212cf6ca54d337c8229962e /sources/pyside6/PySide6/glue/qtgui.cpp | |
| parent | 4d761eaaf852f8d82925e111150f25c0dd5f3e83 (diff) | |
Add public native interface classes
Some native interface classes were included in public headers.
Task-number: PYSIDE-2497
Task-number: PYSIDE-1568
Change-Id: I2e61ed8cd1a8dfc7d5d04d2730d456ec800eb446
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index ed03a54c7..130de11bb 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -783,12 +783,45 @@ auto *cppResult = new QtGuiHelper::QOverrideCursorGuard(); Shiboken::Object::getOwnership(%PYARG_0); // Ensure the guard is removed // @snippet qguiapplication-setoverridecursor +// @snippet qguiapplication-nativeInterface +bool hasNativeApp = false; +#if QT_CONFIG(xcb) +if (auto *x11App = %CPPSELF.nativeInterface<QNativeInterface::QX11Application>()) { + hasNativeApp = true; + %PYARG_0 = %CONVERTTOPYTHON[QNativeInterface::QX11Application*](x11App); +} +#endif +if (!hasNativeApp) { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; +} +// @snippet qguiapplication-nativeInterface + // @snippet qscreen-grabWindow WId id = %1; %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id, %2, %3, %4, %5); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); // @snippet qscreen-grabWindow +// @snippet qscreen-nativeInterface +bool hasNativeScreen = false; +#ifdef Q_OS_WIN +if (auto *winScreen = %CPPSELF.nativeInterface<QNativeInterface::QWindowsScreen>()) { + hasNativeScreen = true; + %PYARG_0 = %CONVERTTOPYTHON[QNativeInterface::QWindowsScreen*](winScreen); +} +#endif +if (!hasNativeScreen) { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; +} +// @snippet qscreen-nativeInterface + +// @snippet qx11application-resource-ptr + auto *resource = %CPPSELF.%FUNCTION_NAME(); +%PYARG_0 = PyLong_FromVoidPtr(resource); +// @snippet qx11application-resource-ptr + // @snippet qwindow-fromWinId WId id = %1; %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id); |
