Added basic functionality backend in C++

This commit is contained in:
2025-02-07 19:24:34 +02:00
parent 854469166a
commit f9c394e0d1
6 changed files with 56 additions and 2 deletions

View File

@ -17,6 +17,8 @@ qt_add_qml_module(appProject-Orion
VERSION 1.0 VERSION 1.0
QML_FILES QML_FILES
Main.qml Main.qml
SOURCES user.h user.cpp
SOURCES userlist.h userlist.cpp
) )
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.

View File

@ -19,7 +19,5 @@ Window {
text: qsTr("This view is currently empty :(") text: qsTr("This view is currently empty :(")
height: parent.height height: parent.height
} }
} }
} }

View File

@ -0,0 +1,5 @@
#include "user.h"
User::User(QString name, QDate dateOfBirth, QDate dateOfDeath, bool isItDefault)
: name{name}, dateOfBirth{dateOfBirth}, dateOfDeath{dateOfDeath}
{}

17
src/Project-Orion/user.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef USER_H
#define USER_H
#include <qdatetime.h>
class User
{
public:
User(QString name, QDate dateOfBirth, QDate dateOfDeath, bool isItDefault = false);
private:
QString name;
QDate dateOfBirth;
QDate dateOfDeath;
bool isItDefault = false;
};
#endif // USER_H

View File

@ -0,0 +1,13 @@
#include "userlist.h"
UserList::UserList() {}
QVector<User> UserList::getList() const
{
return list;
}
void UserList::setList(const QVector<User> &newList)
{
list = newList;
}

View File

@ -0,0 +1,19 @@
#ifndef USERLIST_H
#define USERLIST_H
#include <QObject>
#include "user.h"
class UserList
{
public:
UserList();
QVector<User> getList() const;
void setList(const QVector<User> &newList);
private:
QVector<User> list;
};
#endif // USERLIST_H