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

How I can create custom Style for Qt Quick Controls?

$
0
0
Hi everyone! I’ve created my Qt Quick Component. This component is a part of my plugin and I want to use special Style to create customization of my component. I’ve found this wiki article [qt-project.org] but I can’t understand how I can use this object. My code for Style component looks like: import QtQuick 2.3   QtObject {     property QtObject backgroundColors: QtObject {         property color normalColor: "white"         property color pressedColor: "lightsteelblue"     }       property int rowHeight: 30     property int itemOffset: 22     property QtObject titleLabel: QtObject {         property QtObject font: QtObject {             property string family: "Helvetica Neue"             property bool bold: true             property bool italic: false             property bool underline: false             property real pointSize: 15         }         property QtObject colors: QtObject {             property color normalColor: "black"             property color pressedColor: "white"         }     }       property QtObject descriptionLabel: QtObject {         property QtObject font: QtObject {             property string family: "Helvetica Neue"             property bool bold: false             property bool italic: false             property bool underline: false             property real pointSize: 12         }           property QtObject colors: QtObject {             property color normalColor: "black"             property color pressedColor: "white"         }     }     property QtObject icon: QtObject {         property int height: 16         property url url: "../../images/expander.png"     } } When I’ve create it like this: property ShavTreeViewStyle style: ShavTreeViewStyle { } All works fine! But when I try to use it from main file like this:     ShavTreeView {         id: treeView         anchors.right: parent.right         width: 300         height: parent.height         datasList: list         style: ShavTreeViewStyle {             icon.height: 22         }     } I’ve received the error message: QQmlApplicationEngine failed to load component qrc:/main.qml:47 Cannot assign to non-existent property "height" How I can create Style object to use in my component? Thanks for the any help!

Viewing all articles
Browse latest Browse all 4972

Trending Articles