mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
gui/moninj: add scrollbars
This commit is contained in:
parent
d30fe60edd
commit
c63afae875
@ -219,19 +219,20 @@ class _MonInjDock(QtWidgets.QDockWidget):
|
|||||||
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
|
self.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
|
||||||
QtWidgets.QDockWidget.DockWidgetFloatable)
|
QtWidgets.QDockWidget.DockWidgetFloatable)
|
||||||
|
|
||||||
self.grid = QtWidgets.QGridLayout()
|
|
||||||
gridw = QtWidgets.QWidget()
|
|
||||||
gridw.setLayout(self.grid)
|
|
||||||
self.setWidget(gridw)
|
|
||||||
|
|
||||||
def layout_widgets(self, widgets):
|
def layout_widgets(self, widgets):
|
||||||
w = self.grid.itemAt(0)
|
scroll_area = QtWidgets.QScrollArea()
|
||||||
while w is not None:
|
self.setWidget(scroll_area)
|
||||||
self.grid.removeItem(w)
|
|
||||||
w = self.grid.itemAt(0)
|
grid = QtWidgets.QGridLayout()
|
||||||
|
grid_widget = QtWidgets.QWidget()
|
||||||
|
grid_widget.setLayout(grid)
|
||||||
|
|
||||||
for i, (_, w) in enumerate(sorted(widgets, key=itemgetter(0))):
|
for i, (_, w) in enumerate(sorted(widgets, key=itemgetter(0))):
|
||||||
self.grid.addWidget(w, i // 4, i % 4)
|
grid.addWidget(w, i // 4, i % 4)
|
||||||
self.grid.setColumnStretch(i % 4, 1)
|
grid.setColumnStretch(i % 4, 1)
|
||||||
|
|
||||||
|
scroll_area.setWidget(grid_widget)
|
||||||
|
|
||||||
|
|
||||||
class MonInj(TaskObject):
|
class MonInj(TaskObject):
|
||||||
|
Loading…
Reference in New Issue
Block a user