Control QML Type
The base type of user interface controls. More...
Import Statement: | import QtQuick.Controls 2.0 |
Since: | Qt 5.7 |
Inherited By: | AbstractButton, BusyIndicator, ComboBox, Container, DayOfWeekRow, Dial, MonthGrid, Page, PageIndicator, Pane, ProgressBar, RangeSlider, ScrollBar, ScrollIndicator, Slider, SpinBox, StackView, Tumbler, and WeekNumberColumn |
Properties
- availableHeight : real
- availableWidth : real
- background : Item
- bottomPadding : real
- contentItem : Item
- focusPolicy : enumeration
- focusReason : enumeration
- font : font
- hoverEnabled : bool
- hovered : bool
- leftPadding : real
- locale : Locale
- mirrored : bool
- padding : real
- rightPadding : real
- spacing : real
- topPadding : real
- visualFocus : bool
- wheelEnabled : bool
Detailed Description
Control is the base type of user interface controls. It receives input events from the window system, and paints a representation of itself on the screen.
Property Documentation
This property holds the height available after deducting vertical padding.
See also padding, topPadding, and bottomPadding.
This property holds the width available after deducting horizontal padding.
See also padding, leftPadding, and rightPadding.
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.
This property holds the bottom padding.
See also padding, topPadding, and availableHeight.
This property holds the visual content item.
Note: The content item is automatically resized inside the padding of the control.
This property determines the way the control accepts focus.
Constant | Description |
---|---|
Qt.TabFocus | The control accepts focus by tabbing. |
Qt.ClickFocus | The control accepts focus by clicking. |
Qt.StrongFocus | The control accepts focus by both tabbing and clicking. |
Qt.WheelFocus | The control accepts focus by tabbing, clicking, and using the mouse wheel. |
Qt.NoFocus | The control does not accept focus. |
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 visualFocus and 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.
This property determines whether the control accepts hover events. The default value is false
.
See also hovered.
This property holds whether the control is hovered.
See also hoverEnabled.
This property holds the left padding.
See also padding, rightPadding, and availableWidth.
This property holds the locale of the control. It contains locale specific properties for formatting data and numbers. Unless a special locale has been set, this is either the parent's locale or the default locale.
Control propagates explicit locale properties from parent to children. If you change a specific property on a control's locale, that property propagates to all of the control's children, overriding any system defaults for that property.
See also mirrored and LayoutMirroring.
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.
This property holds the default padding.
See also availableWidth, availableHeight, topPadding, leftPadding, rightPadding, and bottomPadding.
This property holds the right padding.
See also padding, leftPadding, and availableWidth.
This property holds the top padding.
See also padding, bottomPadding, and availableHeight.
This property holds whether the control has visual focus. This property is true
when the control has active focus and the focus reason is either Qt.TabFocusReason
, Qt.BacktabFocusReason
, or Qt.ShortcutFocusReason
.
In general, for visualizing key focus, this property is preferred over Item::activeFocus. This ensures that key focus is only visualized when interacting with keys - not when interacting via touch or mouse.
See also focusReason and Item::activeFocus.
This property determines whether the control handles wheel events. The default value is false
.