初始化窗口和关于窗口的小部件布局调整

在初始化窗口中,标题标签被移除,并用AboutWidget实例替换,以简化界面并提供重新设计的介绍视图。
This commit is contained in:
moyanj 2024-09-14 23:58:11 +08:00
parent 26ceec9fdf
commit 2aa7bccd8d
3 changed files with 17 additions and 8 deletions

View File

@ -27,13 +27,13 @@ class InitWindow(QWidget):
# 初始化布局
self.layout = QVBoxLayout(self)
self.titleLabel = SubtitleLabel('初始化')
# 将组件添加到布局中
self.layout.addWidget(AboutWidget())
self.start_button = PushButton('开始')
self.start_button.clicked.connect(self.run)
self.layout.addWidget(self.start_button)
# 将组件添加到布局中
self.layout.addWidget(self.titleLabel)
self.layout.addWidget(AboutWidget())
# 应用布局
self.setLayout(self.layout)

View File

@ -1,8 +1,17 @@
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QSizePolicy
from PyQt5.QtGui import QPixmap
class AboutWidget(QWidget):
def __init__(self, typex="init"):
super().__init__()
self.base = QVBoxLayout()
self.base.addWidget(QLabel("About"))
self.base = QHBoxLayout()
logo = QPixmap("resources/logo.png")
logo_label = QLabel()
logo_label.setPixmap(logo)
logo_label.setScaledContents(True)
# 自适应图片大小
logo_label.setFixedSize(int(logo_label.height() * 0.4), int(logo_label.height() * 0.4))
# logo_label.setFixedSize(50, 50)
self.base.addWidget(logo_label)
self.setLayout(self.base)

BIN
resources/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB