[Solved]CheckBox element for desktop application



  • Hi everybody,

    I'm developing a desktop HMI application with Qt Quick, and I need a simple checkbox.
    I was wondering how I can achieve this and what would be the simplest approach, for example:

    • importing a module from somewhere.
    • writing a checkbox module from scratch!

    I hope there exist better options than the latter...
    Thanks in advance for your help.



  • maybe you can have a look at the qt components "here":http://qt.gitorious.org/qt-components



  • Thanks saho, yes that is very useful. However meanwhile I figured out to write a very simple chechekbox myself ;)
    I'll post it here as well, might be useful for others:

    the CheckBox.qml file:

    @
    import QtQuick 1.0

    Button{
    id: checkBox

    radius: 3
    buttonColor: "white"
    borderColor: "black"
    border.width: 2
    width: 30; height: 28
    
    property bool checked: false
    
    onButtonClick: {
    
        checked =  checked ? false : true
    }
    
    Image {
    
        opacity: checked ? 1.0 : 0.1
        smooth: true
        width: 12; height: 12
        source:  "images/check.png"
        anchors.fill: parent
    }
    

    }
    @

    Just note that in order to make this work, one should provide a Button.qml module as well. There are many examples of a button in the Qt Quick tutorials and examples.


Log in to reply
 

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