How to add image to row in TableView
sharon_obl82 last edited by
I'm sorry if this is a repeated question which had been posted up before but i can't seem to find any thread that could help answer my question.
I have a table which I will display when the form is clicked but when a user clicks Add Row to add, a 'New" image will be added next to the row in the table, if user tries to delete the row, a "scissors" image will be displayed next to the row selected to be deleted.
My tableview code is as simple as below:
multigrp = new QStandardItemModel(0,1,this);
multigrp->setHorizontalHeaderItem(0, new QStandardItem(QString(tr("Talkgroup Alias"))));
Does anyone know how to add an image next to the row as shown in the pictures?
You are trying to display the image in the tableview. You need to implement custom delegate for displaying the image. Set the custom delegate for your first column. Just look at how to write a custom delegate. It should help you.