コード例 #1
0
 def create_star(cls):
     poly = cls()
     poly.append(core.PointF(1.0, 0.5))
     for i in range(1, 5):
         val = 0.8 * i * math.pi
         point = core.PointF(0.5 + 0.5 * math.cos(val),
                             0.5 + 0.5 * math.sin(val))
         poly.append(point)
     return poly
コード例 #2
0
 def create_diamond(cls):
     points = [
         core.PointF(0.4, 0.5),
         core.PointF(0.5, 0.4),
         core.PointF(0.6, 0.5),
         core.PointF(0.5, 0.6),
         core.PointF(0.4, 0.5),
     ]
     poly = gui.PolygonF()
     poly.add_points(*points)
     return poly
コード例 #3
0
ファイル: graphicsobject.py プロジェクト: phil65/PrettyQt
 def serialize_fields(self):
     return dict(
         enabled=self.isEnabled(),
         opacity=self.opacity(),
         pos=core.PointF(self.pos()),
         # z=self.z(),
         rotation=self.rotation(),
         scale=self.scale(),
         transform_origin_point=core.PointF(self.transformOriginPoint()),
         visible=self.isVisible(),
         graphics_effect=self.graphicsEffect(),
     )
コード例 #4
0
ファイル: scroller.py プロジェクト: phil65/PrettyQt
 def handle_input(
     self, input_type: InputStr, position: types.PointFType, timestamp: int = 0
 ) -> bool:
     if isinstance(position, tuple):
         position = core.PointF(*position)
     if input_type not in INPUT:
         raise InvalidParamError(input_type, INPUT)
     return self.handleInput(INPUT[input_type], position, timestamp)
コード例 #5
0
def test_linef():
    line = core.LineF()
    p1 = core.PointF(0, 0)
    p2 = core.PointF(1, 0)
    line[0] = p1
    line[1] = p2
    assert line[0] == p1
    assert line[1] == p2
    assert line.get_center() == core.PointF(0.5, 0)
    line.get_normal_vector()
    line.get_unit_vector()
    line.to_line()
    line2 = core.LineF(1, 0, 0, 0)
    assert line2 == reversed(line)
    assert abs(line) == 1
    for p in line:
        pass
コード例 #6
0
def test_painterpath():
    path = gui.PainterPath()
    rect = core.RectF(0, 0, 1, 1)
    path.addRect(rect)
    assert len(path) == 5
    assert bool(path)
    assert core.PointF(0.5, 0.5) in path
    path[1] = (0.5, 0.5)
    path.add_rect(QtCore.QRect(0, 0, 1, 1))
コード例 #7
0
 def hit_test(self, point: types.PointFType, fuzzy: bool = False) -> int | None:
     if isinstance(point, tuple):
         point = core.PointF(*point)
     accuracy = (
         QtCore.Qt.HitTestAccuracy.FuzzyHit
         if fuzzy
         else QtCore.Qt.HitTestAccuracy.ExactHit
     )
     result = self.hitTest(point, accuracy)
     if result == -1:
         return None
     return result
コード例 #8
0
 def get_start_center_point(self) -> core.PointF:
     return core.PointF(self.startCenterPoint())
コード例 #9
0
 def get_last_center_point(self) -> core.PointF:
     return core.PointF(self.lastCenterPoint())
コード例 #10
0
 def set_p2(self, point: types.PointFType):
     self.setP2(core.PointF(*point) if isinstance(point, tuple) else point)
コード例 #11
0
ファイル: tapgesture.py プロジェクト: phil65/PrettyQt
 def get_position(self) -> core.PointF:
     return core.PointF(self.position())
コード例 #12
0
 def get_delta(self) -> core.PointF:
     return core.PointF(self.delta())
コード例 #13
0
 def get_final_stop(self) -> core.PointF:
     return core.PointF(self.finalStop())
コード例 #14
0
ファイル: scroller.py プロジェクト: phil65/PrettyQt
 def get_final_position(self) -> core.PointF:
     return core.PointF(self.finalPosition())
コード例 #15
0
 def get_point(self, index: int) -> core.PointF:
     return core.PointF(self.at(index))
コード例 #16
0
 def get_center(self) -> core.PointF:
     return core.PointF(self.center())
コード例 #17
0
 def get_focal_point(self) -> core.PointF:
     return core.PointF(self.focalPoint())
コード例 #18
0
 def get_scroll_position(self) -> core.PointF:
     return core.PointF(self.scrollPosition())
コード例 #19
0
def test_pointf():
    p = core.PointF()
    repr(p)
コード例 #20
0
 def get_p2(self) -> core.PointF:
     return core.PointF(self.p2())
コード例 #21
0
ファイル: scroller.py プロジェクト: phil65/PrettyQt
 def get_velocity(self) -> core.PointF:
     return core.PointF(self.velocity())
コード例 #22
0
 def get_last_offset(self) -> core.PointF:
     return core.PointF(self.lastOffset())
コード例 #23
0
 def __contains__(self, point: types.PointFType) -> bool:
     if isinstance(point, tuple):
         point = core.PointF(*point)
     return self.containsPoint(point, QtCore.Qt.FillRule.OddEvenFill)
コード例 #24
0
ファイル: graphicsvideoitem.py プロジェクト: phil65/PrettyQt
 def get_offset(self) -> core.PointF:
     return core.PointF(self.offset())
コード例 #25
0
 def add_points(self, *points: types.PointFType):
     for p in points:
         if isinstance(p, tuple):
             p = core.PointF(*p)
         self.append(p)
コード例 #26
0
ファイル: vector4d.py プロジェクト: phil65/PrettyQt
 def to_pointf(self) -> core.PointF:
     return core.PointF(self.toPointF())
コード例 #27
0
 def get_start(self) -> core.PointF:
     return core.PointF(self.start())
コード例 #28
0
ファイル: scroller.py プロジェクト: phil65/PrettyQt
 def get_pixel_per_meter(self) -> core.PointF:
     return core.PointF(self.pixelPerMeter())
コード例 #29
0
ファイル: gesture.py プロジェクト: phil65/PrettyQt
 def get_hot_spot(self) -> core.PointF:
     return core.PointF(self.hotSpot())
コード例 #30
0
 def get_p1(self) -> core.PointF:
     return core.PointF(self.p1())