本文整理汇总了Python中PySide.QtGui.QTextEdit.setFontPointSize方法的典型用法代码示例。如果您正苦于以下问题:Python QTextEdit.setFontPointSize方法的具体用法?Python QTextEdit.setFontPointSize怎么用?Python QTextEdit.setFontPointSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QTextEdit
的用法示例。
在下文中一共展示了QTextEdit.setFontPointSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScratchPadWidget
# 需要导入模块: from PySide.QtGui import QTextEdit [as 别名]
# 或者: from PySide.QtGui.QTextEdit import setFontPointSize [as 别名]
class ScratchPadWidget(QtGui.QWidget):
def __init__(self, parent):
"""
Constructor
This widget is kind of different.
It does not exactly subclass CustomWidget
"""
QtGui.QWidget.__init__(self)
self.name = "Scratchpad"
self.parent = parent
self.config = self.parent.config
self.iconp = self.config.icons_path
self.icon = QIcon(self.iconp + 'pencil.png')
self._createGui()
def _createGui(self):
self._createScratchPadWindow()
scratchpad_layout = QtGui.QVBoxLayout()
save_btn = QtGui.QPushButton("Save to file", self)
save_btn.setIcon(QIcon(self.iconp + 'save-download.png'))
label = QtGui.QLabel("Write some notes here")
scratchpad_layout.addWidget(label)
scratchpad_layout.addWidget(self.scratchpad_window)
scratchpad_layout.addWidget(save_btn)
# Connect signals and slots
save_btn.clicked.connect(self._saveButtonClicked)
self.setLayout(scratchpad_layout)
def _createScratchPadWindow(self):
"""
Some binary analysis commands will output to this.
"""
self.scratchpad_window = QTextEdit()
self.scratchpad_window.setFontPointSize(9)
#################################################################
# GUI Callbacks
#################################################################
def _saveButtonClicked(self):
try:
filename, flt = QFileDialog.getSaveFileName(
self,
"File to save notes",
"",
selectedFilter = '*.txt')
sp_text = self.scratchpad_window.toPlainText()
with open(filename, 'w') as f:
f.write(sp_text)
print "Saved notes to \"%s\"" % filename
except:
print "[!] Problem saving notes..."
print traceback.format_exc()
示例2: CustomWidget
# 需要导入模块: from PySide.QtGui import QTextEdit [as 别名]
# 或者: from PySide.QtGui.QTextEdit import setFontPointSize [as 别名]
class CustomWidget(QtGui.QMainWindow):
def __init__(self):
"""
Constructor
"""
QtGui.QMainWindow.__init__(self)
self.name = "Custom widget"
self.central_widget = QtGui.QWidget()
self.setCentralWidget(self.central_widget)
# TODO: This is ugly, improve it
self.iconp = JConfig().icons_path
self._createLayout()
def _createGui(self):
"""
Subclasses must override this
depending on the elements they want to add
self._createOutputTree(),
self._createOutputTable(),
self._createOutputWindow() and add them to
the corresponding layouts.
"""
raise NotImplementedError
def _createToolBar(self, name):
"""
Subclasses need to define the
specific Actions
"""
self.toolbar = self.addToolBar(name)
self.toolbar.setMovable(False)
def _createLayout(self):
"""
This creates the basic layout:
Buttons & Outputs
"""
# Layouts (This is a common disposition)
main_layout = QtGui.QVBoxLayout()
self.button_layout = QtGui.QHBoxLayout()
output_layout = QtGui.QVBoxLayout()
# You will need to create your buttons
# and add them to your layout like this:
# self.button_layout.addWidget(button_1)
# Output Layout Inner (QSplitter)
# Add as many widgets as you please
# They will be ordered vertically and
# be resizable by the user
# self.splitter.addWidget(self.table_label)
# self.splitter.addWidget(...)
self.splitter = QSplitter(QtCore.Qt.Vertical)
# Nested layouts
main_layout.addLayout(self.button_layout)
output_layout.addWidget(self.splitter)
main_layout.addLayout(output_layout)
self.central_widget.setLayout(main_layout)
def _createOutputWindow(self):
"""
Some binary analysis commands will output to this.
"""
self.output_label = QtGui.QLabel('Output')
self.output_window = QTextEdit()
self.output_window.setFontPointSize(10)
self.output_window.setReadOnly(True)
# Save it for later use
self.output_window.original_textcolor = self.output_window.textColor()
def _createOutputTable(self):
"""
A vanilla QTableWidget. Callbacks modify
its properties, like number of columns, etc.
"""
self.table_label = QtGui.QLabel('Table Output')
self.table = QTableWidget()
self.table.setColumnCount(3)
self.table.setColumnWidth(0, 100)
self.table.setColumnWidth(1, 300)
self.table.setColumnWidth(2, 300)
self.table.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
# Connect signals to slots
self.table.customContextMenuRequested.connect(self._tablePopup)
self.table.horizontalHeader().sectionDoubleClicked.connect(self._tableHeaderDoubleClicked)
#.........这里部分代码省略.........