moment/src/qml/Base/HIcon.qml

34 lines
832 B
QML
Raw Normal View History

import QtQuick 2.12
2019-09-13 07:27:26 +10:00
import QtGraphicalEffects 1.12
2019-09-13 07:27:26 +10:00
Image {
id: icon
cache: true
asynchronous: true
fillMode: Image.PreserveAspectFit
visible: Boolean(svgName)
2019-11-18 18:57:13 +11:00
source: svgName ? `../../icons/${iconPack}/${svgName}.svg` : ""
sourceSize.width: svgName ? dimension : 0
sourceSize.height: svgName ? dimension : 0
2019-09-13 07:27:26 +10:00
property string svgName: ""
2019-12-05 00:08:38 +11:00
property bool small: false
property int dimension:
theme ?
(small ? theme.icons.smallDimension : theme.icons.dimension) :
(small ? 16 : 22)
2019-09-13 07:27:26 +10:00
property color colorize: theme.icons.colorize
2019-11-18 18:57:13 +11:00
property string iconPack: theme ? theme.icons.preferredPack : "thin"
2019-09-13 07:27:26 +10:00
layer.enabled: ! Qt.colorEqual(colorize, "transparent")
layer.effect: ColorOverlay {
color: icon.colorize
cached: icon.cache
}
}