initial commit

This commit is contained in:
2025-12-19 22:42:57 -06:00
commit 52ff5cff2b
6 changed files with 101 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build/*

24
CMakeLists.txt Normal file
View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.16)
project(HelloQt LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Adjust path to your Qt MinGW install
set(CMAKE_PREFIX_PATH "C:/Qt/6.7.2/mingw_64")
find_package(Qt6 REQUIRED COMPONENTS Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_executable(HelloQt
src/main.cpp
src/mainwindow.hpp
src/mainwindow.cpp
)
target_link_libraries(HelloQt PRIVATE Qt6::Widgets)

9
scripts/build.bat Normal file
View File

@@ -0,0 +1,9 @@
rm -r build
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
cmake --build .
C:\Qt\6.10.1\mingw_64\bin\windeployqt.exe HelloQt.exe

13
src/main.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include <QApplication>
#include "mainwindow.hpp"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}

33
src/mainwindow.cpp Normal file
View File

@@ -0,0 +1,33 @@
#include "mainwindow.hpp"
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
// probably this will be in a qml file
auto *central = new QWidget(this);
auto *layout = new QVBoxLayout(central);
label_ = new QLabel("cases: 0", this);
label_->setAlignment(Qt::AlignCenter);
button_ = new QPushButton("many such cases !", this);
layout->addWidget(label_);
layout->addWidget(button_);
setCentralWidget(central);
setWindowTitle("moblus !!!");
resize(400, 200);
connect(button_, &QPushButton::clicked, this, &MainWindow::incrementCounter);
}
void MainWindow::incrementCounter() {
counter_++;
label_->setText(QString("cases: %1").arg(counter_));
}

21
src/mainwindow.hpp Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <QMainWindow>
class QLabel;
class QPushButton;
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
private slots:
void incrementCounter();
private:
int counter_ = 0;
QLabel *label_;
QPushButton *button_;
};