我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用PySide.QtGui.QTextBrowser()。
def setupUi(self, Manual): Manual.setObjectName(_fromUtf8("Manual")) Manual.resize(740, 450) Manual.setMinimumSize(QtCore.QSize(740, 450)) Manual.setMaximumSize(QtCore.QSize(740, 450)) self.textBrowser = QtGui.QTextBrowser(Manual) self.textBrowser.setGeometry(QtCore.QRect(10, 40, 721, 371)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.label = QtGui.QLabel(Manual) self.label.setGeometry(QtCore.QRect(10, 10, 271, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.manual_bn = QtGui.QPushButton(Manual) self.manual_bn.setGeometry(QtCore.QRect(650, 420, 75, 23)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) self.manual_bn.setFont(font) self.manual_bn.setObjectName(_fromUtf8("manual_bn")) self.retranslateUi(Manual) QtCore.QMetaObject.connectSlotsByName(Manual)
def setupUi(self): """Bruh""" self.setGeometry(50, 50, 450, 250) self.setWindowTitle("ZeZe's TWTools - Updating Servers") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Layout""" self.verticalLayout = QtGui.QVBoxLayout(self) self.text = QtGui.QLabel("Updating server list:") self.verticalLayout.addWidget(self.text) """Download bar""" self.progress_bar = QtGui.QProgressBar(self) self.progress_bar.setMinimum(0) self.progress_bar.setMaximum(27) self.progress_bar.setValue(0) self.progress_bar.setFormat("%v / %m") self.verticalLayout.addWidget(self.progress_bar) """Text browser for progress""" self.progress_text = QtGui.QTextBrowser(self) self.verticalLayout.addWidget(self.progress_text) """Button""" self.horizontalLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.horizontalLayout) self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(self.Spacer) self.cancelButton = QtGui.QPushButton("Cancel") self.horizontalLayout.addWidget(self.cancelButton) self.cancelButton.clicked.connect(self.cancel_function)
def setupUi(self, About): About.setObjectName(_fromUtf8("About")) About.resize(378, 342) About.setMinimumSize(QtCore.QSize(378, 342)) About.setMaximumSize(QtCore.QSize(378, 342)) self.label = QtGui.QLabel(About) self.label.setGeometry(QtCore.QRect(10, 10, 191, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(About) self.label_2.setGeometry(QtCore.QRect(10, 30, 181, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(10) font.setBold(False) font.setWeight(50) self.label_2.setFont(font) self.label_2.setObjectName(_fromUtf8("label_2")) self.label_3 = QtGui.QLabel(About) self.label_3.setGeometry(QtCore.QRect(10, 50, 211, 16)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(8) font.setItalic(False) self.label_3.setFont(font) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(About) self.label_4.setGeometry(QtCore.QRect(10, 60, 261, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(8) font.setItalic(False) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.textBrowser = QtGui.QTextBrowser(About) self.textBrowser.setGeometry(QtCore.QRect(10, 90, 361, 211)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.about_bn = QtGui.QPushButton(About) self.about_bn.setGeometry(QtCore.QRect(290, 310, 75, 23)) self.about_bn.setObjectName(_fromUtf8("about_bn")) self.retranslateUi(About) QtCore.QMetaObject.connectSlotsByName(About)
def chat_new_topic_ui(self, window): # make widjet ui_path = G.MW.chat_add_topic_path # widget loader = QtUiTools.QUiLoader() file = QtCore.QFile(ui_path) #file.open(QtCore.QFile.ReadOnly) add_window = G.MW.chatAddTopic = loader.load(file, G.MW) file.close() # set modal window add_window.setWindowModality(QtCore.Qt.WindowModal) add_window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # ****** add first line # H h_layout = QtGui.QHBoxLayout() line_frame = QtGui.QFrame(parent = add_window.new_topics_frame) # button button = QtGui.QPushButton('img', parent = line_frame) button.setFixedSize(100, 100) button.img_path = False h_layout.addWidget(button) # -- button connect button.clicked.connect(partial(self.chat_image_view_ui, button)) button.setContextMenuPolicy( QtCore.Qt.ActionsContextMenu ) addgrup_action = QtGui.QAction( 'Inser Image From Clipboard', add_window) addgrup_action.triggered.connect(partial(self.chat_add_img_to_line, button)) button.addAction( addgrup_action ) # text field text_field = QtGui.QTextEdit(parent = line_frame) #text_field = QtGui.QTextBrowser(parent = line_frame) text_field.setMaximumHeight(100) h_layout.addWidget(text_field) line_frame.setLayout(h_layout) # V v_layout = QtGui.QVBoxLayout() v_layout.addWidget(line_frame) add_window.new_topics_frame.setLayout(v_layout) # ****** append line data add_window.line_data = {} add_window.line_data['1'] = (button, text_field) # connect button add_window.cansel_button.clicked.connect(partial(G.MW.close_window, add_window)) add_window.add_line_button.clicked.connect(partial(self.chat_add_line_to_message, add_window, v_layout)) add_window.send_message_button.clicked.connect(partial(self.chat_new_topic_action, add_window, G.MW.chat_status)) add_window.show()
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(465, 393) self.verticalLayout = QtGui.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setContentsMargins(-1, 20, -1, 20) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.icon_lb = QtGui.QLabel(Dialog) font = QtGui.QFont() font.setPointSize(20) self.icon_lb.setFont(font) self.icon_lb.setText("") self.icon_lb.setObjectName("icon_lb") self.horizontalLayout.addWidget(self.icon_lb) self.title_lb = QtGui.QLabel(Dialog) font = QtGui.QFont() font.setPointSize(20) self.title_lb.setFont(font) self.title_lb.setObjectName("title_lb") self.horizontalLayout.addWidget(self.title_lb) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout) self.text_link_lb = QtGui.QLabel(Dialog) self.text_link_lb.setObjectName("text_link_lb") self.verticalLayout.addWidget(self.text_link_lb) self.textBrowser = QtGui.QTextBrowser(Dialog) self.textBrowser.setObjectName("textBrowser") self.verticalLayout.addWidget(self.textBrowser) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.donate_btn = QtGui.QPushButton(Dialog) self.donate_btn.setObjectName("donate_btn") self.horizontalLayout_2.addWidget(self.donate_btn) self.verticalLayout.addLayout(self.horizontalLayout_2) self.verticalLayout.setStretch(2, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1262, 529) self.user_email = QtGui.QLabel(Form) self.user_email.setGeometry(QtCore.QRect(1030, 20, 221, 31)) font = QtGui.QFont() font.setPointSize(12) font.setWeight(75) font.setBold(True) self.user_email.setFont(font) self.user_email.setObjectName("user_email") self.retrieve_button = QtGui.QPushButton(Form) self.retrieve_button.setGeometry(QtCore.QRect(10, 50, 103, 34)) self.retrieve_button.setObjectName("retrieve_button") self.compose_button = QtGui.QPushButton(Form) self.compose_button.setGeometry(QtCore.QRect(140, 50, 103, 34)) self.compose_button.setObjectName("compose_button") self.received_email = QtGui.QTableWidget(Form) self.received_email.setGeometry(QtCore.QRect(10, 90, 821, 431)) self.received_email.setObjectName("received_email") self.received_email.setColumnCount(3) self.received_email.setRowCount(0) item = QtGui.QTableWidgetItem() self.received_email.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem() self.received_email.setHorizontalHeaderItem(1, item) item = QtGui.QTableWidgetItem() self.received_email.setHorizontalHeaderItem(2, item) self.email_body = QtGui.QTextBrowser(Form) self.email_body.setGeometry(QtCore.QRect(840, 120, 411, 401)) self.email_body.setObjectName("email_body") self.label = QtGui.QLabel(Form) self.label.setGeometry(QtCore.QRect(930, 80, 91, 41)) font = QtGui.QFont() font.setPointSize(12) font.setWeight(75) font.setBold(True) self.label.setFont(font) self.label.setObjectName("label") self.app_title = QtGui.QLabel(Form) self.app_title.setGeometry(QtCore.QRect(10, 0, 101, 41)) font = QtGui.QFont() font.setPointSize(18) font.setWeight(75) font.setBold(True) self.app_title.setFont(font) self.app_title.setObjectName("app_title") self.showing_label = QtGui.QLabel(Form) self.showing_label.setGeometry(QtCore.QRect(560, 60, 271, 20)) font = QtGui.QFont() font.setPointSize(12) font.setWeight(75) font.setBold(True) self.showing_label.setFont(font) self.showing_label.setObjectName("showing_label") self.open_browser = QtGui.QPushButton(Form) self.open_browser.setGeometry(QtCore.QRect(1100, 80, 151, 34)) self.open_browser.setObjectName("open_browser") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)