Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (2,44 KB) Statistiken
| Zweig: | Revision:
9d05e414 Christian Ehringfeld
#include "group.h"

#include "models/person.h"
#include "models/group.h"
bb5e9339 SebastianDiel
#include "../src/relation.h"
9d05e414 Christian Ehringfeld
//#include <QQmlListProperty>
#include <QDebug>

Group::Group() : Entity() {
connect(this, SIGNAL(personsChanged()), this, SLOT(personChangedSlot()));
qDebug() << "Konstruktor!";
persons = QList<Person *>();
persons.append(new Person("Vera", "Geseke", Person::FEMALE, "Vera Geseke.jpg", "", "", QDate::currentDate()));
persons.append(new Person("Harry", "Hirsch", Person::MALE));
persons.append(new Person("Sibylle", "Mentzel", Person::FEMALE, "Sibylle Mentzel.jpg", "", "", QDate::currentDate()));
}

QList<Person *> Group::getPersons() const {
return persons;
}

void Group::setPersons(const QList<Person *> &value) {
qDebug() << "set!!!";
persons = value;
}
f53f7740 Christian Ehringfeld
QSharedPointer<Person> Group::getTeacherP() const {
586bb527 Christian Ehringfeld
return teacherP;
}

f53f7740 Christian Ehringfeld
void Group::setTeacherP(const QSharedPointer<Person> &value) {
586bb527 Christian Ehringfeld
teacherP = value;
}
f53f7740 Christian Ehringfeld
Person *Group::getTeacher() const {
586bb527 Christian Ehringfeld
return teacher;
}

f53f7740 Christian Ehringfeld
void Group::setTeacher(Person *value) {
586bb527 Christian Ehringfeld
teacher = value;
}
f53f7740 Christian Ehringfeld
QSharedPointer<Artikel> Group::getArtikel() const {
a47954c0 Christian Ehringfeld
return artikel;
}

f53f7740 Christian Ehringfeld
void Group::setArtikel(const QSharedPointer<Artikel> &value) {
a47954c0 Christian Ehringfeld
artikel = value;
}

9d05e414 Christian Ehringfeld
void Group::personChangedSlot() {
qDebug() << "changed!";
}

f53f7740 Christian Ehringfeld
QHash<QString, CuteEntityManager::Relation> Group::getRelations() {
a47954c0 Christian Ehringfeld
QHash<QString, CuteEntityManager::Relation> h = QHash<QString, CuteEntityManager::Relation>();
f53f7740 Christian Ehringfeld
CuteEntityManager::Relation r = CuteEntityManager::Relation("artikel", CuteEntityManager::MANY_TO_ONE);
a47954c0 Christian Ehringfeld
h.insert("artikel", r);
return h;
}

9d05e414 Christian Ehringfeld
//void Group::appendPerson(QQmlListProperty<Person> *list, Person *p) {
// Group *group = qobject_cast<Group*>(list->object);
// if(group && p) {
// group->addPerson(p);
// emit group->personsChanged();
// }
//}

//int Group::personsCount(QQmlListProperty<Person>*list)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group)
// return group->m_persons.count();
// return 0;
//}

//Person* Group::personAt(QQmlListProperty<Person> *list, int i)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group)
// return group->m_persons.at(i);
// return 0;

//}

//void Group::personsClear(QQmlListProperty<Person> *list)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group) {
// group->m_persons.clear();
// emit group->personsChanged();
// }
//}