Questions tagged [qtableview]

QTableView is a Qt class providing a default model/view implementation of a table view.

A QTableView implements a table view that displays items from a model. This class is used to provide standard tables that were previously provided by the QTable class, but using the more flexible approach provided by Qt's model/view architecture.

QTableView implements the interfaces defined by the QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

1244 questions
60
votes
4 answers

how to get selected rows in QTableView

After watching many threads about getting selected rows numbers, I am really confused. How do you get ROW numbers in QTableView using QStandardItemModel I used below selection model and behavior…
shett73
  • 601
  • 1
  • 5
  • 4
52
votes
4 answers

Columns auto-resize to size of QTableView

I am new to Qt and I have just managed to make a QTableView work with my model. It has fixed 3 columns. When I open a window, it look ok but when i resize the window, the QTableView itself gets resized but columns' width remains the same. Is there…
khajvah
  • 4,889
  • 9
  • 41
  • 63
50
votes
1 answer

How to select Row in QTableView?

I am new to QT, and I'm using QTableView, as shown below: On the left side of the table, Qt is automatically showing a row number, as I've noted in red. How do I get rid of these numbers? My other problem is, if I click any cell, only that cell is…
saravanan
  • 1,605
  • 6
  • 20
  • 25
46
votes
1 answer

How to set row height of QTableView?

I have QTableView and QAbstractTableModel. I require rows to have height equal to 24. I know the only way to do this is by calling QTableView::setRowHeight. Since the model is dynamic it may be added new rows, but I don't want to call setRowHeight…
Ashot
  • 10,807
  • 14
  • 66
  • 117
41
votes
2 answers

QTableWidget vs QTableView

I am new to this Model/View Framework of Qt. In my application I want to have 1000 X 1000 cells. There should be minimum memory requirement & it should be fast. I don't know what this Model terminology is for. But I have my own class which knows how…
Cool_Coder
  • 4,888
  • 16
  • 57
  • 99
40
votes
4 answers

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

Here's a print screen of my software: As you can see, the first QTableVIew headers do not take 100% of the width. In fact, there is a small vertical white space on the right of the field size. How can I get the headers to take 100% of the width of…
user2429940
34
votes
3 answers

How to make sure columns in QTableView are resized to the maximum

I'm not sure how to ask this, so, feel free to ask for more information. It seems that tableView->resizeColumnsToContents() will only resize all the columns based on data in current view. Which means that if I have more data below (which is longer…
Amree
  • 2,890
  • 3
  • 30
  • 51
31
votes
3 answers

How can I select by rows instead of individual cells in QTableView in PyQt?

In the sample code below (heavily influenced from here), I want the entire row of the clicked cell to be selected instead of the individual cell. How can I change the code to incorporate that? import re import operator import os import sys import…
c00kiemonster
  • 22,241
  • 34
  • 95
  • 133
29
votes
2 answers

QTableView has unwanted checkboxes in every cell

I'm just getting started with Qt programming, and I'm trying to make a simple tabular data layout using a QTableView control with a model class of my own creation inheriting from QAbstractTableModel. For some reason, my table view ends up looking…
Tyler McHenry
  • 74,820
  • 18
  • 121
  • 166
25
votes
5 answers

Qt: start editing of cell after one click

By default the cell in QTableView starts being edited after double click. How to change this behavior. I need it to start editing after one click. I have set combo-box delegate to the cell. When clicking the cell it only selects it. When double…
Ashot
  • 10,807
  • 14
  • 66
  • 117
24
votes
2 answers

how to add a right click menu to each cell of QTableView in PyQt

I want to add a right click menu to delete, rename or open image in each of cell of QTAbleView in the rigt click menu, I have tried and found everyone is trying to add menu to a header in tableview, i tried below but that seems not working in the…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
24
votes
1 answer

QTableView - what signal is sent when user selects a row by clicking to it?

Is there a signal which is emitted when the user selects a row in QTableView by mouse (single selection model)?
danatel
  • 4,844
  • 11
  • 48
  • 62
24
votes
3 answers

Qt hide column in QTableView

I want to hide the ID column in the QtableView and i can't do that on my implementation. Can anyone help me? void MainWindow::on_actionClear_Search_triggered() { model = new QStandardItemModel(cars.size(),6,this); //create…
laura
  • 2,085
  • 13
  • 36
  • 68
22
votes
2 answers

Qt - QTableView - Clickable button in table row

I require a button/link within a table row of a QTableView. This is to open a dialog to allow that row to be edited more efficiently. After hours of looking on the web I am yet to find a decent example. I am aware that this is likely to be done…
cweston
  • 11,297
  • 19
  • 82
  • 107
21
votes
3 answers

How to display a Pandas data frame with PyQt5/PySide2

I have a problem with the line below self.tableView.set??????????(df) that supposed to display the data frame in PyQt5. I put ??? there where I am missing the code I need. def btn_clk(self): path = self.lineEdit.text() df =…
Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
1
2 3
82 83