Qt 5.6 | Qt Labs Controls | QML Types | Control QML Type

Qt 5.6.3 Reference Documentation

# Control QML Type

A user interface control. More...

Import Statement: | import Qt.labs.controls 1.0
Inherited By: | AbstractButton, BusyIndicator, ComboBox, Container, DayOfWeekRow, Dial, MenuItem, MonthGrid, Page, PageIndicator, Pane, ProgressBar, RangeSlider, ScrollBar, ScrollIndicator, Slider, SpinBox, StackView, Tumbler, and WeekNumberColumn

- List of all members, including inherited members

## Properties

- availableHeight : real
- availableWidth : real
- background : Item
- bottomPadding : real
- contentItem : Item
- focusReason : enumeration
- font : font
- leftPadding : real
- locale : Locale
- mirrored : bool
- padding : real
- rightPadding : real
- spacing : real
- topPadding : real

## Detailed Description

Control is the base type of user interface controls.

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

## Property Documentation

[read-only] availableHeight : real

This property holds the height available after deducting vertical padding.

See also padding, topPadding, and bottomPadding.

[read-only] availableWidth : real

This property holds the width available after deducting horizontal padding.

See also padding, leftPadding, and rightPadding.

background : Item

This property holds the background item.

Note: If the background item has no explicit size specified, it automatically follows the control's size. In most cases, there is no need to specify width or height for a background item.

bottomPadding : real

This property holds the bottom padding.

See also padding, topPadding, and availableHeight.

contentItem : Item

This property holds the visual content item.

Note: The content item is automatically resized inside the padding of the control.

[read-only] focusReason : enumeration

This property holds the reason of the last focus change.

Note: This property does not indicate whether the control has active focus, but the reason why the control either gained or lost focus.

Constant | Description
--- | ---
`Qt.MouseFocusReason` | A mouse action occurred.
`Qt.TabFocusReason` | The Tab key was pressed.
`Qt.BacktabFocusReason` | A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
`Qt.ActiveWindowFocusReason` | The window system made this window either active or inactive.
`Qt.PopupFocusReason` | The application opened/closed a pop-up that grabbed/released the keyboard focus.
`Qt.ShortcutFocusReason` | The user typed a label's buddy shortcut
`Qt.MenuBarFocusReason` | The menu bar took focus.
`Qt.OtherFocusReason` | Another reason, usually application-specific.

See also Item::activeFocus.

font : font

This property holds the font currently set for the control.

This property describes the control's requested font. The font is used by the control's style when rendering standard components, and is available as a means to ensure that custom controls can maintain consistency with the native platform's native look and feel. It's common that different platforms, or different styles, define different fonts for an application.

The default font depends on the system environment. ApplicationWindow maintains a system/theme font which serves as a default for all controls. There may also be special font defaults for certain types of controls. You can also set the default font for controls by passing a custom font to QGuiApplication::setFont(), before loading the QML. Finally, the font is matched against Qt's font database to find the best match.

Control propagates explicit font properties from parent to children. If you change a specific property on a control's font, that property propagates to all of the control's children, overriding any system defaults for that property.

leftPadding : real

This property holds the left padding.

See also padding, rightPadding, and availableWidth.

locale : Locale

This property holds the locale of the control.

See also mirrored and LayoutMirroring.

[read-only] mirrored : bool

This property holds whether the control is mirrored.

This property is provided for convenience. A control is considered mirrored when its visual layout direction is right-to-left.

See also locale and LayoutMirroring.

padding : real

This property holds the default padding.

See also availableWidth, availableHeight, topPadding, leftPadding, rightPadding, and bottomPadding.

rightPadding : real

This property holds the right padding.

See also padding, leftPadding, and availableWidth.

spacing : real

This property holds the spacing.

topPadding : real

This property holds the top padding.

See also padding, bottomPadding, and availableHeight.