Add more API to enable custom menu positioning.
ClosedPublic

Authored by hein on Feb 10 2017, 12:43 PM.

Details

Summary

Without being able to get the menu size it's not possible to
calculate the right values to pass to open() for cases where
we want to bypass QMenu's own positioning behavior. This
enables doing things like "open context menu above panel even
if it would fit below" with QML menus.

I'm not happy with this change, but if we want the result it's
what we gotta do.

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hein updated this revision to Diff 11168.Feb 10 2017, 12:43 PM
hein retitled this revision from to Add more API to enable custom menu positioning..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added reviewers: Plasma, mart.
hein added a subscriber: plasma-devel.
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptFeb 10 2017, 12:43 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript

We have this openRelateive thing with "bottom left posed" and what not, shouldn't it have a thing for "have the bottom left corner of the menu be at the top of the parent item"?

hein added a comment.Feb 10 2017, 12:50 PM

I'm not convinced it's worth it. This patch allows writing the same sort of code we already have in ContainmentInterface for context menu placement. If we resort to doing it there then clearly we need it in other places as well.

(And I wrote openRelative ...)

I can't say how this looks in context of the new popup positioning protocol on Wayland etc. though.

hein added a comment.Feb 10 2017, 12:52 PM

Although ... maybe one hack we could do is change the meaning of "TopPosedLeftAlignedPopup" to "bottom edge of menu at top of visualParent" instead of "0,0 of menu at top of visualParent". Marco?

mart edited edge metadata.Feb 10 2017, 1:21 PM
In D4546#84979, @hein wrote:

Although ... maybe one hack we could do is change the meaning of "TopPosedLeftAlignedPopup" to "bottom edge of menu at top of visualParent" instead of "0,0 of menu at top of visualParent". Marco?

this could break some existing users tough?

hein updated this revision to Diff 11180.Feb 10 2017, 3:22 PM
hein edited edge metadata.

New approach.

hein added a comment.Feb 10 2017, 3:30 PM

To expand on the updated patch (I wrote a new commit message, but Phab doesn't notice automatically): The TM appears to be the only user of TopPosedLeftAlignedPopup currently, and the new behavior is also in line with the "Popup positioned on the top" docstring for the enum entry.

mart accepted this revision.Feb 10 2017, 3:32 PM
mart edited edge metadata.
This revision is now accepted and ready to land.Feb 10 2017, 3:32 PM
This revision was automatically updated to reflect the committed changes.