aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidextras/doc
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2013-09-27 16:25:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-29 10:42:12 +0100
commitdf30d6777be1ede1cd1b529341c96ed40aa34b37 (patch)
tree98e1e8d4c6a6338bdb4f4a20e0c3d9d48024d89c /src/androidextras/doc
parentc1d9cc68c7a70fe3a61a0b21b57bf4afd990e564 (diff)
Update documentation
- The list of examples was not showing in the index page. - Added information about types, method signatures, J2N and GC. - Fixed some typos. Change-Id: Ibe66ddbc0b1cac323563d629ca82bfe54d69dfc1 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/androidextras/doc')
-rw-r--r--src/androidextras/doc/qtandroidextras.qdocconf8
-rw-r--r--src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp52
-rw-r--r--src/androidextras/doc/src/qtandroidextras-examples.qdoc36
-rw-r--r--src/androidextras/doc/src/qtandroidextras-index.qdoc9
-rw-r--r--src/androidextras/doc/src/qtandroidextras-module.qdoc3
5 files changed, 99 insertions, 9 deletions
diff --git a/src/androidextras/doc/qtandroidextras.qdocconf b/src/androidextras/doc/qtandroidextras.qdocconf
index c69586c..8992696 100644
--- a/src/androidextras/doc/qtandroidextras.qdocconf
+++ b/src/androidextras/doc/qtandroidextras.qdocconf
@@ -24,18 +24,16 @@ qhp.QtAndroidExtras.subprojects.classes.title = C++ Classes
qhp.QtAndroidExtras.subprojects.classes.indexTitle = Qt Android Extras C++ Classes
qhp.QtAndroidExtras.subprojects.classes.selectors = class fake:headerfile
qhp.QtAndroidExtras.subprojects.classes.sortPages = true
-
-tagfile = ../../../doc/qtandroidextras/qtandroidextras.tags
+qhp.QtAndroidExtras.subprojects.examples.title = Examples
+qhp.QtAndroidExtras.subprojects.examples.indexTitle = Qt Android Extras Examples
+qhp.QtAndroidExtras.subprojects.examples.selectors = fake:example
depends += qtcore qtdoc
-
headerdirs += ..
sourcedirs += ..
exampledirs += ../../../examples/androidextras \
- ../ \
snippets
-excludedirs += ../../../examples/widgets/doc
imagedirs += images
navigation.landingpage = "Qt Android Extras"
navigation.cppclassespage = "Qt Android Extras C++ Classes"
diff --git a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
index 899ca74..1388873 100644
--- a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
+++ b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
@@ -81,3 +81,55 @@ void function()
}
}
//! [Check for exceptions]
+
+//! [Registering native methods]
+static void fromJavaOne(JNIEnv *env, jobject thiz, jint x)
+{
+ Q_UNUSED(env)
+ Q_UNUSED(thiz)
+ qDebug() << x << "< 100";
+}
+
+static void fromJavaTwo(JNIEnv *env, jobject thiz, jint x)
+{
+ Q_UNUSED(env)
+ Q_UNUSED(thiz)
+ qDebug() << x << ">= 100";
+}
+
+void registerNativeMethods() {
+ JNINativeMethod methods[] {{"callNativeOne", "(I)V", reinterpret_cast<void *>(fromJavaOne)},
+ {"callNativeTwo", "(I)V", reinterpret_cast<void *>(fromJavaTwo)}};
+
+ QAndroidJniObject javaClass("my/java/project/FooJavaClass");
+ QAndroidJniEnvironment env;
+ env->RegisterNatives(env->GetObjectClass(javaClass),
+ methods,
+ sizeof(methods) / sizeof(methods[0]));
+
+}
+
+void foo()
+{
+ QAndroidJniObject::callStaticMethod("my/java/project/FooJavaClass", "foo", "(I)V", 10); // Output: 10 < 100
+ QAndroidJniObject::callStaticMethod("my/java/project/FooJavaClass", "foo", "(I)V", 100); // Output: 100 >= 100
+}
+
+//! [Registering native methods]
+
+//! [Java native methods]
+class FooJavaClass
+{
+ public static void foo(int x)
+ {
+ if (x < 100)
+ callNativeOne(x);
+ else
+ callNativeTwo(x);
+ }
+
+private static native void callNativeOne(int x);
+private static native void callNativeTwo(int x);
+
+}
+//! [Java native methods]
diff --git a/src/androidextras/doc/src/qtandroidextras-examples.qdoc b/src/androidextras/doc/src/qtandroidextras-examples.qdoc
new file mode 100644
index 0000000..725641e
--- /dev/null
+++ b/src/androidextras/doc/src/qtandroidextras-examples.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \group examples-qtandroidextras
+ \title Qt Android Extras Examples
+ \brief Examples in the Qt Android Extras module.
+ \ingroup all-examples
+
+ These are the examples available in the \l{Qt Android Extras} module.
+
+ \note These examples will only work on Android.
+*/
diff --git a/src/androidextras/doc/src/qtandroidextras-index.qdoc b/src/androidextras/doc/src/qtandroidextras-index.qdoc
index cf7d3df..74ca249 100644
--- a/src/androidextras/doc/src/qtandroidextras-index.qdoc
+++ b/src/androidextras/doc/src/qtandroidextras-index.qdoc
@@ -40,8 +40,7 @@
#include <QtAndroidExtras>
\endcode
- To link against the module, add this line to your \l qmake \c
- .pro file:
+ To link against the Qt Android Extras module, add this line to your project file:
\code
QT += androidextras
@@ -53,4 +52,10 @@
\list
\li \l{Qt Android Extras C++ Classes}{C++ Classes}
\endlist
+
+ \section1 Examples
+
+ \list
+ \li \l{Qt Android Extras Examples}
+ \endlist
*/
diff --git a/src/androidextras/doc/src/qtandroidextras-module.qdoc b/src/androidextras/doc/src/qtandroidextras-module.qdoc
index badb8a7..8a5eccb 100644
--- a/src/androidextras/doc/src/qtandroidextras-module.qdoc
+++ b/src/androidextras/doc/src/qtandroidextras-module.qdoc
@@ -40,8 +40,7 @@
#include <QtAndroidExtras>
\endcode
- To link against the module, add this line to your \l qmake \c
- .pro file:
+ To link against the Qt Android Extras module, add this line to your project file:
\code
QT += androidextras