-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualeditor.cpp
More file actions
47 lines (39 loc) · 1.14 KB
/
Copy pathvisualeditor.cpp
File metadata and controls
47 lines (39 loc) · 1.14 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
46
47
#include "visualeditor.h"
#include "ui_visualeditor.h"
/*
* Edits a molecule
*/
VisualEditor::VisualEditor(QWidget *parent, AttributeList *incomingData) : QDialog(parent), ui(new Ui::VisualEditor)
{
//initialize variables
layout = new QVBoxLayout(this);
setLayout(layout);
attributes = incomingData;
fillForm();
ui->setupUi(this);
this->show();
}
VisualEditor::~VisualEditor()
{
delete ui;
}
//fill in form with molecule info
void VisualEditor::fillForm(){
attributes->Display(this, layout, fieldValues);
QPushButton* button = new QPushButton(this);
button->setText("Save");
saveButton = button;
layout->addWidget(button);
}
void VisualEditor::AddField(std::string name, std::string value)
{
QLabel* nameLab = new QLabel(this);
nameLab->setText(QString::fromStdString(name));
QLineEdit* field = new QLineEdit(this);
field->setText(QString::fromStdString(value));
QHBoxLayout* newGroup = new QHBoxLayout;
newGroup->addWidget(nameLab);
newGroup->addWidget(field);
layout->addItem(newGroup);
fieldValues.push_back(value);
}