diff options
author | Tor Arne Vestbø <[email protected]> | 2025-03-27 11:12:31 +0100 |
---|---|---|
committer | Tor Arne Vestbø <[email protected]> | 2025-03-27 15:57:42 +0100 |
commit | cf8f9580da5414dfc3f79b4c83c6684497a3241c (patch) | |
tree | 060bf78b3d6bfc043123f702632dfcfbade4f7f8 | |
parent | 002badc3abdea577651b58c5d61c35ea7c38240a (diff) |
Cast NativeResourceForIntegrationFunction via QFunctionPointer
To fix warnings with Xcode 16.3:
/Users/torarne/dev/qt/qtbase/src/widgets/widgets/qtabbar.cpp:117:6: warning: cast from 'QPlatformNativeInterface::NativeResourceForIntegrationFunction' (aka 'void *(*)()') to 'SetContentBorderAreaEnabledFunction' (aka 'void (*)(QWindow *, unsigned long long, bool)') converts to incompatible function type [-Wcast-function-type-mismatch]
117 | (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(q->window()->windowHandle(), identifier, q->isVisible());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pick-to: 6.9 6.8
Change-Id: Ie7b5ace64c1aad5f970bc1a23e59c5724fcd92b5
Reviewed-by: Marc Mutz <[email protected]>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 12 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qtabbar.cpp | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbar.cpp | 3 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbarlayout.cpp | 6 |
6 files changed, 21 insertions, 16 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 58bda2706af..91032b24bed 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -60,17 +60,17 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource) { if (resource.toLower() == "registerdraggedtypes") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerDraggedTypes); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::registerDraggedTypes)); if (resource.toLower() == "registertouchwindow") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerTouchWindow); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::registerTouchWindow)); if (resource.toLower() == "setembeddedinforeignview") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setEmbeddedInForeignView); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::setEmbeddedInForeignView)); if (resource.toLower() == "registercontentborderarea") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerContentBorderArea); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::registerContentBorderArea)); if (resource.toLower() == "setcontentborderareaenabled") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setContentBorderAreaEnabled); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::setContentBorderAreaEnabled)); if (resource.toLower() == "testcontentborderposition") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::testContentBorderPosition); + return NativeResourceForIntegrationFunction(QFunctionPointer(QCocoaNativeInterface::testContentBorderPosition)); return nullptr; } diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 20530e067bc..749a4484a9c 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -437,7 +437,7 @@ static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY) return false; // Not Cocoa platform plugin. typedef bool (*TestContentBorderPositionFunction)(QWindow *, int); - return (reinterpret_cast<TestContentBorderPositionFunction>(function))(window, windowY); + return (reinterpret_cast<TestContentBorderPositionFunction>(QFunctionPointer(function)))(window, windowY); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 40894c28702..d3cf1587c45 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3234,8 +3234,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e) typedef void (*RegisterTouchWindowFn)(QWindow *, bool); case QEvent::Enter: if (w->testAttribute(Qt::WA_AcceptTouchEvents)) { - RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn> - (platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow")); + RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn>( + QFunctionPointer(platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"))); if (registerTouchWindow) registerTouchWindow(w->window()->windowHandle(), true); } @@ -3243,8 +3243,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; case QEvent::Leave: if (w->testAttribute(Qt::WA_AcceptTouchEvents)) { - RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn> - (platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow")); + RegisterTouchWindowFn registerTouchWindow = reinterpret_cast<RegisterTouchWindowFn>( + QFunctionPointer(platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"))); if (registerTouchWindow) registerTouchWindow(w->window()->windowHandle(), false); } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index b586a96e4d7..53d13ca2855 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -106,14 +106,16 @@ void QTabBarPrivate::updateMacBorderMetrics() if (!function) return; // Not Cocoa platform plugin. typedef void (*RegisterContentBorderAreaFunction)(QWindow *window, quintptr identifier, int upper, int lower); - (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(q->window()->windowHandle(), identifier, upper, lower); + (reinterpret_cast<RegisterContentBorderAreaFunction>(QFunctionPointer(function)))( + q->window()->windowHandle(), identifier, upper, lower); // Set visibility state function = nativeInterface->nativeResourceFunctionForIntegration("setContentBorderAreaEnabled"); if (!function) return; typedef void (*SetContentBorderAreaEnabledFunction)(QWindow *window, quintptr identifier, bool enable); - (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(q->window()->windowHandle(), identifier, q->isVisible()); + (reinterpret_cast<SetContentBorderAreaEnabledFunction>(QFunctionPointer(function)))( + q->window()->windowHandle(), identifier, q->isVisible()); #endif } diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index b8b462b03f8..66fdcf20d78 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -1000,7 +1000,8 @@ static void enableMacToolBar(QToolBar *toolbar, bool enable) return; // Not Cocoa platform plugin. typedef void (*SetContentBorderAreaEnabledFunction)(QWindow *window, void *identifier, bool enabled); - (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(toolbar->window()->windowHandle(), toolbar, enable); + (reinterpret_cast<SetContentBorderAreaEnabledFunction>(QFunctionPointer(function)))( + toolbar->window()->windowHandle(), toolbar, enable); } #endif diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index cc842e26574..a81155257b3 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -336,9 +336,11 @@ void QToolBarLayout::updateMacBorderMetrics() typedef void (*RegisterContentBorderAreaFunction)(QWindow *window, void *identifier, int upper, int lower); if (mainWindow->toolBarArea(tb) == Qt::TopToolBarArea) { - (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), tb, upper.y(), lower.y()); + (reinterpret_cast<RegisterContentBorderAreaFunction>(QFunctionPointer(function)))( + tb->window()->windowHandle(), tb, upper.y(), lower.y()); } else { - (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), tb, 0, 0); + (reinterpret_cast<RegisterContentBorderAreaFunction>(QFunctionPointer(function)))( + tb->window()->windowHandle(), tb, 0, 0); } #endif } |