Icon QML Type
Import Statement: | import org.kde.kirigami.primitives |
Properties
- active : bool
- animated : bool
- color : color
- fallback : string
- isMask : bool
- paintedHeight : qreal
(since 5.15)
- paintedWidth : qreal
(since 5.15)
- placeholder : string
(since 5.15)
- roundToIconSize : bool
- selected : bool
- source : var
- status : enumeration
(since 5.15)
- valid : bool
Detailed Description
Class for rendering an icon in UI.
Property Documentation
active : bool |
Whether this icon will use the QIcon::Active mode when drawing the icon, resulting in a graphical effect being applied to the icon to indicate that it is currently active.
This is typically used to indicate when an item is being hovered or pressed.
TODO qdoc @image html icon/active.png
The color differences under the default KDE color palette, Breeze. Note that a dull highlight background is typically displayed behind active icons and it is recommended to add one if you are creating a custom component.
animated : bool |
If set, icon will blend when the source is changed
color : color |
The color to use when drawing this icon when isMask is enabled. If this property is not set or is Qt::transparent
, the icon will use the text or the selected text color, depending on if selected is set to true.
fallback : string |
The name of a fallback icon to load from the icon theme when the `source` cannot be found. The default fallback icon is `"unknown"`.
Note: This will only be loaded if source is unavailable (e.g. it doesn't exist, or network issues have prevented loading).
isMask : bool |
Whether this icon will be treated as a mask. When an icon is being used as a mask, all non-transparent colors are replaced with the color provided in the Icon's color property.
See also color.
paintedHeight : qreal |
The height of the painted area measured in pixels. This will be smaller than or equal to the height of the area taken up by the Item itself. This can be 0.
This property was introduced in 5.15.
paintedWidth : qreal |
The width of the painted area measured in pixels. This will be smaller than or equal to the width of the area taken up by the Item itself. This can be 0.
This property was introduced in 5.15.
placeholder : string |
The name of an icon from the icon theme to show while the icon set in `source` is being loaded. This is primarily relevant for remote sources, or those using slow- loading image providers. The default temporary icon is `"image-x-icon"`
Note: This will only be loaded if the source is a type which can be so long-loading that a temporary image makes sense (e.g. a remote image, or from an ImageProvider of the type QQmlImageProviderBase::ImageResponse)
This property was introduced in 5.15.
roundToIconSize : bool |
If set, icon will round the painted size to defined icon sizes. Default is true.
selected : bool |
Whether this icon will use the QIcon::Selected mode when drawing the icon, resulting in a graphical effect being applied to the icon to indicate that it is currently selected.
This is typically used to indicate when a list item is currently selected.
TODO qdoc @image html icon/selected.png
The color differences under the default KDE color palette, Breeze. Note that a blue background is typically displayed behind selected elements.
source : var |
The source of this icon. An Icon can pull from:
- The icon theme:
- The filesystem:
- Remote URIs:
- Custom providers:
- Your application's bundled resources:
Note: See https://doc.qt.io/qt-5/qtquickcontrols2-icons.html for how to bundle icon themes in your application to refer to them by name instead of by resource URL.
Note: Use fallback to provide a fallback theme name for icons.
Note: Cuttlefish is a KDE application that lets you view all the icons that you can use for your application. It offers a number of useful features such as previews of their appearance across different installed themes, previews at different sizes, and more. You might find it a useful tool when deciding on which icons to use in your application.
status : enumeration |
Whether the icon is correctly loaded, is asynchronously loading or there was an error. Note that image loading will not be initiated until the item is shown, so if the Icon is not visible, it can only have Null or Loading states.
This property was introduced in 5.15.
valid : bool |
Whether this icon's source is valid and it is being used.