Added support for bindig relations (foreign keys) to combo boxes.

This commit is contained in:
2016-02-11 12:11:32 +01:00
parent ca35df241f
commit 1b6141923f
7 changed files with 63 additions and 8 deletions
+13 -4
View File
@@ -6,10 +6,21 @@ ComboData::ComboData(const QVariant &index, const QString &label)
m_label = label;
}
ComboData::ComboData(const QSharedPointer<QObject> &index)
{
m_index = QVariant::fromValue(index);
ComboItem *ci = qobject_cast<ComboItem*>(index.data());
if (ci != NULL)
{
m_label = ci->toString();
}
}
ComboData::~ComboData()
{
}
QVariant ComboData::index() const
{
return m_index;
@@ -19,6 +30,7 @@ void ComboData::setIndex(const QVariant &index)
{
m_index = index;
}
QString ComboData::label() const
{
return m_label;
@@ -28,6 +40,3 @@ void ComboData::setLabel(const QString &label)
{
m_label = label;
}