-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistviewitem.cpp
More file actions
38 lines (33 loc) · 1.05 KB
/
listviewitem.cpp
File metadata and controls
38 lines (33 loc) · 1.05 KB
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
#include "listviewitem.h"
ListViewItem::ListViewItem(QWidget *parent,int ID,std::vector<int> neightboors,int size): QWidget(parent)
{
Q_UNUSED(size);
this->ID=ID;
myLayout=new QHBoxLayout(this);
this->setLayout(myLayout);
myLayout->addWidget(new QLabel(QString::number(ID+1)+"=>",this));
for(unsigned i=0;i<neightboors.size();i++){
listViewRemoveButton * label=new listViewRemoveButton(this,neightboors[i]);
connect(label,SIGNAL(remove(int)),this,SLOT(removeRequest(int)));
myLayout->addWidget(label);
if(i<(neightboors.size()-1)){
myLayout->addWidget(new QLabel(":",this));
}
}
myLayout->addSpacerItem(new QSpacerItem(1,1, QSizePolicy::Expanding, QSizePolicy::Fixed));
}
void ListViewItem::removeRequest(int id){
emit remove(id,ID);
}
ListViewItem::~ListViewItem(){
QLayoutItem *wItem;
while (true){
wItem =myLayout->takeAt(0);
if(wItem==NULL){
break;
}
delete wItem->widget();
delete wItem;
}
delete myLayout;
}