parent
f64ee85a74
commit
d39ca6a372
@ -0,0 +1,70 @@
|
||||
#include "country.h"
|
||||
|
||||
Country::Country(QString name, QString capital, QString iso, QString region, QString alt, QObject *object)
|
||||
|
||||
{}
|
||||
|
||||
QString Country::capital() const
|
||||
{
|
||||
return m_capital;
|
||||
}
|
||||
|
||||
void Country::setCapital(const QString &newCapital)
|
||||
{
|
||||
if (m_capital == newCapital)
|
||||
return;
|
||||
m_capital = newCapital;
|
||||
emit capitalChanged();
|
||||
}
|
||||
|
||||
QString Country::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void Country::setName(const QString &newName)
|
||||
{
|
||||
if (m_name == newName)
|
||||
return;
|
||||
m_name = newName;
|
||||
emit nameChanged();
|
||||
}
|
||||
|
||||
QString Country::iso() const
|
||||
{
|
||||
return m_iso;
|
||||
}
|
||||
|
||||
void Country::setIso(const QString &newIso)
|
||||
{
|
||||
if (m_iso == newIso)
|
||||
return;
|
||||
m_iso = newIso;
|
||||
emit isoChanged();
|
||||
}
|
||||
|
||||
QString Country::region() const
|
||||
{
|
||||
return m_region;
|
||||
}
|
||||
|
||||
void Country::setRegion(const QString &newRegion)
|
||||
{
|
||||
if (m_region == newRegion)
|
||||
return;
|
||||
m_region = newRegion;
|
||||
emit regionChanged();
|
||||
}
|
||||
|
||||
QString Country::alt() const
|
||||
{
|
||||
return m_alt;
|
||||
}
|
||||
|
||||
void Country::setAlt(const QString &newAlt)
|
||||
{
|
||||
if (m_alt == newAlt)
|
||||
return;
|
||||
m_alt = newAlt;
|
||||
emit altChanged();
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
#ifndef COUNTRY_H
|
||||
#define COUNTRY_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
class Country : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL);
|
||||
Q_PROPERTY(QString capital READ capital WRITE setCapital NOTIFY capitalChanged FINAL)
|
||||
Q_PROPERTY(QString iso READ iso WRITE setIso NOTIFY isoChanged FINAL)
|
||||
Q_PROPERTY(QString region READ region WRITE setRegion NOTIFY regionChanged FINAL)
|
||||
Q_PROPERTY(QString alt READ alt WRITE setAlt NOTIFY altChanged FINAL)
|
||||
|
||||
|
||||
public:
|
||||
Country(QString name, QString capital, QString iso, QString region, QString alt, QObject *object);
|
||||
QString capital() const;
|
||||
void setCapital(const QString &newCapital);
|
||||
QString name() const;
|
||||
void setName(const QString &newName);
|
||||
|
||||
QString iso() const;
|
||||
void setIso(const QString &newIso);
|
||||
|
||||
QString region() const;
|
||||
void setRegion(const QString &newRegion);
|
||||
|
||||
QString alt() const;
|
||||
void setAlt(const QString &newAlt);
|
||||
|
||||
signals:
|
||||
void capitalChanged();
|
||||
void nameChanged();
|
||||
|
||||
void isoChanged();
|
||||
|
||||
void regionChanged();
|
||||
|
||||
void altChanged();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_capital;
|
||||
QString m_iso;
|
||||
QString m_region;
|
||||
QString m_alt;
|
||||
};
|
||||
|
||||
#endif // COUNTRY_H
|
Loading…
Reference in new issue