Theme in -QT- Qt Quick components



  • HI all,
    I was trying to use the -QT- Qt Quick components for symbian . in Meego it was fairly easy to change the theme colour using theme.inverted = false.
    how can I do that in Symbian? do we have an api to do that?

    kind regards
    Nish



  • Never came across such in Symbian ( to my best of knowledge). But you can easily change themes by creating different qml files for each theme namely, and apply it in your qml either by property binding or a simple state change.



  • but doesn't that defeat the whole purpose of having QT components? We were supposed to use QT components to reduce our coding. I was not able to find any sort of property in the Window and Toolbar component to change the background colour. Just to change the colour will I have to create a new QML for these components?



  • bq. Just to change the colour will I have to create a new QML for these components

    No, you can change the color within the QML if you know what the color you are about to change. But when it comes to professional/enterprise apps, the designers want more freedom to change the themes. It is not a good design approach to keep dynamic materials like skins inside code. So you have to create a new QML file with just the skin elements as properties.

    @
    // auroraSkin.qml
    Item {
    id: auroraSkin
    property string bkgImage: "qrc:/images/bkg.jpg";
    property string homeIcon: "qrc:/images/tb_home.svg";
    property color fontColor: "#661100"
    property int titleFontSize: 40
    property int subTitleFontSize: 30
    property int contentFontSize: 23
    property int contentMargin: 8
    }
    @

    @
    // aquaBlueSkin.qml
    Item {
    id: aquaBlueSkin
    property string bkgImage: "qrc:/images/bkgblue.jpg";
    property string homeIcon: "qrc:/images/tb_home_aqua.svg";
    property color fontColor: "#AA2150"
    property int titleFontSize: 35
    property int subTitleFontSize: 20
    property int contentFontSize: 20
    property int contentMargin: 11
    }
    @

    When a Item property is referred as skin, it makes switching the skins more easy.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.