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

QWidget update events but no visual update

Using Qt4.8 on a Mint Linux 12, I implemented a simple window containing a QTableView to show contents of a model. The model data is continually updated (log messages) and the dataChanged() signal is emitted on a regular basis (i.e. every…
arne
  • 4,514
  • 1
  • 28
  • 47
5
votes
1 answer

How to update QAbstractTableModel and QTableView after sorting the data source?

I have a custom data structure that I want to display in a PyQt application using a QTableView. I'm using a subclass of QAbstractTableModel to communicate with the data. The data structure itself is in a separate module and knows nothing about…
Nick Ulle
  • 409
  • 5
  • 14
5
votes
1 answer

HowTo create model/view QTableView with custom (non-editable) delegates?

Here is what I'm trying to get ( this is a QTableView widget + MVC based on QAbstractTableModel with multiply delegates ): Notes: Delegates a not working as editors, they are ONLY viewers! I'm not getting to edit model with this table…
mosg
  • 12,041
  • 12
  • 65
  • 87
5
votes
2 answers

In PyQt5 how do I properly move rows in a QTableView using Drag&Drop

I (simply) want to be able to use a QTableViews Drag&Drop mechanism to move existing rows. I found lots of sources (e.g. here, here or here) which describe some aspects of dragging, dropping, inserting etc. but I'm still struggling to make it work…
frans
  • 8,868
  • 11
  • 58
  • 132
5
votes
2 answers

How to align text in a header of QTableView in Qt using only CSS?

I tried the CSS code: QTableView QHeaderView::section { text-align: center; } And it did not help me. PS I write the SCADA system in the WinCC OA that uses Qt, and there you can change the appearance of components only using CSS
Max Lich
  • 221
  • 2
  • 10
5
votes
1 answer

Modify cells in QTableView PYQT5

I would like to modify any cell (except header) within given QTableView. Here below is my original code that does not allow for any changes: import sys import csv from datetime import datetime, timedelta import calendar from PyQt5.QtWidgets import…
New2coding
  • 715
  • 11
  • 23
5
votes
1 answer
5
votes
1 answer

PyQt: How to adjust QTableView header-size/column-width

I am trying to set the header-size or column-width as described in this link. The problems are: table.horizontalHeader().setStretchLastSection(True) is ok but not optimal self.produktKaufTb.setColumnWidth(1,…
Georg Gutsche
  • 452
  • 4
  • 9
  • 17
5
votes
2 answers

How to inject widgets between QHeaderView and QTableView?

I would like to display widgets between the QHeaderView and the rest of the QTableView, like in the example picture below (created with Photoshop), as this seems like a natural way to enable input for filtering columns. Does anybody have any ideas…
timmwagener
  • 2,368
  • 2
  • 19
  • 27
5
votes
1 answer

QTableView: interactive column resize without QHeaderView

I have a QTableView with a hidden horizontal header table->horizontalHeader()->hide(); As you can see, the text in the central column is clipped because of the column width. To view the text, the user would need to resize the column, but without a…
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213
5
votes
2 answers

How to prevent Qt from alpha-blending the selection over icons in QListView?

I have a Qt application that uses a QTableView and a QListView. In both witdgets I display some icons. The problem is that when the user selects one of the entries Qt alpha blends the selection over the icons making the icons appear with less…
ahe
  • 2,319
  • 1
  • 19
  • 22
5
votes
5 answers

Copy/Paste multiple items from QTableView in pyqt4?

We can select multiple items(partial rows and partial columns) from QTableView using self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection), but after selecting some rows and columns(partial and partial) if I do CTRL+C and paste it in…
learncode
  • 1,105
  • 4
  • 18
  • 36
5
votes
0 answers

How to get current column and its sorting direction of QTableView

This code creates a single QTableView. Clicking the column displays the arrow that indicates the direction of column sorting. Clicking the tableView's item itself prints out the clicked index. When the tableView item is clicked I want to know what…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
5
votes
1 answer

paintEvent in QTableView derived class: Paint device returned engine == 0, type: 1

As a follow up of Qt load indicator by animated image (aka preloader) or alternative? I try to paint inside a QTableView. But when I initialize the QPainter I get the following warnings. QWidget::paintEngine: Should no longer be…
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
5
votes
1 answer

how to set precision and alignment for displaying numeric values in QTableView

What would be the easiest way to set fixed format to display numeric values in QTableView? I need to format as currency - so always show decimal part separator and 2 digits after it. Possibly align righ, maybe append a currency name. Right now it…
murison
  • 3,640
  • 2
  • 23
  • 36