-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
如题,实测加上 self.layerMain().setPage(1) 后虽然可以跳转到第 2 个页面,但没有在侧边栏上显示选中第 2 个页面。
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from siui.components.page import SiPage
from siui.components.widgets import *
from siui.templates.application.application import SiliconApplication
class HomePage(SiPage):
"""主页"""
def __init__(self, parent, x):
super().__init__(parent)
self.label = SiLabel(x, self)
class MainWindow(SiliconApplication):
"""程序主窗口"""
def __init__(self):
super().__init__(None)
self.setFixedSize(1200, 700)
lm = self.layerMain()
lm.addPage(HomePage(self, '1'), icon=SiGlobal.siui.iconpack.get('ic_fluent_home_filled'), hint='主页')
lm.addPage(HomePage(self, '2'), icon=SiGlobal.siui.iconpack.get('ic_fluent_home_filled'), hint='主页2')
lm.setPage(1) # 设置为第 0 个页面(主页)
SiGlobal.siui.reloadAllWindowsStyleSheet() # 应用窗口样式
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()
环境为Windows11.
Metadata
Metadata
Assignees
Labels
No labels