Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.3
-
None
Description
If we scale a combobox and its popup accordingly, its popup has an incorrect position when it is flipped vertically to stay inside our window
The following example displays two scaled comboboxes (x2):
- the popup of the top one has a correct position (no vertical flip)
- the popup of the bottom one has an incorrect position (vertical flip)
This issue comes from the calculations in QQuickPopupPositioner::reposition() when it tries to flip the popup around (above <-> below) to fit vertically inside the window
newTopLeft is defined as const QPointF newTopLeft(p->x, m_parentItem->height() - p->y - rect.height());
It should take into account the scale factor between m_parentItem and popupItem->parentItem() to subtract rect.height() e.g.
~~~
const auto scaleFactor = m_parentItem->mapToItem(popupItem->parentItem(), QRectF{0, 0, 1, 1}).height();
const QPointF newTopLeft(p->x, m_parentItem->height() - p->y - rect.height()/scaleFactor);
~~~