AppFramework QML Type

Provides access to path settings, visual settings and OS information. More...

Import Statement: import ArcGIS.AppFramework 1.0

Properties

Signals

Methods

Detailed Description

The AppFramework component provides a number of miscellaneous functions to display information about the device or app, as well as to perform actions that need to be performed above other objects. The AppFramework component also contains functions to create a number of other component objects.

AppFramework is a singleton component, created on the app's launch. Individual instances of this component cannot be created.

The following code snippet explains the usage of AppFramework component, displaying in text the userHomePath and osVersion properties.

App {
    id: app;
    width: 800;
    height: 532;

    Text {
        id: titleText;

        anchors {
            left: parent.left;
            right: parent.right;
            top: parent.top;
            topMargin: 100;
        }

        Column {
            Text { font.pointSize: 15; text: "UserHomePath: " +AppFramework.userHomePath; }
            Text { font.pointSize: 15; text: "OS Version: " + AppFramework.osVersion; }
        }

        color: "#4c4c4c";
        horizontalAlignment: Text.AlignHCenter;
    }

}

Property Documentation

[read-only] availableLocaleNames : QStringList

Returns a list of available locale names.

ComboBox {
    model:AppFramework.availableLocaleNames
}

[read-only] buildAbi : string

Returns the full architecture string that the app was compiled for.

Text {
    text: AppFramework.buildAbi
}

[read-only] buildCpuArchitecture : string

Returns a string describing the architecture of the CPU that the app was compiled for.

Text {
    text: AppFramework.buildCpuArchitecture
}

[read-only] clipboard : Clipboard

If no clipboard object exists, creates a new clipboard object. Otherwise, returns the pre-existing clipboard object.


[read-only] currentCpuArchitecture : string

Returns a string describing the architecture of the CPU that the app is currently running on. Note that this function is dependent on what the OS reports, and may not describe the actual CPU architecture if the OS does not provide that information.

Text {
        text: AppFramework.currentCpuArchitecture
}

defaultLocale : string

Contains the default locale for an application. The default locale is the same as the systemLocale property.

This property accepts only correctly formatted locale codes.

AppFramework.defaultLocale = "fr_CA"; // sets the current locale to Canadian French
AppFramework.defaultLocale = AppFramework.systemLocale; // restores current locale to system locale

displayScaleFactor : double

Returns the device's scale factor, calculating it if necessary based on the screen's DPI.

Text {
    text:"Hello AppStudio!"
    font.pixelSize: 20 * AppFramework.displayScaleFactor
}

[read-only] environment : Environment

If no environment object exists, creates a new environment object. Otherwise, returns the pre-existing environment object.


importPathList : QStringList

Returns the list of directories where the engine searches for installed modules in a URL-based directory structure.

ComboBox {
        model:AppFramework.importPathList
}

[read-only] isOnline : bool

Returns true if the device is currently connected to a network. Otherwise, returns false.

This property will be deprecated soon, and should no longer be used. Instead, use the isOnline property in the Networking component.


[read-only] kernelType : string

Returns the type of operating system kernel Qt was compiled for. This will also usually be the kernel the application is running on. On Windows, this returns the type of Windows kernel, such as 'winnt'. On Unix systems, this returns the same name as the output of the command "uname -s".


[read-only] kernelVersion : string

Returns the release version of the operating system kernel. On Windows, this will return the version of the NT or CE kernel. On Unix systems (including Android and MacOS), this will return the same as the "uname -r" command would return.

If the version cannot be determined, returns an empty string.

Text {
        text:"OS Kernel is " + AppFramework.kernelType  + " and version is "+ AppFramework.kernelVersion
}

[read-only] logging : Logging

Creates and returns a new logging object.


[read-only] network : Network

Returns a network object, creating one if one does not exist.


offlineStoragePath : string

Returns the directory for storing offline user data.

Text {
    text: AppFramework.offlineStoragePath
}

[read-only] osDisplayName : string

Returns a form of the product version similar to that returned by osVersion, but containing other identifying tokens like operating system type and codenames. The resulting string is good to display to the user, but may be unsuitable for long-term storage.

If osVersion returns 'unknown', this will instead refer to the kernelType and kernelVersion properties.

Text {
    text: AppFramework.osDisplayName
}

[read-only] osName : string

Returns the product name of the operating system the application is running in.

Text {
    text: AppFramework.osName
}

[read-only] osVersion : string

Returns the product version of the operating system in string form. If this cannot be determined, returns 'unknown'.

Text{
    text: AppFramework.osVersion
}

[read-only] qtVersion : string

Returns the version number of Qt at run-time as a string.

Text {
    text: AppFramework.qtVersion
}

[read-only] settings : Settings

Returns a settings object, creating one if one does not exist.


[read-only] sslLibraryBuildVersion : string

Returns the version string of the SSL library in use. If no SSL support is available, returns an empty value.

Text {
    text: AppFramework.sslLibraryBuildVersion
}

[read-only] sslLibraryVersion : string

Returns the version number of the SSL library in use. If no SSL support is available, returns an empty value.

Text {
    text: AppFramework.sslLibraryVersion
}

[read-only] standardPaths : StandardPaths

Returns a StandardPaths object. If one does not exist, one will be created.


[read-only] systemInformation : object

Returns an object containing values with additional information about the platform the app is running on. This is useful for differentiating between different models running the same OS, such as between iPhones and iPads, or for providing information that may help distinguish what platform the device is.

Warning: Differentiation of Android hardware between ARM and x86 environments may not be possible. Instead, this will be reported based on the app's target environment.

Text {
    text: JSON.stringify(AppFramework.systemInformation, undefined, 2)
}

On an iOS device, this property returns something like this:

{
  "family": "tablet",
  "manufacturer": "Apple",
  "model": "iPad Mini",
  "unixMachine": "iPad5,4",
  "unixNodeName": "iPad-Mini-Name",
  "unixRelease": "17.4.0",
  "unixSysName": "Darwin",
  "unixVersion": "Darwin Kernel Version 17.4.0: Fri Dec 8 19:35:52 PST 2017; root:xnu-4570.40.9~1/RELEASE_ARM64_T7001"
}

While on an Android device, the results will resemble this:

{
  "family": "phone",
  "manufacturer": "samsung",
  "model": "SM-G955F",
  "unixMachine": "armv8l",
  "unixNodeName": "localhost",
  "unixRelease": "4.4.111-13760092-QB18535760",
  "unixSysName": "Linux",
  "unixVersion": "#1 SMP PREEMPT Thu Jun 14 16:44:12 KST 2018"
}

[read-only] systemLocale : string

Returns the locale provided by the operating system.


[read-only] temporaryFolder : FileFolder

Creates and returns a new folder in the system's temporary directory.


[read-only] userHomeFolder : FileFolder

Creates and returns a folder at the destination defined by the user home path.


userHomePath : string

Returns the device's user home path.

Text {
    text: AppFramework.userHomePath
}

[read-only] version : string

Returns the current AppFramework version the app is using.

Text {
    text: AppFramework.version
}

Signal Documentation

onlineStateChanged(bool online)

Signal emitted when the online state of the device has changed.

Note: The corresponding handler is onOnlineStateChanged.


Method Documentation

addImportPath(string path)

Adds the defined path as a directory where the engine searches for installed modules in a URL-based directory structure. The defined path is inserted as the first item to the existing import path list.

AppFramework.addImportPath("C:\Users\UserName\Documents\ImportLocation");
console.log(AppFramework.importPathList[0]);

The path parameter

The path to be added as a directory. this may be a local filesystem directory, a path or URL for a Qt Resource, or a URL.


color alphaColor(color color, double alpha)

Converts a color into an alpha-blended or semi-transparent color using the input alpha value.

Item {
        Rectangle {
                id:rect
                width: 20;height:20;
                color:  "#ff0000"
        }

        Button {
                text:"CreateAlphaColor"
                onClicked: {
                        var color = rect.color;
                        var newColor = AppFramework.alphaColor(color, 0.50);
                        console.log(newColor.toString()); // returns #80ff0000
                        rect.color = newColor;
                }
        }
}

The color parameter

The RGB value of this color.

The alpha parameter

The alpha component (transparency) of this color. For example, for 50% transparency, enter 0.5.


BinaryData binaryData()

Produces a binary data object to manage binary content, e.g. to convert from one text encoding scheme to another, or manipulate raw data.

For example,

var s = "Hello";
var b = AppFramework.binaryData(s); //  produces a binary data object
b.size; // returns 5
b.setStringData("ArcGIS AppStudio"); // Sets the string data to a 20-byte binary object.
b.size; // returns 20

BinaryData binaryData(var value)

Produces a binary data object to manage binary content. This object will be created containing the given variable.

The value parameter

The variable the binary data object will be created containing.


clearComponentCache()

Clears the engine's internal component cache.

This function causes the property metadata of all components previously loaded by the engine to be destroyed. The engine is returned to a state where it doesn't cobtain any loaded component data.


collectGarbage()

Invokes the garbage collector, which will attempt to reclaim memory by locating and disposing of objects no longer reachable in the script environment.

Normally this function isn't necessary; the garbage collector is automatically invoked. However, this function can be called manually to ensure garbage collection should be performed as soon as possible.

AppFramework.collectGarbage();

int compareVersionNumber(object version1, object version2)

Compares two provided version numbers. This will return an integer less than, equal to, or greater than zero, depending on if the first version number is less than, equal to, or greater than the second version number, respectively.

The version1 parameter

The first of the two version numbers. As an example, if you expect the result to be negative, this number should be lower than the second number.

The version2 parameter

The second of the two version numbers. As an example, if you expect the result to be negative, this number should be higher than the first number.


color contrastColor(color color)

Generates a black or white color value that contrasts with the given color value. A lighter color will return black, while a darker color will return white.

var color = "#00ffff"; // on the brighter side
var tintColor = "#ff0000"
var newColor = AppFramework.contrastColor(color,tintColor);
console.log(newColor.toString()); // returns"#ff0000"

The color parameter

The color value to return a contrasting value for.


color contrastColor(color color, color tintColor)

Generates a brighter or darker version of the supplied color to contrast. The tintColor parameter adds a shade of variety to the returned color.

The color parameter

The color to return a brighter or darker version of.

The tintColor parameter

The color to tint the returned, contrasting color with.


string createId()

Creates a uniquely identifying ID in string format.

This property is deprecated, and should not be used. Instead, use the AppFramework::uuid method.

function createId() {
    // return AppFramework.createId(); // deprecated
    return AppFramework.uuid().toString(2); // e.g. "6c2ca30085ff45f49b6242e588c5ebf3"
}

string createUuidString()

Creates a universally unique identifier (UUID) string; a 128-bit number to use as a way to identify a particular object or component. Without a defined format, defaults to using curly brackets and hyphens.

This property is deprecated, and should not be used. Instead, use the uuid method.


string createUuidString(int format)

Creates a universally unique identifier (UUID) string; a 128-bit number to use as a way to identify a particular object or component.

This property is deprecated, and should not be used. Instead, use the uuid method.

For example,

function createUuidString(format) {
    // return AppFramework.createUuidString(format); // deprecated
    return AppFramework.uuid().toString(format);
    // e.g. "{6c2ca300-85ff-45f4-9b62-42e588c5ebf3}" (format === 0, default)
    //      "6c2ca300-85ff-45f4-9b62-42e588c5ebf3"   (format === 1)
    //      "6c2ca30085ff45f49b6242e588c5ebf3"       (otherwise)
}

The format parameter

0 to include curly brackets and hyphens, e.g. {3F2504E0-4F89-41D3-9A0C-0305E82C3301}. 1 to include hyphens but not curly brackets, e.g. 3F2504E0-4F89-41D3-9A0C-0305E82C3301. 2 to not include hyphens or curly brackets, e.g. 3F2504E04F8941D39A0C0305E82C3301.


File file(url pathUrl)

Creates a new file object at the specified URL destination.

The pathUrl parameter

The URL to the file that will be created.


File file(string path)

Creates a new file object at the specified path destination.

The path parameter

The path to the file that will be created.


FileFolder fileFolder(url pathUrl)

Creates a new fileFolder object at the specified URL destination.

The pathUrl parameter

The URL to the file that will be created.


FileFolder fileFolder(string path)

Creates a new fileFolder object at the specified path destination.

The path parameter

The path to the folder that will be created.


FileInfo fileInfo(url pathUrl)

Creates a new FileInfo object at the specified URL destination.

The pathUrl parameter

The URL to the object that will be created.


FileInfo fileInfo(string path)

Creates a new FileInfo object at the specified path destination.

The path parameter

The path to the object that will be created.


bool grabWindowToClipboard()

Save a graphic image of the screen to the clipboard.

The following example will save an image to the clipboard and will include content for the full extent of the app.

Button {
        text: "Capture"
        onClicked: AppFramework.grabWindowToClipboard()
}

bool grabWindowToClipboard(rect rect)

Save a graphic image of the screen to the clipboard.

By including a definition of the rectangle that you wish to capture, you can tailor your screen shot. In the following example, when the user clicks the button an image is saved to the clipboard whose origin is the left hand edge of the app and the bottom of the toolbar, and its extent is the same height and width of the map component.

Button {
    text: "Capture"
        onClicked: AppFramework.grabWindowToClipboard( Qt.rect(0, toolbar.height, map.width, map.height) )
}

The rect parameter

The rectangle extent to save to clipboard, in the form of (x, y, width, height).


bool grabWindowToFile(string path)

Save a graphic image of the screen to a nominated file.

The following example will save an image to a file called map.png and will include content for the full extent of the app.

Button {
    text: "Capture"
        onClicked: AppFramework.grabWindowToFile("map.png")
}

The path parameter

The filename and path for the saved image.


bool grabWindowToFile(string path, rect rect)

Save a graphic image of the screen to a nominated file.

By including a definition of the rectangle that you wish to capture, you can tailor your screen shot. In the following example, when the user clicks the button an image is saved to file called map.png whose origin is the left hand edge of the app and the bottom of the toolbar, and its extent is the same height and width of the map component.

Button {
    text: "Capture"
        onClicked: AppFramework.grabWindowToFile("map.png", Qt.rect(0, toolbar.height, map.width, map.height) )
}

The path parameter

The filename and path for the saved image.

The rect parameter

The rectangle extent to save to file, in the form of (x, y, width, height).


bool instanceOf(var value, var type)

Returns true if the supplied value is of the requested value type. Otherwise, returns false.

Item {
        property url testUrl: "http://"
        property string testUrlString: "http://"

        ImageObject {
                id: imageObject
        }

        Component.onCompleted: {
                console.log( AppFramework.instanceOf(imageObject.exifInfo, "ExifInfo")); // returns true
                console.log( AppFramework.instanceOf(testUrl, "url")); // returns true
                console.log( AppFramework.instanceOf(testUrlString, "string")); // returns true
                console.log( AppFramework.instanceOf(testUrlString, "url")); // returns false
        }
}

The value parameter

The value to check the type of.

The type parameter

The type of value to check the provided value against.


bool isAppInstalled(qstringlist appIdentifierValues)

Accepts a list of app identifier string values, using them to determine if an app is installed on the device.

This method is not supported on Linux, where it returns false regardless.

Item {
    property var appIdentifiersList: [[
        "https://survey123.arcgis.app",
        "com.esri.survey123",
        "arcgis-survey123",
        "Esri.Survey123forArcGIS_eytg3kh68c6a8"
    ],
    [
        "https://appstudio.arcgis.com/player.html",
        "com.esri.appstudio.player",
        "arcgis-appstudio-player",
        "Esri.ArcGISAppStudioPlayer_eytg3kh68c6a8"
    ],
    [
        "https://quickcapture.arcgis.app",
        "com.esri.arcgisquickcapture",
        "arcgis-quickcapture"
        "Esri.ArcGISQuickCapture_eytg3kh68c6a8"
    ]]

    ComboBox {
        Layout.fillWidth: true
        model: [
                    "Survey123",
                    "AppStudioPlayer",
                    "QuickCapture"
                ]

        onActivated: {
            installedField.text = AppFramework.isAppInstalled(appIdentifiersList[currentIndex]);
        }
    }

    TextField {
        id: installedField
        Layout.fillWidth: true

        readOnly: true
    }
}

The appIdentifierValues parameter

A list of identifying values to search the device for.

Each operating system uses a different value as an app identifier: macOS uses a bundle identifier, Android uses a packageName, Windows and iOS use a url scheme or protocol, and UWP apps use a package family name.

For Windows and iOS, Esri's URI schemes are as follows:

App NameURI schemes
AppStudio Playerarcgis-appstudio-player
Collectorarcgis-collector
QuickCapturearcgis-quickcapture
Explorerarcgis-explorer
Navigatorarcgis-navigator
Survey123arcgis-survey123
Workforcearcgis-workforce

For Android, Esri's app package names are as follows:

App NamePackage Name
AppStudio Playercom.esri.appstudio.player
Collectorcom.esri.collector
QuickCapturecom.esri.arcgisquickcapture
Explorercom.esri.explorer
Navigatorcom.esri.navigator
Survey123com.esri.survey123
Workforcecom.esri.workforce

For UWP, Esri's app package family names are as follows:

App NamePackage Family Name
AppStudio PlayerEsri.ArcGISAppStudioPlayer_eytg3kh68c6a8
QuickCaptureEsri.ArcGISQuickCapture_eytg3kh68c6a8
Survey123Esri.Survey123forArcGIS_eytg3kh68c6a8

For macOS, the AppStudio Player bundle identifier is com.esri.appstudio.player.


bool isAppInstalled(string appIdentifier)

Accepts a single app identifier string value, and returns true if the given app is installed on the device. Otherwise, returns false.

This method is not supported on Linux, where it returns false regardless.

The appIdentifier parameter

The identifying string for the app.

Each operating system uses a different value as an app identifier: macOS uses a bundle identifier, Android uses a packageName, Windows and iOS use a url scheme or protocol, and UWP apps use a package family name.

For Windows and iOS, Esri's URI schemes are as follows:

App NameURI schemes
AppStudio Playerarcgis-appstudio-player
Collectorarcgis-collector
QuickCapturearcgis-quickcapture
Explorerarcgis-explorer
Navigatorarcgis-navigator
Survey123arcgis-survey123
Workforcearcgis-workforce

For Android, Esri's app package names are as follows:

App NamePackage Name
AppStudio Playercom.esri.appstudio.player
Collectorcom.esri.collector
QuickCapturecom.esri.arcgisquickcapture
Explorercom.esri.explorer
Navigatorcom.esri.navigator
Survey123com.esri.survey123
Workforcecom.esri.workforce

For UWP, Esri's app package family names are as follows:

App NamePackage Family Name
AppStudio PlayerEsri.ArcGISAppStudioPlayer_eytg3kh68c6a8
QuickCaptureEsri.ArcGISQuickCapture_eytg3kh68c6a8
Survey123Esri.Survey123forArcGIS_eytg3kh68c6a8

For macOS, the AppStudio Player bundle identifier is com.esri.appstudio.player.


loadTranslator(var translations, string appFolderPath)

Loads a translator in the default locale. The default locale is described by the defaultLocale property.

AppFramework.defaultLocale = "fr_CA";
AppFramework.loadTranslator( app.info.json.translations, app.folder.path);

The translations parameter

A JavaScript object that contains fileName and path members. fileName refers to a string array containing translation files. Note that the actual translation files will have a suffix for each locale. path refers to a subfolder in the app where these translations can be found. For instance, the following translation object will return the translation files for HelloApp, found in the 'languages' folder:

{
    "fileName": [ "HelloApp" ],
    "path": "languages"
}

The appFolderPath parameter

The actual location of the current running app. For apps running in ArcGIS AppStudio or AppStudio Player this will be a location in the file system; for built apps, this location will be to a Qt Resource. To refer to either location, use app.folder.path.


loadTranslator(var translations, string appFolderPath, string locale)

Loads a translator for the set locale. For example, this code snippet:

var locale = "fr_CA";
AppFramework.loadTranslator( app.info.json.translations, app.folder.path, locale);

will load the translation file languages/HelloApp_fr.qm if available.

var locale = "fr_CA";
AppFramework.loadTranslator( app.info.json.translations, app.folder.path, locale);

The translations parameter

A JavaScript object that contains fileName and path members. fileName refers to a string array containing translation files. Note that the actual translation files will have a suffix for each locale. path refers to a subfolder in the app where these translations can be found. For instance, the following translation object will return the translation files for HelloApp, found in the 'languages' folder:

{
    "fileName": [ "HelloApp" ],
    "path": "languages"
}

The appFolderPath parameter

The actual location of the current running app. For apps running in ArcGIS AppStudio or AppStudio Player this will be a location in the file system; for built apps, this location will be to a Qt Resource. To refer to either location, use app.folder.path.

The locale parameter

The locale code for the language you intend to load translation files from.


loadTranslator(var translations, string appFolderPath, string locale, bool retranslate)

The translations parameter

The appFolderPath parameter

The locale parameter

The retranslate parameter


LocaleInfo localeInfo()

Returns a locale object initialized to the default system's locale. If a locale object doesn't exist, one will be created.


LocaleInfo localeInfo(var locale)

Returns a locale object initialized to the given locale. If a locale object doesn't exist, one will be created.

The locale parameter

The locale code to return an object for.


string objectToString(object object)

Returns a user-readable string describing the defined object. It provides the structure of the component along with the class hierarchy and lists all the properties, signals and methods it supports.

console.log(AppFramework.objectToString(imageObject.exifInfo))

The object parameter

The object to return information about.


bool openUrlExternally(url url)

Opens the provided URL in an external app. This method can accept multiple kinds of URLs, and will behave differently depending on what kind of URL is provided.

If given a web URL, the the destination will open in the device's default browser. On Android, a share sheet will open allowing the user to select a preferred browser. If given an app link, the app will open if installed on the user's device. Otherwise, it will behave in the same way as a web URL. If given an app schema, the app will open if installed on the user's device. Otherwise, it will do nothing. If given a file URL, Android will open a share sheet to select an app to open the file with, iOS will open it in a document viewer, and all other platforms will open the file using the default app used for its MIME type.

The url parameter

The URL to open in an external app. This can be a web URL, an app link, an app schema, or a file URL.

property var link: "arcgis-survey123://";
AppFramework.openUrlExternally(link);

string pathVariable(string name)

Returns the path of the input environment variable as a string.

For example,

AppFramework.pathVariable("HOME"); // produces C:\Users\UserName
AppFramework.resolvedPath("$HOME/file.txt"); // produces C:\Users\UserName/file.txt
AppFramework.resolvedPathUrl("$HOME/file.txt"); // produces file:///C:/Users/UserName/file.txt
AppFramework.setPathVariable("HOME", "C:/Temp");
AppFramework.resolvedPath("$HOME/file.txt"); // now produces C:/Temp/file.txt
AppFramework.resolvedPathUrl("$HOME/file.txt"); // produces file:///C:/Temp/file.txt

The name parameter

The name of the path variable.

See also setPathVariable().


removeImportPath(string path)

Removes the path from the list of import paths.

AppFramework.removeImportPath("C:\Users\UserName\Documents\ImportLocation");

The path parameter

The path you wish to remove from import paths.


string resolvedPath(url pathUrl)

Converts a file URL into a local filename or resource.

For example,

u = AppFramework.resolvedPathUrl(":/file.png"); // produces qrc:///file.png
AppFramework.resolvedPath(u); // produces :/file.png

The pathUrl parameter

The URL you wish to convert.


string resolvedPath(string path)

Refers to a local filename or resource.

For example,

AppFramework.resolvedPath("~/file.txt");

produces the path: "C:/Users/UserName/file.txt"

The path parameter

The path you wish to resolve.


url resolvedPathUrl(string pathUrl)

Converts a local filename or resurce into a file URI scheme.

For example,

AppFramework.resolvedPathUrl("C:/Temp/file.txt"); // produces "file:///C:/Temp/file.txt"
AppFramework.resolvedPathUrl("~/file.txt"); // produces "file:///C:/Users/Somebody/file.txt"
AppFramework.resolvedPathUrl(":/file.txt"); // produces "qrc:///file.txt"

The pathUrl parameter

The path to convert into a URL scheme.


url resolvedUrl(url url)

Returns the given URL, resolved relative to the URL of the caller.

property url urlTest : "./temp"
// returns "file:///C:/Users/john007/ArcGIS/AppStudio/Apps/49cfc974e8fc48f2bfd91e0f873c2353/temp"
console.log(AppFramework.resolvedUrl(urlTest));

The url parameter

The URL to resolve.


sendKey(var key)

Sends a triggered key press, or sequence of key presses, to the app.

The key parameter

The key being sent to the app.


sendKey(var key, item item)

Sends a triggered key press, or sequence of key presses, to the target item.

The key parameter

The key being sent to the item.

The item parameter

The item the key is being sent to.


sendStandardKey(var key)

Sends the triggered standard key binding to the app.

For a list of applicable key bindings, refer to Qt's listing: http://doc.qt.io/qt-5/qkeysequence.html#StandardKey-enum

The key parameter

The key being sent to the app.


sendStandardKey(var key, item item)

Sends the triggered standard key binding to the item.

For a list of applicable key bindings, refer to Qt's listing: http://doc.qt.io/qt-5/qkeysequence.html#StandardKey-enum

The key parameter

The key being sent to the item.

The item parameter

The item the key is being sent to.


setPathVariable(string name, string value)

Sets the environment variable used in the expansion of a call to resolvedPath.

For example,

AppFramework.pathVariable("HOME"); // produces C:\Users\UserName
AppFramework.resolvedPath("$HOME/file.txt"); // produces C:\Users\UserName/file.txt
AppFramework.resolvedPathUrl("$HOME/file.txt"); // produces file:///C:/Users/UserName/file.txt
AppFramework.setPathVariable("HOME", "C:/Temp");
AppFramework.resolvedPath("$HOME/file.txt"); // now produces C:/Temp/file.txt
AppFramework.resolvedPathUrl("$HOME/file.txt"); // produces file:///C:/Temp/file.txt

The name parameter

The name of the path variable being set.

The value parameter

The value of the path variable being set.

See also pathVariable().


trimComponentCache()

Trims the in-use engine's internal component cache. This function causes the property metadata of any loaded components not currently in use to be destroyed. If there is no engine currently in use, does nothing.


string typeOf(var value)

Returns the type of value it has been given as a string.

console.log(AppFramework.typeOf(myButton)); // returns Button

The value parameter

The value to identify.


string typeOf(var value, bool displayName)

Returns the type of alias value that has been given as a string.

console.log(AppFramework.typeOf(myButton, true)); // returns Button_QMLTYPE_34

The value parameter

The value to identify.

The displayName parameter

If true, will return the alias name.


UrlInfo urlInfo(url url)

Creates and returns a new UrlInfo object based on the given URL.

The url parameter

The URL to derive an object from.


object uuid(qbytearray rfc4122)

Returns a UUID from a binary representation of the value.

If this method fails, a null UUID is created.

The rfc4122 parameter

The binary representation of the UUID.


object uuid(string uuid)

Returns a UUID from a string value. Supports the following string formats:

  • Strings with braces, for example, {00000000-0000-0000-0000-000000000000}
  • Strings without braces, for example, 00000000-0000-0000-0000-000000000000
  • Hex digits without braces or dashes, for example, 00000000000000000000000000000000

For example,

let myid = AppFramework.uuid("6c2ca30085ff45f49b6242e588c5ebf3");
console.log(myid.toString(0)); "{6c2ca300-85ff-45f4-9b62-42e588c5ebf3}"

The uuid parameter

The UUID to return.


object uuid()

Returns a new UUID.


VersionNumber versionNumber(string versionString)

Returns a VersionNumber object containing the version number provided in the parameter.

The versionString parameter

A string form of the version number, with individual numbers inside spearated by decimal points. For example, 3.7.355.


VersionNumber versionNumber(int major, int minor, int micro)

Returns a VersionNumber object containing the version number defined by the three provided parameters.

The major parameter

The first of the three components of a version number. For example, for version 3.7.355, this property would contain 3.

The minor parameter

The second of the three components of a version number. For example, for version 3.7.355, this property would contain 7.

The micro parameter

The third of the three components of a version number. For example, for version 3.7.355, this property would contain 355.


object xmlToJson(string xml)

Converts the given string containing XML content into a JavaScript object.

This XML content can originate from a file or from the internet. If the content comes from online, use the NetworkRequest object to retrieve such concept.

The xml parameter

The XML content string to convert.


object xmlToJson(string xml, object options)

Converts the given string containing XML content into a JavaScript object, with configurable options.

This XML content can originate from a file or from the internet. If the content comes from online, use the NetworkRequest object to retrieve such concept.

The xml parameter

The XML content string to convert.

The options parameter

The following options are supported:

OptionsDescriptionDefault value
attributePrefixThe prefix placed before the name of any attribute in the resulting JSON.@
nodesPropertyThe name of a section of the JSON where the original order of attributes in the XML is described, as JSON does not respect the original order.#nodes
textPropertyThe name of the property that lists text within the XML.#text
commentPropertyThe name of the property that contains all comments in the XML.#comment
cdataPropertyThe name of the property that contains all cdata in the XML. If multiple cdata tags are in the XML, they will be listed in order relative to each other, but not other elements.#cdata
indexFormatThe format that the index number of elements in the XML will be given. Use '%1' within this option to display a number that increments with each new element.[%1]
rootPropertyIf set to true, preserves the root name of the XML.false
preserveNamespacesIf set to true, preserves the namespaces within the XML.false

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.