1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-10 05:30:45 -08:00

Make the list of line checkboxes scrollable.

Copied from Perforce
 Change: 194172
This commit is contained in:
Gareth Rees 2018-06-26 09:59:44 +01:00
parent f62ff53c90
commit 6e27d4f95e

View file

@ -374,17 +374,23 @@ class ApplicationWindow(QtWidgets.QMainWindow):
shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+W"), self)
shortcut.activated.connect(self.close)
layout = QtWidgets.QHBoxLayout(self._main)
main_layout = QtWidgets.QHBoxLayout(self._main)
self._lines_scroll = QtWidgets.QScrollArea()
self._lines_widget = QtWidgets.QWidget()
self._lines_scroll.setWidget(self._lines_widget)
self._lines_scroll.setWidgetResizable(True)
self._lines_scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self._line_checkbox = {}
left_panel = QtWidgets.QVBoxLayout()
layout.addLayout(left_panel)
lines_layout = QtWidgets.QVBoxLayout(self._lines_widget)
self._lines = QtWidgets.QVBoxLayout()
left_panel.addLayout(self._lines)
left_panel.addStretch(1)
lines_layout.addLayout(self._lines)
lines_layout.addStretch(1)
main_layout.addWidget(self._lines_scroll)
canvas = FigureCanvas(Figure(figsize=(10, 6)))
layout.addWidget(canvas)
main_layout.addWidget(canvas)
self.addToolBar(QtCore.Qt.BottomToolBarArea,
NavigationToolbar(canvas, self))
@ -411,6 +417,8 @@ class ApplicationWindow(QtWidgets.QMainWindow):
self._model.needs_redraw()
checkbox.stateChanged.connect(state_changed)
checkbox.setStyleSheet(f"color:{line.color}")
self._lines_scroll.setMinimumWidth(
self._lines_widget.sizeHint().width())
def main():