RibbonPushButton: Fix the button height bug.
This commit is contained in:
parent
181549a541
commit
fb8f5b0110
|
@ -15,14 +15,18 @@ Item {
|
||||||
property string tip_text: text
|
property string tip_text: text
|
||||||
property string text
|
property string text
|
||||||
default property alias content: m.contentData
|
default property alias content: m.contentData
|
||||||
property int icon_size: height
|
property int icon_size: Math.floor(height * 0.7)
|
||||||
signal clicked()
|
signal clicked()
|
||||||
opacity: enabled ? 1.0 : 0.3
|
opacity: enabled ? 1.0 : 0.3
|
||||||
implicitWidth: left.width + right.width
|
implicitHeight: 50
|
||||||
implicitHeight: left.height
|
implicitWidth: (label.contentWidth > 40 ? label.contentWidth - (m.count ? 5 : -5) : 40) + 12
|
||||||
RowLayout{
|
RowLayout{
|
||||||
id: btn
|
id: btn
|
||||||
anchors.centerIn: parent
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
spacing: 0
|
spacing: 0
|
||||||
RibbonRectangle{
|
RibbonRectangle{
|
||||||
id: left
|
id: left
|
||||||
|
@ -30,8 +34,8 @@ Item {
|
||||||
bottomLeftRadius: topLeftRadius
|
bottomLeftRadius: topLeftRadius
|
||||||
topRightRadius:m.count ? 0 : topLeftRadius
|
topRightRadius:m.count ? 0 : topLeftRadius
|
||||||
bottomRightRadius:m.count ? 0 : topLeftRadius
|
bottomRightRadius:m.count ? 0 : topLeftRadius
|
||||||
implicitWidth: label.contentWidth > 40 ? label.contentWidth - (m.count ? 5 : -5) : 40
|
implicitWidth: root.width - (right.visible ? right.width : 0)
|
||||||
implicitHeight: 40
|
implicitHeight: root.height - label.contentHeight
|
||||||
color: {
|
color: {
|
||||||
if (left_th.pressed)
|
if (left_th.pressed)
|
||||||
return pressed_color
|
return pressed_color
|
||||||
|
@ -58,7 +62,7 @@ Item {
|
||||||
source: typeof(root.icon_source) === "string" ? root.icon_source : ""
|
source: typeof(root.icon_source) === "string" ? root.icon_source : ""
|
||||||
visible: typeof(root.icon_source) === "string"
|
visible: typeof(root.icon_source) === "string"
|
||||||
fillMode:Image.PreserveAspectFit
|
fillMode:Image.PreserveAspectFit
|
||||||
height: icon_size
|
height: left.height
|
||||||
width: height
|
width: height
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
@ -75,7 +79,7 @@ Item {
|
||||||
topRightRadius:3
|
topRightRadius:3
|
||||||
bottomRightRadius:3
|
bottomRightRadius:3
|
||||||
implicitWidth: 12
|
implicitWidth: 12
|
||||||
implicitHeight: 40
|
implicitHeight: left.height
|
||||||
visible: m.count
|
visible: m.count
|
||||||
color: {
|
color: {
|
||||||
if (right_th.pressed||m.opened)
|
if (right_th.pressed||m.opened)
|
||||||
|
@ -103,15 +107,6 @@ Item {
|
||||||
onTapped: m.popup()
|
onTapped: m.popup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RibbonToolTip{
|
|
||||||
text: tip_text
|
|
||||||
visible: (left_hh.hovered || right_hh.hovered)&& show_tooltip && text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RibbonMenu{
|
|
||||||
id:m
|
|
||||||
width: 100
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
@ -127,4 +122,14 @@ Item {
|
||||||
font.family: Qt.platform.os === "osx" ? "PingFang SC" : "Microsoft YaHei UI"
|
font.family: Qt.platform.os === "osx" ? "PingFang SC" : "Microsoft YaHei UI"
|
||||||
color: text_color
|
color: text_color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RibbonToolTip{
|
||||||
|
text: tip_text
|
||||||
|
visible: (left_hh.hovered || right_hh.hovered)&& show_tooltip && text
|
||||||
|
}
|
||||||
|
|
||||||
|
RibbonMenu{
|
||||||
|
id:m
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue