[Qt-interest] QHeaderView::sectionSizeFromContents bug?
Kamil Klimek
naresh at tlen.pl
Tue Jan 11 08:51:30 CET 2011
Hi there. I've found a ?bug? in sectionSizeFromContents. I think, that adding space for drop indicator icon in QHeaderView is wrong. It should be done by QStyle subclass. Why's that? Because in Vista style, sort indicator is put (in horizontal mode) above the text, so it doesn't require space on the right of the text. It requires bigger modification of code. First of all it requires QStyleOptionHeaderV2, where you should put field isSortIndicatorShown, and than QStyle should or should not add required space for it. I'm writing here to consult this case mostly with Trolls, but any contribution would be realy nice. As for me it looks like look'n'feel bug. If I'll find some time, I'll try to clone current Qt repository and create patch for it.
QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const
{
...
// here's code responsible for this "look'n'feel bug"
// QHeaderView takes responsibility for something that QStyle derived class should do.
if (isSortIndicatorShown()) {
int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this);
if (d->orientation == Qt::Horizontal)
size.rwidth() += size.height() + margin;
else
size.rheight() += size.width() + margin;
}
return size;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110111/6b1334ca/attachment.html
More information about the Qt-interest-old
mailing list