|
|
@ -28,7 +28,7 @@ MainWindow::MainWindow() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::buildUI() { |
|
|
|
void MainWindow::buildUI() { |
|
|
|
setMinimumSize(1000, 400); |
|
|
|
setMinimumSize(1000, 700); |
|
|
|
|
|
|
|
|
|
|
|
auto uiLyt = new QVBoxLayout; |
|
|
|
auto uiLyt = new QVBoxLayout; |
|
|
|
glWidget = new GLWidget(simulation); |
|
|
|
glWidget = new GLWidget(simulation); |
|
|
@ -287,6 +287,9 @@ QWidget * MainWindow::buildAddUI() { |
|
|
|
addBtn->setToolTip("Add configured pendulum"); |
|
|
|
addBtn->setToolTip("Add configured pendulum"); |
|
|
|
removeBtn->setToolTip("Remove all pendula"); |
|
|
|
removeBtn->setToolTip("Remove all pendula"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addBtn->setStyleSheet("background-color: #aaffaa"); |
|
|
|
|
|
|
|
removeBtn->setStyleSheet("background-color: #ffaaaa"); |
|
|
|
|
|
|
|
|
|
|
|
connect(addBtn, &QPushButton::clicked, this, &MainWindow::add); |
|
|
|
connect(addBtn, &QPushButton::clicked, this, &MainWindow::add); |
|
|
|
connect(removeBtn, &QPushButton::clicked, this, &MainWindow::remove); |
|
|
|
connect(removeBtn, &QPushButton::clicked, this, &MainWindow::remove); |
|
|
|
|
|
|
|
|
|
|
@ -341,6 +344,8 @@ QWidget * MainWindow::buildSimulationUI() { |
|
|
|
reset->setToolTip("Reset Simulation controls"); |
|
|
|
reset->setToolTip("Reset Simulation controls"); |
|
|
|
togglePlay->setToolTip("Pause/Resume Simulation"); |
|
|
|
togglePlay->setToolTip("Pause/Resume Simulation"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
togglePlay->setStyleSheet("background-color: #aaaaff"); |
|
|
|
|
|
|
|
|
|
|
|
connect(reset, &QPushButton::clicked, this, &MainWindow::resetSimulationControl); |
|
|
|
connect(reset, &QPushButton::clicked, this, &MainWindow::resetSimulationControl); |
|
|
|
connect(togglePlay, &QPushButton::clicked, this, &MainWindow::toggleSimulation); |
|
|
|
connect(togglePlay, &QPushButton::clicked, this, &MainWindow::toggleSimulation); |
|
|
|
connect(togglePlay, &QPushButton::clicked, [this, togglePlay](){ |
|
|
|
connect(togglePlay, &QPushButton::clicked, [this, togglePlay](){ |
|
|
@ -403,7 +408,7 @@ void MainWindow::add() { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (rainbow){ |
|
|
|
if (rainbow){ |
|
|
|
auto hue = progress + 0.5; |
|
|
|
auto hue = float(progress + 0.5); |
|
|
|
c = QColor::fromHsvF(hue, 1, 1); |
|
|
|
c = QColor::fromHsvF(hue, 1, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
simulation->pendula.push_back(new Pendulum(M, L, c, angle)); |
|
|
|
simulation->pendula.push_back(new Pendulum(M, L, c, angle)); |
|
|
|