Important: Please read the Qt Code of Conduct -

[Solved]How to set single column from Qsqltablemodel to Qlistview?

  • Hi,
    I have a Qsqltablemodel in which there is a table from sql database. now i want to give only one column to edit to user and i want to store that table again in database after save button clicked . So, i have added a Qlistview in mainwindow.ui. But it seems very difficult to add one single column from model to this view. Is there any class which will give me directly one column which i can set to list view and after editing can easily add in that model again ?

  • Lifetime Qt Champion


    To set the column you want to use just call setModelColumn

    Hope it helps

  • Hi, it works. I just added two lines of code

    and its working now thanks. How to mark it solved?

  • Hi, simply add [SOLVED] to the title of your first post.

Log in to reply