Qt World Summit: Submit your Presentation

How to split QStringList in two columns for QStringListModel?

  • Hi everybody!

    I have tableView, it should have only two columns, but enormous amount of rows. I know already that i can use QStandardItemModel and append QStandardItem's instead pure strings(using QStringListModel), but i do need a performance and speed, so i want to ask. Is it possible to add two columns with QStringListModel instead of single-first-one?

    Because for my assumption, appending data in to lists using bitwise fastest operators is much better then create hundreds thousands objects.

    strList << "maString";                         // appending to QStringList
    stdItems->append(new QStandardItem("maString"));    // appending to QList<QStandardItem>

  • Qt Champions 2017

    StringListModel is only one column and multi rows. If you have huge data sets, better you write the custom model using QAbstractListModel.

  • @Engelard said in How to split QStringList in two columns for QStringListModel?:


    In Qt doumentation is written:
    "The model provides all the standard functions of an editable model, representing the data in the string list as a model with one column and a number of rows equal to the number of items in the list."

Log in to reply