Data model and tableview (beginner)

  • Hello there,

    I'm trying to write my first app in Qt using tableview. I looked into some tutorials but I found them confusing for a beginner like me. Please note I'm very beginner at C++ and Qt.
    What I understood is that to fill a tableview I need a data model.

    Can anyone give me a simple example on how to properly build a data model and insert/link it to a tableview, please?
    How do I add/remove items to it?

    I'm also not sure whether to use TableView or TableWidget. The goal is a table with contents that can be colored and clickable URLs on its cells. (in the future I may also need to put a combo box inside a cell)

    Thanks for any help

  • Lifetime Qt Champion


    You have to give more information about the kind of data you want to handle in your application.

  • Thanks for answering!
    In the table it is regular text data: url, text, numbers and dates.

  • Thank you all for the answers this Qt forum is friendly!

  • I'd recommend you to read through this article first. That should give you a good overview about what is happening. After that you can start having a look at the various more advanced (and more complete) examples that are linked at the bottom of that article such as the address book example.

Log in to reply

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