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

Add layout classes HBoxLayout and VBoxLayout.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20190821083216.1340-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Adrian Hunter 2019-08-21 11:32:12 +03:00 committed by Arnaldo Carvalho de Melo
parent 181ea40a24
commit 42c303ff9a
1 changed files with 31 additions and 10 deletions

View File

@ -980,20 +980,41 @@ class CallTreeModel(CallGraphModelBase):
ids.insert(0, query.value(1))
return ids
# Vertical widget layout
# Vertical layout
class HBoxLayout(QHBoxLayout):
def __init__(self, *children):
super(HBoxLayout, self).__init__()
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):
def __init__(self, *children):
super(VBoxLayout, self).__init__()
self.layout().setContentsMargins(0, 0, 0, 0)
for child in children:
if child.isWidgetType():
self.layout().addWidget(child)
else:
self.layout().addLayout(child)
# Vertical layout widget
class VBox():
def __init__(self, w1, w2, w3=None):
def __init__(self, *children):
self.vbox = QWidget()
self.vbox.setLayout(QVBoxLayout())
self.vbox.layout().setContentsMargins(0, 0, 0, 0)
self.vbox.layout().addWidget(w1)
self.vbox.layout().addWidget(w2)
if w3:
self.vbox.layout().addWidget(w3)
self.vbox.setLayout(VBoxLayout(*children))
def Widget(self):
return self.vbox