工控上位机控制系统通用UI框架
This commit is contained in:
42
wndMain/pageParaSet/sub_uiParaSet.py
Normal file
42
wndMain/pageParaSet/sub_uiParaSet.py
Normal file
@ -0,0 +1,42 @@
|
||||
# 参数设置内嵌页面子类
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from PySide6.QtCore import Slot, Qt
|
||||
from msg_dict import g_uiGeometrySize
|
||||
from wndMain.pageParaSet.uiSub_ParaSet import Ui_pageParaSet
|
||||
|
||||
|
||||
class CSubPageParaSetting(QWidget):
|
||||
# public:
|
||||
def __init__(self, widgetSize: tuple[int, int], parent=None):
|
||||
super().__init__(parent)
|
||||
self.ui = Ui_pageParaSet()
|
||||
self.ui.setupUi(self)
|
||||
# 按需声明对应的成员变量
|
||||
self.szStack = widgetSize
|
||||
pass
|
||||
|
||||
# 界面初始化
|
||||
def uiInit(self) -> None:
|
||||
self._screenAdapter() # 界面自适应
|
||||
self._changeWndStyle() # 设置成无框架边框
|
||||
self._centerWidget() # 居中显示
|
||||
pass
|
||||
|
||||
# ----------------------------------------
|
||||
# private:
|
||||
# 界面自适应
|
||||
def _screenAdapter(self) -> None:
|
||||
self.resize(self.szStack[0], self.szStack[1])
|
||||
self.ui.tabParaSetting.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], g_uiGeometrySize['WND_MARGIN_VERT'],
|
||||
self.szStack[0] - g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
|
||||
self.szStack[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
|
||||
pass
|
||||
|
||||
# 修改窗体属性
|
||||
def _changeWndStyle(self) -> None:
|
||||
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
|
||||
pass
|
||||
|
||||
# 窗口居中显示
|
||||
def _centerWidget(self) -> None:
|
||||
pass
|
||||
Reference in New Issue
Block a user