-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNoBorderScrollArea_example.py
More file actions
39 lines (25 loc) · 1.08 KB
/
NoBorderScrollArea_example.py
File metadata and controls
39 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
from qtpy import QtWidgets
from qtpy.QtWidgets import QPushButton
from eqt.ui.NoBorderScrollArea import NoBorderScrollArea
class MainUI(QtWidgets.QMainWindow):
def __init__(self, parent=None):
"""Any button added after the `NoBorderScrollArea` is instanced will not be styled as
expected, due to the bug in `qdarkstyle`. The method `apply_qdarkstyle_to_buttons` needs
to be invoked."""
QtWidgets.QMainWindow.__init__(self, parent)
layout = QtWidgets.QVBoxLayout()
widg = QtWidgets.QWidget()
widg.setLayout(layout)
layout.addWidget(QPushButton("Test"))
layout.addWidget(QPushButton("Test2"))
self.scroll_area_widget = NoBorderScrollArea(widg)
layout.addWidget(QPushButton("Test3"))
self.scroll_area_widget.apply_qdarkstyle_to_buttons(widg)
layout.addWidget(QPushButton("Test4"))
self.setCentralWidget(self.scroll_area_widget)
self.show()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = MainUI()
sys.exit(app.exec_())