2022-04-07 19:34:28 +08:00
|
|
|
import os
|
2022-04-19 20:18:10 +08:00
|
|
|
from PyQt5.QtCore import pyqtSignal, Qt
|
2022-04-04 22:34:07 +08:00
|
|
|
from PyQt5.QtGui import *
|
|
|
|
from PyQt5.QtWidgets import *
|
|
|
|
|
|
|
|
|
2022-04-07 19:34:28 +08:00
|
|
|
class AddListAction(QLabel):
|
2022-04-16 21:45:29 +08:00
|
|
|
create_todo_list = pyqtSignal()
|
|
|
|
|
2022-04-04 22:34:07 +08:00
|
|
|
def __init__(self):
|
2022-04-07 19:34:28 +08:00
|
|
|
super(AddListAction, self).__init__()
|
2022-04-04 22:34:07 +08:00
|
|
|
self.widget = QWidget(self)
|
2022-04-07 19:34:28 +08:00
|
|
|
self.widget.setMaximumHeight(50)
|
|
|
|
self.setObjectName('AddListAction')
|
|
|
|
layout = QHBoxLayout()
|
|
|
|
self.widget.setLayout(layout)
|
|
|
|
self.add_image = QLabel()
|
2022-04-12 21:34:18 +08:00
|
|
|
|
2022-04-07 19:34:28 +08:00
|
|
|
self.add_image.setPixmap(QPixmap(os.getcwd() + '/../images/add.png'))
|
|
|
|
# self.add_image.setObjectName('pic_label')
|
|
|
|
|
|
|
|
self.add_text = QLabel("新建列表")
|
|
|
|
layout.addWidget(self.add_image, 3)
|
|
|
|
layout.addWidget(self.add_text, 4)
|
2022-04-14 16:19:59 +08:00
|
|
|
|
2022-04-19 20:18:10 +08:00
|
|
|
def mousePressEvent(self, QMouseEvent):
|
|
|
|
if QMouseEvent.buttons() == Qt.LeftButton:
|
2022-04-30 22:17:00 +08:00
|
|
|
# print('点击QLabel')
|
2022-04-19 20:18:10 +08:00
|
|
|
|
|
|
|
self.create_todo_list.emit()
|
|
|
|
self.setStyleSheet('background-color:#eaeaea;')
|
2022-04-14 16:19:59 +08:00
|
|
|
|
2022-04-19 20:18:10 +08:00
|
|
|
# def mouseReleaseEvent(self, QMouseEvent):
|
|
|
|
# if QMouseEvent.buttons == Qt.LeftButton:
|
|
|
|
# print('点击QLabel')
|
|
|
|
# self.create_todo_list.emit()
|
|
|
|
# self.setStyleSheet('background-color:#eaeaea;')
|