本文整理匯總了Python中PySide2.QtCore.QRectF方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QRectF方法的具體用法?Python QtCore.QRectF怎麽用?Python QtCore.QRectF使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtCore
的用法示例。
在下文中一共展示了QtCore.QRectF方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_topleft_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_topleft_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
*__________________________
| |
| |
|________________________|
"""
if not rect:
return None
point = rect.topLeft()
return QtCore.QRectF(
point.x() - (POINT_RADIUS / 2.0) - POINT_OFFSET,
point.y() - (POINT_RADIUS / 2.0) - POINT_OFFSET,
POINT_RADIUS, POINT_RADIUS)
示例2: get_bottomleft_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_bottomleft_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
__________________________
| |
| |
|________________________|
*
"""
if not rect:
return None
point = rect.bottomLeft()
return QtCore.QRectF(
point.x() - (POINT_RADIUS / 2.0) - POINT_OFFSET,
point.y() + (POINT_RADIUS / 2.0) - POINT_OFFSET,
POINT_RADIUS, POINT_RADIUS)
示例3: get_bottomright_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_bottomright_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
__________________________
| |
| |
|________________________|
*
"""
if not rect:
return None
point = rect.bottomRight()
return QtCore.QRectF(
point.x() + (POINT_RADIUS / 2.0) - POINT_OFFSET,
point.y() + (POINT_RADIUS / 2.0) - POINT_OFFSET,
POINT_RADIUS, POINT_RADIUS)
示例4: get_left_side_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_left_side_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
__________________________
| |
*| |
|________________________|
"""
if not rect:
return None
top = rect.top() + (rect.height() / 2.0)
return QtCore.QRectF(
rect.left() - (POINT_RADIUS / 2.0) - POINT_OFFSET,
top - (POINT_RADIUS / 2.0),
POINT_RADIUS, POINT_RADIUS)
示例5: get_right_side_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_right_side_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
__________________________
| |
| |*
|________________________|
"""
if not rect:
return None
top = rect.top() + (rect.height() / 2.0)
return QtCore.QRectF(
rect.right() + (POINT_RADIUS / 2.0) - POINT_OFFSET,
top - (POINT_RADIUS / 2.0) ,
POINT_RADIUS, POINT_RADIUS)
示例6: get_bottom_side_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_bottom_side_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
__________________________
| |
| |
|________________________|
*
"""
if not rect:
return None
return QtCore.QRectF(
rect.left() + (rect.width() / 2.0) - (POINT_RADIUS / 2.0),
rect.bottom() + (POINT_RADIUS / 2.0) - POINT_OFFSET,
POINT_RADIUS, POINT_RADIUS)
示例7: get_combined_rects
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_combined_rects(rects):
"""
this function analyse list of rects and return
a rect with the smaller top and left and highest right and bottom
__________________________________ ?
| | A |
| | |
|______________| ___________| B
| | |
|_____________________|__________|
"""
if not rects:
return None
left = min([rect.left() for rect in rects])
right = max([rect.right() for rect in rects])
top = min([rect.top() for rect in rects])
bottom = max([rect.bottom() for rect in rects])
return QtCore.QRectF(left, top, right - left, bottom - top)
示例8: fitInView
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def fitInView(self, scale=True):
rect = self.getImageDims()
if not rect.isNull():
self.setSceneRect(rect)
unity = self.transform().mapRect(QRectF(0, 0, 1, 1))
self.scale(1 / unity.width(), 1 / unity.height())
viewrect = self.viewport().rect()
scenerect = self.transform().mapRect(rect)
factor = min(viewrect.width() / scenerect.width(),
viewrect.height() / scenerect.height())
self.scale(factor, factor)
if self.hasImage():
self.updateIndicatorSize()
self._zoom = 0
示例9: __init__
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def __init__(self, name=None):
pen = QtGui.QPen(QtCore.Qt.SolidLine)
pen.setColor(QtGui.QColor(0, 0, 0, 255))
pen.setWidthF(0.2)
pen.setJoinStyle(QtCore.Qt.MiterJoin)
self.pen = pen
self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
self.font = QtGui.QFont('Decorative', 12)
self.rect = QtCore.QRectF()
self.shape = QtGui.QPainterPath()
self.path = QtGui.QPainterPath()
self.scale = (1, 1)
self.tooltip = ''
self.method = ''
self.args = []
示例10: _boundingRect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def _boundingRect(self):
height, width = 0, 0
width += self._addr_width
width += self.LINEAR_INSTRUCTION_OFFSET
if self._bytes_text:
height += Conf.disasm_font_height * len(self._bytes_text) * self.currentDevicePixelRatioF()
else:
height += Conf.disasm_font_height * self.currentDevicePixelRatioF()
if self._bytes_text:
width += max(len(line) for line in self._bytes_text) * Conf.disasm_font_width * self.currentDevicePixelRatioF()
else:
width += Conf.disasm_font_metrics.width(QUnknownBlock.DEFAULT_TEXT) * self.currentDevicePixelRatioF()
return QRectF(0, 0, width, height)
#
# Private methods
#
示例11: boundingRect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def boundingRect(self):
extra = (self.pen().width() + 20) / 2.0
p1 = self.line().p1()
p2 = self.line().p2()
size = QtCore.QSizeF(p2.x() - p1.x(), p2.y() - p1.y())
return QtCore.QRectF(p1, size).normalized().adjusted(-extra, -extra, extra, extra)
示例12: clicked
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def clicked(self, cursor):
self.handeling = True
self.rect = QtCore.QRectF(cursor, cursor)
示例13: get_shape_rect_from_options
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_shape_rect_from_options(options):
return QtCore.QRectF(
options['shape.left'],
options['shape.top'],
options['shape.width'],
options['shape.height'])
示例14: get_top_side_rect
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def get_top_side_rect(rect):
"""
this function return a manipulator rect for the transform
handler.
_____________*____________
| |
| |
|________________________|
"""
if not rect:
return None
return QtCore.QRectF(
rect.left() + (rect.width() / 2.0) - (POINT_RADIUS / 2.0),
rect.top() - (POINT_RADIUS / 2.0) - POINT_OFFSET,
POINT_RADIUS, POINT_RADIUS)
示例15: apply_relative_transformation
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QRectF [as 別名]
def apply_relative_transformation(self, rects):
for rect in rects:
resize_rect_with_reference(
rect, self.reference_rect, self.rect)
self.reference_rect = QtCore.QRectF(
self.rect.topLeft(), self.rect.bottomRight())