| 22 | class Window(QTextEdit): |
| 23 | |
| 24 | def __init__(self, parent=None): |
| 25 | super(Window, self).__init__(parent) |
| 26 | self.resize(800, 600) |
| 27 | # 设置横向纵向滚动条总是显示 |
| 28 | self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) |
| 29 | self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) |
| 30 | with open("Data/ScrollBar.qss", "rb") as fp: |
| 31 | content = fp.read() |
| 32 | encoding = chardet.detect(content) or {} |
| 33 | content = content.decode(encoding.get("encoding") or "utf-8") |
| 34 | self.setText(content) |
| 35 | # 设置样式 |
| 36 | self.setStyleSheet(content) |
| 37 | |
| 38 | |
| 39 | if __name__ == "__main__": |