PDA

View Full Version : How To keep the 1st row of QTableWidget empty (Frozen Row)



powlee
7th March 2013, 15:29
Hi,
I have a little Problem with a frozen row I implemented. Reference (http://doc.qt.digia.com/stable/itemviews-frozencolumn.html).

In the 1st Row of my Table I have a number of widgets (multiSelect ComboBoxes) as input for filters to create new views. I reimplemented the frozen column example for rows and it almost works. The reason why I chose a frozen Row is: it stays in place while scrolling, and it doesn't change position when sorting is enabled.

The problem is that the frozen Row covers the 1st line of my data in the table. So how can I leave the 1st row of my QTableWidget empty while sorting is enabled?

thx for any help

wysota
8th March 2013, 01:08
You can move the whole viewport down by subclassing and reimplementing resize event for the table and using setViewportMargins() to enlarge the distance between top of the table and the viewport and reposition the header so that there is the header, then some empty space (for the frozen row) and then the viewport. You can also place the frozen row there directly to have everything embedded in a single widget.

powlee
8th March 2013, 12:30
thanks this sounds good. If you are not to busy would you mind giving me a small example/snippet of how to do so? Much appreciated.