Add homeButton

This commit is contained in:
2024-01-25 16:11:16 +01:00
parent d5a92d122b
commit 1ec3c6c219
4 changed files with 65 additions and 5 deletions

View File

@@ -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

View File

@@ -2,6 +2,7 @@
#include <QMainWindow>
#include <QPushButton>
#include <QVBoxLayout>
#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;
};

5
homeButton.cpp Normal file
View File

@@ -0,0 +1,5 @@
//
// Created by breizhhardware on 1/25/24.
//
#include "homeButton.h"

48
homeButton.h Normal file
View File

@@ -0,0 +1,48 @@
//
// Created by breizhhardware on 1/25/24.
//
#ifndef HOMEBUTTON_H
#define HOMEBUTTON_H
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
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