again, well i have a question (and maybe a problem), i make a program with qt and qml in qt5 and qml with qtquick 2.0, and i have a c++ model qlist, and i need modify the li
I got the answer for my self, first, I stopped using the attribute Q_INVOCABLE in the method append_concept, second, I added a line of code in the implementation of addConcept. Here is the code:
Before:
Q_INVOKABLE static void append_concept(QQmlListProperty *list, Concept *cpt);
Now:
static void append_concept(QQmlListProperty *list, Concept *cpt);
Maybe this not affect, but i prefer not take risks.
And in the implementations of addConcept
and removeConcept
:
void ConceptsList::addConcept(QString m_id, QString quantity, QString price, QString unit, QString description)
{
Concept *cpt=new Concept(m_id, quantity, unit, price, description);
m_concepts.append(cpt);
this->conceptsChanged();
}
void ConceptsList::removeConcept(int index)
{
m_concepts.removeAt(index);
this->conceptsChanged();
}