C

Qt QML Type

Provides a global object with useful enums and functions from Qt. More...

Import Statement: import QtQuick
Since: Qt Quick Ultralite 1.0

Properties

Methods

  • font font(object fontConfiguration)
  • matrix4x4 matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)
  • point point(real x, real y)
  • point rect(real x, real y, real width, real height)
  • string resolvedUrl(String url)
  • color rgba(real red, real green, real blue, real alpha)

Detailed Description

The Qt object is a global object with utility functions, properties and enums.

It is not instantiable; to use it, call the members of the global Qt object directly. For example:

import QtQuick 2.15

Text {
    color: Qt.rgba(1, 0, 0, 1)
    text: "hello, world"
}

Enums

The Qt object contains some of the enums available in the Qt Namespace. For example, you can access the Qt::Vertical enumeration value as Qt.Vertical.

Types

If the QtQuick module has been imported, the following helper functions for creating objects of specific data types are also available for clients to use:

Property Documentation

[since Qt Quick Ultralite 2.8] AlignmentFlag : enumeration

This enum type is used to describe alignment. It contains horizontal and vertical flags that can be combined to produce the required effect.

The horizontal flags are:

ConstantDescription
AlignLeftAligns with the left edge.
AlignRightAligns with the right edge.
AlignHCenterCenters horizontally in the available space.

The vertical flags are:

ConstantDescription
AlignTopAligns with the top.
AlignBottomAligns with the bottom.
AlignVCenterCenters vertically in the available space.

You can use only one of the horizontal flags at a time. There is one two-dimensional flag:

ConstantDescription
AlignCenterCenters in both dimensions.

You can use only one horizontal and one vertical flag at a time. Qt::AlignCenter counts as both horizontal and vertical.

Conflicting combinations of flags have undefined meanings.

This property was introduced in Qt Quick Ultralite 2.8.


Key : enumeration

The key names used by Qt.

ConstantDescription
Key_Escape 
Key_Tab 
Key_Backtab 
Key_Backspace 
Key_Return 
Key_EnterTypically located on the keypad.
Key_Insert 
Key_Delete 
Key_PauseThe Pause/Break key (Note: Not related to pausing media)
Key_Print 
Key_SysReq 
Key_ClearCorresponds to the Clear key on selected Apple keyboard models. On other systems it is commonly mapped to the numeric keypad key 5, when Num Lock is off.
Key_Home 
Key_End 
Key_Left 
Key_Up 
Key_Right 
Key_Down 
Key_PageUp 
Key_PageDown 
Key_Shift 
Key_ControlOn macOS, this corresponds to the Command keys.
Key_MetaOn macOS, this corresponds to the Control keys. On Windows keyboards, this key is mapped to the Windows key.
Key_Alt 
Key_AltGrOn Windows, when the KeyDown event for this key is sent, the Ctrl+Alt modifiers are also set.
Key_CapsLock 
Key_NumLock 
Key_ScrollLock 
Key_F1 
Key_F2 
Key_F3 
Key_F4 
Key_F5 
Key_F6 
Key_F7 
Key_F8 
Key_F9 
Key_F10 
Key_F11 
Key_F12 
Key_F13 
Key_F14 
Key_F15 
Key_F16 
Key_F17 
Key_F18 
Key_F19 
Key_F20 
Key_F21 
Key_F22 
Key_F23 
Key_F24 
Key_F25 
Key_F26 
Key_F27 
Key_F28 
Key_F29 
Key_F30 
Key_F31 
Key_F32 
Key_F33 
Key_F34 
Key_F35 
Key_Super_L 
Key_Super_R 
Key_Menu 
Key_Hyper_L 
Key_Hyper_R 
Key_Help 
Key_Direction_L 
Key_Direction_R 
Key_Space 
Key_Any 
Key_Exclam 
Key_QuoteDbl 
Key_NumberSign 
Key_Dollar 
Key_Percent 
Key_Ampersand 
Key_Apostrophe 
Key_ParenLeft 
Key_ParenRight 
Key_Asterisk 
Key_Plus 
Key_Comma 
Key_Minus 
Key_Period 
Key_Slash 
Key_0 
Key_1 
Key_2 
Key_3 
Key_4 
Key_5 
Key_6 
Key_7 
Key_8 
Key_9 
Key_Colon 
Key_Semicolon 
Key_Less 
Key_Equal 
Key_Greater 
Key_Question 
Key_At 
Key_A 
Key_B 
Key_C 
Key_D 
Key_E 
Key_F 
Key_G 
Key_H 
Key_I 
Key_J 
Key_K 
Key_L 
Key_M 
Key_N 
Key_O 
Key_P 
Key_Q 
Key_R 
Key_S 
Key_T 
Key_U 
Key_V 
Key_W 
Key_X 
Key_Y 
Key_Z 
Key_BracketLeft 
Key_Backslash 
Key_BracketRight 
Key_AsciiCircum 
Key_Underscore 
Key_QuoteLeft 
Key_BraceLeft 
Key_Bar 
Key_BraceRight 
Key_AsciiTilde 
Key_nobreakspace 
Key_exclamdown 
Key_cent 
Key_sterling 
Key_currency 
Key_yen 
Key_brokenbar 
Key_section 
Key_diaeresis 
Key_copyright 
Key_ordfeminine 
Key_guillemotleft 
Key_notsign 
Key_hyphen 
Key_registered 
Key_macron 
Key_degree 
Key_plusminus 
Key_twosuperior 
Key_threesuperior 
Key_acute 
Key_mu 
Key_paragraph 
Key_periodcentered 
Key_cedilla 
Key_onesuperior 
Key_masculine 
Key_guillemotright 
Key_onequarter 
Key_onehalf 
Key_threequarters 
Key_questiondown 
Key_Agrave 
Key_Aacute 
Key_Acircumflex 
Key_Atilde 
Key_Adiaeresis 
Key_Aring 
Key_AE 
Key_Ccedilla 
Key_Egrave 
Key_Eacute 
Key_Ecircumflex 
Key_Ediaeresis 
Key_Igrave 
Key_Iacute 
Key_Icircumflex 
Key_Idiaeresis 
Key_ETH 
Key_Ntilde 
Key_Ograve 
Key_Oacute 
Key_Ocircumflex 
Key_Otilde 
Key_Odiaeresis 
Key_multiply 
Key_Ooblique 
Key_Ugrave 
Key_Uacute 
Key_Ucircumflex 
Key_Udiaeresis 
Key_Yacute 
Key_THORN 
Key_ssharp 
Key_division 
Key_ydiaeresis 
Key_Multi_key 
Key_Codeinput 
Key_SingleCandidate 
Key_MultipleCandidate 
Key_PreviousCandidate 
Key_Mode_switch 
Key_Kanji 
Key_Muhenkan 
Key_Henkan 
Key_Romaji 
Key_Hiragana 
Key_Katakana 
Key_Hiragana_Katakana 
Key_Zenkaku 
Key_Hankaku 
Key_Zenkaku_Hankaku 
Key_Touroku 
Key_Massyo 
Key_Kana_Lock 
Key_Kana_Shift 
Key_Eisu_Shift 
Key_Eisu_toggle 
Key_Hangul 
Key_Hangul_Start 
Key_Hangul_End 
Key_Hangul_Hanja 
Key_Hangul_Jamo 
Key_Hangul_Romaja 
Key_Hangul_Jeonja 
Key_Hangul_Banja 
Key_Hangul_PreHanja 
Key_Hangul_PostHanja 
Key_Hangul_Special 
Key_Dead_Grave 
Key_Dead_Acute 
Key_Dead_Circumflex 
Key_Dead_Tilde 
Key_Dead_Macron 
Key_Dead_Breve 
Key_Dead_Abovedot 
Key_Dead_Diaeresis 
Key_Dead_Abovering 
Key_Dead_Doubleacute 
Key_Dead_Caron 
Key_Dead_Cedilla 
Key_Dead_Ogonek 
Key_Dead_Iota 
Key_Dead_Voiced_Sound 
Key_Dead_Semivoiced_Sound 
Key_Dead_Belowdot 
Key_Dead_Hook 
Key_Dead_Horn 
Key_Dead_Stroke 
Key_Dead_Abovecomma 
Key_Dead_Abovereversedcomma 
Key_Dead_Doublegrave 
Key_Dead_Belowring 
Key_Dead_Belowmacron 
Key_Dead_Belowcircumflex 
Key_Dead_Belowtilde 
Key_Dead_Belowbreve 
Key_Dead_Belowdiaeresis 
Key_Dead_Invertedbreve 
Key_Dead_Belowcomma 
Key_Dead_Currency 
Key_Dead_a 
Key_Dead_A 
Key_Dead_e 
Key_Dead_E 
Key_Dead_i 
Key_Dead_I 
Key_Dead_o 
Key_Dead_O 
Key_Dead_u 
Key_Dead_U 
Key_Dead_Small_Schwa 
Key_Dead_Capital_Schwa 
Key_Dead_Greek 
Key_Dead_Lowline 
Key_Dead_Aboveverticalline 
Key_Dead_Belowverticalline 
Key_Dead_Longsolidusoverlay 
Key_Back 
Key_Forward 
Key_Stop 
Key_Refresh 
Key_VolumeDown 
Key_VolumeMute 
Key_VolumeUp 
Key_BassBoost 
Key_BassUp 
Key_BassDown 
Key_TrebleUp 
Key_TrebleDown 
Key_MediaPlayA key setting the state of the media player to play
Key_MediaStopA key setting the state of the media player to stop
Key_MediaPrevious 
Key_MediaNext 
Key_MediaRecord 
Key_MediaPauseA key setting the state of the media player to pause (Note: not the pause/break key)
Key_MediaTogglePlayPauseA key to toggle the play/pause state in the media player (rather than setting an absolute state)
Key_HomePage 
Key_Favorites 
Key_Search 
Key_Standby 
Key_OpenUrl 
Key_LaunchMail 
Key_LaunchMedia 
Key_Launch0On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key for legacy reasons.
Key_Launch1On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key for legacy reasons.
Key_Launch2On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons.
Key_Launch3On X11 this key is mapped to XF86XK_Launch1 key for legacy reasons.
Key_Launch4On X11 this key is mapped to XF86XK_Launch2 key for legacy reasons.
Key_Launch5On X11 this key is mapped to XF86XK_Launch3 key for legacy reasons.
Key_Launch6On X11 this key is mapped to XF86XK_Launch4 key for legacy reasons.
Key_Launch7On X11 this key is mapped to XF86XK_Launch5 key for legacy reasons.
Key_Launch8On X11 this key is mapped to XF86XK_Launch6 key for legacy reasons.
Key_Launch9On X11 this key is mapped to XF86XK_Launch7 key for legacy reasons.
Key_LaunchAOn X11 this key is mapped to XF86XK_Launch8 key for legacy reasons.
Key_LaunchBOn X11 this key is mapped to XF86XK_Launch9 key for legacy reasons.
Key_LaunchCOn X11 this key is mapped to XF86XK_LaunchA key for legacy reasons.
Key_LaunchDOn X11 this key is mapped to XF86XK_LaunchB key for legacy reasons.
Key_LaunchEOn X11 this key is mapped to XF86XK_LaunchC key for legacy reasons.
Key_LaunchFOn X11 this key is mapped to XF86XK_LaunchD key for legacy reasons.
Key_LaunchGOn X11 this key is mapped to XF86XK_LaunchE key for legacy reasons.
Key_LaunchHOn X11 this key is mapped to XF86XK_LaunchF key for legacy reasons.
Key_MonBrightnessUp 
Key_MonBrightnessDown 
Key_KeyboardLightOnOff 
Key_KeyboardBrightnessUp 
Key_KeyboardBrightnessDown 
Key_PowerOff 
Key_WakeUp 
Key_Eject 
Key_ScreenSaver 
Key_WWW 
Key_Memo 
Key_LightBulb 
Key_Shop 
Key_History 
Key_AddFavorite 
Key_HotLinks 
Key_BrightnessAdjust 
Key_Finance 
Key_Community 
Key_AudioRewind 
Key_BackForward 
Key_ApplicationLeft 
Key_ApplicationRight 
Key_Book 
Key_CD 
Key_CalculatorOn X11 this key is not mapped for legacy reasons. Use Qt::Key_Launch1 instead.
Key_ToDoList 
Key_ClearGrab 
Key_Close 
Key_Copy 
Key_Cut 
Key_Display 
Key_DOS 
Key_Documents 
Key_Excel 
Key_Explorer 
Key_Game 
Key_Go 
Key_iTouch 
Key_LogOff 
Key_Market 
Key_Meeting 
Key_MenuKB 
Key_MenuPB 
Key_MySites 
Key_News 
Key_OfficeHome 
Key_Option 
Key_Paste 
Key_Phone 
Key_Calendar 
Key_Reply 
Key_Reload 
Key_RotateWindows 
Key_RotationPB 
Key_RotationKB 
Key_Save 
Key_Send 
Key_Spell 
Key_SplitScreen 
Key_Support 
Key_TaskPane 
Key_Terminal 
Key_Tools 
Key_Travel 
Key_Video 
Key_Word 
Key_Xfer 
Key_ZoomIn 
Key_ZoomOut 
Key_Away 
Key_Messenger 
Key_WebCam 
Key_MailForward 
Key_Pictures 
Key_Music 
Key_Battery 
Key_Bluetooth 
Key_WLAN 
Key_UWB 
Key_AudioForward 
Key_AudioRepeat 
Key_AudioRandomPlay 
Key_Subtitle 
Key_AudioCycleTrack 
Key_Time 
Key_Hibernate 
Key_View 
Key_TopMenu 
Key_PowerDown 
Key_Suspend 
Key_ContrastAdjust 
Key_TouchpadToggle 
Key_TouchpadOn 
Key_TouchpadOff 
Key_MicMute 
Key_Red 
Key_Green 
Key_Yellow 
Key_Blue 
Key_ChannelUp 
Key_ChannelDown 
Key_Guide 
Key_Info 
Key_Settings 
Key_MicVolumeUp 
Key_MicVolumeDown 
Key_New 
Key_Open 
Key_Find 
Key_Undo 
Key_Redo 
Key_MediaLast 
Key_unknown 
Key_CallA key to answer or initiate a call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
Key_CameraA key to activate the camera shutter. On Windows Runtime, the environment variable QT_QPA_ENABLE_CAMERA_KEYS must be set to receive the event.
Key_CameraFocusA key to focus the camera. On Windows Runtime, the environment variable QT_QPA_ENABLE_CAMERA_KEYS must be set to receive the event.
Key_Context1 
Key_Context2 
Key_Context3 
Key_Context4 
Key_Flip 
Key_HangupA key to end an ongoing call (see Qt::Key_ToggleCallHangup for a key to toggle current call state)
Key_No 
Key_Select 
Key_Yes 
Key_ToggleCallHangupA key to toggle the current call state (ie. either answer, or hangup) depending on current call state
Key_VoiceDial 
Key_LastNumberRedial 
Key_Execute 
Key_Printer 
Key_Play 
Key_Sleep 
Key_Zoom 
Key_Exit 
Key_Cancel 

Orientation : enumeration

This type is used to signify an object's orientation.

ConstantValue
Horizontal
Vertical

[since Qt Quick Ultralite 1.1] uiLanguage : string

The uiLanguage holds the name of the language to be used for user interface string translations.

You can set the value freely and use it in bindings. By convention, an empty string means no translation from the language used in the source code is intended to occur.

This property was introduced in Qt Quick Ultralite 1.1.

See also Internationalization and Localization with Qt Quick Ultralite.


Method Documentation

[since Qt Quick Ultralite 1.9] font font(object fontConfiguration)

Returns a font with the properties specified in the fontConfiguration object. The fontConfiguration object must contain key-value pairs where valid keys are the font's subproperty names, and the values are valid values for each subproperty.

Calling Qt.font() on a readonly property enables the qmltocpp tool to emit optimized C++ code. This optimization currently is applied for constant font configurations only. In the following example, the optimized code removes the unnecessary bindings on the first three Text items:

function someConditon() : bool { return false }

readonly property font fontConfig1: Qt.font({ pixelSize: 40, italic: true })
readonly property font fontConfig2: Qt.font({ pixelSize: 24 })

Column {
    Text {
        font: fontConfig1
        text: "dog"
    }

    Text {
        font: fontConfig1
        text: "cat"
    }

    Text {
        font: fontConfig2
        text: "mole"
    }

    Text {
        font: someConditon() ? fontConfig1 : fontConfig2
        text: "hedgehog"
    }
}

This method was introduced in Qt Quick Ultralite 1.9.


[since Qt Quick Ultralite 1.7] matrix4x4 matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)

Returns a matrix4x4 with the specified values.

The arguments correspond to their positions in the matrix:

m11m12m13m14
m21m22m23m24
m31m32m33m34
m41m42m43m44

This method was introduced in Qt Quick Ultralite 1.7.


[since Qt Quick Ultralite 2.9] point point(real x, real y)

Returns a point with the specified x and y coordinates.

This method was introduced in Qt Quick Ultralite 2.9.


[since Qt Quick Ultralite 2.9] point rect(real x, real y, real width, real height)

Returns a rect with the top left corner at x, y and the specified width and height.

This method was introduced in Qt Quick Ultralite 2.9.


[since Qt Quick Ultralite 2.0] string resolvedUrl(String url)

Identity function for syntactical compatibility with Qt6 QML. Returns the passed-in string url unchanged.

This method was introduced in Qt Quick Ultralite 2.0.


color rgba(real red, real green, real blue, real alpha)

Returns a color with the specified red, green, blue, and alpha components. All components should be in the range 0-1 (inclusive).


Available under certain Qt licenses.
Find out more.