Skip to content

SearchPopupField: Premium Edition

lt;dr:

KirigamiAddons_SearchPopupField

TL;DW:

Before this patch popup was kind-of animating into existence (although with its own fair share of glitches), but instantly disappeared on close. Because standard popup transitions were not implemented. This is an unstyled T.Popup after all, so everything about it is DIY.

This patch implements a transition that first cross-fades search field's background with popup's background, and then animates y offset and expands at the same time. It goes in reverse order for exit transition.

If there's not enough room on the bottom, popup will be pushed upward when opened, animated during parallel transition on y and height.

Content item is now clipped with a rounded rectangle shape that perfectly matches popup's background, and is not resized on the fly anymore (which was a really inappropriate effect). Popup is now padded by background's border width (because border is "inner"), so content does not overlap with that border anymore.

Popup now uses the new OverlayZStacking attached property, but only if running on KF6 (implemented as typeof !== "undefined" check). Though, turned out some improvements are needed on Kirigami side to be able to detect reparenting of dynamically created root control from a nested Popup instance.

Popup now closes automatically if root control becomes invisible. Y offset, height and backgrounds' opacity properties are re-bound to their target expressions on opened/closed handlers in case QQuickPopup decides to skip transitions (which may happen to a nested popups when an outer one is closed) and also to stay up-to-date before next time a transition starts. An alternative approach would be to set them in aboutToShow/Hide handlers, but that would mess up with mid-flights reversals (if a user has slow animations or otherwise manages to open while closing or vice-versa).

Two existing properties are deprecated now: spaceAvailableLeft & Right. Their purpose was unclear to me, and implementation seem broken: all it did was pushing popup out of bounds to the left if a search field was stretching across whole window width. Besides, naming of those properties is not RTL-friendly, and likely will break your layouts in some ways.

Merge request reports