diff --git a/declarativeimports/plasmacomponents/qml/ProgressBar.qml b/declarativeimports/plasmacomponents/qml/ProgressBar.qml index 67805caf0..a04f91b69 100644 --- a/declarativeimports/plasmacomponents/qml/ProgressBar.qml +++ b/declarativeimports/plasmacomponents/qml/ProgressBar.qml @@ -87,6 +87,7 @@ Item { id: contents property bool _isVertical: orientation == Qt.Vertical + property int _tileWidth: width width: _isVertical ? progressBar.height : progressBar.width height: _isVertical ? progressBar.width : progressBar.height @@ -99,17 +100,20 @@ Item { interval: 0 running: false onTriggered: { + contents._tileWidth = Math.floor(contents.width/(Math.floor(contents.width/(contents.height/1.6)))) + + if (barFrameSvg.hasElement("hint-bar-stretch")) { barFrameSvg.resizeFrame(Qt.size(barPixmapItem.width, barPixmapItem.height)) } else { - barFrameSvg.resizeFrame(Qt.size(Math.floor(contents.height/1.6), contents.height)) + barFrameSvg.resizeFrame(Qt.size(contents._tileWidth, contents.height)) } barPixmapItem.pixmap = barFrameSvg.framePixmap() if (backgroundFrameSvg.hasElement("hint-bar-stretch")) { backgroundFrameSvg.resizeFrame(Qt.size(backgroundPixmapItem.width, backgroundPixmapItem.height)) } else { - backgroundFrameSvg.resizeFrame(Qt.size(Math.floor(contents.height/1.6), contents.height)) + backgroundFrameSvg.resizeFrame(Qt.size(contents._tileWidth, contents.height)) } backgroundPixmapItem.pixmap = backgroundFrameSvg.framePixmap() } @@ -132,9 +136,8 @@ Item { } QPixmapItem { id: backgroundPixmapItem - fillMode: QPixmapItem.Tile - width: Math.floor(parent.width/(height/1.6))*Math.floor(height/1.6) - height: parent.height + anchors.fill: parent + fillMode: QPixmapItem.TileHorizontally onWidthChanged: resizeTimer.restart() onHeightChanged: resizeTimer.restart() } @@ -142,11 +145,12 @@ Item { QPixmapItem { id: barPixmapItem - fillMode: QPixmapItem.Tile - width: indeterminate ? Math.floor(height/1.6)*2 : range.position + fillMode: QPixmapItem.TileHorizontally + width: indeterminate ? contents._tileWidth*2 : range.position height: contents.height visible: indeterminate || value > 0 + onWidthChanged: resizeTimer.restart() SequentialAnimation { id: indeterminateAnimation