This will not work, because the component-ID can be an arbitrary reverse-DNS string identifying the application, and doesn't have to resemble the .desktop-entry-id at all. If that happens, it's purely accidental.
I was planning to add a componentsByLaunchable(TYPE, STR) method to AppStream anyway, I could probably do that for the next release of AS.
Minor nitpicks, then it's good to go.
You always add a separator at the end, so this isn't strictly neccessary (QMenu is smart enough to collapse double separators, though)
|134 ↗||(On Diff #18889)|
Unrelated, from D7561?