def paint(self, painter, option, widget): """ TOWRITE :param `painter`: TOWRITE :type `painter`: `QPainter`_ :param `option`: TOWRITE :type `option`: `QStyleOptionGraphicsItem`_ :param `widget`: TOWRITE :type `widget`: `QWidget`_ """ objScene = self.scene() # QGraphicsScene* if not objScene: return paintPen = self.pen() # QPen painter.setPen(paintPen) self.updateRubber(painter) if option.state & QStyle.State_Selected: paintPen.setStyle(Qt.DashLine) if objScene.property(ENABLE_LWT): # .toBool() paintPen = self.lineWeightPen() painter.setPen(paintPen) if self.normalPath.elementCount(): painter.drawPath(self.normalPath) zero = self.normalPath.elementAt(0) # QPainterPath::Element last = self.normalPath.elementAt(self.normalPath.elementCount() - 1) # QPainterPath::Element painter.drawLine(QPointF(zero.x, zero.y), QPointF(last.x, last.y))
def _draw_edges(self, painter, topleft_point, bottomright_point): for edge in self._edges: edge_coords = edge.coordinates color = QColor(0x70, 0x70, 0x70) pen = QPen(color) pen.setWidth(1.5) painter.setPen(pen) for from_, to_ in zip(edge_coords, edge_coords[1:]): start_point = QPointF(*from_) end_point = QPointF(*to_) # optimization: don't draw edges that are outside of the current scope if (start_point.x() > bottomright_point.x() or start_point.y() > bottomright_point.y()) and \ (end_point.x() > bottomright_point.x() or end_point.y() > bottomright_point.y()): continue elif (start_point.x() < topleft_point.x() or start_point.y() < topleft_point.y()) and \ (end_point.x() < topleft_point.x() or end_point.y() < topleft_point.y()): continue painter.drawPolyline((start_point, end_point)) # arrow # end_point = self.mapToScene(*edges[-1]) end_point = (edge_coords[-1][0], edge_coords[-1][1]) arrow = [ QPointF(end_point[0] - 3, end_point[1]), QPointF(end_point[0] + 3, end_point[1]), QPointF(end_point[0], end_point[1] + 6) ] brush = QBrush(color) painter.setBrush(brush) painter.drawPolygon(arrow)
def test_subsegment(self): "Subsegment a single box with three seeds points" w = self.window # Open document for subsegmentation w.open_document(TESTDATA / 'test_subsegment.inselect') self.assertEqual(1, w.model.rowCount()) # Select a box and add sub-segmentation seed points # TODO LH Selecting the box and adding points like this is nasty - # possible to use QTest.mouseClick? box = w.view_graphics_item.scene.box_items().next() box.setSelected(True) seeds = [ QPointF(290.0, 145.0), QPointF(586.0, 276.0), QPointF(272.0, 453.0) ] for pos in seeds: box.append_subsegmentation_seed_point(pos) # Sub-segment self.run_async_operation(partial(w.run_plugin, 1)) # Should have three boxes self.assertEqual(3, w.model.rowCount()) self.assertTrue(w.model.modified) # Close the document with patch.object(QMessageBox, 'question', return_value=QMessageBox.No): self.assertTrue(self.window.close_document())
def paintEvent(self, pe): # make an arrow polygon right in the middle painter = QPainter(self) painter.setPen(Qt.NoPen) # draw the background transparent rect painter.save() painter.setOpacity(self.BACKGROUND_OPACITY) # get the rectangle coordinates it should extend over the whole width with only a portion at the center painter.setBrush(Qt.black) empty_space_percent = 1 - self.BACKROUND_HEIGHT_PERCENT rect_top = empty_space_percent / 2 * self.height() rect_height = self.BACKROUND_HEIGHT_PERCENT * self.height() painter.drawRect(0, rect_top, self.width(), rect_height) painter.restore() painter.setRenderHint(QPainter.Antialiasing) pen = QPen() pen.setWidth(self.ARROW_LINE_WIDTH) pen.setCapStyle(Qt.RoundCap) if self._mouse_inside: pen.setColor(self._hover_color) else: pen.setColor(self._normal_color) # get the arrow coords painter.setPen(pen) self_center = QPointF(self.width() / 2, self.height() / 2) # use this as the arrow tip for now if self._direction == self.LEFT: h_shift = self._arrow_width elif self._direction == self.RIGHT: h_shift = - self._arrow_width v_shift = self._arrow_height / 2 top_point = self_center + QPointF(h_shift, - v_shift) bottom_point = self_center + QPointF(h_shift, v_shift) painter.drawLine(top_point, self_center) painter.drawLine(self_center, bottom_point)
def calculateArcData(self, startX, startY, midX, midY, endX, endY): """ TOWRITE :param `startX`: TOWRITE :type `startX`: qreal :param `startY`: TOWRITE :type `startY`: qreal :param `midX`: TOWRITE :type `midX`: qreal :param `midY`: TOWRITE :type `midY`: qreal :param `endX`: TOWRITE :type `endX`: qreal :param `endY`: TOWRITE :type `endY`: qreal """ #TODO/PORT# double centerX; #TODO/PORT# double centerY; #TODO/PORT# getArcCenter(startX, startY, #TODO/PORT# midX, midY, #TODO/PORT# endX, endY, #TODO/PORT# ¢erX, ¢erY); arcStartPoint = QPointF(startX - centerX, startY - centerY) arcMidPoint = QPointF(midX - centerX, midY - centerY) arcEndPoint = QPointF(endX - centerX, endY - centerY) self.setPos(centerX, centerY) radius = QLineF(centerX, centerY, midX, midY).length() # qreal self.updateArcRect(radius) self.updatePath() self.setRotation(0) self.setScale(1)
def __init__(self, startX, startY, midX, midY, endX, endY, rgb, parent=None): #OVERLOADED IMPL?# ArcObject::ArcObject(ArcObject* obj, QGraphicsItem* parent) : BaseObject(parent) """ Default class constructor. :param `startX`: TOWRITE :type `startX`: qreal :param `startY`: TOWRITE :type `startY`: qreal :param `midX`: TOWRITE :type `midX`: qreal :param `midY`: TOWRITE :type `midY`: qreal :param `endX`: TOWRITE :type `endX`: qreal :param `endY`: TOWRITE :type `endY`: qreal :param `rgb`: TOWRITE :type `rgb`: QRgb :param `parent`: TOWRITE :type `parent`: `QGraphicsItem`_ """ super(ArcObject, self).__init__(parent) qDebug("ArcObject Constructor()") self.arcStartPoint = QPointF() self.arcMidPoint = QPointF() self.arcEndPoint = QPointF() self.init(startX, startY, midX, midY, endX, endY, rgb, Qt.SolidLine) # TODO: getCurrentLineType
def end_point(self): ''' Compute connection end point - redefined function ''' if self.child.on_the_right: return QPointF(self.child.x(), self.child.y() + self.child.boundingRect().height() / 2) else: return QPointF(self.child.x() + self.child.boundingRect().width(), self.child.y() + self.child.boundingRect().height() / 2)
def simple_arrow(self, origin='head', path=None): ''' Compute the two points of an vertical arrow head ''' if origin == 'head': endp = self.end_point else: endp = self.start_point return (QPointF(endp.x() - 5, endp.y() - 5), QPointF(endp.x() + 5, endp.y() - 5))
def beforeTest(self): points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)] pol = self.scene.addPolygon(QPolygonF(points)) self.assert_(isinstance(pol, QGraphicsPolygonItem)) self.wrp = weakref.ref(pol, pol_del) #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj self.assertEqual(sys.getrefcount(pol), 3)
def _draw_reticle(self): if self._reticle is None or (self._reticle.size() != self.size()): self._new_reticle() dbm_lines = [ QLineF(self._hz_to_x(self._low_frequency), self._dbm_to_y(dbm), self._hz_to_x(self._high_frequency), self._dbm_to_y(dbm)) for dbm in numpy.arange(self._low_dbm, self._high_dbm, 20.0) ] dbm_labels = [ (dbm, QPointF( self._hz_to_x(self._low_frequency) + 2, self._dbm_to_y(dbm) - 2)) for dbm in numpy.arange(self._low_dbm, self._high_dbm, 20.0) ] frequency_lines = [ QLineF(self._hz_to_x(frequency), self._dbm_to_y(self._high_dbm), self._hz_to_x(frequency), self._dbm_to_y(self._low_dbm)) for frequency in numpy.arange(self._low_frequency, self._high_frequency, self._frequency_step * 10.0) ] frequency_labels = [(frequency, QPointF( self._hz_to_x(frequency) + 2, self._dbm_to_y(self._high_dbm) + 10)) for frequency in numpy.arange( self._low_frequency, self._high_frequency, self._frequency_step * 10.0)] painter = QtGui.QPainter(self._reticle) try: painter.setRenderHint(QtGui.QPainter.Antialiasing) painter.setPen(Qt.blue) # TODO: Removed to support old (<1.0) PySide API in Ubuntu 10.10 #painter.drawLines(dbm_lines) for dbm_line in dbm_lines: painter.drawLine(dbm_line) # TODO: Removed to support old (<1.0) PySide API in Ubuntu 10.10 #painter.drawLines(frequency_lines) for frequency_line in frequency_lines: painter.drawLine(frequency_line) painter.setPen(Qt.white) for dbm, point in dbm_labels: painter.drawText(point, '%+.0f' % dbm) for frequency, point in frequency_labels: painter.drawText(point, '%.0f' % (frequency / 1e6)) finally: painter.end()
def get_node_from_pos(self): if self.node_from is None: return QPointF() n1 = self.node_from() if n1 is None: return QPointF() return n1.pos()
def get_node_to_pos(self): if self.node_to is None: return QPointF() n2 = self.node_to() if n2 is None: return QPointF() return n2.pos()
def middle_points(self): ''' Compute connection intermediate points - redefined function ''' # Make sure the connection does not overlap the comment item if (self.child.on_the_right or (not self.child.on_the_right and self.child.x() + self.child.boundingRect().width() < self.parentItem().boundingRect().width())): go_to_point = self.start_point.x() + 5 else: go_to_point = self.end_point.x() + 5 yield QPointF(go_to_point, self.start_point.y()) yield QPointF(go_to_point, self.end_point.y())
def updatePath(self): path = QPainterPath() path.moveTo(self.pos1) dx = self.pos2.x() - self.pos1.x() dy = self.pos2.y() - self.pos1.y() ctr1 = QPointF(self.pos1.x() + dx * 0.25, self.pos1.y() + dy * 0.1) ctr2 = QPointF(self.pos1.x() + dx * 0.75, self.pos1.y() + dy * 0.9) path.cubicTo(ctr1, ctr2, self.pos2) self.setPath(path)
def shape(self): bound = QPainterPath() rotMatrix = QTransform().rotate(self.angle) poly = QPolygonF([ QPointF(0, 0), QPointF(self.w, 0), QPointF(self.w, self.h), QPointF(0, self.h), ]) poly = rotMatrix.map(poly) bound.addPolygon(poly) return bound
def __init__(self, parent): super(QNEConnection, self).__init__(parent) self.setPen(QPen(Qt.black, 2)) self.setBrush(QBrush(Qt.NoBrush)) self.setZValue(-1) self.m_port1 = None self.m_port2 = None self.pos1 = QPointF() self.pos2 = QPointF()
def end_point(self): ''' Compute connection end point - redefined function ''' # Arrow always bumps at the screen edge try: view = self.scene().views()[0] view_pos = view.mapToScene( view.viewport().geometry()).boundingRect().topLeft() scene_pos_x = self.mapFromScene(view_pos).x() return QPointF(scene_pos_x, self.start_point.y()) except (IndexError, AttributeError): # In case there is no view (e.g. Export PNG from cmd line) return QPointF(self.start_point.x() - 250, self.start_point.y())
def __readDiagramInfo(self, diagramNode): dinfo = treenode.DiagramInfo() # read diagram info: if diagramNode is None: return dinfo, -1 if diagramNode.hasAttribute('uid'): uid = int(diagramNode.getAttribute('uid')) else: uid = -1 if diagramNode.hasAttribute('expanded'): val = diagramNode.getAttribute('expanded').lower() if val in ('yes', '1', 'true'): dinfo.expanded = True else: dinfo.expanded = False if diagramNode.hasAttribute('hAuto'): val = diagramNode.getAttribute('hAuto').lower() if val in ('yes', '1', 'true'): dinfo.autopositioning[DisplayRegime.Horizontal].autopos = True else: dinfo.autopositioning[DisplayRegime.Horizontal].autopos = False if diagramNode.hasAttribute('vAuto'): val = diagramNode.getAttribute('vAuto').lower() if val in ('yes', '1', 'true'): dinfo.autopositioning[DisplayRegime.Vertical].autopos = True else: dinfo.autopositioning[DisplayRegime.Vertical].autopos = False hShift = QPointF() if diagramNode.hasAttribute('hx'): hShift.setX(float(diagramNode.getAttribute('hx'))) if diagramNode.hasAttribute('hy'): hShift.setY(float(diagramNode.getAttribute('hy'))) dinfo.autopositioning[DisplayRegime.Horizontal].shift = hShift vShift = QPointF() if diagramNode.hasAttribute('vx'): vShift.setX(float(diagramNode.getAttribute('vx'))) if diagramNode.hasAttribute('vy'): vShift.setY(float(diagramNode.getAttribute('vy'))) dinfo.autopositioning[DisplayRegime.Vertical].shift = vShift if diagramNode.hasAttribute('sceneX'): dinfo.scenePos.setX(float(diagramNode.getAttribute('sceneX'))) if diagramNode.hasAttribute('sceneY'): dinfo.scenePos.setY(float(diagramNode.getAttribute('sceneY'))) return dinfo, uid
def __init__(self, scene): ''' Initialize the game ''' self.scene = scene scene.scene_left.connect(self.quit_scene) self.rocket = Rocket() self.width = self.scene.sceneRect().width() self.height = self.scene.sceneRect().height() self.screen_bottom = self.height - self.rocket.boundingRect().height() scene.addItem(self.rocket) # Compute random land points random.seed() p1 = QPointF(0.0, random.uniform(0.0, self.height)) p2 = QPointF(random.uniform(0.0, self.width / 4.0), random.uniform(0.0, self.height)) p3 = QPointF(random.uniform(p2.x(), 2 * self.width / 3.0), self.height) p4 = QPointF(p3.x() + 40.0, self.height) p5 = QPointF(self.width, random.uniform(0.0, self.height)) path = QPainterPath(p1) slope = (p2.y() - p1.y()) / (p2.x() - p1.x()) sign = 3 for point in range(int((p2.x() - p1.x()) / 5)): sign = -sign x = p1.x() + point * 5 path.lineTo(x, slope * x + sign) path.lineTo(p2) path.lineTo(p3) path.lineTo(p4) path.lineTo(p5) scene.addPath(path) # Initialize the music try: self.music = phonon.Phonon.createPlayer( phonon.Phonon.MusicCategory, phonon.Phonon.MediaSource(':/lander.mp3')) except NameError: LOG.warning('Could not initialise phonon') # Initialize the animation for the translation of the rocket self.animation = QtCore.QPropertyAnimation(self.rocket, "position") self.rocket_position = None # Initialize the animation for the rotation of the rocket self.rotation = QtCore.QPropertyAnimation(self.rocket, "angle") # Catch the key events to add user interaction: self.scene.keyPressEvent = lambda x: self.key(x) # updateCurrentTime is called by Qt when time changes self.animation.updateCurrentTime = lambda x: self.time_progress(x) # Connect signal sent at end of animation self.animation.finished.connect(self.animation_finished)
def paintEvent(self, event): painter = QPainter(self) painter.setBrush(self.brush) painter.setPen(self.pen) painter.setRenderHint(QPainter.Antialiasing) rect = self.geometry() from_point = QPointF(0, rect.height() / 2) to_point = QPointF(rect.width(), rect.height() / 2) # from_point = QPointF(0, 0) # to_point = QPointF(rect.width(), rect.height()) # noinspection PyProtectedMember ClassyEdge._draw_arrow(painter, from_point, to_point, 10)
def _draw_edges(self, painter, topleft_point, bottomright_point): # draw edges if self._edges: for edge in self._edges: edge_coords = edge.coordinates if edge.sort == EdgeSort.BACK_EDGE: # it's a back edge # Honey color = QColor(0xf9, 0xd5, 0x77) elif edge.sort == EdgeSort.TRUE_BRANCH: # True branch # Aqar color = QColor(0x79, 0xcc, 0xcd) elif edge.sort == EdgeSort.FALSE_BRANCH: # False branch # Tomato color = QColor(0xf1, 0x66, 0x64) else: # Dark Gray color = QColor(0x56, 0x5a, 0x5c) pen = QPen(color) pen.setWidth(2) painter.setPen(pen) for from_, to_ in zip(edge_coords, edge_coords[1:]): start_point = QPointF(*from_) end_point = QPointF(*to_) # optimization: don't draw edges that are outside of the current scope if (start_point.x() > bottomright_point.x() or start_point.y() > bottomright_point.y()) and \ (end_point.x() > bottomright_point.x() or end_point.y() > bottomright_point.y()): continue elif (start_point.x() < topleft_point.x() or start_point.y() < topleft_point.y()) and \ (end_point.x() < topleft_point.x() or end_point.y() < topleft_point.y()): continue painter.drawPolyline((start_point, end_point)) # arrow # end_point = self.mapToScene(*edges[-1]) end_point = (edge_coords[-1][0], edge_coords[-1][1]) arrow = [ QPointF(end_point[0] - 3, end_point[1]), QPointF(end_point[0] + 3, end_point[1]), QPointF(end_point[0], end_point[1] + 6) ] brush = QBrush(color) painter.setBrush(brush) painter.drawPolygon(arrow)
def testsquareToQuad(self): q1 = QPolygonF() q1.append(QPointF(10.0, 10.0)) q1.append(QPointF(20.0, 10.0)) q1.append(QPointF(10.0, -10.0)) q1.append(QPointF(20.0, -10.0)) t1 = QTransform() r1 = QTransform.squareToQuad(q1, t1) r2 = QTransform.squareToQuad(q1) self.assertTrue(r1) self.assert_(r2) self.assertEqual(t1, r2)
def mouseReleaseEvent(self, event): if event.button() == Qt.LeftButton: if self.panActive: self.panActive = False if not ENABLE_KINETIC_PANNING or self.lastMoveTime.msecsTo(QTime.currentTime()) > HOLD_TIME_THRESHOLD: return self.kineticPanSpeed = QPointF() entriesConsidered = 0 currentTime = QTime.currentTime() for entry in self.mouseHistory: if not entry.time: continue if entry.time.msecsTo(currentTime) < HOLD_TIME_THRESHOLD: self.kineticPanSpeed += entry.position entriesConsidered += 1 if entriesConsidered > 0: self.kineticPanSpeed /= entriesConsidered self.lastMoveTime = currentTime self.kineticTimer.start() self.panDecellerate = True event.accept()
def __init__(self, parent): super(QNEConnection, self).__init__(parent) self.normalPen = QPen(QApplication.palette().text().color(), 2) self.selectedPen = QPen(QApplication.palette().text().color(), 2, Qt.DashLine) self.setPen(self.normalPen) self.setBrush(QBrush(Qt.NoBrush)) self.setZValue(-1) self.setFlag(QGraphicsItem.ItemIsSelectable) self.m_port1 = None self.m_port2 = None self.pos1 = QPointF() self.pos2 = QPointF()
def __init__(self, x, y, w, h, key_size=50, parent=None): super(KeyboardEditorScene, self).__init__(x, y, w, h, parent=parent) self.dragStartPos = None self.selectedItem = None self.dragItemStartPos = None self.zIncrementer = 0 self.dragging = False self.dragBoxRect = DragBox(QPointF(0.0, 0.0), QPointF(0.0, 0.0)) self.dragBoxRect.hide() self.dragBoxRect.setZValue(5000000) self.addItem(self.dragBoxRect) self.gridActive = True self.keySize = key_size self.snapSize = 0.125
def removePoints(self, listp): print("Remove Points") print("--------------------------------------------------------") print("Entran", len(listp), "polilineas") ####################################################################### poligon_list = [] for poliline in listp: qp = QPolygonF() for p in poliline: qp.append(QPointF(p.x, p.z)) poligon_list.append(qp) print("Hay ", len(poligon_list), "poligonos") resulting_list = recursiP(poligon_list) polylines = [] for element in resulting_list: polyline = [] for pnt in element: punto = SNGPoint2D() punto.x = pnt.x() punto.z = pnt.y() polyline.append(punto) polylines.append(polyline) print("Salen", len(polylines), "polilineas") print("--------------------------------------------------------") return polylines
def gripEdit(self, before, after): """ TOWRITE :param `before`: TOWRITE :type `before`: `QPointF`_ :param `after`: TOWRITE :type `after`: `QPointF`_ """ delta = QPointF(after - before) if before == self.objectTopLeft(): self.setObjectRect(after.x(), after.y(), self.objectWidth() - delta.x(), self.objectHeight() - delta.y()) elif before == self.objectTopRight(): self.setObjectRect(self.objectTopLeft().x(), self.objectTopLeft().y() + delta.y(), self.objectWidth() + delta.x(), self.objectHeight() - delta.y()) elif before == self.objectBottomLeft(): self.setObjectRect(self.objectTopLeft().x() + delta.x(), self.objectTopLeft().y(), self.objectWidth() - delta.x(), self.objectHeight() + delta.y()) elif before == self.objectBottomRight(): self.setObjectRect(self.objectTopLeft().x(), self.objectTopLeft().y(), self.objectWidth() + delta.x(), self.objectHeight() + delta.y())
def __init__(self, mw, parent=None): """ Default class constructor. :param `mw`: Pointer to a application main window instance. :type `mw`: `MainWindow`_ :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ super(MdiArea, self).__init__(parent) self.mainWin = mw self.gSpiralsImgPath = mw.gImgDir + os.sep + 'texture-spirals.png' self.gLogoSpiralsImgPath = mw.gImgDir + os.sep + 'logo-spirals.png' try: #if QT_VERSION >= 0x040800 self.setTabsClosable(True) except AttributeError: pass self.useLogo = False self.useTexture = False self.useColor = False self.bgLogo = QPixmap() self.bgTexture = QPixmap(self.gSpiralsImgPath) self.bgColor = QColor() self.bgLogo = QPixmap(self.gLogoSpiralsImgPath) # Brushes self.colorBrush = QBrush(QColor(EMBROIDERBLUE1)) self.backgroundBrush = QBrush(QPixmap(self.gSpiralsImgPath)) linearGrad = QLinearGradient(QPointF(0, 0), QPointF(400, 400)) linearGrad.setColorAt(0, QColor(EMBROIDERBLUE1)) linearGrad.setColorAt(1, QColor(EMBROIDERBLUE2)) self.gradientBrush = QBrush(linearGrad) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.setActivationOrder(QMdiArea.ActivationHistoryOrder) self.setFocusPolicy(Qt.WheelFocus) self.setFocus() self.setAcceptDrops(True) self.doSetDocumentMode(True)
def paint(self, painter, option, widget=None): """@reimp @public virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) """ #Q_UNUSED(option) #Q_UNUSED(widget) d = self.__d key = d.hash pm = QPixmap() if not QPixmapCache.find(key, pm): # Set up a convenient path path = QPainterPath() path.setFillRule(Qt.OddEvenFill) path.addEllipse(QPointF(d.actualOuterRadius, d.actualOuterRadius), d.actualOuterRadius, d.actualOuterRadius) path.addEllipse(QPointF(d.actualOuterRadius, d.actualOuterRadius), d.actualInnerRadius, d.actualInnerRadius) nActualDiameter = 2.0 * d.actualOuterRadius pm = QPixmap(nActualDiameter, nActualDiameter) pm.fill(Qt.transparent) p = QPainter(pm) # Draw the ring background p.setPen(Qt.NoPen) p.setBrush(d.backgroundColor) p.setRenderHint(QPainter.Antialiasing) p.drawPath(path) # Draw the ring foreground # TODO: Expose this gradient as Qml Property gradient = QConicalGradient(d.actualOuterRadius, d.actualOuterRadius, 0.0) gradient.setColorAt(0.0, Qt.transparent) gradient.setColorAt(0.05, d.foregroundColor) gradient.setColorAt(0.8, Qt.transparent) p.setBrush(gradient) p.drawPath(path) p.end() QPixmapCache.insert(key, pm) # Draw pixmap at center of item w, h = self.width(), self.height() sz = min(w, h) painter.drawPixmap(0.5 * (w - sz), 0.5 * (h - sz), pm)
def objectQuadrant270(self): """ TOWRITE :return: TOWRITE :rtype: `QPointF`_ """ return self.objectCenter() + QPointF(0, self.objectRadius())