又是没什么进展的一天!修改“我的一天”头部布局,添加“重要”

This commit is contained in:
liyp 2022-04-13 21:42:41 +08:00
parent f760d0d1a7
commit 4a055e99fd
17 changed files with 96 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 558 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 KiB

After

Width:  |  Height:  |  Size: 79 KiB

BIN
images/10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

BIN
images/11.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

BIN
images/4.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

BIN
images/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
images/6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

BIN
images/7.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

BIN
images/8.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
images/9.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View file

@ -71,6 +71,7 @@ class MainWidget(QWidget):
self.system_listWidget.addItem(self.important_item)
self.system_listWidget.setItemWidget(self.important_item, self.important_item.widget)
# self.system_listWidget.addScrollBarWidget(False)
# 测试添加下面的
# self.two_day = SelfListWidgetItem('我的一天', 1, os.getcwd() + '/../images/sun.svg')

View file

@ -36,6 +36,10 @@ QListWidget::item {
/* border-right: 4px solid rgb(9, 187, 7);*/
}
#todo_list{
min-width:700px;
background-color: rgba(211, 211, 211, 0.5);
}
/*QPushButton {*/
/* max-width: 120px;*/
/* color: white;*/
@ -114,6 +118,8 @@ QLabel#AddListAction::hover{
background: #eaeaea;
/* padding-right:25px;*/
}
/*我的一天专门的*/
QLabel#title {
/* padding-top:20px;*/
font-size:32px;
@ -130,16 +136,19 @@ QLabel#time_label{
/* margin:50px;*/
/* background-color:blanchedalmond;*/
/*}*/
QLabel#head_label{
/* margin: 30px;*/
/*堆栈页面的 通用 头部标题文字*/
QLabel#head_label{
margin-left: 30px;
color:white;
font-weight:bold;
}
#my_day{
background-image:url("../images/2.jpg");
background-position: center;
border-radius: 10px;
padding-top:40px;}
/*#my_day{*/
/* background-image:url("../images/2.jpg");*/
/* background-position: center;*/
/* border-radius: 10px;*/
/* padding-top:40px;}*/
/*QLineEdit {*/
/* border: 2px solid rgb(52,52,52);*/
@ -150,7 +159,8 @@ QLabel#head_label{
/*}*/
/*隐藏按钮右侧的下拉三角*/
QPushButton::menu-indicator{ image:none;}
QMenu {
/* 半透明效果 */
background-color: rgba(255, 255, 255, 230);

14
view/ChangeThemeLabel.py Normal file
View file

@ -0,0 +1,14 @@
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import *
class ChangeTheme(QLabel):
def __init__(self):
super(ChangeTheme, self).__init__()
self.setScaledContents(True)
self.widget = QWidget()
self.label = QLabel('主题')
layout = QVBoxLayout()
layout.addWidget(self.label)
self.widget.setLayout(layout)
self.widget.show()

View file

@ -7,14 +7,9 @@ from PyQt5.QtWidgets import *
class HeadLabel(QLabel):
def __init__(self):
super(HeadLabel, self).__init__()
self.setScaledContents(True)
self.setObjectName('head_label')
layout = QVBoxLayout()
# self.resize(200,100)
# widget = QWidget(self)
# widget.setLayout(layout)
# self.setMinimumHeight(300)
# self.setMinimumWidth(300)
# widget.setMaximumHeight(100)
# 设置当前时间
weekday = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
@ -30,10 +25,11 @@ class HeadLabel(QLabel):
self.font = QFont()
self.font.setPointSize(32)
self.title.setFont(self.font)
# todo: 需要调整布局,修复字体溢出
self.title.setObjectName('title')
# self.title.setObjectName('title')
self.time_label = QLabel(str(month) + '' + str(day) + '日,' + weekday[weekday_index])
self.time_label.setObjectName('time_label')
# self.time_label.setObjectName('time_label')
layout.addWidget(self.title)
layout.addWidget(self.time_label)
self.setLayout(layout)

View file

@ -4,12 +4,15 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
from view.MyDayHeadLabel import HeadLabel
from view.ChangeThemeLabel import ChangeTheme
class MyDay(QWidget):
def __init__(self):
def __init__(self, parent=None):
super(MyDay, self).__init__()
self.setObjectName('my_day')
self.setStyleSheet('#my_day{background-image:url("../images/10.jpg")}')
self.setAttribute(Qt.WA_StyledBackground)
# todo : 使用网格布局设置背景图
# 下面这一句有问题,需要修复修改主题的实现方法
@ -28,10 +31,10 @@ class MyDay(QWidget):
head_widget = QWidget(self)
head_widget.setMaximumHeight(100)
# head_widget.
# head_widget.setObjectName('head_widget')
head_widget.setAttribute(Qt.WA_StyledBackground)
# self.setStyleSheet('#head_widget{margin:50px}')
self.todo_list = QListWidget()
self.todo_list.setObjectName('todo_list')
# head_widget.setPalette(palette)
@ -39,11 +42,9 @@ class MyDay(QWidget):
head_layout.setAlignment(Qt.AlignCenter)
# head_left_layout = QVBoxLayout()
layout.addWidget(head_widget, 2)
layout.addWidget(head_widget, 2, Qt.AlignTop)
head_label = HeadLabel()
layout.addStretch(0)
layout.addWidget(self.todo_list, 6, Qt.AlignCenter | Qt.AlignTop)
head_layout.addWidget(head_label, 8)
self.menu_image = QPushButton()
@ -58,7 +59,43 @@ class MyDay(QWidget):
head_layout.addStretch(1)
self.setLayout(layout)
# todo : 下面的方法实现点击更换主题的功能
def menu_action(self):
pass
# self.menu_image.clicked.connect(self.menu_action)
button_menu = QMenu(self)
# 背景透明
button_menu.setAttribute(Qt.WA_TranslucentBackground)
# 无边框、去掉自带阴影
button_menu.setWindowFlags(
button_menu.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
self.menu_image.setMenu(button_menu)
theme_label = QAction(self)
theme_label.setText('主题')
theme_label.setDisabled(True)
button_menu.addAction(theme_label)
button_menu.addSeparator()
# button_menu
for i in range(11):
label_action = QAction(self)
label_action.setIcon(QIcon('../images/' + str(i) + '.jpg'))
label_action.setText(str(i))
label_action.triggered.connect(lambda: self.menu_action(str(i)))
button_menu.addAction(label_action)
# pass
# todo : 下面的方法实现点击更换主题的功能
def menu_action(self, count):
# 点击按钮
# self.menu_label = ChangeTheme()
self.setStyleSheet('#my_day{background-image:url("../images/3.jpg");'
'background-position: center; border-radius: 10px;'
' padding-top:40px;}')
print('选中:' + count)
# self.palette = QPalette()
# self.palette.setBrush(self.palette.Background, QBrush(QPixmap('../images/' + count + '.png')))
# self.setPalette(self.palette)
pass

View file

@ -36,7 +36,7 @@ class SelfListWidgetItem(QListWidgetItem):
self.item_name_label = QLabel(self.item_name)
# print(self.item_name)
self.item_name_label.setObjectName('item_name_label')
# todo 需要设置qss使字体靠中间一点,如果有气泡使气泡靠右 done
layout.addWidget(self.item_name_label, 3)

7
view/ToDoListItem.py Normal file
View file

@ -0,0 +1,7 @@
from PyQt5.QtWidgets import *
class ToDoListItem(QListWidgetItem):
def __init__(self):
super(ToDoListItem, self).__init__()
self.widget = QWidget()