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
+8 -2
View File
@@ -15,7 +15,6 @@
#include "ivalidator.h"
#include "combodata.h"
template <class T>
class AutoForm : public IForm
{
@@ -84,7 +83,14 @@ private:
ComboData data = m_bindCombos[combo][i];
combo->addItem(data.label(), data.index());
if (field == data.index()) {
if (data.index().canConvert<QObject*>()) {
ComboItem* ci = qobject_cast<ComboItem*>(data.index().value<QObject*>());
ComboItem* ciField = qobject_cast<ComboItem*>(field.value<QObject*>());
if (ci->eq(ciField)) {
idx = i;
}
}
else if (field == data.index()) {
idx = i;
}
}