Bug #13464
openMoving of WMenuItem
0%
Description
There currently exist no direct way to move around WMenuItem
s in a WMenu
. Although this IS supported by first removing them, and adding them again, calling WMenu::removeItem() and WMenu::insertItem() respectively.
Now, this will result in a segfault, when the contents of the item are loaded Lazy. This is because the wrapping container (uContentsContainer
) is removed, and the content that was added to the WStackedWidget
to display it, it taken back by the WMenuItem
(WMenuItem::returnContentsInStack()
). To avoid this issue, we need to check the assumption that the uContentsContainer
exists, when we try to add it to the WStackedWidget
.
Additionally, since we already offer removeItem
and insertItem
, we can cut out the middle-man, and provide WMenu::moveItem(int fromIndex, int toIndex)
, and WMenu::moveItem(WMenuItem* item, int toIndex)
.
Any existing WMenuItem
at toIndex
or beyond, will have their index increased by one.
No data to display