1

I'm new to Qt and Qt/QML and I am trying to setup a menubar but it doesn't show it at all.

I've copied pasted the code and still nothing(from Qt doc).

import QtQuick 2.0
import QtQuick.Controls 1.0

ApplicationWindow {
    visible: true;
    width: 1000;
    height: 700;
    title: "App";
    MenuBar {
        Menu {
            title: "File"
            MenuItem { text: "Open..." }
            MenuItem { text: "Close" }
        }

        Menu {
            title: "Edit"
            MenuItem { text: "Cut" }
            MenuItem { text: "Copy" }
            MenuItem { text: "Paste" }
        }
    }
}
3
  • are you getting any error or warding in console ?
    – Kunal
    Oct 7, 2013 at 10:16
  • All is clean.No errors,the window properties are set.
    – adi
    Oct 7, 2013 at 10:20
  • Which OS are you using? With your code on Mac OS X 10.8 I see the menu bar but not inside the app, I see them inside the top menu bar in the OS.
    – koopajah
    Oct 7, 2013 at 10:25

1 Answer 1

8

Solved it by using

menuBar: MenuBar{//Menubar content}

instead of

MenuBar{//Menubar content}

2
  • You should mark this as the answer. (You should see an empty check mark next to it that you can click)
    – jp36
    Jan 27, 2014 at 15:45
  • +1 Man they really need to fix the documentation in Qt. I'm sure everybody copy and paste the example, then realize it doesn't work, and find this question/answer.
    – laurent
    May 27, 2014 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.