Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106098

ComboBox: The implicitContentWidthPolicy property doesn't work for the Imagine style

    XMLWordPrintable

Details

    • All
    • e11df48384 (qt/qtdeclarative/dev) 5827a95dd4 (qt/qtdeclarative/6.3) 761eea369d (qt/qtdeclarative/6.4) 5827a95dd4 (qt/tqtc-qtdeclarative/6.3) 761eea369d (qt/tqtc-qtdeclarative/6.4) 00fd966684 (qt/tqtc-qtdeclarative/6.2)

    Description

      From the documentation, it says that 

      implicitContentWidthPolicy provides an easy way to control how the implicitContentWidth is calculated, which in turn affects the implicitWidth of the ComboBox and ensures that text will not be elided.
      

       However, the implicitContentWidth will only affect the implicitWidth for the Basic, Fusion, Material and Universal styles (and perhaps also the native styles, which I haven't checked yet).
      But it won't work for the Imagine style.

       

      Here is the implicitWidth binding for the Fusion style:

          implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
                                  implicitContentWidth + leftPadding + rightPadding)

      And here is the implicitWidth binding for the Imagine style:

      implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
                                  contentItem.implicitWidth + background ? (background.leftPadding + background.rightPadding) : 0)

      As you can see, the implicitContentWidth isn't a part of the implicitWidth binding for the Imagine style.
      The Imagine style implicitWidth appears to have been overlooked in the original patch: https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/225925

      Reproduce with the following qml code:

      ComboBox {
          implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted
          model: ListModel {
              ListElement {
                  name: qsTr("12345678901234567890")
              }
              ListElement {
                  name: qsTr("123")
              }
          }
      }

       

      Attachments

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

        Activity

          People

            hurlevent Oliver Eftevaag
            hurlevent Oliver Eftevaag
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes