本文整理汇总了Python中PyQt5.QtCore.QMetaObject.connectSlotsByName方法的典型用法代码示例。如果您正苦于以下问题:Python QMetaObject.connectSlotsByName方法的具体用法?Python QMetaObject.connectSlotsByName怎么用?Python QMetaObject.connectSlotsByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QMetaObject
的用法示例。
在下文中一共展示了QMetaObject.connectSlotsByName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __init__(self):
super(MainWindow, self).__init__()
self.dbm_obj = Dbm()
self.curFile = ''
self.textEdit = QTextEdit()
self.sectionTreeWidget = QTreeWidget()
self.notesListWidget = QListWidget()
self.createHorizontalGroupBox()
self.setCentralWidget(self.horizontalGroupBox)
self.createActions()
self.createMenus()
# self.createToolBars()
self.createStatusBar()
self.readSettings()
[self.hierarchy_dict, self.notebook_dict, self.section_dict, self.page_dict] = [{}, {}, {}, {}]
self.setCurrentFile('')
# For binding slots and signals
self.fetchPageThread = FetchPage()
self.fetchPageThread.setObjectName('fetchPageThread')
self.syncAllThread = SyncAllThread()
self.syncAllThread.setObjectName('syncAllThread')
self.textEdit.document().contentsChanged.connect(self.documentWasModified)
self.sectionTreeWidget.setObjectName("sectionTreeWidget")
self.notesListWidget.setObjectName("notesListWidget")
QMetaObject.connectSlotsByName(self)
self.readDB()
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __init__(self, title, widget=None, closeButton=True, keySequence=None, isDialog=False, icon=None):
QDialog.__init__(self, ctx.mainScreen)
self.setObjectName("dialog")
self.isDialog = isDialog
self.layout = QVBoxLayout()
self.setLayout(self.layout)
self.wlayout= QHBoxLayout()
if icon:
self.setStyleSheet("""QDialog QLabel{ margin-left:16px;margin-right:10px}
QDialog#dialog {background-image:url(':/images/%s.png');
background-repeat:no-repeat;
background-position: top left; padding-left:500px;} """ % icon)
self.windowTitle = windowTitle(self, closeButton)
self.setTitle(title)
#self.layout.setMargin(0)
self.layout.addWidget(self.windowTitle)
if widget:
self.addWidget(widget)
try:
widget.finished[int].connect(self.reject)
except:
pass
finally:
try:
widget.resizeDialog[int,int].connect(self.resize)
except:
pass
if closeButton:
self.windowTitle.pushButton.clicked.connect(self.reject)
if keySequence:
shortCut = QShortcut(keySequence, self)
shortCut.activated.connect(self.reject)
QMetaObject.connectSlotsByName(self)
self.resize(10,10)
示例3: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def setupUi(self):
self.setObjectName("Dialog")
self.setFixedSize(464, 257)
icon = QIcon()
icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
self.setWindowIcon(icon)
self.setSizeGripEnabled(False)
self.setModal(True)
self.textBrowser = QTextBrowser(self)
self.textBrowser.setGeometry(QRect(0, 130, 491, 192))
self.textBrowser.setObjectName("textBrowser")
self.label = QLabel(self)
self.label.setGeometry(QRect(0, 0, 641, 131))
self.label.setText("")
self.label.setPixmap(QPixmap("./resource/about.jpg"))
self.label.setScaledContents(True)
self.label.setObjectName("label")
self.retranslateUi()
QMetaObject.connectSlotsByName(self)
self.show()
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __init__(self):
super(Widget, self).__init__()
layout = QVBoxLayout(self)
self.gif = GifWidget(self, "../images/yin.gif")
startBtn = QPushButton("开始", self)
startBtn.setObjectName("startBtn")
stopBtn = QPushButton("停止", self)
stopBtn.setObjectName("stopBtn")
changeBtn = QPushButton("改变第二个图", self)
changeBtn.setObjectName("changeBtn")
layout.addWidget(self.gif)
layout.addWidget(startBtn)
layout.addWidget(stopBtn)
layout.addWidget(changeBtn)
QMetaObject.connectSlotsByName(self) # 通过objectname注册信号
示例5: __init__
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __init__(self):
super(TestNinePatchLabel, self).__init__()
self.resize(400, 600)
self.listWidget = QListWidget(self)
self.listWidget.setObjectName("listWidget")
self.listWidget.setStyleSheet("""
QListWidget::item:selected {
background: rgba(0,0,0,0);
}
QListWidget::item:hover {
background: rgba(0,0,0,0);
}
""")
self.textEdit = QTextEdit(self)
self.textEdit.setMaximumHeight(100)
self.textEdit.setObjectName("textEdit")
self.sendBtn = QPushButton("发送", self)
self.sendBtn.setObjectName("sendBtn")
hlayout = QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.setSpacing(0)
hlayout.addWidget(self.textEdit)
hlayout.addWidget(self.sendBtn)
vlayout = QVBoxLayout(self)
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.setSpacing(0)
vlayout.addWidget(self.listWidget)
vlayout.addItem(hlayout)
QMetaObject.connectSlotsByName(self) # 通过objectname注册信号
self.init()
self.setStyleSheet(SCROLLBARSTYLE)
示例6: __setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __setupUi(self):
"""
Private method to perform the general setup of the configuration
widget.
"""
self.setObjectName("ConfigurationDialog")
self.resize(900, 650)
self.verticalLayout_2 = QVBoxLayout(self)
self.verticalLayout_2.setSpacing(6)
self.verticalLayout_2.setContentsMargins(6, 6, 6, 6)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.configSplitter = QSplitter(self)
self.configSplitter.setOrientation(Qt.Horizontal)
self.configSplitter.setObjectName("configSplitter")
self.configListWidget = QWidget(self.configSplitter)
self.leftVBoxLayout = QVBoxLayout(self.configListWidget)
self.leftVBoxLayout.setContentsMargins(0, 0, 0, 0)
self.leftVBoxLayout.setSpacing(0)
self.leftVBoxLayout.setObjectName("leftVBoxLayout")
self.configListSearch = E5ClearableLineEdit(
self, self.tr("Enter search text..."))
self.configListSearch.setObjectName("configListSearch")
self.leftVBoxLayout.addWidget(self.configListSearch)
self.configList = QTreeWidget()
self.configList.setObjectName("configList")
self.leftVBoxLayout.addWidget(self.configList)
self.configListSearch.textChanged.connect(self.__searchTextChanged)
self.scrollArea = QScrollArea(self.configSplitter)
self.scrollArea.setFrameShape(QFrame.NoFrame)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea")
self.configStack = QStackedWidget()
self.configStack.setFrameShape(QFrame.Box)
self.configStack.setFrameShadow(QFrame.Sunken)
self.configStack.setObjectName("configStack")
self.scrollArea.setWidget(self.configStack)
self.emptyPage = QWidget()
self.emptyPage.setGeometry(QRect(0, 0, 372, 591))
self.emptyPage.setObjectName("emptyPage")
self.vboxlayout = QVBoxLayout(self.emptyPage)
self.vboxlayout.setSpacing(6)
self.vboxlayout.setContentsMargins(6, 6, 6, 6)
self.vboxlayout.setObjectName("vboxlayout")
spacerItem = QSpacerItem(
20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.vboxlayout.addItem(spacerItem)
self.emptyPagePixmap = QLabel(self.emptyPage)
self.emptyPagePixmap.setAlignment(Qt.AlignCenter)
self.emptyPagePixmap.setObjectName("emptyPagePixmap")
self.emptyPagePixmap.setPixmap(
QPixmap(os.path.join(getConfig('ericPixDir'), 'eric.png')))
self.vboxlayout.addWidget(self.emptyPagePixmap)
self.textLabel1 = QLabel(self.emptyPage)
self.textLabel1.setAlignment(Qt.AlignCenter)
self.textLabel1.setObjectName("textLabel1")
self.vboxlayout.addWidget(self.textLabel1)
spacerItem1 = QSpacerItem(
20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.vboxlayout.addItem(spacerItem1)
self.configStack.addWidget(self.emptyPage)
self.verticalLayout_2.addWidget(self.configSplitter)
self.buttonBox = QDialogButtonBox(self)
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(
QDialogButtonBox.Apply | QDialogButtonBox.Cancel |
QDialogButtonBox.Ok | QDialogButtonBox.Reset)
self.buttonBox.setObjectName("buttonBox")
if not self.fromEric and \
self.displayMode == ConfigurationWidget.DefaultMode:
self.buttonBox.button(QDialogButtonBox.Apply).hide()
self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
self.verticalLayout_2.addWidget(self.buttonBox)
self.setWindowTitle(self.tr("Preferences"))
self.configList.header().hide()
self.configList.header().setSortIndicator(0, Qt.AscendingOrder)
self.configList.setSortingEnabled(True)
self.textLabel1.setText(
self.tr("Please select an entry of the list \n"
"to display the configuration page."))
QMetaObject.connectSlotsByName(self)
self.setTabOrder(self.configList, self.configStack)
self.configStack.setCurrentWidget(self.emptyPage)
self.configList.setFocus()
示例7: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
#.........这里部分代码省略.........
self.button_zoom_out.setObjectName("button_zoom_out")
self.gridLayout.addWidget(self.button_zoom_out, 0, 1, 0, 1)
self.button_edit_xml = QPushButton(self.centralwidget)
self.button_edit_xml.setObjectName("button_edit_xml")
self.button_edit_base_xml = QPushButton(self.centralwidget)
self.button_edit_base_xml.setObjectName("button_edit_base_xml")
self.verticalLayout.addLayout(self.gridLayout)
self.verticalLayout.addWidget(self.button_edit_xml)
self.verticalLayout.addWidget(self.button_edit_base_xml)
spacerItem1 = QSpacerItem(10, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.verticalLayout.addItem(spacerItem1)
self.verticalLayout_2 = QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.lineedit_angle = QLineEdit(self.centralwidget)
self.lineedit_angle.setObjectName("lineedit_angle")
self.lineedit_angle.setPlaceholderText("Angle")
self.label_object_id = QLabel(self.centralwidget)
self.label_object_id.setObjectName("label_object_id")
#TextSelectableByCursor
self.label_position = QLabel(self.centralwidget)
self.label_position.setObjectName("label_position")
self.label_model_name = QLabel(self.centralwidget)
self.label_model_name.setObjectName("label_model_name")
self.label_4 = QLabel(self.centralwidget)
self.label_4.setObjectName("label_4")
self.label_5 = QLabel(self.centralwidget)
self.label_5.setObjectName("label_5")
for label in (self.label_object_id, self.label_position, self.label_model_name, self.label_4, self.label_5):
label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
self.verticalLayout_2.addWidget(self.lineedit_angle)
self.verticalLayout_2.addWidget(self.label_object_id)
self.verticalLayout_2.addWidget(self.label_position)
self.verticalLayout_2.addWidget(self.label_model_name)
self.verticalLayout_2.addWidget(self.label_4)
self.verticalLayout_2.addWidget(self.label_5)
self.verticalLayout.addLayout(self.verticalLayout_2)
self.horizontalLayout.addWidget(self.vertLayoutWidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QRect(0, 0, 820, 29))
self.menubar.setObjectName("menubar")
self.file_menu = QMenu(self.menubar)
self.file_menu.setObjectName("menuLoad")
self.file_load_action = QAction("Load", self)
self.file_load_action.triggered.connect(self.button_load_level)
self.file_menu.addAction(self.file_load_action)
self.file_save_action = QAction("Save", self)
self.file_save_action.triggered.connect(self.button_save_level)
self.file_menu.addAction(self.file_save_action)
self.visibility_menu = MenuDontClose(self.menubar)#QMenu(self.menubar)
self.visibility_menu.setObjectName("visibility")
#self.visibility_menu.addAction(self.toggle_action)
self.visibility_actions = []
self.terrain_menu = QMenu(self.menubar)
self.terrain_menu.setObjectName("terrain")
self.terrain_load_action = QAction("Load Terrain", self)
self.terrain_load_action.triggered.connect(self.button_terrain_load_action)
self.terrain_menu.addAction(self.terrain_load_action)
self.terrain_display_actions = []
self.setup_terrain_display_toggles()
#self.menuLoad_2 = QMenu(self.menubar)
#self.menuLoad_2.setObjectName("menuLoad_2")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.file_menu.menuAction())
#self.menubar.addAction(self.menuLoad_2.menuAction())
self.menubar.addAction(self.visibility_menu.menuAction())
self.menubar.addAction(self.terrain_menu.menuAction())
self.retranslateUi(MainWindow)
QMetaObject.connectSlotsByName(MainWindow)
示例8: __init__
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def __init__(self, parent=None, arguments=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.ctimer = QTimer()
#self.stimer = QTimer()
self.null_extra_arg = False
if arguments.title:
self.setWindowTitle(arguments.title)
if arguments.icon:
icon = QIcon(arguments.icon)
self.setWindowIcon(icon)
if not arguments.progressbar:
self.progressBar.hide()
else:
self.constant()
self.ctimer.timeout.connect(self.constantUpdate)
QMetaObject.connectSlotsByName(self)
self.button_ids = ["details_button", "ok_button", "yes_button", "no_button", "continue_button", "cancel_button"]
self.button_names = {
"details_button":_("Details"),
"ok_button":_("Ok"),
"yes_button":_("Yes"),
"no_button":_("No"),
"continue_button":_("Continue"),
"cancel_button":_("Cancel")
}
self.active_buttons = dict((e, False) for e in self.button_names)
self.null_extra_arg = True
if arguments.yesno or arguments.warningyesno:
self.enable_buttons(["yes_button", "no_button"])
if arguments.yesno:
self.label.setText(arguments.yesno)
else:
self.label.setText(arguments.warningyesno)
elif arguments.yesnocancel or arguments.warningyesnocancel:
self.enable_buttons(["yes_button", "no_button", "cancel_button"])
if arguments.yesnocancel:
self.label.setText(arguments.yesnocancel)
else:
self.label.setText(arguments.warningyesnocancel)
elif arguments.sorry or arguments.error or arguments.msgbox:
self.enable_buttons(["ok_button"])
if arguments.sorry:
self.label.setText(arguments.sorry)
elif arguments.error:
self.label.setText(arguments.error)
else:
self.label.setText(arguments.msgbox)
elif arguments.detailedsorry or arguments.detailederror:
self.enable_buttons(["details_button", "ok_button"])
if arguments.detailedsorry:
self.label.setText(arguments.detailedsorry[0])
self.details = arguments.detailedsorry[1]
else:
self.label.setText(arguments.detailederror[0])
self.details = arguments.detailederror[1]
elif arguments.warningcontinuecancel:
self.enable_buttons(["continue_button", "cancel_button"])
self.label.setText(arguments.warningcontinuecancel)
elif arguments.progressbar:
self.label.setText(arguments.progressbar[0])
if not self.null_extra_arg:
if not arguments.extra_arguments:
sys.exit(_("There is no extra argument!"))
self.create_buttons()
if arguments.yeslabel and self.active_buttons["yes_button"]:
self.buttons["yes_button"].setText(arguments.yeslabel)
if arguments.nolabel and self.active_buttons["no_button"]:
self.buttons["no_button"].setText(arguments.nolabel)
if arguments.cancellabel and self.active_buttons["cancel_button"]:
self.buttons["cancel_button"].setText(arguments.cancellabel)
if arguments.continuelabel and self.active_buttons["continue_button"]:
self.buttons["continue_button"].setText(arguments.continuelabel)
示例9: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def setupUi(self, Tip, name = "", head = "", mood = "", pic1 = "", pic2 = "", pic3 = ""):
Tip.setObjectName("Tip")
Tip.resize(275, 180)
size = QSize(275, 180)
Tip.setMinimumSize(size)
Tip.setMaximumSize(size)
Tip.setWindowTitle("")
self.name = name
self.head = head
self.mood = mood
self.pic1 = pic1
self.pic2 = pic2
self.pic3 = pic3
self.mainWidget = QWidget(Tip)
self.mainWidget.setObjectName("tip")
self.verticalLayout = QVBoxLayout(self.mainWidget)
self.verticalLayout.setObjectName("verticalLayout")
self.widget = QWidget(self.mainWidget)
self.widget.setObjectName("widget")
self.widget.setMinimumHeight(80)
self.widget.setMaximumHeight(80)
self.horizontalLayout_2 = QHBoxLayout(self.widget)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.itemHeadLabel = QLabel(self.widget)
self.itemHeadLabel.setMinimumSize(QSize(80, 80))
self.itemHeadLabel.setMaximumSize(QSize(80, 80))
self.itemHeadLabel.setOpenExternalLinks(True)
self.itemHeadLabel.setObjectName("itemHeadLabel")
self.horizontalLayout_2.addWidget(self.itemHeadLabel)
self.widget_3 = QWidget(self.widget)
self.verticalLayout_2 = QVBoxLayout(self.widget_3)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.itemNameLabel = QLabel(self.widget_3)
# self.itemNameLabel.setOpenExternalLinks(True)
self.itemNameLabel.setObjectName("itemNameLabel")
self.verticalLayout_2.addWidget(self.itemNameLabel)
self.itemMoodLabel = QLabel(self.widget_3)
# self.itemMoodLabel.setOpenExternalLinks(True)
self.itemMoodLabel.setObjectName("itemMoodLabel")
self.verticalLayout_2.addWidget(self.itemMoodLabel)
self.horizontalLayout_2.addWidget(self.widget_3)
self.verticalLayout.addWidget(self.widget)
self.widget_2 = QWidget(self.mainWidget)
self.widget_2.setMinimumSize(QSize(0, 80))
self.widget_2.setMaximumSize(QSize(16777215, 80))
self.widget_2.setObjectName("widget_2")
self.horizontalLayout = QHBoxLayout(self.widget_2)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.itemPicLabel_1 = QLabel(self.widget_2)
self.itemPicLabel_1.setObjectName("itemPicLabel_1")
self.horizontalLayout.addWidget(self.itemPicLabel_1)
self.itemPicLabel_2 = QLabel(self.widget_2)
self.itemPicLabel_2.setObjectName("itemPicLabel_2")
self.horizontalLayout.addWidget(self.itemPicLabel_2)
self.itemPicLabel_3 = QLabel(self.widget_2)
self.itemPicLabel_3.setObjectName("itemPicLabel_3")
self.horizontalLayout.addWidget(self.itemPicLabel_3)
self.verticalLayout.addWidget(self.widget_2)
self.mainWidget.setLayout(self.verticalLayout)
self.retranslateUi(self.mainWidget)
QMetaObject.connectSlotsByName(Tip)
示例10: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
#.........这里部分代码省略.........
self.label_5 = QLabel(self.formLayoutWidget_2)
self.label_5.setObjectName(_fromUtf8("label_5"))
self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label_5)
self.ball_box = QComboBox(self.formLayoutWidget_2)
self.ball_box.setObjectName(_fromUtf8("ball_box"))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.ball_box.addItem(_fromUtf8(""))
self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.ball_box)
self.label_6 = QLabel(self.formLayoutWidget_2)
self.label_6.setObjectName(_fromUtf8("label_6"))
self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_6)
self.status_box = QComboBox(self.formLayoutWidget_2)
self.status_box.setObjectName(_fromUtf8("status_box"))
self.status_box.addItem(_fromUtf8(""))
self.status_box.addItem(_fromUtf8(""))
self.status_box.addItem(_fromUtf8(""))
self.status_box.addItem(_fromUtf8(""))
self.status_box.addItem(_fromUtf8(""))
self.status_box.addItem(_fromUtf8(""))
self.formLayout_2.setWidget(2, QFormLayout.FieldRole, self.status_box)
spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.formLayout_2.setItem(1, QFormLayout.FieldRole, spacerItem)
spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.formLayout_2.setItem(3, QFormLayout.FieldRole, spacerItem1)
self.captured_edit = QLineEdit(self.formLayoutWidget_2)
self.captured_edit.setObjectName(_fromUtf8("captured_edit"))
self.formLayout_2.setWidget(4, QFormLayout.FieldRole, self.captured_edit)
self.label = QLabel(self.formLayoutWidget_2)
self.label.setObjectName(_fromUtf8("label"))
self.formLayout_2.setWidget(4, QFormLayout.LabelRole, self.label)
self.formLayoutWidget_3 = QWidget(Dialog)
self.formLayoutWidget_3.setGeometry(QRect(20, 80, 171, 131))
self.formLayoutWidget_3.setObjectName(_fromUtf8("formLayoutWidget_3"))
self.formLayout_3 = QFormLayout(self.formLayoutWidget_3)
self.formLayout_3.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
self.label_8 = QLabel(self.formLayoutWidget_3)
self.label_8.setObjectName(_fromUtf8("label_8"))
self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_8)
self.pokemon_Name_box = QComboBox(self.formLayoutWidget_3)
self.pokemon_Name_box.setObjectName(_fromUtf8("pokemon_Name_box"))
self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.pokemon_Name_box)
spacerItem2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.formLayout_3.setItem(1, QFormLayout.FieldRole, spacerItem2)
self.label_9 = QLabel(self.formLayoutWidget_3)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_9)
self.level_edit = QLineEdit(self.formLayoutWidget_3)
self.level_edit.setObjectName(_fromUtf8("level_edit"))
self.formLayout_3.setWidget(2, QFormLayout.FieldRole, self.level_edit)
self.label_10 = QLabel(self.formLayoutWidget_3)
self.label_10.setObjectName(_fromUtf8("label_10"))
self.formLayout_3.setWidget(3, QFormLayout.LabelRole, self.label_10)
self.hp_edit = QLineEdit(self.formLayoutWidget_3)
self.hp_edit.setObjectName(_fromUtf8("hp_edit"))
self.formLayout_3.setWidget(3, QFormLayout.FieldRole, self.hp_edit)
self.spriteLabel = QLabel(self.formLayoutWidget_3)
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.spriteLabel.sizePolicy().hasHeightForWidth())
self.spriteLabel.setSizePolicy(sizePolicy)
self.spriteLabel.setText(_fromUtf8(""))
self.spriteLabel.setObjectName(_fromUtf8("spriteLabel"))
self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.spriteLabel)
self.textBrowser = QTextBrowser(Dialog)
self.textBrowser.setGeometry(QRect(20, 260, 391, 192))
self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
self.label_3 = QLabel(Dialog)
self.label_3.setGeometry(QRect(335, 460, 71, 20))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_4 = QLabel(Dialog)
self.label_4.setGeometry(QRect(20, 30, 251, 16))
font = QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.logolabel = QLabel(Dialog)
self.logolabel.setGeometry(QRect(280, 20, 121, 51))
self.logolabel.setText(_fromUtf8(""))
self.logolabel.setObjectName(_fromUtf8("logolabel"))
pixmap = QPixmap("images/logo.png")
self.logolabel.setPixmap(pixmap)
self.logolabel.setMask(pixmap.mask())
self.calculateButton = QPushButton(Dialog)
self.calculateButton.setGeometry(QRect(340, 230, 72, 23))
self.calculateButton.setObjectName(_fromUtf8("calculateButton"))
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
示例11: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
#.........这里部分代码省略.........
# ------------添加到布局
toolLayout.addWidget(self.qzoneButton, 0, Qt.AlignLeft)
toolLayout.addWidget(self.skinButton, 1, Qt.AlignLeft)
# --------添加到布局
headInfoLayout.addWidget(self.nameLabel)
headInfoLayout.addWidget(self.moodEdit)
headInfoLayout.addWidget(self.toolWidget)
# ----天气
self.weatherLabel = QLabel(self.headWidget)
self.weatherLabel.setMinimumWidth(60)
self.weatherLabel.setMaximumWidth(60)
self.weatherLabel.setCursor(QCursor(Qt.PointingHandCursor))
self.weatherLabel.setObjectName("weatherLabel")
# ----添加到布局中
headLayout.addWidget(self.headLabel, 0, Qt.AlignLeft)
headLayout.addWidget(self.headInfoWidget, 0, Qt.AlignCenter)
headLayout.addWidget(self.weatherLabel, 0, Qt.AlignRight)
# 搜索输入框
self.searchEdit = LineEdit(self.bgWidget)
self.searchEdit.setFrame(False)
# self.searchEdit.setClearButtonEnabled(True)
self.searchEdit.setObjectName("searchEdit")
# tab
self.tabWidget = QTabWidget(self.bgWidget)
self.tabWidget.setUsesScrollButtons(False) # 取消两个切换按钮
self.tabWidget.setDocumentMode(True) # 取消边框
self.tabWidget.setObjectName("tabWidget")
# --分组
self.tabGroup = QWidget(self.tabWidget)
self.tabGroup.setObjectName("tabGroup")
# ----分组布局
groupVerticalLayout = QVBoxLayout(self.tabGroup)
groupVerticalLayout.setSpacing(0)
groupVerticalLayout.setContentsMargins(0, 0, 0, 0)
groupVerticalLayout.setObjectName("groupVerticalLayout")
# ------分组list控件
self.groupTreeWidget = QTreeWidget(self.tabGroup)
self.groupTreeWidget.setFrameShape(QFrame.NoFrame)
self.groupTreeWidget.setFrameStyle(QFrame.NoFrame)
self.groupTreeWidget.setLineWidth(0)
self.groupTreeWidget.setIndentation(0)
self.groupTreeWidget.setRootIsDecorated(False)
self.groupTreeWidget.setExpandsOnDoubleClick(False)
self.groupTreeWidget.header().setVisible(False)
self.groupTreeWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.groupTreeWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.groupTreeWidget.setObjectName("groupTreeWidget")
# ----添加到布局
groupVerticalLayout.addWidget(self.groupTreeWidget)
# --历史
self.tabHistory = QWidget(self.tabWidget)
self.tabHistory.setObjectName("tabHistory")
# ----历史布局
historyVerticalLayout = QVBoxLayout(self.tabHistory)
historyVerticalLayout.setSpacing(0)
historyVerticalLayout.setContentsMargins(0, 0, 0, 0)
historyVerticalLayout.setObjectName("historyVerticalLayout")
# ------历史list控件
self.historyTreeWidget = QTreeWidget(self.tabHistory)
self.historyTreeWidget.setFrameShape(QFrame.NoFrame)
self.historyTreeWidget.setFrameStyle(QFrame.NoFrame)
self.historyTreeWidget.setLineWidth(0)
self.historyTreeWidget.setIndentation(0)
self.historyTreeWidget.setRootIsDecorated(False)
self.historyTreeWidget.setExpandsOnDoubleClick(False)
self.historyTreeWidget.header().setVisible(False)
self.historyTreeWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.historyTreeWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.historyTreeWidget.setObjectName("historyTreeWidget")
# ----添加到布局
historyVerticalLayout.addWidget(self.historyTreeWidget)
# 添加到tab中
self.tabWidget.addTab(self.tabGroup, "")
self.tabWidget.addTab(self.tabHistory, "")
# 整体布局
verticalLayout = QVBoxLayout(self.bgWidget)
verticalLayout.setSpacing(0)
verticalLayout.setContentsMargins(0, 0, 0, 0)
verticalLayout.setObjectName("verticalLayout")
verticalLayout.addWidget(self.topWidget)
verticalLayout.addWidget(self.headWidget)
verticalLayout.addWidget(self.searchEdit)
verticalLayout.addWidget(self.tabWidget)
# bg
layout = QVBoxLayout(Ucics)
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.bgWidget)
# 初始化一些设置
_translate = QCoreApplication.translate
Ucics.setWindowTitle(_translate("Ucics", "UCICS"))
self.tabWidget.setCurrentIndex(0)
self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tabGroup), _translate("tabGroup", "分组"))
self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tabHistory), _translate("tabHistory", "历史"))
QMetaObject.connectSlotsByName(Ucics)
示例12: setupUi
# 需要导入模块: from PyQt5.QtCore import QMetaObject [as 别名]
# 或者: from PyQt5.QtCore.QMetaObject import connectSlotsByName [as 别名]
def setupUi(self, Item, userhead, name, mood, times, which = 0):
size_280_50 = QSize(280, 50)
Item.setObjectName("Item")
Item.resize(size_280_50) # 窗口大小
Item.setMinimumSize(size_280_50) # 设置最小大小
Item.setMaximumSize(size_280_50) # 设置最大大小
Item.setWindowFlags(Qt.FramelessWindowHint) # 无边框
# 由于父QWidget无法通过样式设置背景
# 所以这里把所有控件放到子QWidget中
self.itemWidget = QWidget(Item)
self.itemWidget.setObjectName("childItem")
# 用户头像
self.userLabel = QLabel(self.itemWidget)
self.userLabel.setMinimumSize(QSize(40, 40))
self.userLabel.setMaximumSize(QSize(40, 40))
self.userLabel.setLineWidth(0)
self.userLabel.setObjectName("userLabel")
# 用户昵称和说说
self.infoWidget = QWidget(self.itemWidget)
self.infoWidget.setObjectName("infoWidget")
# --昵称
self.nameLabel = QLabel(self.infoWidget)
self.nameLabel.setObjectName("nameLabel")
# --说说
self.moodLabel = QLabel(self.infoWidget)
self.moodLabel.setObjectName("moodLabel")
# --布局
infoLayout = QVBoxLayout(self.infoWidget)
infoLayout.setSpacing(2)
infoLayout.setContentsMargins(3, 2, 0, 2)
# 添加到布局中
infoLayout.addWidget(self.nameLabel)
infoLayout.addWidget(self.moodLabel)
# 时间
self.timeLabel = QLabel(self.itemWidget)
self.timeLabel.setMinimumWidth(30)
self.timeLabel.setMaximumWidth(30)
self.timeLabel.setAlignment(Qt.AlignRight | Qt.AlignTop)
self.timeLabel.setObjectName("timeLabel")
# 整体布局
itemLayout = QHBoxLayout(self.itemWidget)
itemLayout.setSpacing(5)
itemLayout.setContentsMargins(10, 5, 15, 5)
# 添加到布局中
itemLayout.addWidget(self.userLabel)
itemLayout.addWidget(self.infoWidget)
itemLayout.addWidget(self.timeLabel)
layout = QHBoxLayout(Item)
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.itemWidget)
# 初始化一些设置
_translate = QCoreApplication.translate
self.userLabel.setStyleSheet("QLabel#userLabel {\n image: url(%s);\n}" % userhead)
self.nameLabel.setText(_translate("Item", name))
self.moodLabel.setText(_translate("Item", mood))
if which:
self.timeLabel.setText(_translate("Item", times))
QMetaObject.connectSlotsByName(Item)