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

Popup isn't positioned as expected in certain circumstances

    XMLWordPrintable

Details

    Description

      A minimal example:

      import QtQuick
      import QtQuick.Controls.Basic
      
      Window {
          width: 640
          height: 480
          visible: true
      
          Item {
              id: root
              objectName: "CustomCombobox"
              x: 10
              y: 300
              width: 200
              height: 20
      
              ComboBox{
                  id:control
                  anchors.fill: parent
                  model: 100
      
                  popup: Popup {
                      id: popupList
                      x: 0
                      y: control.height
                      implicitWidth: 200
                      implicitHeight: contentItem.implicitHeight
                      contentItem: ListView {
                          id:listItems
                          implicitHeight: contentHeight
                          clip: true
                          interactive: true
                          model: control.popup.visible ? control.delegateModel : null
                          currentIndex: control.highlightedIndex
                      }
                  }
              }
          }
      }
      

      That works as expected when there are 100 entries in model, that Popup pops out on top /from the bottom of ComboBox (depending on whether there are more space on top or bottom). But when there are only 10 entries, i.e. model: 10, then ComboBox is totally covered up by its Popup, which is an undesired behavior.

      The current workaround is to explicitly set a height or implicitHeight for Popup.

      It is speculated that popup positioner is doing some optimizations internally. But the result can be unexpected.

      Attachments

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

        Activity

          People

            tatiana.borisova Tatiana Borisova
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes