Qt QListView Tutorial

Qt QListView Tutorial

In my last article, I am write about toturial how to use QTableView. In this tutorial, I am try to write about Qt QListView Tutorial. The QListView class provides a list or icon view onto a model. That is like with QTableView. QListView support only one column (if you get a method how to create multiple column with QListView, maybe you can let me know 🙂 ). So, if you want to create mutliple column, you can use QTreeView or QTableView than QListView.

Below is a basic sample code how to use QListView (Qt QListView Tutorial). This code create a QListView, fill QListView with data, and show QListView program. From this Qt QListView Tutorial, you can extend to your program to more complex. Create a file, save with “listviewexample.cpp“, copy this text :

We can fill QListView item with QStandardItemModel class. This is header file for this Qt QListView Tutorial. Saving this text to “listviewexample.h” :

Create a “listview.pro” file for this Qt QListView Tutorial and fill with this text :

Compile this Qt QListView Tutorial with command “qmake” and “make“. This is output from this Qt QListView Tutorial :

Qt QListView Tutorial

This is a basic tutorial how to use QListView (Qt QListView Tutorial), please let me know if you have a question. You can get the complete code Qt QListView Tutorial at here.

Source :


Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.