Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-373

Button padding does not change upon anchors.fill

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt for MCUs 2.8.2
    • QML

    Description

      In standard Qt, the content has padding values at the top, bottom, left and right. Howver, if we do anchors.fill: parent, then the content takes the same size as that of the parent. 

      import QtQuick 2.7
      import QtQuick.Controls 2.3
      
      Rectangle 
      {
          color: "red"
          anchors.fill: parent    
      
          Button
          {
              contentItem: Rectangle
              {
                  color: "yellow"
                  anchors.fill:parent
              }
          }
      } 

      However, in QtForMCU this does not work. The padding values are not over-written. The content will only take the size of the parent when we explicitly set all padding values to 0. We also tried to force height and width of the contentItem to be the same as parent but that also didn't work. 

      import QtQuick 2.7
      import QtQuick.Controls 2.3
      
      Rectangle 
      {
          color: "red"
          anchors.fill: parent    
      
          Button
          {
              topPadding: 0
              bottomPadding: 0
              leftPadding: 0
              rightPadding: 0
      
              contentItem: Rectangle
              {
                  color: "yellow"
                  anchors.fill:parent
              }
          }
      }
       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            tam5mu Maham Tanveer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes