I want to compile a Qt-Project without an IDE like QtCreator and I use MSYS2.
I installed Qt5 with
pacman -S mingw-w64-x86_64-qt5-base
I could then already create an application with
main.cpp
#include <QApplication>
#include <QPushButton>
int main(int argc, char **argv)
{
QApplication app (argc, argv);
QPushButton button ("Hello world !");
button.show();
return app.exec();
}
and myproject.pro
TEMPLATE = app
TARGET = name_of_the_app
QT = core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += main.cpp
and the commands
qmake
mingw32-make
./release/name_of_the_app.exe
However, now someone sent me a QtApplication a bit more complex and it contains mainwindow.ui and MainWindow.h
The start of those files looks like
mainwindow.h
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1014</width>
<height>643</height>
</rect>
MainWindow.h
#pragma once
#include <QMainWindow>
#include <QStandardItemModel>
#include <QDate>
#include "Patient.h"
#include "MedikamentenplanAnzeigeModel.h"
#include "BehandlungenAnzeigeModel.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
The guy, who sent me the project hasn't sent a .pro file. I want to write that myself. He has sent me a VisualStudio .sln and .vsprojx files
How do I need to adapt my project file. I already added
HEADERS += MainWindow.h
And also
QT += widgets
but still mingw32-make can't find ui_mainwindow.h. Of course, I am completely new to this Qt.
You need add
FORMS=mainwindow.ui
to the myproject.pro