Skip to content

Commit

Permalink
perf scripts python: exported-sql-viewer.py: Add HBoxLayout and VBoxL…
Browse files Browse the repository at this point in the history
…ayout

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>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Oct 7, 2019
1 parent 181ea40 commit 42c303f
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions tools/perf/scripts/python/exported-sql-viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,20 +980,41 @@ def FindPath(self, query):
ids.insert(0, query.value(1))
return ids

# Vertical widget layout
# Vertical layout

class VBox():
class HBoxLayout(QHBoxLayout):

def __init__(self, w1, w2, w3=None):
self.vbox = QWidget()
self.vbox.setLayout(QVBoxLayout())
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):

self.vbox.layout().setContentsMargins(0, 0, 0, 0)
def __init__(self, *children):
super(VBoxLayout, self).__init__()

self.vbox.layout().addWidget(w1)
self.vbox.layout().addWidget(w2)
if w3:
self.vbox.layout().addWidget(w3)
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, *children):
self.vbox = QWidget()
self.vbox.setLayout(VBoxLayout(*children))

def Widget(self):
return self.vbox
Expand Down

0 comments on commit 42c303f

Please sign in to comment.