pyqt-todolist/view/AddToDoLabel.py

27 lines
788 B
Python

from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
class AddToDoAction(QLabel):
def __init__(self):
super(AddToDoAction, self).__init__()
self.setObjectName('add_todo_label')
# widget = QWidget(self)
# widget.setMinimumWidth(500)
layout = QHBoxLayout()
# widget.setLayout(layout)
icon = QLabel()
icon.setPixmap(QPixmap('../images/circle.svg').scaled(50,50))
self.line_edit=QLineEdit()
self.line_edit.setPlaceholderText('添加任务')
layout.addWidget(icon, 1, Qt.AlignLeft)
layout.addWidget(self.line_edit,6,Qt.AlignCenter)
self.setScaledContents(True)
# self.sizeHint()
self.setLayout(layout)
# widget.show()