Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] QTableView - keep 1st column fixed size and non-scrollable
I have a QTableView with 10 columns. I want to keep the 1st column size fixed and non-scrollable (similar to the column 0 showing row count). How can i do this ?
Thanks a lot.
p91paul last edited by
if you don't need column 0(row count), you can write column 1 in the vertical header (just like you do while changing column names), showing it in place of row numbers. (or you can subclass your model and override headerData() function to show 1st column instead of row numbers.
If you need both row numbers and first column, I think you have to subclass QTableView, but I can't help you in this task.
Thanks for replying. I need both the columns.
giesbert last edited by
By default it is not possible (see "this":http://developer.qt.nokia.com/forums/viewthread/5358/ and "this":http://developer.qt.nokia.com/forums/viewthread/1978/ thread). I think there was an example on how to achieve a fixed column on the left by using two widgets in combination... But I don't recognize where...
This is the link http://doc.qt.nokia.com/latest/itemviews-frozencolumn.html
It worked in my application.