add icons for buttons

main
Benjamin Kraft 1 year ago
parent 2c1d9b12c7
commit ab8397d301
  1. 2
      CMakeLists.txt
  2. 1
      icons/add.svg
  3. 1
      icons/compress.svg
  4. 1
      icons/delete.svg
  5. 10
      icons/icons.qrc
  6. 1
      icons/pause.svg
  7. 1
      icons/play.svg
  8. 1
      icons/refresh.svg
  9. 11
      src/MainWindow.cpp

@ -10,7 +10,7 @@ find_package(Qt6 COMPONENTS OpenGLWidgets REQUIRED)
find_package(Eigen3 REQUIRED) find_package(Eigen3 REQUIRED)
file(GLOB_RECURSE SOURCE_FILES src/**.cpp) file(GLOB_RECURSE SOURCE_FILES src/**.cpp)
add_executable(Pendulum WIN32 ${SOURCE_FILES}) add_executable(Pendulum WIN32 ${SOURCE_FILES} icons/icons.qrc)
include_directories(${EIGEN3_INCLUDE_DIR}) include_directories(${EIGEN3_INCLUDE_DIR})

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M450.001-450.001h-230v-59.998h230v-230h59.998v230h230v59.998h-230v230h-59.998v-230Z"/></svg>

After

Width:  |  Height:  |  Size: 189 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M180.001-424.617v-59.999h599.998v59.999H180.001Zm0-115.384V-600h599.998v59.999H180.001Zm270 440v-146.463l-74.001 74-42.153-42.152L480-360.769l146.153 146.153L584-172.464l-74.001-72.77v145.233h-59.998ZM480-663.848 333.847-810.001 376-852.154l74.001 74.001v-146.463h59.998v146.463L584-852.154l42.153 42.153L480-663.848Z"/></svg>

After

Width:  |  Height:  |  Size: 423 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m376-327.692 104-104 104 104L612.308-356l-104-104 104-104L584-592.308l-104 104-104-104L347.692-564l104 104-104 104L376-327.692ZM304.615-160Q277-160 258.5-178.5 240-197 240-224.615V-720h-40v-40h160v-30.77h240V-760h160v40h-40v495.385Q720-197 701.5-178.5 683-160 655.385-160h-350.77ZM680-720H280v495.385q0 9.23 7.692 16.923Q295.385-200 304.615-200h350.77q9.23 0 16.923-7.692Q680-215.385 680-224.615V-720Zm-400 0v520-520Z"/></svg>

After

Width:  |  Height:  |  Size: 523 B

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/icons">
<file>add.svg</file>
<file>compress.svg</file>
<file>delete.svg</file>
<file>pause.svg</file>
<file>play.svg</file>
<file>refresh.svg</file>
</qresource>
</RCC>

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M531.616-226.463v-507.074h201.921v507.074H531.616Zm-305.153 0v-507.074h201.921v507.074H226.463Zm361.113-55.96h90.001v-395.154h-90.001v395.154Zm-305.153 0h90.001v-395.154h-90.001v395.154Zm0-395.154v395.154-395.154Zm305.153 0v395.154-395.154Z"/></svg>

After

Width:  |  Height:  |  Size: 346 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M345.655-245.041v-469.918L714.19-480 345.655-245.041ZM401.615-480Zm0 132.385L609.962-480 401.615-612.385v264.77Z"/></svg>

After

Width:  |  Height:  |  Size: 218 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M482.013-187.271q-123.018 0-208.265-85.065-85.247-85.066-85.247-207.634 0-122.568 85.247-207.664 85.247-85.095 208.291-85.095 69.654 0 131.461 31.038 61.808 31.039 102.231 88.193v-119.231h55.96v235.728H535.963v-55.96h153.96q-31.34-57.649-86.798-90.729-55.459-33.079-121.047-33.079-98.924 0-168.27 69.156t-69.346 167.731q0 98.574 69.221 167.613 69.221 69.038 168.29 69.038 75.906 0 137.024-43.192 61.119-43.192 85.883-114.385h59.119q-26.423 95.307-104.688 154.422-78.266 59.115-177.298 59.115Z"/></svg>

After

Width:  |  Height:  |  Size: 598 B

@ -134,6 +134,10 @@ QWidget * MainWindow::buildAddUI() {
auto normalizeLengthsBtn = new QPushButton("Normalize"); auto normalizeLengthsBtn = new QPushButton("Normalize");
auto resetLengthsBtn = new QPushButton("Reset"); auto resetLengthsBtn = new QPushButton("Reset");
resetMassesBtn->setIcon(QIcon(":/icons/refresh.svg"));
normalizeLengthsBtn->setIcon(QIcon(":/icons/compress.svg"));
resetLengthsBtn->setIcon(QIcon(":/icons/refresh.svg"));
connect(resetMassesBtn, &QPushButton::clicked, this, &MainWindow::resetMasses); connect(resetMassesBtn, &QPushButton::clicked, this, &MainWindow::resetMasses);
connect(normalizeLengthsBtn, &QPushButton::clicked, this, &MainWindow::normalizeLengths); connect(normalizeLengthsBtn, &QPushButton::clicked, this, &MainWindow::normalizeLengths);
connect(resetLengthsBtn, &QPushButton::clicked, this, &MainWindow::resetLengths); connect(resetLengthsBtn, &QPushButton::clicked, this, &MainWindow::resetLengths);
@ -278,7 +282,9 @@ QWidget * MainWindow::buildAddUI() {
lyt->addLayout(btnLyt); lyt->addLayout(btnLyt);
auto addBtn = new QPushButton("Add"); auto addBtn = new QPushButton("Add");
auto removeBtn = new QPushButton("Remove"); auto removeBtn = new QPushButton("Remove all");
addBtn->setIcon(QIcon(":/icons/add.svg"));
removeBtn->setIcon(QIcon(":/icons/delete.svg"));
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);
@ -330,10 +336,13 @@ QWidget * MainWindow::buildSimulationUI() {
auto reset = new QPushButton("Reset"); auto reset = new QPushButton("Reset");
auto togglePlay = new QPushButton("Resume"); auto togglePlay = new QPushButton("Resume");
reset->setIcon(QIcon(":/icons/refresh.svg"));
togglePlay->setIcon(QIcon(":/icons/play.svg"));
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](){
togglePlay->setIcon(QIcon(QString(":/icons/") + (simulation->isPlaying ? "pause.svg" : "play.svg")));
togglePlay->setText(simulation->isPlaying ? "Pause" : "Resume"); togglePlay->setText(simulation->isPlaying ? "Pause" : "Resume");
}); });

Loading…
Cancel
Save