forked from qt-creator/qt-creator
Axivion: Avoid sort indicator overlapping column text
If the column is too narrow we may overlap the text of the column header. Explicitly clear the area before painting the icon. Change-Id: If73c1e2cc66c21dd9ffa41710873faa654bf235e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -144,7 +144,15 @@ void IssueHeaderView::paintSection(QPainter *painter, const QRect &rect, int log
|
|||||||
const int margin = style()->pixelMetric(QStyle::PM_HeaderGripMargin, nullptr, this);
|
const int margin = style()->pixelMetric(QStyle::PM_HeaderGripMargin, nullptr, this);
|
||||||
const QIcon icon = iconForSorted(logicalIndex == m_currentSortIndex ? m_currentSortOrder : SortOrder::None);
|
const QIcon icon = iconForSorted(logicalIndex == m_currentSortIndex ? m_currentSortOrder : SortOrder::None);
|
||||||
const int offset = qMax((rect.height() - ICON_SIZE), 0) / 2;
|
const int offset = qMax((rect.height() - ICON_SIZE), 0) / 2;
|
||||||
const QRect iconRect(rect.left() + rect.width() - ICON_SIZE - margin, offset, ICON_SIZE, ICON_SIZE);
|
const int left = rect.left() + rect.width() - ICON_SIZE - margin;
|
||||||
|
const QRect iconRect(left, offset, ICON_SIZE, ICON_SIZE);
|
||||||
|
const QRect clearRect(left, 0, ICON_SIZE + margin, rect.height());
|
||||||
|
painter->save();
|
||||||
|
QStyleOptionHeader opt;
|
||||||
|
initStyleOption(&opt);
|
||||||
|
opt.rect = clearRect;
|
||||||
|
style()->drawControl(QStyle::CE_Header, &opt, painter, this);
|
||||||
|
painter->restore();
|
||||||
icon.paint(painter, iconRect);
|
icon.paint(painter, iconRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user