[SOLVED] Insert rows

  • 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;

    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 ?


  • Moderators

    There is not enough info, but in general you could try this:
    // If m_Patients is a QList or QVector

    Hard to say anything more without more details.

  • Okay. Thank you. I will try it soon...

  • It does work ! Thanks you very much indeed.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.