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. Why does GroupBox not have a Border attribute in QML?
Forum Updated to NodeBB v4.3 + New Features

Why does GroupBox not have a Border attribute in QML?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 3 Posters 1.7k 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.
  • M Offline
    M Offline
    mirro
    wrote on last edited by mirro
    #1

    What's wrong with the following code?

    GroupBox {
        title: qsTr("Synchronize")
        border{color:"#FF0000"}
    }
    
    J.HilkJ 1 Reply Last reply
    0
    • M mirro

      What's wrong with the following code?

      GroupBox {
          title: qsTr("Synchronize")
          border{color:"#FF0000"}
      }
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @mirro GroupBox has no property named border -> no direct change, you could use the background property to define your own background :

       GroupBox{
              id: control
              title: qsTr("Some Text")
              anchors.fill: parent
              anchors.margins: 10
      
              background: Rectangle {
                      y: control.topPadding - control.padding
                      width: parent.width
                      height: parent.height - control.topPadding + control.padding
                      color: "transparent"
                      border.color: "#21be2b"
                      radius: 2
                  }
          }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      M 1 Reply Last reply
      0
      • J.HilkJ J.Hilk

        @mirro GroupBox has no property named border -> no direct change, you could use the background property to define your own background :

         GroupBox{
                id: control
                title: qsTr("Some Text")
                anchors.fill: parent
                anchors.margins: 10
        
                background: Rectangle {
                        y: control.topPadding - control.padding
                        width: parent.width
                        height: parent.height - control.topPadding + control.padding
                        color: "transparent"
                        border.color: "#21be2b"
                        radius: 2
                    }
            }
        
        M Offline
        M Offline
        mirro
        wrote on last edited by
        #3

        @J-Hilk said in Why does GroupBox not have a Border attribute in QML?:

        background property

        How do I set the background property Image?

        J.HilkJ 1 Reply Last reply
        0
        • M mirro

          @J-Hilk said in Why does GroupBox not have a Border attribute in QML?:

          background property

          How do I set the background property Image?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @mirro

          background: Image {
                          ...
                      }
          

          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          M 1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @mirro

            background: Image {
                            ...
                        }
            
            M Offline
            M Offline
            mirro
            wrote on last edited by mirro
            #5

            @J-Hilk
            thanks a lot.I'd like to ask last question.

            How is the repaint() of GroupBox defined in QML?

            J.HilkJ 1 Reply Last reply
            0
            • M mirro

              @J-Hilk
              thanks a lot.I'd like to ask last question.

              How is the repaint() of GroupBox defined in QML?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @mirro what exactly do you mean with repaint() ?


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              M 1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                @mirro what exactly do you mean with repaint() ?

                M Offline
                M Offline
                mirro
                wrote on last edited by mirro
                #7

                @J-Hilk
                sorry, I mean How is the QWidget::update() defined in QML??

                1 Reply Last reply
                0
                • GrecKoG Offline
                  GrecKoG Offline
                  GrecKo
                  Qt Champions 2018
                  wrote on last edited by
                  #8

                  I believe it isn't.
                  GroupBox only handles the visual logic (properties and positionning).
                  The painting is done by its background item, its contentItem item and label item.

                  Generally controls are a skeleton and delegate the painting to their child item

                  1 Reply Last reply
                  1

                  • Login

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