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
21
votes
4 answers

Qt/C++: Getting the data at a certain cell in a QTableView

I'm trying to get the text at a certain cell in a QTableView. For example: QString codestring = "*" + ui->tblInventory->indexAt(QPoint(0,2)).data().toString() + "*"; This should get the text at the cell in column 0 row 2 in my QTableView. The…
Joseph
  • 12,678
  • 19
  • 76
  • 115
20
votes
2 answers

How to sort a QTableView by a column?

I am using the QTableView to display a QAbstractTableModel: #include #include #include class TestModel : public QAbstractTableModel { public: int rowCount(const QModelIndex &parent =…
Martin Drozdik
  • 12,742
  • 22
  • 81
  • 146
19
votes
3 answers

Qt Using Custom QItemDelegate for QTableView

I followed the Spin Box Delegate tutorial, which Qt provides, to try to implement my own QItemDelegate. It would be used to specify a QComboBox to represent data in a QTableView cell but it is not working. My biggest problem is that I don't know…
arnm
  • 1,705
  • 2
  • 19
  • 30
19
votes
2 answers

How to set data inside a QAbstractTableModel

I need to implement a table with Qt. I believe I'll be suing a QAbstractTableModel, with a QTableView using this model. I understand I'll have to edit the rowCount(), columnCount(), and data() functions of the model. However, I don't understand how…
user1173240
  • 1,455
  • 2
  • 23
  • 50
18
votes
2 answers

PySide + QTableView example

Can anyone point me to a simple example of QTableView in PySide? I found the QTableView docs but unfortunately they don't give an example, and I'm very new to PySide, so I don't even know how to start. (I am very familiar with the JTable in Java…
Jason S
  • 184,598
  • 164
  • 608
  • 970
18
votes
4 answers

How to create filters for QTableView in PyQt

I am using QTableView to display data retrieved from QtSql.QSqlQuery I want to know how can i create filters for it like in excel. In the above image i need to get the filters for All heders (Sh_Code,SH_Seq,Stage) The filters will have unique…
Rao
  • 2,902
  • 14
  • 52
  • 70
18
votes
12 answers

Selected Rows in QTableView, copy to QClipboard

I have a SQLite-Database and I did it into a QSqlTableModel. To show the Database, I put that Model into a QTableView. Now I want to create a Method where the selected Rows (or the whole Line) will be copied into the QClipboard. After that I want to…
Berschi
  • 2,605
  • 8
  • 36
  • 51
17
votes
2 answers

Qt QTableView how to have a checkbox only column

We are using a QTableView with Qt 4.6.3, and need a column that only has a checkbox in each cell. We're using a custom subclass of QAbstractTableModel as the model for the QTableView. Right now, we have a checkbox by setting the…
David Burson
  • 2,947
  • 7
  • 32
  • 55
17
votes
2 answers

How to change the header background color of a QTableView

The following is what I've currently tried. The header text changes color correctly but the background will not change from the default. template inline QVariant TableModel::headerData(int section, Qt::Orientation orientation, int…
andre
  • 7,018
  • 4
  • 43
  • 75
16
votes
3 answers

How to retrieve the selected row(s) of a QTableView?

I'm using the QTableView class with this model: class PaletteTableModel(QtCore.QAbstractTableModel): def __init__(self,colors = [[]],headers =[],parent=None): QtCore.QAbstractTableModel.__init__(self, parent) …
Haussem ChƏdly
  • 249
  • 2
  • 4
  • 11
16
votes
1 answer

QTableView: How can I get the data when user click on a particular cell using mouse

Actually I am new to Qt and unable to match up QMouseEvent with QTableview please help in solving this issue.
ShivaPrasad Gadapa
  • 193
  • 1
  • 2
  • 10
16
votes
1 answer

Change order of columns in QTableView

I wanted to know how we can change the order of columns in QtableView by dragging ? I currently have a class derived from FilterProxyModel as source to QtableView. I am using QT 4.8
MistyD
  • 16,373
  • 40
  • 138
  • 240
15
votes
1 answer

How to select QTableView row with one click

When one of the QTableView's QModelIndex is clicked I want to select an entire row of the same-row-indexes. To accomplish this I connect QTableView's clicked signal to a custom viewClicked() method which receives the clicked QModelIndex…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
15
votes
3 answers

PyQt: Adding rows to QTableView using QAbstractTableModel

I am super new to Qt programming. I am trying to make a simple table that can have rows added by clicking a button. I can implement the table fine but can't seem to get the updated data to show on the table. I believe my problem stems from the fact…
user3439556
  • 153
  • 1
  • 1
  • 5
14
votes
4 answers

How to make a fast QTableView with HTML-formatted and clickable cells?

I'm making a dictionary program that displays word definitions in a 3-column QTableView subclass, as user types them, taking data from a QAbstractTableModel subclass. Something like that: I want to add various formatting to the text, I'm using…
Xilexio
  • 1,178
  • 19
  • 40
1
2
3
82 83