[ui] MaterialIcons: add MaterialLabel

preset Component to create a Label with MaterialIcons font + optional tooltip
This commit is contained in:
Yann Lanthony 2018-08-05 22:20:30 +02:00
parent 6a138e492a
commit 62961dedd9
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import QtQuick 2.9
import QtQuick.Controls 2.4
/**
* MaterialLabel is a standard Label using MaterialIcons font.
* If ToolTip.text is set, it also shows up a tooltip when hovered.
*/
Label {
font.family: MaterialIcons.fontFamily
font.pointSize: 10
ToolTip.visible: toolTipLoader.active && toolTipLoader.item.containsMouse
ToolTip.delay: 1000
Loader {
id: toolTipLoader
anchors.fill: parent
active: parent.ToolTip.text
sourceComponent: MouseArea {
hoverEnabled: true
acceptedButtons: Qt.NoButton
}
}
}

View file

@ -1,3 +1,4 @@
module MaterialIcons
singleton MaterialIcons 2.2 MaterialIcons.qml
MaterialToolButton 2.2 MaterialToolButton.qml
MaterialLabel 2.2 MaterialLabel.qml