Nut/tests/auto/common/user.cpp

56 lines
851 B
C++
Raw Normal View History

2018-01-09 01:07:26 +08:00
#include "comment.h"
2018-01-14 22:03:24 +08:00
#include "score.h"
#include "user.h"
2018-01-09 01:07:26 +08:00
2018-01-09 00:59:16 +08:00
User::User(QObject *tableSet) : Table(tableSet),
2018-01-14 22:03:24 +08:00
m_comments(new TableSet<Comment>(this)),
m_scores(new TableSet<Score>(this))
2018-01-09 00:59:16 +08:00
{
init();
}
int User::id() const
{
return m_id;
}
QString User::username() const
{
return m_username;
}
QString User::password() const
{
return m_password;
}
void User::setId(int id)
{
if (m_id == id)
return;
m_id = id;
emit idChanged(m_id);
}
void User::setUsername(QString username)
{
if (m_username == username)
return;
m_username = username;
emit usernameChanged(m_username);
}
void User::setPassword(QString password)
{
if (m_password == password)
return;
2018-01-09 00:59:16 +08:00
m_password = password;
emit passwordChanged(m_password);
2018-01-09 00:59:16 +08:00
}
2018-01-09 05:44:01 +08:00
NUT_IMPLEMENT_CHILD_TABLE(User, Comment, comments)