Commit 42c303ff authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf scripts python: exported-sql-viewer.py: Add HBoxLayout and VBoxLayout

Add layout classes HBoxLayout and VBoxLayout.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20190821083216.1340-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 181ea40a
...@@ -980,20 +980,41 @@ class CallTreeModel(CallGraphModelBase): ...@@ -980,20 +980,41 @@ class CallTreeModel(CallGraphModelBase):
ids.insert(0, query.value(1)) ids.insert(0, query.value(1))
return ids return ids
# Vertical widget layout # Vertical layout
class VBox(): class HBoxLayout(QHBoxLayout):
def __init__(self, w1, w2, w3=None): def __init__(self, *children):
self.vbox = QWidget() super(HBoxLayout, self).__init__()
self.vbox.setLayout(QVBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
for child in children:
if child.isWidgetType():
self.layout().addWidget(child)
else:
self.layout().addLayout(child)
# Horizontal layout
class VBoxLayout(QVBoxLayout):
self.vbox.layout().setContentsMargins(0, 0, 0, 0) def __init__(self, *children):
super(VBoxLayout, self).__init__()
self.vbox.layout().addWidget(w1) self.layout().setContentsMargins(0, 0, 0, 0)
self.vbox.layout().addWidget(w2) for child in children:
if w3: if child.isWidgetType():
self.vbox.layout().addWidget(w3) self.layout().addWidget(child)
else:
self.layout().addLayout(child)
# Vertical layout widget
class VBox():
def __init__(self, *children):
self.vbox = QWidget()
self.vbox.setLayout(VBoxLayout(*children))
def Widget(self): def Widget(self):
return self.vbox return self.vbox
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment