diff --git a/CMakeLists.txt b/CMakeLists.txt index d0f365e..b9872e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ find_package(Qt6 COMPONENTS add_executable(ihm_robot main.cpp resource.qrc MainWindow.cpp MainWindow.h + homeButton.cpp + homeButton.h ) target_link_libraries(ihm_robot diff --git a/MainWindow.h b/MainWindow.h index c972404..19b9202 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -2,6 +2,7 @@ #include #include #include +#include "homeButton.h" class MainWindow : public QMainWindow { Q_OBJECT @@ -12,20 +13,24 @@ public: this->setCentralWidget(centralWidget); this->mainLayout = new QVBoxLayout(centralWidget); - this->homeButton = new QPushButton("", this); + this->homeBtn = new QPushButton("", this); QPixmap pic(":/img/logo_without_background.png", "PNG"); - this->homeButton->setIcon(pic); - this->homeButton->setIconSize(QSize(249, 51)); + this->homeBtn->setIcon(pic); + this->homeBtn->setIconSize(QSize(249, 51)); - this->mainLayout->addWidget(this->homeButton); + this->mainLayout->addWidget(this->homeBtn); this->setFixedSize(QSize(480, 320)); this->setLayout(mainLayout); + + this->home = new homeButton(this); + this->mainLayout->addWidget(this->home); } private: QVBoxLayout* mainLayout; - QPushButton* homeButton; + QPushButton* homeBtn; QWidget* centralWidget; + homeButton* home; }; diff --git a/homeButton.cpp b/homeButton.cpp new file mode 100644 index 0000000..4d28b06 --- /dev/null +++ b/homeButton.cpp @@ -0,0 +1,5 @@ +// +// Created by breizhhardware on 1/25/24. +// + +#include "homeButton.h" diff --git a/homeButton.h b/homeButton.h new file mode 100644 index 0000000..0f4887d --- /dev/null +++ b/homeButton.h @@ -0,0 +1,48 @@ +// +// Created by breizhhardware on 1/25/24. +// + +#ifndef HOMEBUTTON_H +#define HOMEBUTTON_H +#include +#include +#include + + +class homeButton : public QWidget { + Q_OBJECT + public: + homeButton(QWidget* parent = nullptr) : QWidget(parent) { + this->window = new QWidget(this); + + this->mainLayout = new QVBoxLayout(window); + + this->homologation = new QPushButton("Mode Homologation", this); + this->homologation->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->homologation->setBaseSize(378, 46); + + this->jeu = new QPushButton("Mode Jeu", this); + this->jeu->setStyleSheet("background-color: #ED4747; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->jeu->setBaseSize(378, 46); + + this->test = new QPushButton("Mode Test", this); + this->test->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 378px; margin-top: 20px;"); + this->test->setBaseSize(378, 46); + + this->mainLayout->addWidget(this->homologation); + this->mainLayout->addWidget(this->jeu); + this->mainLayout->addWidget(this->test); + + + } + private: + QVBoxLayout* mainLayout; + QPushButton* homologation; + QPushButton* jeu; + QPushButton* test; + QWidget* window; +}; + + + +#endif //HOMEBUTTON_H