-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCellEditor.cpp
51 lines (37 loc) · 931 Bytes
/
CellEditor.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
/*
* CellEditor.cpp
*
* Created on: 06.08.2008
* Author: asraniel
*/
#include "CellEditor.h"
CellEditor::CellEditor(Simulation *sim) {
simu = sim;
QGridLayout *layout = new QGridLayout();
QPushButton *add = new QPushButton("Add");
connect(add, SIGNAL(clicked()), this, SLOT(add()));
QPushButton *cancel = new QPushButton("Cancel");
connect(cancel, SIGNAL(clicked()), this, SLOT(cancel()));
genome = new QTextEdit();
layout->addWidget(genome,0,0,1,2);
layout->addWidget(add,1,0);
layout->addWidget(cancel,1,1);
setLayout(layout);
}
CellEditor::~CellEditor() {
// TODO Auto-generated destructor stub
}
void CellEditor::add(){
uchar gen[100];
int size = 0;
QString text = genome->toPlainText();
QStringList lines = text.split("\n");
for(int i = 0; i < lines.size();i++){
gen[i] = (uchar)lines.at(i).toInt();
size++;
}
simu->addCell(gen, size);
}
void CellEditor::cancel(){
reject();
}