Skip to content

Fix Menu

ivan tkachenko requested to merge work/ratijas/menu-separator-width into master

MenuSeparator: Match parent's width

Using this opportunity, shorten the code (and optimize, because implicit size inheritance is more efficient that explicit binding) of MenuItem as well.

Menu: Sort out order of properties, add vertical spacing between code

Menu: Simplify JavaScript loops

Both are some sort of reduce/accumulators, but only one of them cleanly maps to modern JavaScript Array API: the other one is two accumulators at once, which quickly gets messy without static typing.

Menu: Drop old workaround for QtQuick.Controls 2.3 (Qt 5.10)

In modern Qt, Menu::currentIndex is always gonna be defined, no fallback is needed.

Menu: Fix up interactivity binding

ApplicationWindow specifically from QtQuick.Controls is not needed, any Window is enough. Also we need to account for popup's padding.

Menu: Drop hack that forced re-evaluation of bindings for width

It was supposedly used to force reevaluation of ListView::implicitWidth binding and onVisibleChildrenChanged() connection below. None of this is needed, at least anymore, because implicitWidth perfectly binds to all individual children's implicitWidth during reduce() execution; and Connections on visibleChildren does not really depend on implicitWidth.

Menu: Fix zero-sized popup glitch in RTL environment

For some reason ListView fails to report any sane contentHeight specifically in RTL mode.

There is a similar trick to force it to work in recently added HorizontalHeaderView.qml styled override. But unlike what that comment in header view says, Menu actually creates components (you could inspect them in GammaRay), but somehow they are being ignored for the purposes of contentHeight estimation.

Merge request reports