Answer the question
In order to leave comments, you need to log in
How to get the number of records that fit in a QTableView window?
it is necessary to find kol-in records which are visible to the user.
the only thing that comes to mind is to find the height of the table and divide by the height of the row...
Answer the question
In order to leave comments, you need to log in
This is actually a difficult task, and I solved it like this.
QHeaderView* header = ui->tableView->verticalHeader();
QWidget* viewport = header->viewport();
int i1 = header->logicalIndexAt(0);
int i2 = header->logicalIndexAt(viewport->height() - 1);
if (i2 < 0)
i2 = header->count() - 1;
QString s = QString::number(i1) + " - " + QString::number(i2);
ui->lbResult->setText(s);
return m_tableView->viewport()->height() / m_tableView->rowHeight(0);
Here is the answer:
return m_tableView->height() / m_tableView->rowHeight(0) - 1;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question