QML ProgressBar Qt 5.7 has no style and color property
-
wrote on 20 Nov 2016, 18:34 last edited by Galbarad
Hi to all
I have problem with ProgressBar componentimport QtQuick.Controls 2.0 ProgressBar { id: pbLife value: 0.5 color: "red" // run time error style: ProgressBarStyle {} // run time error height: iLifeIcon.height anchors.right: parent.right anchors.left: iLifeIcon.right anchors.verticalCenter: iLifeIcon.verticalCenter }
-
Hi to all
I have problem with ProgressBar componentimport QtQuick.Controls 2.0 ProgressBar { id: pbLife value: 0.5 color: "red" // run time error style: ProgressBarStyle {} // run time error height: iLifeIcon.height anchors.right: parent.right anchors.left: iLifeIcon.right anchors.verticalCenter: iLifeIcon.verticalCenter }
-
Hi to all
I have problem with ProgressBar componentimport QtQuick.Controls 2.0 ProgressBar { id: pbLife value: 0.5 color: "red" // run time error style: ProgressBarStyle {} // run time error height: iLifeIcon.height anchors.right: parent.right anchors.left: iLifeIcon.right anchors.verticalCenter: iLifeIcon.verticalCenter }
wrote on 22 Nov 2016, 15:14 last edited byHello @Galbarad ,
You have an example in the documentation Customizing ProgressBar.
-
Hi, @Galbarad,
Unless I am mistaken,
QtQuick.Controls 2.0
are notstyle
proporty. But you can usebackground
property inherited fromControl
Hope this helps
wrote on 24 Nov 2016, 15:08 last edited byHi @CharlieG,
yes style property not available in 2.0 but according documentation property "color" should be available, but it's not available too
hm can't found doc with "color", but see that "style" still in doc
http://doc.qt.io/qt-5/qml-qtquick-controls-progressbar.html#style-prop@Julien-B thanks I'll check
-
Hi @CharlieG,
yes style property not available in 2.0 but according documentation property "color" should be available, but it's not available too
hm can't found doc with "color", but see that "style" still in doc
http://doc.qt.io/qt-5/qml-qtquick-controls-progressbar.html#style-prop@Julien-B thanks I'll check
wrote on 24 Nov 2016, 15:26 last edited by Julien BThe link you provided is for Quick Controls 1.4. but in List of All Members for ProgressBar (1.4) there is
style
but notcolor
.The proper links for Quick Controls 2.0 are ProgressBar QML Type (2.0) and List of All Members for ProgressBar (2.0) and neither
color
norstyle
appears in it. -
wrote on 29 Nov 2016, 13:14 last edited by
Hi all
I found that example from documentation Customizing ProgressBar has problem in case ProgressBar located in other place than left top corner
please check working exampleimport QtQuick 2.6 import QtQuick.Controls 2.0 Rectangle { width: 400 height: 600 ProgressBar { id: control value: 0.5 padding: 2 width: 100 height: 8 z: 100 anchors.centerIn: parent background: Rectangle { anchors.left: control.left anchors.verticalCenter: control.verticalCenter implicitWidth: 50 implicitHeight: 6 color: "#e6e6e6" radius: 3 } contentItem: Rectangle { anchors.left: control.left anchors.verticalCenter: control.verticalCenter width: control.visualPosition * control.width height: control.height radius: 2 color: "#17a81a" z:101 } } }
-
Hi all
I found that example from documentation Customizing ProgressBar has problem in case ProgressBar located in other place than left top corner
please check working exampleimport QtQuick 2.6 import QtQuick.Controls 2.0 Rectangle { width: 400 height: 600 ProgressBar { id: control value: 0.5 padding: 2 width: 100 height: 8 z: 100 anchors.centerIn: parent background: Rectangle { anchors.left: control.left anchors.verticalCenter: control.verticalCenter implicitWidth: 50 implicitHeight: 6 color: "#e6e6e6" radius: 3 } contentItem: Rectangle { anchors.left: control.left anchors.verticalCenter: control.verticalCenter width: control.visualPosition * control.width height: control.height radius: 2 color: "#17a81a" z:101 } } }
wrote on 30 Nov 2016, 07:59 last edited by Julien BIt looks like a bug but I cannot confirm, I checked with
console.log
and it seemscontentItem Rectangle width
is overriden when you useanchors.centerIn: parent
in yourProgressBar
, even ifcontrol.visualPosition * control.width
provide the right result and I don't know why.Anyway you can try this temporary workaround (tested on linux).
Replace in
ProgressBar
anchors.centerIn: parent
by
x: parent.width/2 - control.width/2 y: parent.height/2 - control.height/2
-
wrote on 30 Nov 2016, 15:44 last edited by
Hi @Julien-B
I try workaround, but with no success, may I ask your full test file?I found another problem when I use ProgressBar with background and contentItem I get qml runtime error
qrc:///qml/GameField.qml: Object destroyed during incubationProgressBar { id: pbLife value: 0.5 height: 0.8 * iLifeIcon.height anchors.right: parent.right anchors.left: iLifeIcon.right anchors.verticalCenter: iLifeIcon.verticalCenter background: Rectangle { anchors.fill: pbLife color: "transparent" radius: 3 border.color: "#000000" border.width: 1 } contentItem: Rectangle { anchors.left: pbLife.left anchors.verticalCenter: pbLife.verticalCenter width: pbLife.visualPosition * pbLife.width height: pbLife.height radius: 2 color: "#FF0000" //z: 10 } }
1/9