现在需要给菜单按添加点击事件,没有子菜单的那种按钮。网上好多都是有子菜单的那种的
menubar
localfile
localfile_action
triggered.connect(self.openLocalFile)
local_action
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 992, 26))
self.menubar.setObjectName("menubar")
self.menubar.setStyleSheet(QSS.QMenuBar)
self.localfile = QtWidgets.QMenu(self.menubar)
self.localfile.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
self.localfile.setToolTipDuration(5)
self.localfile.setToolTipsVisible(False)
self.localfile.setObjectName("localfile")
self.localfile_action = QAction(self.mainwindow)
self.localfile_action.setCheckable(False)
self.localfile_action.setObjectName('localFileAction')
self.localfile_action.triggered.connect(self.openLocalFile)
self.localfile_action.setText('本地文件')
self.menubar.addAction(self.localfile_action)