-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.cpp
88 lines (67 loc) · 2.32 KB
/
MainWindow.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "LinearViscoelasticMaterial.h"
#include <Eigen/Dense>
#include <iostream>
#include <math.h>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
setActionsForTemperatureAndFrequency();
pu = new LinearViscoelasticMaterial();
pu->printData();
connect(ui->actionNewMaterial, &QAction::triggered, this, &MainWindow::loadDlgNewMaterial);
connect(ui->actionAbout, &QAction::triggered, about, &DlgAbout::exec);
// std::cout << "Ep: " << pu->getStorageModulus(20,0.05) << std::endl;
// std::cout << "Epp: " << pu->getLossModulus(20,0.05) << std::endl;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::setActionsForTemperatureAndFrequency()
{
QAction *addTemp,*deleteTemp;
addTemp = new QAction("Add Temperature",this);
deleteTemp = new QAction("Delete Temperature",this);
ui->listWidgetTemp->setContextMenuPolicy(Qt::ActionsContextMenu);
ui->listWidgetTemp->addAction(addTemp);
ui->listWidgetTemp->addAction(deleteTemp);
connect(addTemp, SIGNAL(triggered()), this, SLOT(on_pB_AddTemp_clicked()));
connect(deleteTemp, SIGNAL(triggered()), this, SLOT(on_pB_DeleteTemp_clicked()));
QAction *addFreq,*deleteFreq;
addFreq = new QAction("Add Frequency",this);
deleteFreq = new QAction("Delete Frequency",this);
ui->listWidgetFreq->setContextMenuPolicy(Qt::ActionsContextMenu);
ui->listWidgetFreq->addAction(addFreq);
ui->listWidgetFreq->addAction(deleteFreq);
connect(addFreq, SIGNAL(triggered()), this, SLOT(on_pB_AddTempFreq_clicked()));
connect(deleteFreq, SIGNAL(triggered()), this, SLOT(on_pB_DeleteFreq_clicked()));
}
void MainWindow::loadDlgNewMaterial()
{
newMaterial = new DlgNewMaterial();
newMaterial->exec();
}
void MainWindow::on_pB_AddTemp_clicked()
{
QString temperature;
temperature = ui->lineEditTemp->text();
ui->listWidgetTemp->addItem(temperature);
}
void MainWindow::on_pB_DeleteTemp_clicked()
{
delete ui->listWidgetTemp->currentItem();
}
void MainWindow::on_pB_AddFreq_clicked()
{
QString frequency;
frequency = ui->lineEditFreq->text();
ui->listWidgetFreq->addItem(frequency);
}
void MainWindow::on_pB_DeleteFreq_clicked()
{
delete ui->listWidgetFreq->currentItem();
}