dot_shapes.py
Go to the documentation of this file.
1 from python_qt_binding.QtCore import QRectF
2 from python_qt_binding.QtWidgets import QAbstractGraphicsShapeItem
3 
4 
5 class QGraphicsBox3dItem(QAbstractGraphicsShapeItem):
6 
7  def __init__(self, bounding_box):
8  super(QGraphicsBox3dItem, self).__init__()
9  self._bounding_box = bounding_box
10 
11  def boundingRect(self):
12  return self._bounding_box
13 
14  def paint(self, painter, option, widget):
15  # Main rectangle
16  rectangle = QRectF(self._bounding_box.topLeft().x(),
17  self._bounding_box.topLeft().y() + self._bounding_box.height() * 0.1,
18  self._bounding_box.width() - self._bounding_box.height() * 0.1,
19  self._bounding_box.height() - self._bounding_box.height() * 0.1)
20  painter.drawRect(rectangle)
21  # Top line
22  painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1,
23  self._bounding_box.topLeft().y(),
24  self._bounding_box.topRight().x(),
25  self._bounding_box.topRight().y())
26  # Top left corner
27  painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1,
28  self._bounding_box.topLeft().y(),
29  self._bounding_box.topLeft().x() + 1,
30  rectangle.topLeft().y())
31  # Top right corner
32  painter.drawLine(self._bounding_box.topRight().x(),
33  self._bounding_box.topRight().y(),
34  rectangle.topRight().x(),
35  rectangle.topRight().y())
36  # Bottom right corner
37  painter.drawLine(rectangle.bottomRight().x() + 1,
38  rectangle.bottomRight().y() - 1,
39  self._bounding_box.bottomRight().x(),
40  rectangle.bottomRight().y() - self._bounding_box.height() * 0.1)
41  # Right line
42  painter.drawLine(self._bounding_box.topRight().x(),
43  self._bounding_box.topRight().y(),
44  self._bounding_box.topRight().x(),
45  self._bounding_box.bottomRight().y() - self._bounding_box.height() * 0.1)
def paint(self, painter, option, widget)
Definition: dot_shapes.py:14
def __init__(self, bounding_box)
Definition: dot_shapes.py:7


qt_dotgraph
Author(s): Thibault Kruse, Dirk Thomas
autogenerated on Fri Jun 24 2022 02:42:36