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. How to use ComboBoxStyle

How to use ComboBoxStyle

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 2.4k Views
  • 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.
  • chawilaC Offline
    chawilaC Offline
    chawila
    wrote on last edited by chawila
    #1

    i tried these:

    ComboBoxStyle.background: "#223"
    

    and these:

    ComboBoxStyle: {
       background = "#223";
     }       
    

    But i still get:

    Non-existent attached object
    
    raven-worxR 1 Reply Last reply
    0
    • chawilaC chawila

      i tried these:

      ComboBoxStyle.background: "#223"
      

      and these:

      ComboBoxStyle: {
         background = "#223";
       }       
      

      But i still get:

      Non-existent attached object
      
      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

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

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

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • chawilaC Offline
        chawilaC Offline
        chawila
        wrote on last edited by
        #3

        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

        raven-worxR 1 Reply Last reply
        0
        • chawilaC chawila

          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

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @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"
                    }
            }
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          2
          • ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by
            #5

            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

            chawilaC 1 Reply Last reply
            1
            • ODБOïO ODБOï

              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

              chawilaC Offline
              chawilaC Offline
              chawila
              wrote on last edited by chawila
              #6
              This post is deleted!
              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