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

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_;
};