【问题标题】:Pyqt - Add a QMenuBar to a QMainWindow which is in another classPyqt - 将 QMenuBar 添加到另一个类中的 QMainWindow
【发布时间】:2015-06-16 13:06:29
【问题描述】:

我有 2 个类:MainWindow() 和 Menubar()。 MainWindow() 是一个 QMainWindow,Menubar 是一个 QMenuBar。 我不知道如何将菜单栏添加到主窗口。

使用 QToolBar,我可以做这样的事情:

self.toolbar = Toolbar() self.addToolBar(self.toolbar)

但是有了QMenubar,就没有像“addMenuBar()”这样的函数了。

所以我想不通。

【问题讨论】:

    标签: python-3.x pyqt pyqt5


    【解决方案1】:

    QMainWindow 带有默认的QMenuBar,但您可以使用QMainWindow.setMenuBar() 设置一个新的

    更多信息在Qt Documentation

    【讨论】:

    • 可以QMainWindow.setMenuBar()设置一个新的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-07
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-10
    • 2012-02-16
    相关资源
    最近更新 更多