I have struct vector of 128 items. I should put the first 64 items to first QTableWidget and remaining 64 items to second QTableWidget. It is essential to show “index” numbers as they are in my struct vector. Those are Id numbers. I have designed my ui using UI designer, I tried to change QTableWidget First row number there, but it didn’t work. How can I initialize the first tablewidget which index starts with 0 and the second tablewidget which index starts from 64. Please help guyz... Thanks in Advance.
Please Help Me to Solve this.
I will explain it clearly with a Snapshot image. ! Here i have 2 QTableWidgets. Each table widget starts with a Row id as 1. The Row id of the Second Widget should not be the same as 1. Instead of that it must be 65. (since i have 128 items, the first 64 items goes to the first table and the remaining 64 items should be placed in the second Table). Hope you all understand my requirement. Please help me.
If the question is about vertical header labels, then the easiest way to change them in
QTableWidget
is to useQTableWidget::setVerticalHeaderLabels()
.QTableWidget
has simpler API, but is limited in features. For example,QAbstractItemModel::setHeaderData()
is no operation and not re-implemented inQTableModel
. Alternative approach is to useQTableView
withQAbstractItemView
to hold the data. As you said you already have the data separately in some kind of structure, so you can subclass your structure andQAbstractItemView
to produce your custom model to be shown byQTableView
.