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

How to filter Multiple column in Qtableview?

I'm using QtableView to show my logs and to filter them by column, QSortFilterProxyModel is used. If i filter one column using certain value, and with the filtered data, if i try to filter second column, last filter gets reset and data are…
Anand
  • 343
  • 1
  • 5
  • 18
8
votes
1 answer

Qt Qtableview not getting signal for header item clicking

I am using Qtableview with QsqlTableModel for populating a table data. I want to sort the column based on user selection on column header. I tried the way mentioned in QTableView sorting signal? for getting the signal (get the horizontal header from…
rafeequenk
  • 161
  • 1
  • 1
  • 4
8
votes
2 answers

PyQt4 force view to fetchMore from QAbstractItemModel

I have a QTableView that dynamically loads data from a custom model that inherits QAbstractItemModel. The model implements both fetchMore and canFetchMore. The problem is that I would like to be able to select all rows for small datasets, but if I…
Erotemic
  • 4,806
  • 4
  • 39
  • 80
8
votes
1 answer

PyQt QTableView prohibitively slow when scrolling with large data sets

I have a program that loads a profile from a csv file and displays the data in a table. The loading of a pandas data frame to the table is fast because I used a custom model implementation of QAbstractTableModel, but the resizing of the QTableView…
Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68
8
votes
2 answers

Show image in a column of QTableView from QSqlTableModel

I'm curious about how I can display an image from my database in a QTableView. Is there something like QTableWidgetItem that I am able to use it in QTableView? I use QSqlTableModel.
dare
  • 662
  • 1
  • 6
  • 15
8
votes
2 answers

Qt - Clearing QTableView's contents

I am working in Qt 4.7, and have a dialog containing (among other, unrelated things) a QTableView and a QButton. When the QButton is clicked, it must clear all the data from the QTableView. I am unsure on how to accompish this. I've looked around…
thnkwthprtls
  • 3,287
  • 11
  • 42
  • 63
8
votes
3 answers

How to color or make text bold for particular cell in QTableView?

I have used QTableView to saw tabular data in my Qt program and somehow I need to differentiate some cells from others, can be done making font bold in those particular cells or painting background of those particular cells. Can someone please…
Vijay13
  • 525
  • 2
  • 8
  • 18
8
votes
2 answers

How to Remove the Header in QTableView?

As shown in the Image below, How can i remove the unwanted header section ? My Table has to display only 4 column headers. It should not display the whole header section. Please Help to remove the Header Section which is displaying after the 4th…
New Moon
  • 787
  • 6
  • 21
  • 35
8
votes
3 answers

Qt: c++: How to create a SIGNAL/SLOT when selecting a row in QTableView

I have a QTableView which is working properly showing my model on the GUI. however, I would like to create a "SIGNAL/SLOT" that works when I select a row from the QTableView. How can I do that?
McLan
  • 2,552
  • 9
  • 51
  • 85
8
votes
2 answers

Connecting QTableView selectionChanged signal produces segfault with PyQt

I have a QTableView in a PyQt application, and I want to keep track of when the selection changes. I've tried connecting the signal to a slot as follows (using the advice on this…
robintw
  • 27,571
  • 51
  • 138
  • 205
7
votes
1 answer

Fitting columns in QTableView

In my TableModel I've two columns. This model is connected to the TableView. How can I set them up so those two columns fill the tableView so there is no free space? EDIT:
user336635
  • 2,081
  • 6
  • 24
  • 30
7
votes
1 answer

Creating popup menu in Qt for QTableView

I have a QTableView in the main UI of my program. I'd like to show popup menu when user right clicks on the cells of the table and take appropriate action when an option is selected from the menu. I am using Qt Creator 1 (Qt version 4.5). How can…
Donotalo
  • 12,748
  • 25
  • 83
  • 121
7
votes
2 answers

QTableView + QSqlTableModel - how to read id of selected row

I'm using QTableView with QSqlTableModel. In my view I don't display the column containing record id. How can I acquire id of the selected row if its not displayed in any column ? Thanks for help :)
user666491
7
votes
2 answers

QTableView with icons in rows

I have a QTableView showing rows of a database table. In this table I have a column called data type and I have icon images for each type. How can I add these icons in front of each data type? Here's a part of my code as requested by…
kasper360
  • 367
  • 2
  • 4
  • 14
7
votes
3 answers

How do I adjust a QTableView height according to contents?

In my layout, my dynamically generated QTableViews seem to get resized to only show one row. I want to have the container of the table views to have a scrollbar instead of the individual table views, which should show full contents.
savolai ᯓ
  • 666
  • 5
  • 20