Unsolved QTableWidget how to get number of rows in each cell
-
Hi,
i created a table with a given number of rows and columns. I also used setSpan() to merge some cells together.
Now i need to retrieve the number of rows and columns in each cell after merging. Is there a method to loop through all merged cells to get the data I want?
I thought of using rowCount() and columnCount() but it only works with the whole table.
Thank you all
-
@dzungng
You have to march through the cells of the table reading theirQTableView::column
/rowSpan(int row, int column)
to calculate what is there including spanning. -
Thank you for your answer.
I created a table using QTableWidget. Can I use the function you recommended for QTableWidget? -
@dzungng
QTableWidget
inherits fromQTableView
. That means allQTableView
methods are also available on aQTableWidget
. This principle is worth understanding, as it applies all over the place withQWidget
s (and other Qt derived classes).