-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpitem.cpp
64 lines (57 loc) · 1.84 KB
/
pitem.cpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "pitem.h"
#include "mainwindow.h"
QHBoxLayout * mainLay;
QLineEdit * label;
QLabel * number;
QToolButton * copy, * del;
Polynomial * pol_g;
DataBase * db_l;
PItem::PItem(QWidget *parent, Polynomial * pol, DataBase * datab, int num) : QWidget(parent)
{
db_l = datab;
mainLay = new QHBoxLayout();
pol_g = pol;
this->setLayout(mainLay);
label = new QLineEdit(QString::fromStdString(pol->str()));
label->setReadOnly(true);
number = new QLabel(QString::number(num) + ".");
number->setFont(QFont("Helvetica", 20));
label->setFont(QFont("Helvetica", 20));
number->setStyleSheet("QLabel {"
"color: white;"
"}");
label->setStyleSheet("QLabel {"
"color: white;"
"}");
mainLay->addWidget(number, Qt::AlignLeft);
mainLay->addWidget(label, Qt::AlignLeft);
label->setFixedSize(QSize(250, 40));
number->setFixedSize(QSize(30, 35));
// copy = new QToolButton();
del = new QToolButton();
QIcon * ico_copy = new QIcon();
ico_copy->addPixmap(QPixmap(":/images/copy.png"));
// copy->setIcon(*ico_copy);
QIcon * ico_del = new QIcon();
ico_del->addPixmap(QPixmap(":/images/trash.png"));
del->setIcon(*ico_del);
// mainLay->addWidget(copy, Qt::AlignRight);
mainLay->addWidget(del, Qt::AlignRight);
// copy->setFixedSize(QSize(20, 20));
del->setFixedSize(QSize(20, 20));
this->setFixedSize(QSize(400, 45));
del->setProperty("n", num);
connect(del, SIGNAL (clicked()),this, SLOT(deleteClicked()));
}
void PItem::deleteClicked() {
QToolButton * btn = ((QToolButton *)sender());
db_l->remove(btn->property("n").toInt());
refresh_database();
}
PItem::~PItem() {
// delete label;
// delete number;
// delete copy;
// delete del;
// delete mainLay;
}