[Interest] How to add child items to QStandardItemModel?

Anisha kaul anisha.kaul.1983 at gmail.com
Mon Jan 4 12:28:35 CET 2021


Greetings,

Idea is to have something like:

> File
        New
        Save
>Edit
         Cut


I have:

    int main( int argc, char *argv[] )
    {
.........

    QStandardItemModel model;

    QStandardItem *parentItem0 = model.invisibleRootItem();


    QStandardItem *file_item = new QStandardItem(QString("File"));


    QStandardItem *new_ = new QStandardItem(QString("New"));

    file_item->setChild(1, new_);


    parentItem0 = file_item;


    parentItem0->appendRow( file_item );

..........
}

This is not giving me anything.
What is the way to add child items to parent items?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210104/65beb3af/attachment.html>


More information about the Interest mailing list