本文整理汇总了Python中PySide.QtCore.QRect方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QRect方法的具体用法?Python QtCore.QRect怎么用?Python QtCore.QRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore
的用法示例。
在下文中一共展示了QtCore.QRect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(529, 329)
self.selInfoWidget = QtGui.QWidget(Form)
self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
self.selInfoWidget.setObjectName("selInfoWidget")
self.gridLayout = QtGui.QGridLayout(self.selInfoWidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.selDescLabel = QtGui.QLabel(self.selInfoWidget)
self.selDescLabel.setText("")
self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.selDescLabel.setWordWrap(True)
self.selDescLabel.setObjectName("selDescLabel")
self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
self.selNameLabel = QtGui.QLabel(self.selInfoWidget)
font = QtGui.QFont()
font.setWeight(75)
font.setBold(True)
self.selNameLabel.setFont(font)
self.selNameLabel.setText("")
self.selNameLabel.setObjectName("selNameLabel")
self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
self.selectedTree = DataTreeWidget(self.selInfoWidget)
self.selectedTree.setObjectName("selectedTree")
self.selectedTree.headerItem().setText(0, "1")
self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
self.hoverText = QtGui.QTextEdit(Form)
self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
self.hoverText.setObjectName("hoverText")
self.view = FlowchartGraphicsView(Form)
self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
self.view.setObjectName("view")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例2: setupUi
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def setupUi(self, Zebra):
Zebra.setObjectName(_fromUtf8("Zebra"))
Zebra.resize(241, 302)
self.verticalLayoutWidget = QtGui.QWidget(Zebra)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 221, 251))
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.verticalLayoutWidget)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label, QtCore.Qt.AlignHCenter)
self.horizontalSlider = QtGui.QSlider(self.verticalLayoutWidget)
self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider.setObjectName(_fromUtf8("horizontalSlider"))
self.verticalLayout.addWidget(self.horizontalSlider)
self.label_2 = QtGui.QLabel(self.verticalLayoutWidget)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.verticalLayout.addWidget(self.label_2, QtCore.Qt.AlignHCenter)
self.horizontalSlider_2 = QtGui.QSlider(self.verticalLayoutWidget)
self.horizontalSlider_2.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider_2.setObjectName(_fromUtf8("horizontalSlider_2"))
self.verticalLayout.addWidget(self.horizontalSlider_2)
self.label_3 = QtGui.QLabel(self.verticalLayoutWidget)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.verticalLayout.addWidget(self.label_3, QtCore.Qt.AlignHCenter)
self.horizontalSlider_3 = QtGui.QSlider(self.verticalLayoutWidget)
self.horizontalSlider_3.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider_3.setObjectName(_fromUtf8("horizontalSlider_3"))
self.verticalLayout.addWidget(self.horizontalSlider_3)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.pushButton = QtGui.QPushButton(self.verticalLayoutWidget)
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.verticalLayout.addWidget(self.pushButton, QtCore.Qt.AlignHCenter)
self.retranslateUi(Zebra)
# QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("released()")), Zebra.close)
# QtCore.QMetaObject.connectSlotsByName(Zebra)
示例3: resizeEvent
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def resizeEvent(self, event):
QPlainTextEdit.resizeEvent(self, event)
cr = self.contentsRect()
self.lineNumberArea.setGeometry(
QRect(cr.left(), cr.top(), self.lineNumberAreaWidth(),
cr.height()))
# Loads the text of a script into the code editor
示例4: numberbarPaint
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def numberbarPaint(self, number_bar, event):
font_metrics = self.fontMetrics()
current_line = self.document().findBlock(self.textCursor().position()).blockNumber() + 1
block = self.firstVisibleBlock()
line_count = block.blockNumber()
painter = QtGui.QPainter(number_bar)
painter.fillRect(event.rect(), self.palette().base())
# Iterate over all visible text blocks in the document.
while block.isValid():
line_count += 1
block_top = self.blockBoundingGeometry(block).translated(self.contentOffset()).top()
# Check if the position of the block is out side of the visible
# area.
if not block.isVisible() or block_top >= event.rect().bottom():
break
# We want the line number for the selected line to be bold.
if line_count == current_line:
font = painter.font()
font.setBold(True)
painter.setFont(font)
else:
font = painter.font()
font.setBold(False)
painter.setFont(font)
# Draw the line number right justified at the position of the line.
paint_rect = QtCore.QRect(0, block_top, number_bar.width(), font_metrics.height())
painter.drawText(paint_rect, QtCore.Qt.AlignRight, unicode(line_count))
block = block.next()
painter.end()
示例5: setupUi
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(400, 164)
self.buttonBox = QtGui.QDialogButtonBox(Dialog)
self.buttonBox.setGeometry(QtCore.QRect(30, 110, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.comboBox = QtGui.QComboBox(Dialog)
self.comboBox.setGeometry(QtCore.QRect(180, 40, 191, 22))
self.comboBox.setMaxVisibleItems(25)
self.comboBox.setObjectName("comboBox")
self.label = QtGui.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(180, 20, 53, 16))
self.label.setObjectName("label")
self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(20, 20, 53, 16))
self.label_2.setObjectName("label_2")
self.plainTextEdit = QtGui.QPlainTextEdit(Dialog)
self.plainTextEdit.setEnabled(False)
self.plainTextEdit.setGeometry(QtCore.QRect(20, 40, 31, 31))
self.plainTextEdit.setBackgroundVisible(False)
self.plainTextEdit.setObjectName("plainTextEdit")
self.plainTextEdit_2 = QtGui.QPlainTextEdit(Dialog)
self.plainTextEdit_2.setEnabled(False)
self.plainTextEdit_2.setGeometry(QtCore.QRect(120, 40, 31, 31))
self.plainTextEdit_2.setBackgroundVisible(False)
self.plainTextEdit_2.setObjectName("plainTextEdit_2")
self.label_3 = QtGui.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(120, 20, 41, 16))
self.label_3.setObjectName("label_3")
self.label_4 = QtGui.QLabel(Dialog)
self.label_4.setGeometry(QtCore.QRect(20, 80, 351, 16))
self.label_4.setObjectName("label_4")
QtCore.QObject.connect(self.comboBox, QtCore.SIGNAL("currentIndexChanged(QString)"), self.SIGNAL_comboBox_Changed)
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例6: _numberbar_paint
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QRect [as 别名]
def _numberbar_paint(self, number_bar, event):
'''Paint number bar.'''
font_metrics = self.fontMetrics()
current_line = self.edit.document().findBlock(
self.edit.textCursor().position()
).blockNumber() + 1
block = self.edit.firstVisibleBlock()
line_count = block.blockNumber()
painter = QPainter(number_bar)
painter.fillRect(event.rect(), self.palette().base())
# Iterate over all visible text blocks in the document.
while block.isValid():
line_count += 1
block_top = self.edit.blockBoundingGeometry(block).\
translated(self.edit.contentOffset()).top()
# Check if the position of the block is out side of the visible
# area.
if not block.isVisible() or block_top >= event.rect().bottom():
break
# We want the line number for the selected line to be bold.
if line_count == current_line:
font = painter.font()
font.setBold(True)
font.setUnderline(True)
painter.setFont(font)
else:
font = painter.font()
font.setBold(False)
font.setUnderline(False)
painter.setFont(font)
# Draw the line number right justified at the position of the
# line.
paint_rect = QRect(0, block_top, number_bar.width(),
font_metrics.height())
painter.drawText(paint_rect, Qt.AlignRight,
"{} ".format(unicode(line_count)))
block = block.next()
painter.end()
return