QMenu infrastructure - is deriving an own Menu not an option?
-
When I heard about the concept of Pie Menus in the 90s, I instantly loved it.
But nowadays that concept got misunderstood in my opinion. A Pie with some Icons is not a menu, it's an Action-Pie ;)
My interpretation is that when the context menu opens, it arranges its items circularly around the pointer position. You can preset where to start (at which angle), which direction to fill the circle in (clockwise, ccw), how many degrees of a circle may be filled with items, and so on.
With my QPieMenu I've gotten as far as:
- actionEvent: realize when actions get added/removed/changed
- paintEvent: draw what I calculate and animate
- mouseMoveEvent: hover management
I've seen from the start of my development, that a lot of the real work in QMenu is done unter the hood within QMenuPrivate. So I'm reimplementing most of the event handlers. There are no menu-specific virtual methods in QMenu (well, the
sizeHint()
is one, though).
Anyhow - I see no clean way of using the existing QMenu infrastructure with a QMenu-derived class. Am I right?If I'm right, it would mean I have to implement opening submenus and so on, like everything. [Any ideas where I could get a job with this?]
-
Hi,
Did you already saw the Qt Quarterly about the pie menu ?
There might be stuff in there of interest.
-
Thank you very much, I read this like 20 years ago, that was about the time I started using Qt as my preferred gear ;)
But that is what I meant by "the concept got misunderstood". A big round Button with Actions...
20 years ago fullHD was a rare resolution - we didn't have as much screenspace as today. Thus we had to somehow pack on-screen, what was needed within minimal bounds. Times have changed, though...
-
Would you have a picture to share with the result you want to achieve ?
-
You got me hooked. I'm really curious how you expect the pie menu to look differently than the ones we all know. Please share a screenshot.
-
As an alternative approach, there is an unofficial qml plugin to integrate rive animations in your qt app: https://github.com/basysKom/RiveQtQuickPlugin
Here's me loading a .qml file with a rive item into a PyQt6 application, every interaction is handled with rive.
-
Additionally, here's some wheel menus that I found, so if you're good with design and animation concepts, it's pretty easy to replicate without complicated coding:
https://rive.app/community/files/12837-24302-radial-menu-hud-games-interactive/
-
I had to remove my zoom & evade- code, as it didn't work right, yet. But there you can get an idea of what I believe it should look like...
And here's another Video - you can see it doesn't help much not to be able to use the QMenuPrivate infrastructure, as QPieMenu has no way to tell, if it was caused by another menu or not (context). Still looks cool ;)
https://www.dropbox.com/scl/fi/w4b4402k3l7yp8by4mwxq/PieMenuTesting_Wl9kcndwHo.mp4?rlkey=1yylqzywz23p60tafaau0hao3&dl=0And in Windows-Style:
![https://i.imgur.com/c40QMYT.gif](image url)