Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

ProgressBarStyle in a styling Singleton

$
0
0
Hi, I’ve been trying various ways to switch out the style of a ProgressBar to indicate an error state. I’ve tried setting the style in a PropertyChanges, both created there or referenced by id, I’ve tried using Bindings as well as Loaders and Bindings and finally now a style singleton. I like the Singleton approach best, but I cannot make it work either. Here’s my Singleton’s code: pragma Singleton import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1   QtObject {     property ProgressBarStyle progressBarErrorStyle: ProgressBarStyle {         background: Rectangle {             radius: 2             color: "lightgray"             border.color: "gray"             border.width: 1             implicitWidth: 200             implicitHeight: 20         }         progress: Rectangle {             color: "orangered"             border.color: "red"         }     } } The problem is, when I use progressBarErrorStyle in any of my QML files, its type is ProgressBarStyle_QMLTYPE_17. I’ve asked a couple of questions on Stackoverflow related to what I’m trying to do, so I figured I’d try here… http://stackoverflow.com/questions/23210427/cannot-create-certain-qml-types-in-a-singleton http://stackoverflow.com/questions/23121106/qml-property-is-null What am I missing, is it even possible to swap out a ProgressBar’s style at runtime?

Viewing all articles
Browse latest Browse all 4972

Trending Articles