当前位置: 首页>>代码示例>>Python>>正文


Python QMenuBar.setObjectName方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QMenuBar.setObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python QMenuBar.setObjectName方法的具体用法?Python QMenuBar.setObjectName怎么用?Python QMenuBar.setObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QMenuBar的用法示例。


在下文中一共展示了QMenuBar.setObjectName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Main_Window

# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import setObjectName [as 别名]
class Main_Window(QMainWindow):
    def __init__(self):
        super(Main_Window, self).__init__()

        self.menubar = QMenuBar(self)
        self.statusbar = QStatusBar(self)
        self.centralwidget = QWidget(self)
        self.image_view = Image_View(self.centralwidget)
        self.horizontal_slider = QSlider(self.centralwidget)

        self.setup_ui()

    def setup_ui(self):
        # 1. self info
        self.setObjectName("Demo_1")
        self.resize(800, 600)

        # 2.1 sub widgets
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        self.setMenuBar(self.menubar)

        # 2.2
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        # 2.3
        self.centralwidget.setObjectName("centralwidget")
        self.setCentralWidget(self.centralwidget)

        self.image_view.setGeometry(QtCore.QRect(144, 10, 512, 512))
        self.image_view.setObjectName("image_view")

        self.horizontal_slider.setGeometry(QtCore.QRect(144, 530, 512, 22))
        self.horizontal_slider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontal_slider.setObjectName("horizontal_slider")

        # 3 signals and slots
        self.horizontal_slider.valueChanged['int'].connect(self.image_view.repaint)
开发者ID:CaptainWilliam,项目名称:StrawHat,代码行数:41,代码来源:ui_1_random_lines.py

示例2: EditorMainWindow

# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import setObjectName [as 别名]

#.........这里部分代码省略.........
            except:
                traceback.print_exc()

    def button_terrain_load_action(self):
        try:
            print("ok", self.default_path)
            filepath, choosentype = QFileDialog.getOpenFileName(
                self, "Open File",
                self.default_path,
                "BW terrain files (*.out *out.gz);;All files (*)")
            print("doooone")
            if filepath:
                if filepath.endswith(".gz"):
                    file_open = gzip.open
                else:
                    file_open = open

                with file_open(filepath, "rb") as f:
                    try:
                        terrain = BWArchiveBase(f)
                        if self.level is not None:
                            waterheight = get_water_height(self.level)
                        else:
                            waterheight = None

                        image, light_image = parse_terrain_to_image(terrain, waterheight)
                        self.bw_map_screen.set_terrain(image, light_image)
                    except:
                        traceback.print_exc()
        except:
            traceback.print_exc()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(820, 760)
        MainWindow.setMinimumSize(QSize(720, 560))
        MainWindow.setWindowTitle("BW-MapEdit")
        #MainWindow.setWindowTitle("Nep-Nep")


        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        MainWindow.setCentralWidget(self.centralwidget)

        self.horizontalLayout = QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")


        self.scrollArea = QScrollArea(self.centralwidget)
        self.scrollArea.setWidgetResizable(True)

        self.bw_map_screen = BWMapViewer(self.centralwidget)
        self.scrollArea.setWidget(self.bw_map_screen)
        self.horizontalLayout.addWidget(self.scrollArea)

        #self.horizontalLayout.addWidget(self.bw_map_screen)

        self.entity_list_widget = BWEntityListWidget(self.centralwidget)
        self.entity_list_widget.setMaximumSize(QSize(300, 16777215))
        self.entity_list_widget.setObjectName("entity_list_widget")
        self.horizontalLayout.addWidget(self.entity_list_widget)

        spacerItem = QSpacerItem(10, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.horizontalLayout.addItem(spacerItem)

        self.vertLayoutWidget = QWidget(self.centralwidget)
开发者ID:RenolY2,项目名称:battalion-tools-gui,代码行数:70,代码来源:bw_level_edit.py

示例3: Ui_MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import setObjectName [as 别名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(500, 262)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.button_find_id = QPushButton(self.centralwidget)
        self.button_find_id.setGeometry(QtCore.QRect(370, 10, 110, 32))
        self.button_find_id.setObjectName(_fromUtf8("button_find_id"))
        self.button_find_name = QPushButton(self.centralwidget)
        self.button_find_name.setGeometry(QtCore.QRect(370, 50, 110, 32))
        self.button_find_name.setObjectName(_fromUtf8("button_find_name"))
        self.button_find_cas = QPushButton(self.centralwidget)
        self.button_find_cas.setGeometry(QtCore.QRect(370, 90, 110, 32))
        self.button_find_cas.setObjectName(_fromUtf8("button_find_cas"))
        self.button_find_vpid = QPushButton(self.centralwidget)
        self.button_find_vpid.setGeometry(QtCore.QRect(370, 130, 110, 32))
        self.button_find_vpid.setObjectName(_fromUtf8("button_find_cas"))

        self.button_add = QPushButton(self.centralwidget)
        self.button_add.setGeometry(QtCore.QRect(150, 180, 110, 32))
        self.button_add.setObjectName(_fromUtf8("button_add"))

        self.button_stop = QPushButton(self.centralwidget)
        self.button_stop.setGeometry(QtCore.QRect(150, 210, 110, 32))
        self.button_stop.setObjectName(_fromUtf8("button_stop"))

        self.button_invent = QPushButton(self.centralwidget)
        self.button_invent.setGeometry(QtCore.QRect(20, 180, 120, 32))
        self.button_invent.setObjectName(_fromUtf8("button_invent"))

        self.button_invent_2 = QPushButton(self.centralwidget)
        self.button_invent_2.setGeometry(QtCore.QRect(20, 210, 120, 32))
        self.button_invent_2.setObjectName(_fromUtf8("button_invent_2"))

        self.button_delete = QPushButton(self.centralwidget)
        self.button_delete.setGeometry(QtCore.QRect(260, 210, 120, 32))
        self.button_delete.setObjectName(_fromUtf8("button_delete"))

        self.button_manual = QPushButton(self.centralwidget)
        self.button_manual.setGeometry(QtCore.QRect(260, 180, 120, 32))
        self.button_manual.setObjectName(_fromUtf8("button_delete"))  

        self.button_repop = QPushButton(self.centralwidget)
        self.button_repop.setGeometry(QtCore.QRect(380, 195, 110, 32))
        self.button_repop.setObjectName(_fromUtf8("button_repop"))     


        self.line_id = QLineEdit(self.centralwidget)
        self.line_id.setGeometry(QtCore.QRect(90, 10, 251, 21))
        self.line_id.setObjectName(_fromUtf8("line_id"))
        self.line_name = QLineEdit(self.centralwidget)
        self.line_name.setGeometry(QtCore.QRect(90, 50, 251, 21))
        self.line_name.setObjectName(_fromUtf8("line_name"))
        self.line_cas = QLineEdit(self.centralwidget)
        self.line_cas.setGeometry(QtCore.QRect(90, 90, 251, 21))
        self.line_cas.setObjectName(_fromUtf8("line_cas"))
        self.line_vpid = QLineEdit(self.centralwidget)
        self.line_vpid.setGeometry(QtCore.QRect(90, 130, 251, 21))
        self.line_vpid.setObjectName(_fromUtf8("line_cas"))       
        self.label_id = QLabel(self.centralwidget)
        self.label_id.setGeometry(QtCore.QRect(10, 10, 56, 13))
        self.label_id.setObjectName(_fromUtf8("label_id"))
        self.label_name = QLabel(self.centralwidget)
        self.label_name.setGeometry(QtCore.QRect(10, 50, 56, 13))
        self.label_name.setObjectName(_fromUtf8("label_name"))
        self.label_cas = QLabel(self.centralwidget)
        self.label_cas.setGeometry(QtCore.QRect(10, 90, 56, 13))
        self.label_cas.setObjectName(_fromUtf8("label_cas"))
        self.label_vpid = QLabel(self.centralwidget)
        self.label_vpid.setGeometry(QtCore.QRect(10, 130, 56, 13))
        self.label_vpid.setObjectName(_fromUtf8("label_cas"))       
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 22))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        #connection
        #self.trigger=QtCore.pyqtSignal()
        #self.trigger.connect(self.button_add, QtCore.SIGNAL("released()"), self.new)
        #self.connect(self.button_stop, QtCore.SIGNAL("released()"), self.quit)
        #self.connect(self.button_find_id, QtCore.SIGNAL("released()"), self.find_id)
        #self.connect(self.button_find_name, QtCore.SIGNAL("released()"), self.find_name)
        #self.connect(self.button_find_vpid, QtCore.SIGNAL("released()"), self.find_vpid)
        #self.connect(self.button_find_cas, QtCore.SIGNAL("released()"), self.find_cas)
        #self.connect(self.button_invent, QtCore.SIGNAL("released()"), self.invent)
        #self.connect(self.button_invent_2, QtCore.SIGNAL("released()"), self.invent_2)
        #self.connect(self.button_delete, QtCore.SIGNAL("released()"), self.delete)
        #self.connect(self.button_manual, QtCore.SIGNAL("released()"), self.manu)
        #self.connect(self.button_repop, QtCore.SIGNAL("released()"), self.repop)
        self.button_stop.clicked.connect(self.quit)
        self.button_add.clicked.connect(self.new)
        self.button_find_id.clicked.connect(self.find_id)
#.........这里部分代码省略.........
开发者ID:dedichan,项目名称:ChemDB,代码行数:103,代码来源:principal.py

示例4: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import setObjectName [as 别名]
class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()

        self.lastyear = int(time.strftime('%Y', time.localtime(time.time()))) - 1
        self.in_parameters = {u'datetime': str(self.lastyear) + u'年',
                              u'target_area': u'绍兴市',
                              u'density_cell': u'10',
                              u'density_class': 10,
                              u'day_cell': u'15',
                              u'day_class': 10,
                              u'out_type': u'tiff'}
        self.setupUi()

    def setupUi(self):
        self.setObjectName("MainWindow")
        self.setFixedSize(1040, 915)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        icon = QIcon()
        icon.addPixmap(QPixmap('./resource/weather-thunder.png'),QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.centralwidget = QWidget(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
        self.centralwidget.setSizePolicy(sizePolicy)
        self.centralwidget.setObjectName("centralwidget")
        self.layoutWidget = QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QRect(32, 10, 979, 851))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout_5 =QVBoxLayout(self.layoutWidget)
        self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.datetime_label = QLabel(self.layoutWidget)
        self.datetime_label.setObjectName("datetime_label")
        self.horizontalLayout.addWidget(self.datetime_label)
        self.datetime = QDateEdit(self.layoutWidget)
        self.datetime.setDateTime(QDateTime(QDate(self.lastyear, 1, 1), QTime(0, 0, 0)))
        self.datetime.setObjectName("datetime")
        self.horizontalLayout.addWidget(self.datetime)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.target_area_label = QLabel(self.layoutWidget)
        self.target_area_label.setObjectName("target_area_label")
        self.horizontalLayout.addWidget(self.target_area_label)
        self.target_area = QComboBox(self.layoutWidget)
        self.target_area.setObjectName("target_area")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.target_area.addItem("")
        self.horizontalLayout.addWidget(self.target_area)
        spacerItem2 = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem2)
        self.verticalLayout_5.addLayout(self.horizontalLayout)
        self.tabWidget = QTabWidget(self.layoutWidget)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
        self.tabWidget.setSizePolicy(sizePolicy)
        self.tabWidget.setObjectName("tabWidget")
        self.density_tab = QWidget()
        self.density_tab.setObjectName("density_tab")
        self.verticalLayout_3 =QVBoxLayout(self.density_tab)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.verticalLayout_2 =QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.density_cell_label = QLabel(self.density_tab)
        self.density_cell_label.setObjectName("density_cell_label")
        self.horizontalLayout_2.addWidget(self.density_cell_label)
        self.density_cell = QSpinBox(self.density_tab)
        self.density_cell.setProperty("value", 10)
        self.density_cell.setObjectName("density_cell")
        self.horizontalLayout_2.addWidget(self.density_cell)
        spacerItem3 = QSpacerItem(40, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        self.density_class_label = QLabel(self.density_tab)
        self.density_class_label.setObjectName("density_class_label")
        self.horizontalLayout_2.addWidget(self.density_class_label)
        self.density_class = QSpinBox(self.density_tab)
        self.density_class.setProperty("value", 10)
        self.density_class.setObjectName("density_class")
        self.horizontalLayout_2.addWidget(self.density_class)
        spacerItem4 = QSpacerItem(478, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.density_mxd = QPushButton(self.density_tab)
#.........这里部分代码省略.........
开发者ID:LuckyBoy314,项目名称:LightningBulletin_v1,代码行数:103,代码来源:UI.py

示例5: VGenesTextMain

# 需要导入模块: from PyQt5.QtWidgets import QMenuBar [as 别名]
# 或者: from PyQt5.QtWidgets.QMenuBar import setObjectName [as 别名]

#.........这里部分代码省略.........
                shortcut=QKeySequence.Print,
                statusTip="Print the current form letter",
                triggered=self.print_)

        self.copyAct = QAction(QIcon(':/PNG-Icons/pages.png'), "&Copy", self,
                shortcut=QKeySequence.Copy,
                statusTip="Copy the current selection's contents to the clipboard",
                triggered=self.textEdit.copy)

        self.pasteAct = QAction(QIcon(':/PNG-Icons/Paste.png'), "&Paste", self,
                shortcut=QKeySequence.Paste,
                statusTip="Paste the clipboard's contents into the current selection",
                triggered=self.textEdit.paste)

        self.aboutAct = QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        # self.aboutQtAct = QAction("About &Qt", self,
        #         statusTip="Show the Qt library's About box",
        #         triggered=QApplication.instance().aboutQt)

        self.cutAct.setEnabled(False)
        self.copyAct.setEnabled(False)
        self.textEdit.copyAvailable.connect(self.cutAct.setEnabled)
        self.textEdit.copyAvailable.connect(self.copyAct.setEnabled)

    def createMenus(self):

        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(QRect(0, 0, 1029, 22))
        self.menubar.setDefaultUp(False)
        self.menubar.setNativeMenuBar(False)
        self.menubar.setObjectName("menubar")
        self.menuFile = QMenu(self.menubar)


        self.setMenuBar(self.menubar)



        self.fileMenu = self.menuBar().addMenu("&File")
        self.fileMenu.addAction(self.newAct)
        self.fileMenu.addAction(self.openAct)
        self.fileMenu.addAction(self.closeAct)
        self.fileMenu.addAction(self.saveAct)
        self.fileMenu.addAction(self.saveAsAct)
        self.fileMenu.addAction(self.printAct)
        self.fileMenu.addSeparator();
        self.fileMenu.addAction(self.exitAct)

        self.editMenu = self.menuBar().addMenu("&Edit")
        self.editMenu.addAction(self.cutAct)
        self.editMenu.addAction(self.copyAct)
        self.editMenu.addAction(self.pasteAct)

        self.menuBar().addSeparator()

        self.helpMenu = self.menuBar().addMenu("&Help")
        self.helpMenu.addAction(self.aboutAct)
        # self.helpMenu.addAction(self.aboutQtAct)

    def createToolBars(self):
        self.fileToolBar = self.addToolBar("File")
        self.fileToolBar.addAction(self.newAct)
        self.fileToolBar.addAction(self.openAct)
开发者ID:PWilsonUofC,项目名称:VGenes,代码行数:70,代码来源:VgenesTextEdit.py


注:本文中的PyQt5.QtWidgets.QMenuBar.setObjectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。