AutoTableModel now can display data from related table.
Usage example of ComboBox binding in Accommodation plugin.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#ifndef ADDRESS_H
|
||||
#define ADDRESS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include <data/comboitem.h>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#pragma db object
|
||||
class Address : public ComboItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString city READ city WRITE setCity)
|
||||
Q_PROPERTY(QString street READ street WRITE setStreet)
|
||||
Q_PROPERTY(QString houseNumber READ houseNumber WRITE setHouseNumber)
|
||||
|
||||
public:
|
||||
explicit Address(QObject *parent = 0);
|
||||
~Address();
|
||||
|
||||
QString city() const;
|
||||
void setCity(const QString &city);
|
||||
|
||||
QString street() const;
|
||||
void setStreet(const QString &street);
|
||||
|
||||
QString houseNumber() const;
|
||||
void setHouseNumber(const QString &houseNumber);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_city;
|
||||
QString m_street;
|
||||
QString m_houseNumber;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
virtual bool eq(ComboItem *other);
|
||||
virtual QString toString();
|
||||
};
|
||||
|
||||
#endif // ADDRESS_H
|
||||
Reference in New Issue
Block a user