diff --git a/src/GUI/ModelDataExtractor.cxx b/src/GUI/ModelDataExtractor.cxx index 0ed61cd6e..a05efb7c0 100644 --- a/src/GUI/ModelDataExtractor.cxx +++ b/src/GUI/ModelDataExtractor.cxx @@ -1,6 +1,7 @@ #include "ModelDataExtractor.hxx" #include +#include ModelDataExtractor::ModelDataExtractor(QObject *parent) : QObject(parent) { @@ -24,7 +25,15 @@ QVariant ModelDataExtractor::data() const } if (m_value.isArray()) { - return m_value.property(m_index).toVariant(); + quint32 uIndex = static_cast(m_index); + auto v = m_value.property(uIndex); + if (v.isQObject()) { + // handle the QList case + auto obj = v.toQObject(); + return obj->property(m_role.toUtf8().constData()); + } + + return m_value.property(uIndex).toVariant(); } return {}; @@ -51,6 +60,8 @@ void ModelDataExtractor::setModel(QJSValue model) this, &ModelDataExtractor::onDataChanged); // ToDo: handle rows added / removed + } else { + qWarning() << "object but not a QAIM" << m_value.toQObject(); } } else { // might be null, or an array diff --git a/src/GUI/qml/PopupChoice.qml b/src/GUI/qml/PopupChoice.qml index 1e9e3bdc5..1bb2d15e8 100644 --- a/src/GUI/qml/PopupChoice.qml +++ b/src/GUI/qml/PopupChoice.qml @@ -38,6 +38,9 @@ Item { if ((currentIndex == -1) && haveHeader()) return headerText; + if (!currentItemText.data) + return ""; + return currentItemText.data }