How to get a QTableView to fill 100% of the width?

If you are using Qt 5, QHeaderView::setResizeMode() is no longer available. Instead, you can use QHeaderView::setSectionResizeMode(): ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); Or just call it for every column: for (int c = 0; c < ui->tableView->horizontalHeader()->count(); ++c) { ui->tableView->horizontalHeader()->setSectionResizeMode( c, QHeaderView::Stretch); }

QTableWidget vs QTableView

cmannett85’s recommendation is a good one. Read the docs about a dozen times. Then, if performance and memory issues are your primary concern and you think you can out-perform the QTableWidget implementation, then a QTableView interface on top of a QAbstractTableModel or QStandardItemModel is what you’re looking for. Since you’re new to Qt’s model-view architecture, … Read more

How to set row height of QTableView?

For Qt versions < 5 QHeaderView *verticalHeader = myTableView->verticalHeader(); verticalHeader->setResizeMode(QHeaderView::Fixed); verticalHeader->setDefaultSectionSize(24); For Qt versions >= 5 use QHeaderView *verticalHeader = myTableView->verticalHeader(); verticalHeader->setSectionResizeMode(QHeaderView::Fixed); verticalHeader->setDefaultSectionSize(24); If that function doesn’t apply to vertical headers, you likely will have to call setRowHeight() every time you add a new row.

How to select Row in QTableView?

Use table->verticalHeader()->hide(); to get the vertical header and hide it, and table->setSelectionBehavior(QAbstractItemView::SelectRows); to make QTableView only select whole rows. You may also want to specify the selection mode.

how to get selected rows in QTableView

The method selectionModel() return a QItemSelectionModel. You can use QItemSelectionModel class to check/change/other selection(s) Example: QItemSelectionModel *select = table->selectionModel(); select->hasSelection() //check if has selection select->selectedRows() // return selected row(s) select->selectedColumns() // return selected column(s) …

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)