diff options
author | Joshua Drake <joshua.ellis.drake@gmail.com> | 2022-11-19 04:04:00 -0600 |
---|---|---|
committer | Joshua Drake <joshua.ellis.drake@gmail.com> | 2022-11-19 04:04:00 -0600 |
commit | 1321168cb22a76df96d747194fcb91863e4e0659 (patch) | |
tree | 772cc08ae6c85bd1a8b527509c3dd88bcc5600dc /mainwindow.cpp | |
parent | 1ed60cd00cd9fdcc45dab1f81e00dd723858a430 (diff) |
Added Wire Class. Program now has some functionality!
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r-- | mainwindow.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 6fb2bf5..44a3a2e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -8,6 +8,12 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); initializeGraphics(); + + connect(&m_wire,&Wire::calculation, [&]() { + ui->lineEditWireGauge->setText(m_wire.gauge()); + ui->lineEditWireWeight->setText(QString::number(m_wire.weight())); + ui->lineEditPeakCurrent->setText(QString::number(m_wire.peakCurrent())); + }); } MainWindow::~MainWindow() @@ -18,12 +24,15 @@ MainWindow::~MainWindow() void MainWindow::on_spinBoxPeakSystemPower_valueChanged(double arg1) { - + m_wire.setPeakSystemPower(arg1); + m_wire.calculate(); + m_battery.setPeakSystemPower(arg1); } void MainWindow :: initializeGraphics() { for(auto entry : batteries)ui->comboBoxBatteryChemistry->addItem(entry.name); + for(auto entry : wireMaterials)ui->comboBoxWireMaterial->addItem(entry); } void MainWindow::on_comboBoxBatteryChemistry_currentIndexChanged(int index) @@ -37,3 +46,23 @@ void MainWindow::on_actionactionSettings_triggered() } +void MainWindow::on_comboBoxWireMaterial_currentIndexChanged(int index) +{ + m_wire.setActiveWireType(index); + m_wire.calculate(); +} + +void MainWindow::on_doubleSpinBoxSystemVoltage_valueChanged(double arg1) +{ + m_wire.setSystemVoltage(arg1); + m_wire.calculate(); + m_battery.setSystemVoltage(arg1); +} + + +void MainWindow::on_doubleSpinBoxEstimatedWireLength_valueChanged(double arg1) +{ + m_wire.setWireLength(arg1); + m_wire.calculate(); +} + |