[Qt-interest] setViewportMargins on QTableView

Davor J. DavorJ at live.com
Wed Feb 3 08:35:24 CET 2010


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