Core: Improved layout of the progress toggle button

Horizontally centered. Vertically less unbalanced. And now also it also
works nicely in High-Dpi mode.

Change-Id: Ie02794fcda251c054f4f0a24b1f14f8f5a8e8847
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
Alessandro Portale
2014-07-28 18:16:53 +02:00
parent d1a8347e65
commit da41de929e

View File

@@ -706,18 +706,17 @@ ToggleButton::ToggleButton(QWidget *parent)
QSize ToggleButton::sizeHint() const
{
return QSize(12, 12);
return QSize(13, 12); // Uneven width, because the arrow's width is also uneven.
}
void ToggleButton::paintEvent(QPaintEvent *event)
{
QToolButton::paintEvent(event);
QPainter p(this);
QStyle *s = style();
QStyleOption arrowOpt;
arrowOpt.initFrom(this);
arrowOpt.rect = QRect(rect().center().x() - 3, rect().center().y() - 6, 9, 9);
s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
arrowOpt.rect.adjust(2, 0, -1, -2);
Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowUp, &p, &arrowOpt);
}