Important: Please read the Qt Code of Conduct -

MenuBar inner working

  • Hi,

    I'm trying to understand the inner working of the menubar control (not how to use it, but how it is implemented). I already figured out that MenuBar.qml uses MenuBarPrivate, which is actually a QQuickMenuBar object (same for the Menu - QQuickMenu). What I'm failing to understand is how the MenuBar uses the Menu components which are defined inside. I can see that the MenuBar uses a Repeater (model is the QQuickMenuBar menus property), but I can't figure out how that list is populated with the menus that are defined in the MenuBar component.
    Anybody an idea how that is done, I'm sure i'm overlooking something stupid...


  • Got it, in the qquickmenubar I see: Q_CLASSINFO("DefaultProperty", "menus"). This will fill the menus list with the inner defined components.

Log in to reply