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

QML ComboBox menu is not aligned with top of ComboBox when popup extends up and scale is not 1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.12, 6.5.0
    • Quick: Controls 2
    • None
    • Windows 11
    • Windows

    Description

      When a ComboBox popup menu goes up instead of down, it does not align with the ComboBox if the ComboBox scale is something other than 1.

      It's pretty cool that the ComboBox popup menu automatically avoids extending outside the window frame, but it looks pretty ugly when the Item it's on is scaled proportionally to the window size. Run the attached code and drag the window larger; the control itself looks fine but the menu does not scale correctly at all. As you get close to 1:1 scaling, the menu lines up but is you shrink the window smaller than 1:1 it misaligns in the opposite direction.

      // main.qml in attached 7z file
      ApplicationWindow {
          id: window
          width: 320; height: 240
          visible: true
          title: qsTr("ComboBox Scale Defect")    Rectangle {
              anchors.centerIn: parent
              width: 180; height: 180
              color: "lightblue"
              scale: window.height/height  // scale proportionally to window height        ComboBox {
                  id: comboBox
                  anchors.bottom: parent.bottom
                  model: [ "one", "two", "three" ]
      //            popup.scale: parent.scale   // fixes popup's font size, but not position
                  Component.onCompleted: popup.open()
              }
          }
      }

      I see two issues when ComboBox scale is not 1:

      • popup menu does not align with top of ComboBox
        • this is the focus of this issue
      • popup menu is not scaled to match ComboBox
        • workaround is simple: popup.scale: parent.scale

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            stan.m Stanley Morris
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes