I'm working off the itemviews/pixelator example that is provided by Qt, and I'm having trouble making the subclassed QTableView appear in it's proper size. My impression was that changing line 144 of mainwindow.cpp to adjustSize(); would make everything fit right, but it doesn't. This is despite the delegate returns a 12x12 pixel size for its sizeHint(), and the model returns proper column and row counts.

I searched on the issue, and saw that one would need to implement the sizeHint() method for the subclasses QTableView object. Fair enough, I did so. While the situation is better now, for some reason the QTableView widget is shown smaller that it should be, and is thus surrounded by scrollbars still. for example when the delegate returns 12x12 for sizeHint(), and the model reports 40 rows and 40 columns, the overloaded sizeHint() returns 480x480 pixels appropriately - but the widget itself is actually crancked into what seems to be about 480x455 (including the scrollbars), or 460x440 visible inside the scrollbars.

what is going wrong here? what else should be done, besides overriding sizeHint()?