本文整理汇总了Python中PyQt5.QtWidgets.QTextBrowser.setObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.setObjectName方法的具体用法?Python QTextBrowser.setObjectName怎么用?Python QTextBrowser.setObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.setObjectName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PreviewWidgetColor
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setObjectName [as 别名]
class PreviewWidgetColor(QGroupBox):
def __init__(self, parent=None):
super().__init__(parent)
self.setTitle(self.tr("Preview"))
self.setMaximumHeight(120)
self.parent = parent
vboxLayout = QVBoxLayout(self)
self.previewGroupBox = QGroupBox(self)
self.previewGroupBox.setObjectName("previewGroupBox")
vboxLayout.addWidget(self.previewGroupBox)
self.horizontalLayout = QHBoxLayout(self.previewGroupBox)
self.verticalLayout = QVBoxLayout()
self.horizontalLayout.addLayout(self.verticalLayout)
self.previewLabel = QLabel(self.previewGroupBox)
self.previewLabel.setText(self.tr("Window Text"))
self.previewLabel.setObjectName("previewLabel")
self.verticalLayout.addWidget(self.previewLabel)
self.previewPushButton = QPushButton(self.previewGroupBox)
self.previewPushButton.setText(self.tr("Button"))
self.previewPushButton.setObjectName("previewPushButton")
self.verticalLayout.addWidget(self.previewPushButton)
self.previewTextBrowser = QTextBrowser(self.previewGroupBox)
self.previewTextBrowser.setObjectName("previewTextBrowser")
css = iniToCss(os.path.join("/usr/share/color-schemes", self.parent.children()[1].currentItem().colorSchemeName))
self.previewTextBrowser.setHtml("""<style>#unclicked {color : rgb(%s);}
#clicked {color : rgb(%s);}</style>"""%(css[1][0],css[1][1]) +
self.tr("""<p>Normal text <a id='unclicked' href='#'>link</a> <a id='clicked' href='#'>visited</a></p>"""))
self.horizontalLayout.addWidget(self.previewTextBrowser)
self.previewPushButton.installEventFilter(self.previewGroupBox)
self.previewPushButton.setFocusPolicy(Qt.NoFocus)
self.previewTextBrowser.installEventFilter(self.previewGroupBox)
self.previewTextBrowser.setFocusPolicy(Qt.NoFocus)
self.previewTextBrowser.setTextInteractionFlags(Qt.NoTextInteraction)
def eventFilter(self, obj, event):
if self.previewPushButton:
if event.type() == QEvent.MouseButtonRelease:
return True
elif event.type() == QEvent.MouseButtonPress:
return True
elif event.type() == QEvent.MouseButtonDblClick:
return True
else:
return False
else:
super().eventFilter(obj, event)
示例2: About_Dialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setObjectName [as 别名]
class About_Dialog(QDialog):
def __init__(self):
super(About_Dialog, self).__init__()
self.setupUi()
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()
def retranslateUi(self):
_translate = QCoreApplication.translate
self.setWindowTitle(_translate("Dialog", "关于"))
self.textBrowser.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">绍兴防雷中心 雷电公报制图-v1.0</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">联系:[email protected]</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;\"><br /></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">©绍兴防雷中心 All rights reserved</span></p></body></html>"))
示例3: PreviewWidgetColor
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setObjectName [as 别名]
class PreviewWidgetColor(QGroupBox):
def __init__(self, parent=None):
super().__init__(parent)
self.setTitle(self.tr("Preview"))
self.setMaximumHeight(120)
vboxLayout = QVBoxLayout(self)
self.previewGroupBox = QGroupBox(self)
self.previewGroupBox.setObjectName("previewGroupBox")
vboxLayout.addWidget(self.previewGroupBox)
self.horizontalLayout = QHBoxLayout(self.previewGroupBox)
self.verticalLayout = QVBoxLayout()
self.horizontalLayout.addLayout(self.verticalLayout)
self.previewLabel = QLabel(self.previewGroupBox)
self.previewLabel.setText(self.tr("Window Text"))
self.previewLabel.setObjectName("previewLabel")
self.verticalLayout.addWidget(self.previewLabel)
self.previewPushButton = QPushButton(self.previewGroupBox)
self.previewPushButton.setText(self.tr("Button"))
self.previewPushButton.setObjectName("previewPushButton")
self.verticalLayout.addWidget(self.previewPushButton)
self.previewTextBrowser = QTextBrowser(self.previewGroupBox)
self.previewTextBrowser.setObjectName("previewTextBrowser")
self.previewTextBrowser.insertHtml(self.tr("""<style>
#unclicked {color : rgb(255,0,0);}
#sunclicked {color : rgb(255,0,255);}
#clicked {color : rgb(0,255,0);}
#sclicked {color : rgb(0,0,255);}
</style>
<p>Normal metin <a id='unclicked' href='#'>bağlantı</a> <a id='clicked' href='#'>ziyaret edilmiş</a></p>
<p>Seçili metin <a id='sunclicked' href='#'>bağlantı</a> <a id='sclicked' href='#'>ziyaret edilmiş</a></p>"""))
cursor = self.previewTextBrowser.textCursor()
cursor.setPosition(39)
cursor.setPosition(76, QTextCursor.KeepAnchor)
self.previewTextBrowser.setTextCursor(cursor)
self.horizontalLayout.addWidget(self.previewTextBrowser)
self.previewPushButton.installEventFilter(self.previewGroupBox)
self.previewPushButton.setFocusPolicy(Qt.NoFocus)
self.previewTextBrowser.installEventFilter(self.previewGroupBox)
self.previewTextBrowser.setFocusPolicy(Qt.NoFocus)
self.previewTextBrowser.setTextInteractionFlags(Qt.NoTextInteraction)
def eventFilter(self, obj, event):
if self.previewPushButton:
if event.type() == QEvent.MouseButtonRelease:
return True
elif event.type() == QEvent.MouseButtonPress:
return True
elif event.type() == QEvent.MouseButtonDblClick:
return True
else:
return False
else:
super().eventFilter(obj, event)
示例4: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setObjectName [as 别名]
#.........这里部分代码省略.........
self.__layout_path = QHBoxLayout()
self.__layout_path.addLayout(self.__layout_choose_path)
self.__layout_path.addWidget(self.__rbn_search_file)
self.__layout_path.addWidget(self.__rbn_search_content)
self.__layout_path.setContentsMargins(0, 0, 0, 0)
self.__lab_path_fram.setLayout(self.__layout_path)
# search state
self.__layout_state = QHBoxLayout()
self.__layout_state.addWidget(self.__lab_state)
self.__layout_state.addWidget(self.__pbn_search)
self.__layout_state.addWidget(self.__pbn_stop)
self.__layout_state.setContentsMargins(0, 0, 0, 10)
self.__lab_state_fram.setLayout(self.__layout_state)
# top layout
self.__layout_top = QVBoxLayout()
self.__layout_top.addWidget(self.__lab_title_fram)
self.__layout_top.addWidget(self.__lab_mode_fram)
self.__layout_top.addWidget(self.__lab_pattern_fram)
self.__layout_top.addWidget(self.__lab_path_fram)
self.__layout_top.addWidget(self.__lab_state_fram)
self.__layout_top.addWidget(self.__tabView)
self.__layout_top.setSpacing(10)
self.__widget_frame.setLayout(self.__layout_top)
self.__layout_fram = QGridLayout()
self.__layout_fram.addWidget(self.__widget_frame, 0, 0, 1, 1)
self.__layout_fram.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.__layout_fram)
# set object name
self.__widget_frame.setObjectName('fram')
self.__lab_title.setObjectName('lab_title')
self.__ln_open_tool.setObjectName('ln_open_tool')
self.__lab_mode_fram.setObjectName('mode_fram')
self.__ln_file_name.setObjectName('ln_pattern')
self.__ln_file_path.setObjectName('ln_path')
self.__lab_state.setObjectName('state')
self.__tabView.setObjectName('tabView')
self.__browser_result.setObjectName('browser_result')
self.__browser_error.setObjectName('browser_error')
self.setStyleSheet(
'#fram{'
'border-image: url(Images/bg);'
'}'
'#lab_title{'
'color: white;'
'font-size: 18pt;'
'}'
'#open_tool{'
'color: black;'
'}'
'#mode_fram{'
# 'border-top: 1px solid rgba(20, 20, 20, 100);'
# 'border-bottom: 1px solid rgba(20, 20, 20, 100);'
'background: rgba(0, 0, 0, 40);'
'}'
'#ln_open_tool, #ln_path{'
'border-top-left-radius: 2px;'
'border-bottom-left-radius: 2px;'
'}'
'#ln_pattern{'
'border-radius: 2px;'
示例5: Ui_Dialog
# 需要导入模块: from PyQt5.QtWidgets import QTextBrowser [as 别名]
# 或者: from PyQt5.QtWidgets.QTextBrowser import setObjectName [as 别名]
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(430, 486)
icon = QIcon()
icon.addPixmap(QPixmap(_fromUtf8("images/icon.ico")), QIcon.Normal, QIcon.Off)
Dialog.setWindowIcon(icon)
self.formLayoutWidget_2 = QWidget(Dialog)
self.formLayoutWidget_2.setGeometry(QRect(230, 80, 181, 131))
self.formLayoutWidget_2.setObjectName(_fromUtf8("formLayoutWidget_2"))
self.formLayout_2 = QFormLayout(self.formLayoutWidget_2)
self.formLayout_2.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
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"))
#.........这里部分代码省略.........