From 55374630b99370aff2dc241a19e40f17e14670b3 Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 31 Jan 2026 16:42:22 -0800 Subject: [PATCH] setup main window --- CMakeLists.txt | 13 ++++++++++++- main.cpp | 13 +++++++++++-- mainwindow.cpp | 13 +++++++++++++ mainwindow.h | 18 ++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 mainwindow.cpp create mode 100644 mainwindow.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cadfcc7..8150df8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,18 @@ find_package(Qt6 REQUIRED COMPONENTS qt_standard_project_setup() -qt_add_executable(adhd main.cpp) +qt_add_executable(adhd main.cpp mainwindow.cpp) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +set_target_properties(adhd PROPERTIES + # MACOSX_BUNDLE_GUI_IDENTIFIER com.example.adhd + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE $> +) target_link_libraries(adhd PRIVATE diff --git a/main.cpp b/main.cpp index bcb895a..1e87fcd 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,15 @@ #include +#include +#include "mainwindow.h" -int main(int argc, char *args[]) { +int main(int argc, char *argv[]) { std::cout << "Starting adhd program" << std::endl; - return 0; + + QApplication a(argc, argv); + a.setStyle("fusion"); + + MainWindow w; + w.show(); + + return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp new file mode 100644 index 0000000..bdf4f15 --- /dev/null +++ b/mainwindow.cpp @@ -0,0 +1,13 @@ +#include "mainwindow.h" +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) +{ + QWidget *centralWidget = new QWidget(this); + QLabel *label = new QLabel(centralWidget); + label->setText("Let's get some stuff done!"); + + setCentralWidget(centralWidget); +} + +MainWindow::~MainWindow() {} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..2869038 --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,18 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +QT_BEGIN_NAMESPACE +QT_END_NAMESPACE + +class MainWindow : public QMainWindow { + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); +}; + +#endif // MAINWINDOW_H