Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Learning
  3. Qt in Education
  4. Are the example images of padding and inset correct?
Forum Updated to NodeBB v4.3 + New Features

Are the example images of padding and inset correct?

Scheduled Pinned Locked Moved Unsolved Qt in Education
2 Posts 2 Posters 73 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.
  • L Offline
    L Offline
    Lopher
    wrote last edited by
    #1

    019ac614-26ef-4815-9530-c37b6b5a7c4d-image.png

    Shouldn't the padding area be between the red Background and the blue Content item? Why does it here refer to the distance directly from the outside to the content area? Is this correct?

    Or is my understanding correct? Inset is the distance between a component and the outside, while padding is the distance between the Background and the Content item.

    I really don't understand this picture; it confuses me.

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote last edited by
      #2

      @Lopher said in Are the example images of padding and inset correct?:

      Shouldn't the padding area be between the red Background and the blue Content item? Why does it here refer to the distance directly from the outside to the content area? Is this correct?

      Or is my understanding correct? Inset is the distance between a component and the outside, while padding is the distance between the Background and the Content item.

      Is that the Control layout diagram? If not, I'm out of wild guesses.

      The diagram is correct. The documentation for Control.padding appears to have been written without considering non-0 insets.

      test.qml:

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 200
          height: 100
          visible: true
      
          Control {
              id: control
              anchors.fill: parent
              leftInset: 10
              leftPadding: leftInset * 2
              contentItem: Rectangle {
                  color: "light blue"
                  Text {
                      text: "contentItem.width:" + control.contentItem.width +
                            "\nbackground.width:" + control.background.width +
                            "\ncontrol.width:" + control.width
                  }
              }
              background: Rectangle { color: "red" }
          }
      }
      

      8f84f3de-bf7f-4677-8f0e-b9bdf5774b56-image.png

      Asking a question about code? http://eel.is/iso-c++/testcase/

      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