2022-04-14 21:22:47 +08:00
|
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
|
from PyQt5.QtGui import QPixmap, QIcon
|
|
|
|
|
from PyQt5.QtWidgets import *
|
|
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ToDoItem(QListWidgetItem):
|
2022-04-15 21:33:24 +08:00
|
|
|
|
"""
|
|
|
|
|
:param todo_name : 新建的待办事项名称
|
|
|
|
|
"""
|
|
|
|
|
|
2022-04-14 21:22:47 +08:00
|
|
|
|
def __init__(self, todo_name):
|
|
|
|
|
super(ToDoItem, self).__init__()
|
2022-04-15 21:33:24 +08:00
|
|
|
|
print('添加的新ToDo:' + todo_name)
|
2022-04-14 21:22:47 +08:00
|
|
|
|
|
2022-04-15 21:33:24 +08:00
|
|
|
|
self.widget = QWidget()
|
2022-04-14 21:22:47 +08:00
|
|
|
|
layout = QHBoxLayout()
|
2022-04-15 21:33:24 +08:00
|
|
|
|
|
|
|
|
|
# self.widget.setMinimumHeight(100)
|
|
|
|
|
self.widget.setLayout(layout)
|
|
|
|
|
self.widget.show()
|
2022-04-14 21:22:47 +08:00
|
|
|
|
self.mark_icon = QPushButton()
|
2022-04-15 21:33:24 +08:00
|
|
|
|
self.mark_icon.setObjectName('todo_mark_icon')
|
2022-04-14 21:22:47 +08:00
|
|
|
|
self.mark_icon.setIcon(
|
2022-04-15 21:33:24 +08:00
|
|
|
|
QIcon(QPixmap('../images/circle.svg').scaled(200, 200, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)))
|
2022-04-14 21:22:47 +08:00
|
|
|
|
self.todo_label = QLabel()
|
2022-04-15 21:33:24 +08:00
|
|
|
|
self.todo_label.setAlignment(Qt.AlignCenter)
|
|
|
|
|
if todo_name:
|
2022-04-14 21:22:47 +08:00
|
|
|
|
self.todo_label.setText(str(todo_name))
|
|
|
|
|
self.important_button = QPushButton()
|
2022-04-15 21:33:24 +08:00
|
|
|
|
self.important_button.setIcon(
|
2022-04-14 21:22:47 +08:00
|
|
|
|
QIcon(QPixmap('../images/star_list.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)))
|
2022-04-15 21:33:24 +08:00
|
|
|
|
self.important_button.setObjectName('mark_important')
|
2022-04-14 21:22:47 +08:00
|
|
|
|
layout.addWidget(self.mark_icon, 2)
|
|
|
|
|
layout.addWidget(self.todo_label, 6)
|
2022-04-15 21:33:24 +08:00
|
|
|
|
layout.addWidget(self.important_button, 2)
|