C
Android User Profiles example
Shows how to use User Profiles functionality from the QtAndroidAutomotive.Base module in a Qt Quick application.
Building and deploying the example
See specific steps relating to building and deploying Qt for Android Automotive examples.
Overview
This example shows how to create a Qt Quick application that uses the User Profiles functionality from the QtAndroidAutomotive.Base module.
Including the API
To use the User Profiles in QML, first, we have to import the QtAndroidAutomotive.Base module:
import QtAndroidAutomotive.Base
Accessing the current user name
To read the current user information it is enough to access the currentUser property of the AndroidUserProfiles singleton object:
Text { text: AndroidUserProfiles.currentUser.userName height: labelHeight font.pixelSize: fontPixelSize }
Invoking the User Properties view
Another feature of the API is showing the User Properties view, where the user can change the name.
Button { width: buttonWidth height: buttonHeight anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Show User Properties view") font.pixelSize: fontPixelSize onClicked: AndroidUserProfiles.showUserPropertiesView() }
Invoking the User Switch view
The API also offers the option of showing the User Switch view, where the current user can be changed.
Button { width: buttonWidth height: buttonHeight anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Show User Switcher view") font.pixelSize: fontPixelSize onClicked: AndroidUserProfiles.showUserSwitcherView() }
See also Qt for Android.
Available under certain Qt licenses.
Find out more.