-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWidget.py
58 lines (49 loc) · 1.87 KB
/
MainWidget.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import (QApplication, QHBoxLayout, QSplitter, QWidget, QTableView,
QVBoxLayout,QListView,QPushButton)
from PyQt5.QtCore import Qt,QObject,QEvent
class MainWidget(QWidget):
def __init__(self,parent=None):
super().__init__(parent)
self.LeftLay=QVBoxLayout()
self.LeftLay.setContentsMargins(0,0,0,0)
self.RightLay=QVBoxLayout()
self.RightLay.setContentsMargins(0,0,0,0)
#btn=QPushButton("sdsdsd")
#self.RightLay.setMenuBar(btn)
self.BottomLay=QVBoxLayout()
self.BottomLay.setContentsMargins(0,0,0,0)
self.initUI()
#btn.clicked.connect(self.btncl)
"""def btncl(self):
#QSplitter.sizes()
print(self.sender().parent().parent().sizes())
self.sender().parent().parent().setSizes([1,0])"""
def initUI(self):
mainLayout = QHBoxLayout(self)
LeftWidget=QWidget(self)
RightWidget=QWidget(self)
BottomWidget=QWidget(self)
LeftWidget.setLayout(self.LeftLay)
RightWidget.setLayout(self.RightLay)
BottomWidget.setLayout(self.BottomLay)
self.HSplitter = QSplitter(Qt.Horizontal)
self.HSplitter.addWidget(LeftWidget)
self.HSplitter.addWidget(RightWidget)
self.VSplitter = QSplitter(Qt.Vertical)
self.VSplitter.addWidget(self.HSplitter)
self.VSplitter.addWidget(BottomWidget)
#self.HSplitter.setSizes([300,300])
#self.VSplitter.setSizes([300,500])
mainLayout.addWidget(self.VSplitter)
self.setLayout(mainLayout)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MainWidget()
ex.LeftLay.addWidget(QListView(ex))
ex.RightLay.addWidget(QTableView(ex))
ex.BottomLay.addWidget(QTableView(ex))
ex.show()
sys.exit(app.exec_())