[Interest] How to get a column data from QTableWidget

Tony Rietwyk tony at rightsoft.com.au
Sat May 30 03:32:45 CEST 2020


Hi Ghobad,

item->tableWidget()->item(item->row(), my_intended_col_index)->data(role)

Regards, Tony

On 29/05/2020 10:35 pm, Ghobad Zarrinchian wrote:
> Dear all,
> I have a QTableWidget with some rows and columns in my application and 
> I want to extract the data from a specific column when its row (item) 
> is double clicked. I don't know which function can get me the data 
> when having a pointer to the item. I use the slot function below and 
> need some method like 'col' as used here. However, there is no such 
> function.
>
> voidMainWindow::on_tableWidget_itemDoubleClicked(QTableWidgetItem*item)
> {
> QString data = item->col(my_intended_col_index).toString(); // no such 
> function
> }
>
> How should i modify the code above to work for me?
> Thanks.
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200530/23e7a0ca/attachment.html>


More information about the Interest mailing list