Checkbox



  • Hi, I want to make a checkbox and i am able to do that but i want to resize "tick" and "rectangle" size in checkbox, To resize there is :- "checkboxstyle" and the code is given

    CheckBox {
         text: "Check Box"
         style: CheckBoxStyle {
             indicator: Rectangle {
                     implicitWidth: 16
                     implicitHeight: 16
                     radius: 3
                     border.color: control.activeFocus ? "darkblue" : "gray"
                     border.width: 1
                     Rectangle {
                         visible: control.checked
                         color: "#555"
                         border.color: "#333"
                         radius: 1
                         anchors.margins: 4
                         anchors.fill: parent
                     }
             }
         }
     }
    

    By doing this it is getting resize, but definitely i will not not get "tick" inside rectangle,
    i will get another rectangle, i searched for this online that how to resize checkbox with tick but i got that it's not possible as the "tick" is image and it's size is fixed.

    Is it right or wrong ?



  • hi,
    @Bhushan_Sure said in Checkbox:

    indicator: Rectangle {

    You can do

    indicator :  Image{}
    

    and create your indicator image



  • @LeLev image source i have to give or QT will take system's image ?



  • @Bhushan_Sure
    you can create a scalable image (.svg) with Inkscape for exemple, and set is as source of your indicator Image



  • @LeLev Thank you Very much, it Worked :)


Log in to reply
 

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