setup main window
This commit is contained in:
+12
-1
@@ -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 $<NOT:$<CONFIG:Debug>>
|
||||
)
|
||||
|
||||
target_link_libraries(adhd
|
||||
PRIVATE
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
#include <iostream>
|
||||
#include <QApplication>
|
||||
#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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QLabel>
|
||||
|
||||
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() {}
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
Reference in New Issue
Block a user