summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAssam Boudjelthia <[email protected]>2025-06-27 16:34:31 +0300
committerAssam Boudjelthia <[email protected]>2025-06-29 22:47:00 +0000
commitfc0c1d8641e63b5cae9009f27c72eb4c30df11da (patch)
tree32c9731e23183b84f101193fbbfe9be1dbbed6b9 /src
parent4fb3927503672def5a6914eb6c9fb7187bb7e356 (diff)
Fix JNI snippet code compile errorsHEADdev
Add needed includes and leave out Java code. Amends 6a49c7f19f514056a7029de6ae04b424e5affc5a. Task-number: QTBUG-137566 Change-Id: I0bbefb406be8eca1c079bf1b8c3583a67380d495 Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/doc/snippets/jni/src_qjniobject.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/doc/snippets/jni/src_qjniobject.cpp b/src/corelib/doc/snippets/jni/src_qjniobject.cpp
index 33221405220..ab1a1b5ca03 100644
--- a/src/corelib/doc/snippets/jni/src_qjniobject.cpp
+++ b/src/corelib/doc/snippets/jni/src_qjniobject.cpp
@@ -1,8 +1,13 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtCore/qglobal.h>
+#include <QtCore/qdebug.h>
#if defined(Q_QDOC) || defined(Q_OS_ANDROID)
+
+#include <QtCore/qjniobject.h>
+#include <QtCore/qjnitypes.h>
+
//! [QJniObject scope]
void functionScope()
{
@@ -13,7 +18,8 @@ void functionScope()
myJString = string.object<jstring>();
}
- // Ops! myJString is no longer valid.
+ // Ops! myJString is no longer valid.
+ QString myQtString = QJniObject(myJString).toString();
}
//! [QJniObject scope]
@@ -47,6 +53,7 @@ void foo()
}
//! [C++ native methods]
+#if 0 // Java code
//! [Java native methods]
class FooJavaClass
{
@@ -63,5 +70,6 @@ private static native void callNativeTwo(int x);
}
//! [Java native methods]
+#endif
#endif