dot_shapes.py
Go to the documentation of this file.
00001 from python_qt_binding.QtCore import QRectF
00002 from python_qt_binding.QtWidgets import QAbstractGraphicsShapeItem
00003 
00004 class QGraphicsBox3dItem(QAbstractGraphicsShapeItem):
00005     def __init__(self, bounding_box):
00006         super(QGraphicsBox3dItem, self).__init__()
00007         self._bounding_box = bounding_box
00008 
00009     def boundingRect(self):
00010         return self._bounding_box
00011 
00012     def paint(self, painter, option, widget):
00013         # Main rectangle
00014         rectangle = QRectF(self._bounding_box.topLeft().x(),
00015                            self._bounding_box.topLeft().y() + self._bounding_box.height() * 0.1,
00016                            self._bounding_box.width() - self._bounding_box.height() * 0.1,
00017                            self._bounding_box.height() - self._bounding_box.height() * 0.1)
00018         painter.drawRect(rectangle)
00019         # Top line
00020         painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1,
00021                          self._bounding_box.topLeft().y(),
00022                          self._bounding_box.topRight().x(),
00023                          self._bounding_box.topRight().y())
00024         # Top left corner
00025         painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1,
00026                          self._bounding_box.topLeft().y(),
00027                          self._bounding_box.topLeft().x() + 1,
00028                          rectangle.topLeft().y())
00029         # Top right corner
00030         painter.drawLine(self._bounding_box.topRight().x(),
00031                          self._bounding_box.topRight().y(),
00032                          rectangle.topRight().x(),
00033                          rectangle.topRight().y())
00034         # Bottom right corner
00035         painter.drawLine(rectangle.bottomRight().x() + 1,
00036                          rectangle.bottomRight().y() - 1,
00037                          self._bounding_box.bottomRight().x(),
00038                          rectangle.bottomRight().y() - self._bounding_box.height() * 0.1)
00039         # Right line
00040         painter.drawLine(self._bounding_box.topRight().x(),
00041                          self._bounding_box.topRight().y(),
00042                          self._bounding_box.topRight().x(),
00043                          self._bounding_box.bottomRight().y() - self._bounding_box.height() * 0.1)


qt_dotgraph
Author(s): Thibault Kruse
autogenerated on Thu Jun 6 2019 18:07:32