PDA

View Full Version : Showing a Hidden QTableView Column



dchow
15th June 2011, 21:12
I'm trying to do something that seems like it should be very simple, but the more I look into it I wonder if it's a Qt bug.

So, I have a QTableView that has columns that can be shown/hidden as the user likes. After I initialize the table, I call a custom restoreColumns() method that hides the columns (using QTableView::hideColumn()) that the user had hidden the last time the GUI was open.

The problem then comes when the user tries to show the columns that were hidden by the user the last time the GUI was ran. The appropriate signal/slot gets called and run through but for some reason the QTableView isn't updating to display the column.

What's weird is that any column that is already displayed (was not hidden by the user the last time the GUI was ran) has no problems with getting hidden/shown.

Any thoughts? Thanks!

dchow
16th June 2011, 01:11
Okay - I figured it out... It looks like in my restoreColumns() method the width of some of the hidden columns is 0. So basically make sure that that doesn't happen when restoring the width!