[Qt-interest] setViewportMargins on QTableView
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Thu Feb 4 02:02:02 CET 2010
Hi Davor,
Why not just layout the view inside your own widget with the margins set on
that? You can switch off the frame on the view to make it look seamless.
Hope that helps,
Tony.
> -----Original Message-----
> I am currently trying to set the viewportMargins on
> QTableView. Apparently,
> QTableView calls setViewportMargins() internally, so I have
> to adjust it
> constantly in the resizeEvent() to take effect. In my search
> for how to
> implement it correctly, I read this line from the
> QAbstractScrollArea::setViewportMargins reference:
>
> "Note that this function is frequently called by QTreeView
> and QTableView,
> so margins must be implemented by QAbstractScrollArea
> subclasses. Also, if
> the subclasses are to be used in item views, they should not
> call this
> function."
>
> I do not see how this can be done. How does one subclass
> QAbstractScrollArea
> so it can be used by the QTableView. The member function is
> not virtual, so
> QTreeView will always call QAbstractScrollArea::setViewportMargins()
> internally, no matter how I implement it?
>
> Regards,
> Davor
More information about the Qt-interest-old
mailing list