fix(StatusProgressBar): Hide text in bar if it does not fit (#672)
This commit is contained in:
parent
1b25ddd2b5
commit
9498be05ef
|
@ -34,10 +34,24 @@ ProgressBar {
|
|||
radius: 5
|
||||
|
||||
StatusBaseText {
|
||||
id: textItem
|
||||
anchors.centerIn: parent
|
||||
property bool _fittedInBar: width < bar.width ? true : false
|
||||
text: control.text
|
||||
font.pixelSize: 12
|
||||
color: Theme.palette.indirectColor1
|
||||
Component.onCompleted: opacity = width < bar.width ? 1 : 0
|
||||
on_FittedInBarChanged: {
|
||||
if (_fittedInBar && opacity == 0) {
|
||||
fadeIn.start();
|
||||
}
|
||||
else if (!_fittedInBar) {
|
||||
fadeIn.stop();
|
||||
opacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
OpacityAnimator { id: fadeIn; target: textItem; from: 0; to: 1; duration: 250 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue