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
7
votes
3 answers

Resize Vertical Header of QTableView in PyQt4?

I need to reduce the size of first column(the column with vertical headers) How can I resize a vertical header of QTableView in PyQt4? I have very large headers and small GUI block to show this table so, please help me! I am able to resize all the…
learncode
  • 1,105
  • 4
  • 18
  • 36
7
votes
1 answer

Cannot connect (null)::selectionChanged to QTableView

I have the following promoted QTableView: class QRightClickableTableView : public QTableView { Q_OBJECT public: explicit QRightClickableTableView(QWidget *parent = 0): QTableView(parent) {} private slots: void mouseReleaseEvent(QMouseEvent…
user2411693
  • 533
  • 4
  • 14
7
votes
3 answers

QSortFilterProxyModel filtering complete signal

I'm using a custom QSortFilterProxyModel to implement custom filtering for QTableView by overriding filterAcceptsRow(). How can my application be notified when I change the filtering criteria and after filterAcceptsRow() is applied on the whole…
Mohamed
  • 265
  • 3
  • 6
7
votes
1 answer

Set initial text when editing a QTableView cell

I've subclassed QAbstractTableModel and overrode the flags() method so that some of the table cells are editable. The problem is that when I start editing, the existing cell value is erased. I would like to initially have the existing cell value…
bdforbes
  • 1,486
  • 1
  • 13
  • 31
7
votes
2 answers

How to display a simple QMap in a QTableView in Qt?

I have a QMap called map. I initialize this map with couple of row of data from my database. Now I send this map to another class which contain GUI classes. In my GUI I have a TableView item. I need to show this map in any order in this TableView.…
Bernard
  • 4,240
  • 18
  • 55
  • 88
7
votes
1 answer

Search/Find functionality in QTableView

I have a QWidget and inside that, there is a QTableView. I need to have a find functionality on the first column of the table, so when I click on Ctrl+F, a find dialog will pop-up. class Widget(QWidget): def __init__(self,md,parent=None): …
Orcl User
  • 293
  • 1
  • 5
  • 20
7
votes
2 answers

Best strategy to update QTableView with data in real-time from different threads

I have application that for now starting few threads ( like 5 – 10 ) to collect data from different source . They are separated from the main GUI thread so I don’t feel any slowness in the GUI and I can keep working while the background threads are…
user63898
  • 29,839
  • 85
  • 272
  • 514
7
votes
1 answer

QTableView drag move rows

I'm using a QTableView with a QAbstractTableModel and a QSortFilterProxyModel so that I can sort the items by clicking on the table headers. I'd like to add the option for the user to sort the rows in the view manually, by dragging them. I don't…
user672033
7
votes
6 answers

checkbox and itemdelegate in a tableview

I'm doing an implementation of a CheckBox that inherits from QitemDelegate, to put it into a QTableView. the problem is that I get when inserted flush left and I need it centered. As I understand the method that is responsible for the Paint. I have…
jackajack
  • 153
  • 1
  • 1
  • 11
6
votes
1 answer

Qt QTableView draw border around active cells

I'm trying to implement behavior similar Excel in a QTableView, where a border is painted around the entire current selection. I have tried this what feels like a hundred different ways and keep getting problems. I can draw the border easily…
buck
  • 1,502
  • 1
  • 20
  • 23
6
votes
1 answer

How do I call dataChanged

The following is my add a row class. It is called by the code, not the table and I want it to properly call dataChanged when a new row is added, although this isn't working, the table doesn't do anything. What am I doing wrong? void…
Will03uk
  • 3,346
  • 8
  • 34
  • 40
6
votes
1 answer

QAbstractTableModel editing without clearing previous data in cell

I have created a model based off of QAbstractTableModel that allows the user to edit data in that model. The model is displayed in a QTableView in a QMainWindow. So far in my model I am able to make the cells editable, and save whatever the user…
DaveK
  • 658
  • 8
  • 21
6
votes
2 answers

QTableView Selecion Change

Been googling around for some time on this one but I can't seem to find anything. Need the signal for QTableView on a selection change. Tried tbl_view.itemSelectionChanged.connect(self.select_row) but the compiler complains this doesn't exist. I…
Elcid_91
  • 1,571
  • 4
  • 24
  • 50
6
votes
2 answers

QTableView + QAbstractTableModel: Move rows via drag'n'drop

I have a simple QAbstractTableModel-based model and a QTableView for it. My aim is simple as well: allow to move/reorder rows via drag'n'drop. Notes: D'n'd changes inside QTableView should be reflected in my model; D'n'd supposed to be internal -…
Nikolai Shalakin
  • 1,349
  • 2
  • 13
  • 25
6
votes
4 answers

Row, deleted from model, stays in view, what am I doing wrong?

I have QTableView, filled by QSqlRelationalTableModel. Changes should be committed or reverted on button hit. When I edit some row, it changes state in the view when editing finishes, and succesfully commits changes to DB when submitAll()…
Maxim Popravko
  • 4,100
  • 3
  • 29
  • 43