Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
org.qtproject.qt.android.QtQuickView Class Reference
Inheritance diagram for org.qtproject.qt.android.QtQuickView:
Collaboration diagram for org.qtproject.qt.android.QtQuickView:

Public Member Functions

 QtQuickView (Context context, String qmlUri, String appName) throws InvalidParameterException
 QtQuickView (Context context, String qmlUri, String appName, String[] qmlImportPaths) throws InvalidParameterException
 QtQuickView (Context context)
void setProperty (String propertyName, Object value)
int connectSignalListener (String signalName, Class<?>[] argTypes, Object listener)
boolean disconnectSignalListener (int signalListenerId)
QtQmlStatus getStatus ()
void setStatusChangeListener (QtQmlStatusChangeListener listener)
void invokeMethod (String methodName, Object[] params)
void invokeMethod (String methodName)

Protected Member Functions

void createWindow (long parentWindowReference)

Detailed Description

The QtQuickView class lets you easily add QML content to your Android app as a View. QtQuickView instantiates a QQuickView with a given QML component source URI path and embeds it inside itself. You can add it in your Android app's layout as with any other View. QtQuickView is a good choice when you want to extend your non-Qt Android app with QML content but do not want to make the entire app using the Qt framework. It brings the power of Qt Quick into your Android app, making it possible to use various Qt Quick APIs, in Android Java or Kotlin apps.

Known limitations:

  • Only CMake is supported, not qmake.
  • Only one QtQuickView can be added to your app, adding multiple outcomes unknown.
See also
Qt QQuickView

Definition at line 31 of file QtQuickView.java.

Constructor & Destructor Documentation

◆ QtQuickView() [1/3]

org.qtproject.qt.android.QtQuickView.QtQuickView ( Context context,
String qmlUri,
String appName ) throws InvalidParameterException
inline

Creates a QtQuickView to load and view a QML component. Instantiating a QtQuickView will load the Qt libraries, including the app library specified by appName. Then it creates a QQuickView that loads the QML source specified by qmlUri.

Parameters
contextthe parent Context
qmlUrithe URI of the main QML file
appNamethe name of the Qt app library to load and start. This corresponds to the target name set in Qt app's CMakeLists.txt
Exceptions
InvalidParameterExceptionif either qmlUri or appName is empty or null
See also
Qt QQuickView

Definition at line 63 of file QtQuickView.java.

References context(), and String.

Here is the call graph for this function:

◆ QtQuickView() [2/3]

org.qtproject.qt.android.QtQuickView.QtQuickView ( Context context,
String qmlUri,
String appName,
String[] qmlImportPaths ) throws InvalidParameterException
inline

Creates a QtQuickView to load and view a QML component. Instantiating a QtQuickView will load the Qt libraries, including the app library specified by appName. Then it creates a QQuickView that loads the QML source specified by qmlUri. This overload accepts an array of strings in the case where the QML application should load QML modules from custom paths.

Parameters
contextthe parent Context
qmlUrithe URI of the main QML file
appNamethe name of the Qt app library to load and start. This corresponds to the target name set in the Qt app's CMakeLists.txt
qmlImportPathsan array of strings for additional import paths to be passed to QQmlEngine, or null if additional import paths are not required
Exceptions
InvalidParameterExceptionif either qmlUri or appName is empty or null
See also
Qt QQmlEngine

Definition at line 83 of file QtQuickView.java.

References context(), and String.

Here is the call graph for this function:

◆ QtQuickView() [3/3]

org.qtproject.qt.android.QtQuickView.QtQuickView ( Context context)
inline

Creates a QtQuickView that can later load and view a QML component by calling loadContent(QtQuickViewContent, String[])

Parameters
contextthe parent Context

Definition at line 101 of file QtQuickView.java.

References context().

Here is the call graph for this function:

Member Function Documentation

◆ connectSignalListener()

int org.qtproject.qt.android.QtQuickView.connectSignalListener ( String signalName,
Class<?>[] argTypes,
Object listener )
inline

Connects a SignalListener to a signal of the QML root object. Will delay forming a connection until the root object is ready.

Parameters
signalNamethe name of the root object's signal
argTypesthe Class types of the signal arguments
listeneran instance of the QtSignalListener interface
Returns
a connection id between signal and listener or the existing connection id if there is an existing connection between the same signal and listener. Otherwise, a negative value is returned if the signal does not exist on the QML root object. Always returns true if the root object is not ready.

Definition at line 260 of file QtQuickView.java.

References Class, signalName(), and String.

Here is the call graph for this function:

◆ createWindow()

void org.qtproject.qt.android.QtQuickView.createWindow ( long parentWindowReference)
inlineprotected

Definition at line 181 of file QtQuickView.java.

◆ disconnectSignalListener()

boolean org.qtproject.qt.android.QtQuickView.disconnectSignalListener ( int signalListenerId)
inline

Disconnects a SignalListener with a given id obtained from QtQuickView#connectSignalListener(String, Class, QtSignalListener) or QtQuickView#connectSignalListener(String, Class[], Object) call, from listening to a signal.

Parameters
signalListenerIdthe connection id
Returns
Returns true if the connection id is valid and has been successfuly removed, otherwise returns false.

Definition at line 297 of file QtQuickView.java.

◆ getStatus()

QtQmlStatus org.qtproject.qt.android.QtQuickView.getStatus ( )
inline

Gets the status of the QML component.

Returns
Returns QtQmlStatus.READY when the QML component is ready. Invoking methods that operate on the QML root object QtQuickView#setProperty(String, Object), QtQuickView#getProperty(String), QtQuickView#connectSignalListener(String, Class, QtSignalListener) and QtQuickView#connectSignalListener(String, Class[], Object) would succeed only if the current status is READY. It can also return NULL, LOADING, or ERROR based on the status of the underlying QQuickView instance.
See also
QQuickView

Definition at line 320 of file QtQuickView.java.

◆ invokeMethod() [1/2]

void org.qtproject.qt.android.QtQuickView.invokeMethod ( String methodName)
inline

Invokes a QML method of the root object.

Parameters
methodNamename of the method
See also
QtQuickView.invokeMethod(String, Object[])

Definition at line 370 of file QtQuickView.java.

References methodName(), and String.

Here is the call graph for this function:

◆ invokeMethod() [2/2]

void org.qtproject.qt.android.QtQuickView.invokeMethod ( String methodName,
Object[] params )
inline

Invokes a QML method of the root object.

Supported parameter types are java.lang.Integer,java.lang.Double, java.lang.Float, java.lang.Boolean and java.lang.String. These types get converted to their corresponding types: int, double, real, bool, and string, respectively.

Parameters
methodNamename of the method
paramsarray of parameters that are passed to the method
See also
QML int
QML double
QML real
QML bool
QML string

Definition at line 358 of file QtQuickView.java.

References methodName(), and String.

Here is the call graph for this function:

◆ setProperty()

void org.qtproject.qt.android.QtQuickView.setProperty ( String propertyName,
Object value )
inline

Sets the value of an existing property on the QML root object. The supported types are java.lang.Integer, java.lang.Double, java.lang.Float, java.lang.Boolean and java.lang.String. These types get converted to their corresponding QML types int, double/float, bool and string. This function does not add properties to the QML root object if they do not exist, but prints a warning.

Parameters
propertyNamethe name of the existing root object property to set the value of
valuethe value to set the property to QML's int, double/float, bool or string
See also
QML int
QML double/float
QML bool
QML string

Definition at line 201 of file QtQuickView.java.

References String.

◆ setStatusChangeListener()

void org.qtproject.qt.android.QtQuickView.setStatusChangeListener ( QtQmlStatusChangeListener listener)
inline

Sets a QtQmlStatusChangeListener to listen to status changes.

Parameters
listeneran instance of a QtQmlStatusChangeListener interface

Definition at line 330 of file QtQuickView.java.


The documentation for this class was generated from the following file: