🎉 empty Qt6 window !

main
bog 2023-12-26 16:30:10 +01:00
parent 4165716590
commit 41cc81c70b
11 changed files with 193 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*~*
*\#*
.cache
build

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
.PHONY: build install
build:
meson setup build
meson compile -C build
install: build
meson install -C build

45
meson.build Normal file
View File

@ -0,0 +1,45 @@
project(
'pixtool',
'cpp',
version: '0.0.0',
default_options: [
'cpp_std=c++17',
'warning_level=3'
]
)
conf = configuration_data()
conf.set('version', meson.project_version())
configure_file(
input: 'src/conf.in.hpp',
output: 'conf.hpp',
configuration: conf
)
qt6 = import('qt6')
qt6_dep = dependency('qt6', modules: ['Core', 'Widgets'])
qt_src = qt6.compile_moc(
headers: [
'src/gui/Window.hpp'
]
)
executable(
'pixtool',
sources: [
'src/main.cpp',
'src/Presenter.cpp',
# model
'src/pixtool/PixTool.cpp',
# gui
'src/gui/Window.cpp',
] + qt_src,
dependencies: [
qt6_dep
],
install: true
)

14
src/Presenter.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "Presenter.hpp"
namespace pt
{
/*explicit*/ Presenter::Presenter(gui::Window& window, model::PixTool& pixtool)
: m_window { window }
, m_pixtool { pixtool }
{
}
/*virtual*/ Presenter::~Presenter()
{
}
}

21
src/Presenter.hpp Normal file
View File

@ -0,0 +1,21 @@
#ifndef pt_PRESENTER_HPP
#define pt_PRESENTER_HPP
#include "pixtool/PixTool.hpp"
#include "gui/Window.hpp"
namespace pt
{
class Presenter
{
public:
explicit Presenter(gui::Window& window, model::PixTool& pixtool);
virtual ~Presenter();
private:
gui::Window& m_window;
model::PixTool& m_pixtool;
};
}
#endif

6
src/conf.in.hpp Normal file
View File

@ -0,0 +1,6 @@
#ifndef pt_CONF_HPP
#define pt_CONF_HPP
#define PT_VERSION std::string("@version@")
#endif

21
src/gui/Window.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "Window.hpp"
#include "conf.hpp"
namespace pt
{
namespace gui
{
/*explicit*/ Window::Window(QWidget* parent)
: QMainWindow(parent)
{
setWindowTitle(QString::fromStdString("PixTool v" + PT_VERSION));
setMinimumSize(QSize {640, 480});
show();
}
/*virtual*/ Window::~Window()
{
}
}
}

22
src/gui/Window.hpp Normal file
View File

@ -0,0 +1,22 @@
#ifndef pt_gui_WINDOW_HPP
#define pt_gui_WINDOW_HPP
#include <QMainWindow>
namespace pt
{
namespace gui
{
class Window: public QMainWindow
{
Q_OBJECT
public:
explicit Window(QWidget* parent=nullptr);
virtual ~Window();
private:
};
}
}
#endif

18
src/main.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <iostream>
#include <QApplication>
#include "pixtool/PixTool.hpp"
#include "gui/Window.hpp"
#include "Presenter.hpp"
int main(int argc, char** argv)
{
QApplication app {argc, argv};
pt::gui::Window window;
pt::model::PixTool pixtool;
pt::Presenter presenter {window, pixtool};
return app.exec();
}

15
src/pixtool/PixTool.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "PixTool.hpp"
namespace pt
{
namespace model
{
/*explicit*/ PixTool::PixTool()
{
}
/*virtual*/ PixTool::~PixTool()
{
}
}
}

19
src/pixtool/PixTool.hpp Normal file
View File

@ -0,0 +1,19 @@
#ifndef pt_model_PIXTOOL_HPP
#define pt_model_PIXTOOL_HPP
namespace pt
{
namespace model
{
class PixTool
{
public:
explicit PixTool();
virtual ~PixTool();
private:
};
}
}
#endif