34 lines
1 KiB
Python
34 lines
1 KiB
Python
import os
|
|
|
|
from PyQt5.QtCore import pyqtSignal
|
|
from PyQt5.QtGui import *
|
|
from PyQt5.QtWidgets import *
|
|
|
|
|
|
class AddListAction(QLabel):
|
|
create_todo_list = pyqtSignal()
|
|
|
|
def __init__(self):
|
|
super(AddListAction, self).__init__()
|
|
self.widget = QWidget(self)
|
|
self.widget.setMaximumHeight(50)
|
|
self.setObjectName('AddListAction')
|
|
layout = QHBoxLayout()
|
|
self.widget.setLayout(layout)
|
|
self.add_image = QLabel()
|
|
|
|
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)
|
|
|
|
# def mousePressEvent(self, QMouseEvent):
|
|
# print('按下QLabel')
|
|
# self.setStyleSheet('background-color:#9f9f9f;')
|
|
|
|
def mouseReleaseEvent(self, QMouseEvent):
|
|
print('释放QLabel')
|
|
self.create_todo_list.emit()
|
|
self.setStyleSheet('background-color:#eaeaea;')
|