-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdifferenceswidget.cpp
More file actions
45 lines (39 loc) · 1.11 KB
/
differenceswidget.cpp
File metadata and controls
45 lines (39 loc) · 1.11 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
38
39
40
41
42
43
44
45
#include "differenceswidget.h"
#include "ui_differenceswidget.h"
#include "change.h"
#include "note.h"
#include "potentialdiffwidget.h"
#include <QDebug>
DifferencesWidget::DifferencesWidget(QWidget *parent) :
QScrollArea(parent),
ui(new Ui::DifferencesWidget)
{
ui->setupUi(this);
//Make container for widgets
central = new QWidget;
diffBox = new QVBoxLayout(central);
//set the scroll container's widget to the container widget
this->setWidget(central);
}
void DifferencesWidget::addDifferences(QVector<Change*> changes, Chapter* chapter)
{
if(!diffBox->isEmpty())
{
for(int i = 0; i < differenceWidgets.size(); i++)
{
diffBox->removeWidget(differenceWidgets.at(i));
delete differenceWidgets.at(i);
}
}
differenceWidgets.clear();
for(int i = 0; i < changes.size(); i++)
{
PotentialDiffWidget* newDiff = new PotentialDiffWidget(0, changes.at(i), chapter);
differenceWidgets.append(newDiff);
diffBox->addWidget(differenceWidgets.at(i));
}
}
DifferencesWidget::~DifferencesWidget()
{
delete ui;
}