[PyQt] Working example of QMenuBar on OSX? Examples don't work
Vincent Vande Vyvre
vincent.vande.vyvre at telenet.be
Sat Jun 4 06:11:55 BST 2016
Le 04/06/2016 01:09, Marcel Maré a écrit :
> Hi All,
>
> I could not find a working PyQt5.6 working example of the (system) menu bar on OS X.I have taken notice of the section “QMenuBar on OS X” in the docs (http://doc.qt.io/qt-5/qmenubar.html) but still couldn’t get it to work.
>
> I would expect this to work:
>
> self.menubar = QtWidgets.QMenuBar() # note: no parent
> self.menubar.setObjectName("menubar")
> self.menuFile = QtWidgets.QMenu(self.menubar)
> self.menuFile.setObjectName("menuFile")
> mainwindow.setMenuBar(self.menubar)
> self.actionQuit = QtWidgets.QAction(mainwindow)
> self.actionQuit.setObjectName("actionQuit")
> self.menuFile.addAction(self.actionQuit)
> self.menubar.addAction(self.menuFile.menuAction())
>
> What am I doing wrong?
>
> PS I do not want to use “ setNativeMenuBar(False)”.
>
> TIA
>
> Marcel
>
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Hi,
Are you sure you have set the text of the menu and the action ?
No text, no visibility.
Vincent
More information about the PyQt
mailing list