Questions tagged [qheaderview]

A QHeaderView is a class from the Qt Toolkit which provides a header row or header column for item views.

A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. It uses Qt's model/view architecture for consistency with the other item view classes.

The header gets the data for each section from the underlying model. Each header has an orientation and a number of sections. A section refers to a part of the header - either a row or a column, depending on the orientation. The sections can be moved and resized, and can also be hidden and shown.

Each section of a header is described by a specified section ID, and can be located at a particular visual index in the header. A section can have a sort indicator, which indicates whether the items in the associated item view will be sorted in the order given by the section.

For horizontal headers, the section is equivalent to a column in the model, and for vertical headers, the section is equivalent to a row in the model.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

101 questions
10
votes
2 answers

PyQt:How do i set different header sizes for individual headers?

I have a list containing lists with two items,a word and a number.This list will be presented using a tablewidget. My aim is to produce a table with two columns and with the neccessary rows,but the header of the column which will have the words…
IordanouGiannis
  • 4,149
  • 16
  • 65
  • 99
8
votes
2 answers

PyQt: removing QTreeView columns

I am using QTreeView with QFileSystemModel. It displays columns like Size, Type, Modification Date, which I don't need. How can I remove them from the view? I can't find any removeColumn in model or in view.
gruszczy
  • 40,948
  • 31
  • 128
  • 181
7
votes
3 answers

Resize Vertical Header of QTableView in PyQt4?

I need to reduce the size of first column(the column with vertical headers) How can I resize a vertical header of QTableView in PyQt4? I have very large headers and small GUI block to show this table so, please help me! I am able to resize all the…
learncode
  • 1,105
  • 4
  • 18
  • 36
6
votes
1 answer

How to make a QheaderView multilevel?

I am creating an application that saves the data of an object sending service. I created that with Qt, a model of type QStandardItemModel that I want to display with QtableView. But QtableView shows me the line level on the left. I want to delete…
weird.ly
  • 185
  • 1
  • 7
6
votes
1 answer

PyQt5 : how to Sort a QTableView when you click on the headers of a QHeaderView?

I want to sort a QTableView when I click on the headers of my QHeaderView. I've found a several code sample on the internet like this one: Sort QTableView in pyqt5 but it doesn't work for me. I also look in the Rapid Gui programming Book from…
BillyBoom
  • 191
  • 2
  • 14
6
votes
1 answer

How to set a Header to a QListView

I am having a QListView which has 5 items in it. say(America, Canada, Denmark, Egypt, Finland) in my QListView. Now i want to set a common Header for all this items as COUNTRIES. How can i set a Header to a QListView. Please Help.
New Moon
  • 787
  • 6
  • 21
  • 35
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
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
1 answer

What does QHeaderView::paintSection do such that all I do to the painter before or after is ignored

This question is further development of this post and is different, though may seem similar as this one. I am trying to reimplement QHeaderView::paintSection, so that the background returned from the model would be honored. I tried to do this void…
Serge
  • 1,027
  • 14
  • 21
5
votes
1 answer

Spanning horizontal header in Qt

I want to merge(span) horizontal headers in QTableWidget. I tried googling for the same, but no luck and hence posting it. Please guide me.
user3480065
  • 53
  • 1
  • 5
5
votes
1 answer

Adding Vertical headers to a QTreeView

I have a QTreeView subclass (and QAbstractItemModel subclass) which has a nice horizontal header. I would like to add vertical headers (going down the left side) to match. But unlike QTableView which has separate vertical (setVerticalHeader()) and…
Adam Batkin
  • 51,711
  • 9
  • 123
  • 115
4
votes
2 answers

QHeaderView has no horizontal lines in Windows 10

QTableWidget headers have no horizontal lines in Windows 10. How can I fix it?
Ufx
  • 2,595
  • 12
  • 44
  • 83
4
votes
4 answers

How do I add a header with data to a QTableWidget in Qt?

I'm still learning Qt and I am indebted to the SO community for providing me with great, very timely answers to my Qt questions. Thank you. I'm quite confused on the idea of adding a header to a QTableWidget. What I'd like to do is have a table that…
San Jacinto
  • 8,774
  • 5
  • 43
  • 58
4
votes
4 answers

Different tooltips at each header in QTableView

I can add a single tooltip to all headers using tableview = QTableView() tableview.horizontalHeader().setToolTip("headers") but can I add different tooltips to each header, i.e. I need to access the QWidgets that contains the headers, e.g. (not…
Mads M Pedersen
  • 579
  • 6
  • 16
1
2 3 4 5 6 7