Hey Everyone,
I have made a QTableView subclass which I wanted to resize to fit the columns within it. Basically, I cannot for the life of me figure out what I am missing here. There are an extra 11 pixels that I need to add from some header or border or something, which remains independent of the number of columns in the QTableView. There is no vertical header
I can, live the having the 11 pixels hard coded in here if I have to, but does anyone know what these pixels are accounting for?
int TableViewCopy::maximumWidthHint()
{
int colWidth = 0;
int count = model()->columnCount();
for(int i = 0; i < count; i++)
if(!isColumnHidden(i))
colWidth += columnWidth(i);
int tableWidth =
(colWidth + // total column width
verticalScrollBar()->height() + // Need room for the vertical scrollbar
11); // Why do I need 11 pixels to make it view correctly? (Windows7x64 Aero)
return tableWidth;
}
int TableViewCopy::maximumWidthHint()
{
int colWidth = 0;
int count = model()->columnCount();
for(int i = 0; i < count; i++)
if(!isColumnHidden(i))
colWidth += columnWidth(i);
int tableWidth =
(colWidth + // total column width
verticalScrollBar()->height() + // Need room for the vertical scrollbar
11); // Why do I need 11 pixels to make it view correctly? (Windows7x64 Aero)
return tableWidth;
}
To copy to clipboard, switch view to plain text mode
Thanks in advance for your help everyone!
- Michael
Bookmarks