[SOLVED] Insert rows
QML and Qt Quick
4
Posts
2
Posters
1.4k
Views
1
Watching
-
Hello everyone,
Would you please help me? I have a QML list of items. And I am using C++ bindings to manipulate a list showed in QML.
I did implement this function :@void PatientModelpps::addPatient(const Patient &patient)
{
beginInsertRows(QModelIndex(), 0, 1);
m_Patients << patient;
endInsertRows();
}@to add an Item, but it adds an item at the end on the list whereas I want it at the top of the list.
What can I do ?Thanks.
-
There is not enough info, but in general you could try this:
@
// If m_Patients is a QList or QVector
m_Patients.prepend(patient);
@Hard to say anything more without more details.