Browse Source

ToolStripHoverButton.qml: Add some new features

QGC4.4
davidsastresas 1 year ago committed by Julian Oes
parent
commit
a23da2c6c4
No known key found for this signature in database
GPG Key ID: F0ED380FEA56DE41
  1. 40
      src/QmlControls/ToolStripHoverButton.qml

40
src/QmlControls/ToolStripHoverButton.qml

@ -33,10 +33,12 @@ Button { @@ -33,10 +33,12 @@ Button {
property alias imageSource: innerImage.source
property alias contentWidth: innerText.contentWidth
property real imageScale: 0.6
property real contentMargins: innerText.height * 0.1
property bool forceImageScale11: false
property real imageScale: forceImageScale11 && (text == "") ? 0.8 : 0.6
property real contentMargins: innerText.height * 0.1
property color _currentContentColor: (checked || pressed) ? qgcPal.buttonHighlightText : qgcPal.buttonText
property color _currentContentColorSecondary: (checked || pressed) ? qgcPal.buttonText : qgcPal.buttonHighlight
signal dropped(int index)
@ -65,6 +67,21 @@ Button { @@ -65,6 +67,21 @@ Button {
anchors.centerIn: parent
spacing: contentMargins * 2
Image {
id: innerImageColorful
height: contentLayoutItem.height * imageScale
width: contentLayoutItem.width * imageScale
smooth: true
mipmap: true
fillMode: Image.PreserveAspectFit
antialiasing: true
sourceSize.height: height
sourceSize.width: width
anchors.horizontalCenter: parent.horizontalCenter
source: control.imageSource
visible: source != "" && modelData.fullColorIcon
}
QGCColoredImage {
id: innerImage
height: contentLayoutItem.height * imageScale
@ -77,6 +94,23 @@ Button { @@ -77,6 +94,23 @@ Button {
sourceSize.height: height
sourceSize.width: width
anchors.horizontalCenter: parent.horizontalCenter
visible: source != "" && !modelData.fullColorIcon
QGCColoredImage {
id: innerImageSecondColor
source: modelData.alternateIconSource
height: contentLayoutItem.height * imageScale
width: contentLayoutItem.width * imageScale
smooth: true
mipmap: true
color: _currentContentColorSecondary
fillMode: Image.PreserveAspectFit
antialiasing: true
sourceSize.height: height
sourceSize.width: width
anchors.horizontalCenter: parent.horizontalCenter
visible: source != "" && modelData.biColorIcon
}
}
QGCLabel {
@ -84,6 +118,8 @@ Button { @@ -84,6 +118,8 @@ Button {
text: control.text
color: _currentContentColor
anchors.horizontalCenter: parent.horizontalCenter
font.bold: !innerImage.visible && !innerImageColorful.visible
opacity: !innerImage.visible ? 0.8 : 1.0
}
}
}

Loading…
Cancel
Save