-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added recursive subgraph parsing, box3d shape, graphics items now imm…
…ediately parented (#87) * Added recursive subgraph parsing, box3d shape, graphics items now immediately parented * Method signature fixes and formatting changes Fix * Removed semicolons; replaced tabs with spaces; added newline to end. * Latest set of minor fixes. * fix condition
- Loading branch information
1 parent
ee8f046
commit 363d837
Showing
4 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from python_qt_binding.QtCore import QRectF | ||
from python_qt_binding.QtWidgets import QAbstractGraphicsShapeItem | ||
|
||
class QGraphicsBox3dItem(QAbstractGraphicsShapeItem): | ||
def __init__(self, bounding_box): | ||
super(QGraphicsBox3dItem, self).__init__() | ||
self._bounding_box = bounding_box | ||
|
||
def boundingRect(self): | ||
return self._bounding_box | ||
|
||
def paint(self, painter, option, widget): | ||
# Main rectangle | ||
rectangle = QRectF(self._bounding_box.topLeft().x(), | ||
self._bounding_box.topLeft().y() + self._bounding_box.height() * 0.1, | ||
self._bounding_box.width() - self._bounding_box.height() * 0.1, | ||
self._bounding_box.height() - self._bounding_box.height() * 0.1) | ||
painter.drawRect(rectangle) | ||
# Top line | ||
painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1, | ||
self._bounding_box.topLeft().y(), | ||
self._bounding_box.topRight().x(), | ||
self._bounding_box.topRight().y()) | ||
# Top left corner | ||
painter.drawLine(rectangle.topLeft().x() + self._bounding_box.height() * 0.1, | ||
self._bounding_box.topLeft().y(), | ||
self._bounding_box.topLeft().x() + 1, | ||
rectangle.topLeft().y()) | ||
# Top right corner | ||
painter.drawLine(self._bounding_box.topRight().x(), | ||
self._bounding_box.topRight().y(), | ||
rectangle.topRight().x(), | ||
rectangle.topRight().y()) | ||
# Bottom right corner | ||
painter.drawLine(rectangle.bottomRight().x() + 1, | ||
rectangle.bottomRight().y() - 1, | ||
self._bounding_box.bottomRight().x(), | ||
rectangle.bottomRight().y() - self._bounding_box.height() * 0.1) | ||
# Right line | ||
painter.drawLine(self._bounding_box.topRight().x(), | ||
self._bounding_box.topRight().y(), | ||
self._bounding_box.topRight().x(), | ||
self._bounding_box.bottomRight().y() - self._bounding_box.height() * 0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters