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
0
votes
1 answer

Data Entry for a QTableView with QSqlTableModel

I have a basic QTableView displaying data from an SQLite table with QSqlTableModel. Data entry is done by the parent dialog having a number of widgets representing the field data and an "Add" button. Data removal is done via a "Remove selected rows"…
Tim Jones
  • 307
  • 3
  • 11
0
votes
1 answer

How to emit a signal when cell/item is edited?

I have a method that imports a table from a DB into a QTableWidget, and I want to edit a cell in the DB through the QTableWidget (when editing a cell by double-clicking it). I have tried to use the QTableWidget::cellChanged() signal, but the problem…
Skogen
  • 721
  • 1
  • 11
  • 30
0
votes
1 answer

How to resize the widget that hold a QTableView?

I have a QTableView inside a layout itself inside a Widget. How I can set the Widget size after the call of tableView.resizeColumnsToContents() in order to have the same size of the table (and does not need a scrollbar ) Thanks
nam
  • 3,542
  • 9
  • 46
  • 68
0
votes
1 answer

QTableView/custom table model: set text color in header

My custom table model derives from QAbstractTableModel and is then displayed in a QTableView. Looks like this: I would like to change the text color for certain row headers, which can be decided in the model. Is it possible to color certain headers…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
1 answer

Qt - How to expand or Collapse my QTableView

I have a QTableView with some items in it. If i click on any row, that particular row has to expand with some QPushButtons in it. I had attached the screen shot of it. How can i achieve this? Need ur help. Thanks in Advance.
New Moon
  • 787
  • 6
  • 21
  • 35
0
votes
1 answer

How to set the different QLineEdit Text in a TableView

I have 3 QLineEdits (say Name, Address & Phone No.), a QPushButton (Add button) and a QTableView. When I have entered text in all the QLineEdits, and if I click the Add button, all 3 texts of the QLineEdits should be added in the first row of the…
New Moon
  • 787
  • 6
  • 21
  • 35
0
votes
1 answer

Trouble getting `QWidget* editor` for a `QModelIndex`

I am having trouble augmenting the default edit behavior of QTableView. I want the following behavior when the Enter key is pressed: Start editing the current cell if it is not already being edited. If the cell is being edited, 2a. commit the data…
wsaleem
  • 594
  • 8
  • 25
0
votes
1 answer

QTableView - add named row

Im using a using a QTableView in conjuction with table model derived from QAbstaractTableModel. Now I want to insert rows/columns (which represent states/input chars) but I need to pass a string as a label (which is then shown in the HeaderView) for…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
1 answer

QTableView closes immediately

I tried to use QTableView in a program. I've already fixed all bugs I got in the model in another testproject I started. Now, I tried to insert the model and the QTableView in my mainproject, but in contrast to the other project, the QTableView…
VRTuomi
  • 27
  • 7
0
votes
1 answer

Qt QAbstractModel: remove checkbox

I started to learn Qt, and I would like to implement a table filled with data via QTableView. My problem is, that I don't know how to remove the checkboxes from the cells. It seems like they are put in by default. However, I read that I had to…
VRTuomi
  • 27
  • 7
0
votes
1 answer

How to check/uncheck a QTableView and trigger setData()

I have a custom QTableModel which I'm displaying using QTableView in PyQt. I have some fields set as checkable, and I want to add check all and check none buttons. I feel there should be a way to cause the setData() to be called from the code in…
Andrew Ring
  • 3,185
  • 1
  • 23
  • 28
0
votes
1 answer

PyQt Table Header Context Menu

I am working on a QTableView displaying a custom model subclasses from QAbstractTableModel in PyQt4. I need to be able to allow the user to set which column they want to serve as a specific type of data. To achieve this I want to implement a…
Andrew Ring
  • 3,185
  • 1
  • 23
  • 28
0
votes
1 answer

return number of selected row in QTableView

I have the following code: model = new QStandardItemModel(); channel = new QTableView(this); channel->setModel(model); model->setData(model->index(d,0,QModelIndex()), 0…
jackajack
  • 153
  • 1
  • 1
  • 11
0
votes
1 answer

How to manipulate a pointer to TableView model?

When it´s necessary manipulate a model of a TableView, it's necessary to get this model using the function tableView->model() . But, this returns a pointer to an QAbstractItem, and it's necessary one to a QAbstractModel. So... I convert, using a…
0
votes
1 answer

how to add a column with checkbox in qtableview with model is qsqlmodel?

I want to add a column with checkbox in qtableview with model is qsqlmodel.The model already had query, and qtableview should display the checkbox in the firstcolumn.I try all the solution in google, but failed.Any help is welcome.
coolboymark
  • 203
  • 1
  • 3
  • 9