Skip to content
Snippets Groups Projects
Commit ca7e23db authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Qt: Tree show opening brackets

parent fd29ce17
Branches
No related tags found
No related merge requests found
......@@ -399,7 +399,7 @@ def qt_main():
def __init__(self, t, workspace_widget, is_root, parent=None):
super().__init__(t, workspace_widget, is_root, parent)
self._hlay = no_space(QHBoxLayout(self))
self._head = QLabel(self)
self._head = QLabelOpeningBracket(self)
self._list = no_space(QVBoxLayout())
self.setAutoFillBackground(True)
......
......@@ -339,3 +339,20 @@ def key_to_str(key, mod):
if mod & Qt.ShiftModifier != 0:
c.upper()
return c
class QLabelOpeningBracket(QLabel):
@qtoverride
def paintEvent(self, event):
super().paintEvent(event)
painter = QPainter(self)
x = self.width()
y = self.height()
line_x = x//3
text_h = 12
padding = 3
if y > text_h + 2*padding:
painter.drawLine(line_x, padding, x-2, padding)
painter.drawLine(line_x, padding, line_x, y//2-text_h//2)
painter.drawLine(line_x, y-1-padding, line_x, y//2+text_h//2)
painter.drawLine(line_x, y-1-padding, x-2, y-1-padding)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment