RibbonProgressBar: Added more position choice.

This commit is contained in:
Mentalflow 2024-06-28 14:45:18 +08:00
parent c9600ecb3c
commit 406bf535bf
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
3 changed files with 7 additions and 6 deletions

View File

@ -6,10 +6,11 @@ import RibbonUI 1.0
Item{
id: control
implicitHeight: (textLabelPosition === RibbonProgressBar.LabelPosition.Top || textLabelPosition === RibbonProgressBar.LabelPosition.Bottom && showText ?
(text_label.contentHeight + textLabelMargin + bar.implicitHeight) : showText ? Math.max(bar.implicitHeight, text_label.contentHeight) : bar.implicitHeight)
(text_label.contentHeight + textLabelMargin + bar.implicitHeight) : showText && textLabelPosition !== RibbonProgressBar.LabelPosition.None ? Math.max(bar.implicitHeight, text_label.contentHeight) : bar.implicitHeight)
implicitWidth: bar.implicitWidth + (textLabelPosition === RibbonProgressBar.LabelPosition.Left || textLabelPosition === RibbonProgressBar.LabelPosition.Right && showText ?
(text_label.contentWidth + textLabelMargin) : 0)
enum LabelPosition {
None,
Top,
Left,
Right,
@ -30,6 +31,7 @@ Item{
property alias position: bar.position
property alias indeterminate: bar.indeterminate
property alias bar: bar
property alias textLabel: text_label
ProgressBar {
id: bar
@ -56,7 +58,6 @@ Item{
implicitHeight: barHeight
implicitWidth: barWidth
height: implicitHeight
anchors.verticalCenter: bar.verticalCenter
clip: true
layer.enabled: true
layer.effect: OpacityMask {
@ -96,7 +97,6 @@ Item{
implicitHeight: barHeight
height: barHeight
radius: height / 2
anchors.verticalCenter: bar.verticalCenter
color: bgColor
}
}

View File

@ -286,6 +286,7 @@ Item{
}
Component.onCompleted: Window.window.tabBar = root
//onModern_styleChanged: refresh()
function addPage(content, is_highlight)

View File

@ -6,10 +6,11 @@ import RibbonUI
Item{
id: control
implicitHeight: (textLabelPosition === RibbonProgressBar.LabelPosition.Top || textLabelPosition === RibbonProgressBar.LabelPosition.Bottom && showText ?
(text_label.contentHeight + textLabelMargin + bar.implicitHeight) : showText ? Math.max(bar.implicitHeight, text_label.contentHeight) : bar.implicitHeight)
(text_label.contentHeight + textLabelMargin + bar.implicitHeight) : showText && textLabelPosition !== RibbonProgressBar.LabelPosition.None ? Math.max(bar.implicitHeight, text_label.contentHeight) : bar.implicitHeight)
implicitWidth: bar.implicitWidth + (textLabelPosition === RibbonProgressBar.LabelPosition.Left || textLabelPosition === RibbonProgressBar.LabelPosition.Right && showText ?
(text_label.contentWidth + textLabelMargin) : 0)
enum LabelPosition {
None,
Top,
Left,
Right,
@ -30,6 +31,7 @@ Item{
property alias position: bar.position
property alias indeterminate: bar.indeterminate
property alias bar: bar
property alias textLabel: text_label
ProgressBar {
id: bar
@ -56,7 +58,6 @@ Item{
implicitHeight: barHeight
implicitWidth: barWidth
height: implicitHeight
anchors.verticalCenter: bar.verticalCenter
clip: true
layer.enabled: true
layer.effect: OpacityMask {
@ -96,7 +97,6 @@ Item{
implicitHeight: barHeight
height: barHeight
radius: height / 2
anchors.verticalCenter: bar.verticalCenter
color: bgColor
}
}