mirror of
https://github.com/modelec/ihm.git
synced 2026-01-18 16:47:32 +01:00
update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.27)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(ihm_robot)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@@ -13,7 +13,10 @@ find_package(Qt6 COMPONENTS
|
||||
Widgets
|
||||
REQUIRED)
|
||||
|
||||
add_executable(ihm_robot main.cpp resource.qrc)
|
||||
add_executable(ihm_robot main.cpp resource.qrc
|
||||
MainWindow.cpp
|
||||
MainWindow.h
|
||||
)
|
||||
|
||||
target_link_libraries(ihm_robot
|
||||
Qt::Core
|
||||
|
||||
1
MainWindow.cpp
Normal file
1
MainWindow.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "MainWindow.h"
|
||||
31
MainWindow.h
Normal file
31
MainWindow.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow(QWidget* parent = nullptr) : QMainWindow(parent)
|
||||
{
|
||||
this->centralWidget = new QWidget(this);
|
||||
this->setCentralWidget(centralWidget);
|
||||
|
||||
this->mainLayout = new QVBoxLayout(centralWidget);
|
||||
this->homeButton = new QPushButton("", this);
|
||||
QPixmap pic(":/img/logo_without_background.png", "PNG");
|
||||
this->homeButton->setIcon(pic);
|
||||
this->homeButton->setIconSize(QSize(249, 51));
|
||||
|
||||
this->mainLayout->addWidget(this->homeButton);
|
||||
|
||||
this->setFixedSize(QSize(480, 320));
|
||||
|
||||
this->setLayout(mainLayout);
|
||||
}
|
||||
|
||||
private:
|
||||
QVBoxLayout* mainLayout;
|
||||
QPushButton* homeButton;
|
||||
QWidget* centralWidget;
|
||||
};
|
||||
19
main.cpp
19
main.cpp
@@ -1,20 +1,23 @@
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QPixmap>
|
||||
#include <QMainWindow>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
QMainWindow window;
|
||||
|
||||
MainWindow main;
|
||||
|
||||
main.show();
|
||||
|
||||
/* QMainWindow window;
|
||||
window.setFixedSize(480, 320);
|
||||
|
||||
auto *centralWidget = new QWidget(&window);
|
||||
window.setCentralWidget(centralWidget);
|
||||
|
||||
auto *layout = new QVBoxLayout(centralWidget);
|
||||
|
||||
QPixmap pic(":/img/logo.png", "PNG");
|
||||
QPixmap pic(":/img/logo_without_background.png", "PNG");
|
||||
QPushButton button("", nullptr);
|
||||
button.setIcon(pic);
|
||||
button.setIconSize(QSize(249, 51));
|
||||
@@ -35,6 +38,6 @@ int main(int argc, char* argv[]) {
|
||||
test.setBaseSize(378, 46);
|
||||
layout->addWidget(&test);
|
||||
|
||||
window.show();
|
||||
window.show();*/
|
||||
return QApplication::exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user