forked from qt-creator/qt-creator
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:
@@ -706,18 +706,17 @@ ToggleButton::ToggleButton(QWidget *parent)
|
|||||||
|
|
||||||
QSize ToggleButton::sizeHint() const
|
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)
|
void ToggleButton::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QToolButton::paintEvent(event);
|
QToolButton::paintEvent(event);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
QStyle *s = style();
|
|
||||||
QStyleOption arrowOpt;
|
QStyleOption arrowOpt;
|
||||||
arrowOpt.initFrom(this);
|
arrowOpt.initFrom(this);
|
||||||
arrowOpt.rect = QRect(rect().center().x() - 3, rect().center().y() - 6, 9, 9);
|
arrowOpt.rect.adjust(2, 0, -1, -2);
|
||||||
s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
|
Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowUp, &p, &arrowOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user