QTableView moving header to bottom -- possible?
-
Is there a way to move the top header bar to the bottom of a QTableView?
Thank you.
-
Hi,
AFAIK, no. What is your use case ?
-
I want to use the spreadsheet as an x/y plot, so I want the horizontal header on the bottom, not the top.
Someone elsewhere just suggested using QAbstractScrollArea::setViewportMargins() to make some space below the viewport and reimplementing resizeEvent to position the headers, but I'm still not clear how to accomplish the last part -- re-positioning the headers.
-
Shouldn't you rather use a real plot widget like what the Qwt library offers ?
-
Normally, yes absolutely. However, the plot I require is better fit to a spreadsheet -- squares filled with color, each individually selectable, with tooltips and text inside, etc.
Qwt can be bent with a lot of custom code to do this, but a spreadsheet supports it natively.
The downside of the spreadsheet is that in Qt there doesn't appear to be an easy way to move the header to the footer.
Here's an example. Notice they just use a blank row & column to re-create the header (as a footer).
!http://malcom2073.github.io/emstune/screenshots/3dtable.png(2D spreadsheet plot)!
-
So back to your header problem. You would have to add a new QHeaderView and position/resize it by hand.