How to use ComboBoxStyle



  • i tried these:

    ComboBoxStyle.background: "#223"
    

    and these:

    ComboBoxStyle: {
       background = "#223";
     }       
    

    But i still get:

    Non-existent attached object
    

  • Moderators

    @chawila
    properties starting with a capital letter are attached properties. Which is of course wrong for your case.
    Try this:

    ComboBox {
        style: ComboBoxStyle {
              ....
       }
    }
    


  • Thanks for replying @raven-worx

    But how do i add property inside that?.

    eg background.

    i tried these:

    style: ComboBoxStyle {
    
              background: {
    
                   background = "red"
              }
      }
    

    and

    i tried these:

    style: ComboBoxStyle {
    
              background : "red"
            
      }
    

    do not loose patience i`m new to these


  • Moderators

    @chawila
    syntactically the second approach is way more correct than the first one.
    But see the ComboBoxStyle docs. The background property is of type Component (not of type color).

    style: ComboBoxStyle {
              background: Rectangle {
                           color: "red"
              }
      }
    


  • Hi,
    Like this : (not very nice style but functionnal : ) )

    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.4

    ComboBox {
        anchors.centerIn:parent
         width: 200
        style: ComboBoxStyle {
                background : Rectangle{    //here u can set what u want
                            anchors.fill: parent
                            color : "grey"
                            border.width:1
                }
       }
    

    }

    LA



  • This post is deleted!

Log in to reply
 

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