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
11
votes
2 answers

How to get cell value from selected row (QTableView)?

I have a QTableView and I need to the get value (string) from the first cell of the selected row (any cell on the row could be selected). But I need this value only if exactly one row was selected. I thought - I need to get index of the selected row…
Stals
  • 1,543
  • 4
  • 27
  • 52
10
votes
1 answer

Showing a Hidden QTableView Column

I'm trying to do something that seems like it should be very simple, but the more I look into it I wonder if it's a Qt bug. So, I have a QTableView that has columns that can be shown/hidden as the user likes. After I initialize the table, I call a…
Daren
  • 787
  • 2
  • 7
  • 18
10
votes
2 answers

How to trigger the edit mode of an item in a QTableView?

I'm using QTableView and QStandardItemModel now. In the QTableView, if you double-click a cell, this cell will get into edit mode and you can edit its content. Now I have a problem, I want to trigger the edit mode of an item by code (by command),…
Claire Huang
  • 961
  • 1
  • 18
  • 30
10
votes
1 answer

How to create a filter for QTableWidget?

I'm trying to create a filter for QTableWidget with QLineEdit in PySide. I've seen some tutorials using QSortFilterProxyModel for C++ but couldn't understood how to do it in Python. I need to search in 'VALUE' column.
snir.tur
  • 461
  • 3
  • 7
  • 14
10
votes
3 answers

QTableView output save as .csv or .txt

I wrote the below code for a qt gui to view the query output in a QTableView(Model oriented). now i want to save this output as a .csv or .txt file. There were suggestions to use QTableWidget(Item oriented) but I would like to stick to the model…
RicoRicochet
  • 2,249
  • 9
  • 28
  • 53
10
votes
3 answers

Qt : Fit width of TableView to width of content

I have a window that contains a QTableView which columns are adjusted to content and are fixed in width. The QTableView is nested within a QWidget that in turn is nested within a QScrollArea that in turn is nested within a tabbed QMdiArea which is…
Ilyes Ferchiou
  • 583
  • 3
  • 10
  • 22
9
votes
3 answers

Qt autocomplete QCombobox in QTableview issue

I have a QTableView which has a column with a QComboBox QItemDelegate. There is a list of completions for the combobox. When you start typing and press enter then the completion is done properly (note the capital letter) (press enter) -> But when…
Eejin
  • 770
  • 1
  • 8
  • 29
9
votes
6 answers

How to get right row height in Qt for QTableView object?

From this screenshot you can see a lot of space inside the rows: I've used these functions to get resizing: resizeRowsToContents(); resizeColumnsToContents(); How can I get a better fit for cells/rows sizes?
DragonionS
  • 183
  • 1
  • 4
  • 10
9
votes
6 answers

Determine if QTableView has an open editor

Is there any way to determine if a QTableView has an open editor in the current cell? I need to handle the following situation: A user double-clicks a cell and edits the data, but leaves the cell in the "edit" state. On another part of the UI, an…
Dave Mateer
  • 17,608
  • 15
  • 96
  • 149
9
votes
3 answers

How to open an URL in a QTableView

What is the best way to present a clickable URL in a QTableView (or QTreeView, QListView, etc...) Given a QStandardItemModel where some of the columns contain text with URLs I'd like them to become clickable and then handle the click by using…
Trey Stout
  • 6,231
  • 3
  • 24
  • 27
9
votes
2 answers

How to get list of headers of a QTableView?

I have a QTableView object in my dialog. I need to access the horizontal headers of this table and put them into a QStringList object. Despite intensive search, I could not find in Qt documentation how to get this list of headers. Edit: The closest…
thnkwthprtls
  • 3,287
  • 11
  • 42
  • 63
9
votes
2 answers

QTableView scroll to new added row

To add new rows to model I am calling beginInsertRows and endInsertRows(). How to configure the view to scroll to new added rows and select it. I can do it by sending some signals but maybe Qt has standard way for it.
Ashot
  • 10,807
  • 14
  • 66
  • 117
9
votes
1 answer

Temporarily disable UI update of a QTableView

I have a QStandardItemModel that provides data for a QTableView and a thread that inserts data into the model. Is it possible to temporarily stop the model from updating the table view, and enable it later?
daisy
  • 22,498
  • 29
  • 129
  • 265
9
votes
2 answers

Qt: QTableView how to add a row?

I have got a QTableView with data in it. What is the simplest way to add a row? Thanks!
Michael Zelensky
  • 2,012
  • 3
  • 29
  • 37
8
votes
3 answers

QTableView with a column of images

I have a QTableView to display some informations of a database in the form of a grid. One of the fields is a path to an image and I would like to display these images in my table. I tried something with a delegate, but I'm not really confortable…
Johanna
  • 1,343
  • 4
  • 25
  • 44