PDA

View Full Version : Qt SDK 1.2.1: QTreeView: scrollbars always visible after setting its columns' width



agarny
12th November 2012, 13:12
Hi, I am using Qt SDK 1.2.1 (i.e. Qt 4.8.1) with MSVC on Windows and, in my application, I keep track of the width of the different columns I have in a QTreeView object.

Now, say that I start my application, resize the columns to be of the width I want, and then make sure that the scrollbars are not necessary (and therefore not visible). Say then that I close my application (thus having the width of my QTreeView object's columns saved using QSettings) and restart it. Upon restarting, my application will retrieve the aforementioned widths and set them as my QTreeView object's columns' width.

The result is as expected on Linux and OS X, i.e. my QTreeView object's columns are of the correct size and none of the scrollbars are visible. On Windows, the columns are properly resized too, but the scrollbars are also visible while there is, in effect, no need for them.

Could it be that I missed something very obvious somewhere or is there really something 'wrong' with QTreeView on Windows? Right now, I am using a hack to get what I consider to be the expected behaviour (I decrease the width of the last column thus preventing the scrollbars from being considered necessary), but I really don't like having to do that.

Anyway, as always, any help with this would be much appreciated...

Cheers, Alan.