Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved]CheckBox element for desktop application

[Solved]CheckBox element for desktop application

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elnaz
    wrote on last edited by
    #1

    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.

    /Elnaz ~:>

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ephe
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Elnaz
        wrote on last edited by
        #3

        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.

        /Elnaz ~:>

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved