Skip to content

Class AppInterface

ClassList > AppInterface

App interface made available in QML as iface .

  • #include <appinterface.h>

Inherits the following classes: QObject

Public Signals

Type Name
signal void executeAction (const QString & action)
Requests QField to execute a given action .
signal void importEnded (const QString & path=QString())
signal void importProgress (double progress)
signal void importTriggered (const QString & name)
signal void loadProjectEnded (const QString & path, const QString & name)
signal void loadProjectTriggered (const QString & path, const QString & name)
signal void openPath (const QString & path)
Requests QField to open its local data picker screen to show the path content.
signal void setMapExtent (const QgsRectangle & extent)
Requests QField to set its map to the provided extent .
signal void volumeKeyDown (int volumeKeyCode)
Emitted when a volume key is pressed while QField is set to handle those keys.
signal void volumeKeyUp (int volumeKeyCode)
Emitted when a volume key is pressed while QField is set to handle those keys.

Public Functions

Type Name
AppInterface (QgisMobileapp * app)
AppInterface ()
Q_INVOKABLE void addItemToCanvasActionsToolbar (QQuickItem * item) const
Q_INVOKABLE void addItemToDashboardActionsToolbar (QQuickItem * item) const
Q_INVOKABLE void addItemToMainMenuActionsToolbar (QQuickItem * item) const
Q_INVOKABLE void addItemToPluginsToolbar (QQuickItem * item) const
Q_INVOKABLE QVariantMap availableLanguages () const
Returns a list of available UI translation languages.
Q_INVOKABLE void clearProject () const
Q_INVOKABLE void closeSentry () const
Q_INVOKABLE QObject * findItemByObjectName (const QString & name) const
Q_INVOKABLE bool hasProjectOnLaunch () const
Returns TRUE is a project was passed on when launching QField.
Q_INVOKABLE void importUrl (const QString & url, bool loadOnImport=false)
Q_INVOKABLE void initiateSentry () const
Q_INVOKABLE bool isAuthenticationConfigurationAvailable (const QString & id) const
Q_INVOKABLE bool isFileExtensionSupported (const QString & filename) const
Returns TRUE if a given filename can be opened as a project or standalone dataset.
Q_INVOKABLE bool loadFile (const QString & path, const QString & name=QString())
Q_INVOKABLE void logMessage (const QString & message)
Q_INVOKABLE void logRuntimeProfiler ()
Q_INVOKABLE QObject * mainWindow () const
Q_INVOKABLE QObject * mapCanvas () const
Q_INVOKABLE QObject * positioning () const
Q_INVOKABLE bool print (const QString & layoutName)
Q_INVOKABLE bool printAtlasFeatures (const QString & layoutName, const QList< long long > & featureIds)
Q_INVOKABLE bool readProjectBoolEntry (const QString & scope, const QString & key, bool def=false) const
Q_INVOKABLE double readProjectDoubleEntry (const QString & scope, const QString & key, double def=0.0) const
Q_INVOKABLE QString readProjectEntry (const QString & scope, const QString & key, const QString & def=QString()) const
Q_INVOKABLE int readProjectNumEntry (const QString & scope, const QString & key, int def=0) const
Q_INVOKABLE void reloadProject ()
Reloads the currently opened project.
Q_INVOKABLE void removeRecentProject (const QString & path)
Removes a given project path from the recent projects list.
Q_INVOKABLE void sendLog (const QString & message, const QString & cloudUser)
Q_INVOKABLE void setScreenDimmerTimeout (int timeoutSeconds)

Public Signals Documentation

signal executeAction

Requests QField to execute a given action .

void AppInterface::executeAction;

signal importEnded

void AppInterface::importEnded;

Emitted when an import has ended.

Parameters:

  • path the path within which the imported dataset or project has been copied into

Note:

if the import was not successful, the path value will be an empty string


signal importProgress

void AppInterface::importProgress;

Emitted when an ongoing import reports its progress.

Note:

when an import is started, its progress will be indefinite by default


signal importTriggered

void AppInterface::importTriggered;

Emitted when a dataset or project import has been triggered.

Parameters:

  • name a indentifier-friendly string (e.g. a file being imported)

signal loadProjectEnded

void AppInterface::loadProjectEnded;

Emitted when a project loading has ended.


signal loadProjectTriggered

void AppInterface::loadProjectTriggered;

Emitted when a project has begin loading.


signal openPath

Requests QField to open its local data picker screen to show the path content.

void AppInterface::openPath;

signal setMapExtent

Requests QField to set its map to the provided extent .

void AppInterface::setMapExtent;

signal volumeKeyDown

Emitted when a volume key is pressed while QField is set to handle those keys.

void AppInterface::volumeKeyDown;

signal volumeKeyUp

Emitted when a volume key is pressed while QField is set to handle those keys.

void AppInterface::volumeKeyUp;

Public Functions Documentation

function AppInterface [1/2]

explicit AppInterface::AppInterface (
    QgisMobileapp * app
) 

function AppInterface [2/2]

inline AppInterface::AppInterface () 

function addItemToCanvasActionsToolbar

Q_INVOKABLE void AppInterface::addItemToCanvasActionsToolbar (
    QQuickItem * item
) const

Adds an item in the map canvas menu's action toolbar container


function addItemToDashboardActionsToolbar

Q_INVOKABLE void AppInterface::addItemToDashboardActionsToolbar (
    QQuickItem * item
) const

Adds an item in the dashboard's action toolbar container


function addItemToMainMenuActionsToolbar

Q_INVOKABLE void AppInterface::addItemToMainMenuActionsToolbar (
    QQuickItem * item
) const

Adds an item in the dashboard's action toolbar container

Note:

This function is deprecated and will be removed in the future, use the addItemToDashboardActionsToolbar function instead


function addItemToPluginsToolbar

Q_INVOKABLE void AppInterface::addItemToPluginsToolbar (
    QQuickItem * item
) const

Adds an item in the plugins toolbar container


function availableLanguages

Returns a list of available UI translation languages.

Q_INVOKABLE QVariantMap AppInterface::availableLanguages () const

function clearProject

Q_INVOKABLE void AppInterface::clearProject () const

Clears the currently opened project


function closeSentry

Q_INVOKABLE void AppInterface::closeSentry () const

Closes active sentry connection.


function findItemByObjectName

Q_INVOKABLE QObject * AppInterface::findItemByObjectName (
    const QString & name
) const

Returns the item matching the provided object name


function hasProjectOnLaunch

Returns TRUE is a project was passed on when launching QField.

Q_INVOKABLE bool AppInterface::hasProjectOnLaunch () const

function importUrl

Q_INVOKABLE void AppInterface::importUrl (
    const QString & url,
    bool loadOnImport=false
) 

Imports a compressed project from a given URL and place the content into the Imported Projects folder.

Parameters:

  • url the URL where the compressed project ZIP file is
  • loadOnImport set to TRUE to load the project on successful import

function initiateSentry

Q_INVOKABLE void AppInterface::initiateSentry () const

Initalizes sentry connection.


function isAuthenticationConfigurationAvailable

Q_INVOKABLE bool AppInterface::isAuthenticationConfigurationAvailable (
    const QString & id
) const

Returns TRUE if the authentication configuration id is available.


function isFileExtensionSupported

Returns TRUE if a given filename can be opened as a project or standalone dataset.

Q_INVOKABLE bool AppInterface::isFileExtensionSupported (
    const QString & filename
) const

function loadFile

Q_INVOKABLE bool AppInterface::loadFile (
    const QString & path,
    const QString & name=QString()
) 

Loads a project file or standalone dataset.

Parameters:

  • path the project file (.qgs or .qgz) or standalone dataset path
  • name a project name (if left empty, the project file will be used instead)

function logMessage

Q_INVOKABLE void AppInterface::logMessage (
    const QString & message
) 

Adds a log message that will be visible to the user through the message log panel, as well as added into the device's system logs which will be captured by the sentry's reporting framework when enabled.


function logRuntimeProfiler

Q_INVOKABLE void AppInterface::logRuntimeProfiler () 

Outputs the current runtime profiler model content into the message log panel, as well as added into the device's system logs which will be captured by the sentry's reporting framework when enabled.


function mainWindow

Q_INVOKABLE QObject * AppInterface::mainWindow () const

Returns the main window.


function mapCanvas

Q_INVOKABLE QObject * AppInterface::mapCanvas () const

Returns the main map canvas item.

See also: MapCanvas


function positioning

Q_INVOKABLE QObject * AppInterface::positioning () const

Returns the positioning item.

See also: Positioning


function print

Q_INVOKABLE bool AppInterface::print (
    const QString & layoutName
) 

Prints a project layout to PDF.

Parameters:

  • layoutName the layout name

function printAtlasFeatures

Q_INVOKABLE bool AppInterface::printAtlasFeatures (
    const QString & layoutName,
    const QList< long long > & featureIds
) 

Prints an atlas-driven project layout to PDF.

Parameters:

  • layoutName the layout name
  • featureIds the list of atlas feature IDs

function readProjectBoolEntry

Q_INVOKABLE bool AppInterface::readProjectBoolEntry (
    const QString & scope,
    const QString & key,
    bool def=false
) const

Reads a double from the specified scope and key.

Parameters:

  • scope entry scope (group) name
  • key entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
  • def default value to return if the specified key does not exist within the scope

function readProjectDoubleEntry

Q_INVOKABLE double AppInterface::readProjectDoubleEntry (
    const QString & scope,
    const QString & key,
    double def=0.0
) const

Reads a double from the specified scope and key.

Parameters:

  • scope entry scope (group) name
  • key entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
  • def default value to return if the specified key does not exist within the scope

function readProjectEntry

Q_INVOKABLE QString AppInterface::readProjectEntry (
    const QString & scope,
    const QString & key,
    const QString & def=QString()
) const

Reads a string from the specified scope and key.

Parameters:

  • scope entry scope (group) name
  • key entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
  • def default value to return if the specified key does not exist within the scope

function readProjectNumEntry

Q_INVOKABLE int AppInterface::readProjectNumEntry (
    const QString & scope,
    const QString & key,
    int def=0
) const

Reads an integer from the specified scope and key.

Parameters:

  • scope entry scope (group) name
  • key entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
  • def default value to return if the specified key does not exist within the scope

function reloadProject

Reloads the currently opened project.

Q_INVOKABLE void AppInterface::reloadProject () 

function removeRecentProject

Removes a given project path from the recent projects list.

Q_INVOKABLE void AppInterface::removeRecentProject (
    const QString & path
) 

function sendLog

Q_INVOKABLE void AppInterface::sendLog (
    const QString & message,
    const QString & cloudUser
) 

Sends a logs reporting through to sentry when enabled.


function setScreenDimmerTimeout

Q_INVOKABLE void AppInterface::setScreenDimmerTimeout (
    int timeoutSeconds
) 

Sets the screen drimmer timeout. Dimming can be disabled by setting the timeout to zero.

Parameters:

  • timeoutSeconds timeout in seconds


The documentation for this class was generated from the following file src/core/appinterface.h