-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdataitem.cpp
More file actions
32 lines (24 loc) · 936 Bytes
/
Copy pathdataitem.cpp
File metadata and controls
32 lines (24 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "dataitem.h"
DataItemWidget::DataItemWidget(int id, int cid, int price, const QDate &date,
const QString &description,
const QString &categoryName, QWidget *parent)
: id(id), cid(cid), categoryName(categoryName), price(price), date(date),
description(description), QWidget{parent} {
layout = new QHBoxLayout(this);
dateLabel = new QLabel(date.toString("yyyy-MM-dd"), this);
layout->addWidget(dateLabel);
categoryLabel = new QLabel(categoryName, this);
layout->addWidget(categoryLabel);
layout->addStretch();
priceLabel = new QLabel(QString::number(price), this);
layout->addWidget(priceLabel);
deleteButtom = new QPushButton(QString("删除"), this);
layout->addWidget(deleteButtom);
setLayout(layout);
}
DataItemWidget::~DataItemWidget() {
delete layout;
delete categoryLabel;
delete priceLabel;
delete dateLabel;
}