diff --git a/images/circle.svg b/images/circle.svg
index 521e25b..b275b84 100644
--- a/images/circle.svg
+++ b/images/circle.svg
@@ -1,12 +1 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/resource/current.qss b/resource/current.qss
index 4139db3..efc93b2 100644
--- a/resource/current.qss
+++ b/resource/current.qss
@@ -40,11 +40,33 @@ QListWidget::item {
#todo_list{
min-width:700px;
+ min-height:650px;
+ border-top-left-radius:3px;
+ border-top-right-radius:3px;
+ border-bottom-left-radius:3px;
+ border-bottom-right-radius:3px;
background-color: rgba(211, 211, 211, 0.5);
}
-#add_todo_label{
+QLabel#add_todo_label{
width:500px;
+ max-height:60px;
+ border-top-left-radius:3px;
+ border-top-right-radius:3px;
+ border-bottom-left-radius:3px;
+ border-bottom-right-radius:3px;
+ background-color: rgba(211, 211, 211, 0.5);
+}
+QLineEdit#add_line_edit {
+ border: none;
+ background:transparent;
+/* border-top-left-radius:3px;*/
+/* border-top-right-radius:3px;*/
+/* border-bottom-left-radius:3px;*/
+/* border-bottom-right-radius:3px;*/
+ min-width:700px;
+/* height:60px;*/
+
}
/*QPushButton {*/
/* max-width: 120px;*/
@@ -156,14 +178,7 @@ QLabel#head_label{
/* border-radius: 10px;*/
/* padding-top:40px;}*/
-/*QLineEdit {*/
-/* border: 2px solid rgb(52,52,52);*/
-/* border-top-left-radius:10px; */
-/* border-top-right-radius:10px;*/
-/* border-bottom-left-radius:10px;*/
-/* border-bottom-right-radius:10px;*/
-/*}*/
/*隐藏按钮右侧的下拉三角*/
QPushButton::menu-indicator{ image:none;}
diff --git a/view/AddToDoLabel.py b/view/AddToDoLabel.py
index c8f3918..88bae57 100644
--- a/view/AddToDoLabel.py
+++ b/view/AddToDoLabel.py
@@ -1,27 +1,54 @@
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
-from PyQt5.QtCore import Qt
+from PyQt5.QtCore import Qt, pyqtSignal
class AddToDoAction(QLabel):
+ # 发送创建的ToDo名字
+ todo_name = pyqtSignal(str)
+
def __init__(self):
super(AddToDoAction, self).__init__()
self.setObjectName('add_todo_label')
# widget = QWidget(self)
- # widget.setMinimumWidth(500)
+ self.setMinimumWidth(700)
layout = QHBoxLayout()
# widget.setLayout(layout)
- icon = QLabel()
- icon.setPixmap(QPixmap('../images/circle.svg').scaled(50,50))
- self.line_edit=QLineEdit()
+ icon = QPixmap('../images/circle.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
+ self.icon_label = QLabel()
+ self.icon_label.setPixmap(icon)
+ self.icon_label.setMaximumSize(30, 30)
+ self.icon_label.setScaledContents(True)
+ # icon_label.resize(icon.width(), icon.height())
+ self.line_edit = QLineEdit()
+ # self.line_edit.setMinimumHeight(50)
+ # self.line_edit.clicked.connect(self.line_edit_action)
+ self.line_edit.setObjectName('add_line_edit')
self.line_edit.setPlaceholderText('添加任务')
+ self.line_edit.returnPressed.connect(lambda: self.line_edit_add(self.line_edit.text()))
+ # self.line_edit.se
+ # self.line_edit.setEnabled(False)
+ # self.line_edit.
+ # todo : QLineEdit点击事件
+ # self.line_edit.setAlignment(Qt.AlignLeft)
- layout.addWidget(icon, 1, Qt.AlignLeft)
- layout.addWidget(self.line_edit,6,Qt.AlignCenter)
+ layout.addWidget(self.icon_label, 1, Qt.AlignLeft)
+ layout.addWidget(self.line_edit, 6, Qt.AlignLeft)
+ layout.addStretch(1)
self.setScaledContents(True)
# self.sizeHint()
self.setLayout(layout)
+ self.show()
+
+ # def line_edit_action(self):
+ # print('click left button')
+
+ # todo : 回车添加事件
+ def line_edit_add(self, name):
+ self.todo_name.emit(name)
+ print(name)
+ self.line_edit.clear()
# widget.show()
diff --git a/view/LineEdit.py b/view/LineEdit.py
new file mode 100644
index 0000000..5622b58
--- /dev/null
+++ b/view/LineEdit.py
@@ -0,0 +1,24 @@
+from PyQt5.QtWidgets import *
+from PyQt5.QtCore import Qt, pyqtSignal
+from PyQt5.QtGui import *
+
+
+class LineEdit(QLineEdit):
+ clicked = pyqtSignal()
+
+ def __init__(self):
+ super(LineEdit, self).__init__()
+ # layout = QHBoxLayout()
+ # self.setLayout(layout)
+ # icon = QPixmap('../images/circle.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
+ # icon_label = QLabel()
+ # icon_label.setPixmap(icon)
+ # icon_label.setMaximumSize(30, 30)
+ # icon_label.setScaledContents(True)
+ # layout.addWidget(icon_label)
+
+ def mousePressEvent(self, QMouseEvent):
+ # print('click left button')
+ if QMouseEvent.button() == Qt.LeftButton:
+ # self.setEnabled(False)
+ self.clicked.emit()
diff --git a/view/MyDayView.py b/view/MyDayView.py
index cfb7586..07dc9a3 100644
--- a/view/MyDayView.py
+++ b/view/MyDayView.py
@@ -1,12 +1,10 @@
import os
-import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
from view.AddToDoLabel import AddToDoAction
from view.MyDayHeadLabel import HeadLabel
-from view.ChangeThemeLabel import ChangeTheme
class MyDay(QWidget):
@@ -28,7 +26,7 @@ class MyDay(QWidget):
# 布局样式:继承QWidget,里面一个垂直布局,最上面一个QWidget用来设置头部布局
# 头部QWidget里面一个水平布局,水平布局里面一个QWidget(方便设置整体位置),然后是一个
layout = QVBoxLayout() # 总布局
- head_layout = QHBoxLayout() # 头部总布局
+ head_layout = QHBoxLayout() # 头部总布局
head_widget = QWidget(self)
head_widget.setMinimumHeight(175)
@@ -39,8 +37,10 @@ class MyDay(QWidget):
self.todo_list = QListWidget()
self.todo_list.setObjectName('todo_list')
+ # 添加ToDo的标签
self.add_todo = AddToDoAction()
- self.add_todo.setAlignment(Qt.AlignBottom)
+ self.add_todo.setAlignment(Qt.AlignCenter)
+ self.add_todo.todo_name.connect(self.add_todo_action)
# head_widget.setPalette(palette)
@@ -61,8 +61,7 @@ class MyDay(QWidget):
# self.menu_image.setScaledContents(True)
pic_btn = QPixmap(os.getcwd() + "/../images/menu.png")
self.menu_image.setIcon(QIcon(pic_btn))
- # self.menu_image.setFixedSize(QPixmap(os.getcwd() + "/../images/menu.png").size())
- # head_layout.addLayout(head_left_layout)
+
head_layout.addWidget(self.menu_image, 2)
head_layout.addStretch(1)
@@ -83,7 +82,7 @@ class MyDay(QWidget):
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'))
@@ -97,15 +96,15 @@ class MyDay(QWidget):
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:170px;}')
+ '}')
self.head_label.show()
print('选中:' + count)
- # self.palette = QPalette()
- # self.palette.setBrush(self.palette.Background, QBrush(QPixmap('../images/' + count + '.png')))
- # self.setPalette(self.palette)
- pass
+
+
+ def add_todo_action(self, name):
+ print(name)
diff --git a/view/StackListItem.py b/view/StackListItem.py
deleted file mode 100644
index e69de29..0000000
diff --git a/view/ToDoItem.py b/view/ToDoItem.py
new file mode 100644
index 0000000..59795dd
--- /dev/null
+++ b/view/ToDoItem.py
@@ -0,0 +1,27 @@
+from PyQt5.QtCore import Qt
+from PyQt5.QtGui import QPixmap, QIcon
+from PyQt5.QtWidgets import *
+from PyQt5.QtCore import Qt
+
+
+class ToDoItem(QListWidgetItem):
+ def __init__(self, todo_name):
+ super(ToDoItem, self).__init__()
+
+ widget = QWidget(self)
+ layout = QHBoxLayout()
+ widget.setLayout(layout)
+ widget.show()
+ self.mark_icon = QPushButton()
+ self.mark_icon.setIcon(
+ QIcon(QPixmap('../images/circle.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)))
+ self.todo_label = QLabel()
+ if not todo_name:
+ self.todo_label.setText(str(todo_name))
+ self.important_button = QPushButton()
+ self.mark_icon.setIcon(
+ QIcon(QPixmap('../images/star_list.svg').scaled(30, 30, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)))
+
+ layout.addWidget(self.mark_icon, 2)
+ layout.addWidget(self.todo_label, 6)
+ layout.addWidget(self.important_button,2)