qt5base-lts/tests/auto/widgets
Richard Moe Gustavsen 8393922e70 QComboBox: scroll the popup to the top before positioning it
If the style changes while a popup is open (or about to close),
the popup will change style as well before it's hidden. And
this can result in the popup window briefly ending up smaller
than what it needs to be, in order to fit all the menu items.
In that case, it will show 'up' and 'down' widgets in the
menu that auto scrolls it when hovered. And all this can
happen for a split second while the menu is about to close
(as a result of the user clicking on a menu item).

A bug happens because of this if you click on the last menu
item in the list, and this causes the style to change. In
that case, the 'down' widget will end up directly underneath
the mouse for a split second, which will trigger an auto-scroll
timer to start. This timer will trigger a bit later, after
the popup has been hidden, and scroll the list view a bit down.
The result is that the next time you open the popup, it ends up
at the wrong place on the screen in a failed attempt to center
the current index on top of the combobox.

This patch will make sure that we always scroll the list view
to the top before we start calculating where the popup should
be placed on the screen. Otherwise the geometry ends up wrong
since the popup will anyway be resized (if possible) to fit
all the menu items before it's shown and should therefore not
take scrolling into account.

Pick-to: 6.6 6.5
Fixes: QTBUG-113765
Change-Id: I61b5b832904de471c2303fc67325feec322b1449
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-15 13:04:56 +02:00
..
dialogs Allow disable native messagebox dialog 2023-05-02 10:37:17 +02:00
effects tests: blacklist tst_QGraphicsEffect::draw() on Wayland 2023-04-17 16:05:24 +02:00
graphicsview tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
itemviews Use boolean to indicate QTableWidgetItem is header item 2023-05-05 05:28:19 +00:00
kernel Fix sending deferred delete events when posted before outermost loop 2023-06-09 16:31:35 +02:00
styles QStyleSheetStyle: Default to foreground for unset brushes only 2023-06-09 23:42:47 +02:00
util QCompleter::setPopup() - refactor and cleanup 2023-03-14 21:15:31 +01:00
widgets QComboBox: scroll the popup to the top before positioning it 2023-06-15 13:04:56 +02:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00