Android: Add default template argument return type to AndroidBackendRegister

For AndroidBackendRegister::callInterface, it would be more convenient
to call simple functions without parameters, without being forced to
specify the void return type. Added a default void type argument for
the return type.

Change-Id: Ib7f631c172955cdf0b2e853155fd57c06bef9843
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Petri Virkkunen 2025-05-22 15:10:52 +03:00
parent 43e52253d5
commit 76bf2512e7
4 changed files with 7 additions and 7 deletions

View File

@ -105,7 +105,7 @@ public:
If the interface is not registered, a warning is printed and an empty object is returned.
*/
template <typename Interface, typename Ret, typename... Args,
template <typename Interface, typename Ret = void, typename... Args,
ValidInterfaceType<Interface> = true>
auto callInterface(const char *func, Args... args)
{

View File

@ -58,14 +58,14 @@ namespace QtAndroidInput
void resetSoftwareKeyboard()
{
AndroidBackendRegister *reg = QtAndroid::backendRegister();
reg->callInterface<QtJniTypes::QtInputInterface, void>("resetSoftwareKeyboard");
reg->callInterface<QtJniTypes::QtInputInterface>("resetSoftwareKeyboard");
qCDebug(lcQpaInputMethods) << "@@@ RESETSOFTWAREKEYBOARD";
}
void hideSoftwareKeyboard()
{
AndroidBackendRegister *reg = QtAndroid::backendRegister();
reg->callInterface<QtJniTypes::QtInputInterface, void>("hideSoftwareKeyboard");
reg->callInterface<QtJniTypes::QtInputInterface>("hideSoftwareKeyboard");
qCDebug(lcQpaInputMethods) << "@@@ HIDESOFTWAREKEYBOARD";
}

View File

@ -183,7 +183,7 @@ namespace QtAndroid
#if QT_CONFIG(accessibility)
void initializeAccessibility()
{
m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface, void>(
m_backendRegister->callInterface<QtJniTypes::QtAccessibilityInterface>(
"initializeAccessibility");
}

View File

@ -48,13 +48,13 @@ namespace QtAndroidMenu
void resetMenuBar()
{
AndroidBackendRegister *reg = QtAndroid::backendRegister();
reg->callInterface<QtJniTypes::QtMenuInterface, void>("resetOptionsMenu");
reg->callInterface<QtJniTypes::QtMenuInterface>("resetOptionsMenu");
}
void openOptionsMenu()
{
AndroidBackendRegister *reg = QtAndroid::backendRegister();
reg->callInterface<QtJniTypes::QtMenuInterface, void>("openOptionsMenu");
reg->callInterface<QtJniTypes::QtMenuInterface>("openOptionsMenu");
}
void showContextMenu(QAndroidPlatformMenu *menu, const QRect &anchorRect)
@ -75,7 +75,7 @@ namespace QtAndroidMenu
QMutexLocker lock(&visibleMenuMutex);
if (visibleMenu == menu) {
AndroidBackendRegister *reg = QtAndroid::backendRegister();
reg->callInterface<QtJniTypes::QtMenuInterface, void>("closeContextMenu");
reg->callInterface<QtJniTypes::QtMenuInterface>("closeContextMenu");
pendingContextMenus.clear();
} else {
pendingContextMenus.removeOne(menu);