Skip to content

QMenuItem: Make it a plain QObject

Kai Uwe Broulik requested to merge work/kbroulik/qmenu-not-a-qquickitem into master

This isn't a visual item placed in the scene, Qt applying its recursive enabled/visible properties messes with the action's visibility in unpredictable and hard to debug ways.

Instead, make it a plain QObject and let us handle those properties entirely on our own.


I was debugging why the configure/alternatives menu items in Task Manager’s More menu wouldn’t show up properly under Plasma 6. It seems the way Task Manager nests those menu items, causes intersting effects on the visible/enabled property, overriding the QAction’s visibility with false since the item this is in is effectively invisible, or something. I didn’t fully understand …

Nevertheless, this item isn’t a visual item to be placed in the scene, so it doesn’t need to be a QQuickItem.

This API change has implications on consumers as it no longer has a default property, so you can no longer place arbitrary items, such as Connections, Instantiator inside of it, e.g. Task Manager and Kickoff, potentially others, would need to be ported away first. Makes me wonder if we should perhaps add one for compatibility?

@davidedmundson @mart @ngraham

Merge request reports