You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.1 KiB
C++
60 lines
1.1 KiB
C++
#include "commoditytypedata.h"
|
|
|
|
QX_REGISTER_CPP_COMM(CommodityTypeData)
|
|
|
|
namespace qx {
|
|
template<> void register_class(QxClass<CommodityTypeData>& t) {
|
|
t.setName("CommodityTypeData");
|
|
t.id(&CommodityTypeData::m_id, "id");
|
|
t.data(&CommodityTypeData::m_name, "name");
|
|
t.data(&CommodityTypeData::m_color, "color");
|
|
}
|
|
}
|
|
|
|
CommodityTypeData::CommodityTypeData(QObject *parent)
|
|
:ComboItem(parent)
|
|
{
|
|
m_id = 0;
|
|
}
|
|
long CommodityTypeData::id() const
|
|
{
|
|
return m_id;
|
|
}
|
|
|
|
void CommodityTypeData::setId(long id)
|
|
{
|
|
m_id = id;
|
|
}
|
|
|
|
QString CommodityTypeData::name() const
|
|
{
|
|
return m_name;
|
|
}
|
|
|
|
void CommodityTypeData::setName(const QString &name)
|
|
{
|
|
m_name = name;
|
|
}
|
|
|
|
bool CommodityTypeData::eq(ComboItem *other)
|
|
{
|
|
CommodityTypeData* ct = qobject_cast<CommodityTypeData *> (other);
|
|
|
|
return ct != nullptr && this->id() == ct->id() ;
|
|
}
|
|
|
|
QString CommodityTypeData::toString()
|
|
{
|
|
return this->name();
|
|
}
|
|
|
|
QString CommodityTypeData::color() const {
|
|
return m_color;
|
|
}
|
|
|
|
void CommodityTypeData::setColor(const QString& color) {
|
|
m_color = color;
|
|
}
|
|
|
|
|