Mercurial > trustbridge
comparison ui/textoverlaybutton.cpp @ 731:0bb54205c55a
(Issue31) Improved number formatting and refresh icon.
author | Emanuel Schuetze <emanuel@intevation.de> |
---|---|
date | Thu, 03 Jul 2014 16:13:41 +0200 |
parents | b0929968562a |
children | f6796ff72b65 |
comparison
equal
deleted
inserted
replaced
730:62af7d247430 | 731:0bb54205c55a |
---|---|
17 | 17 |
18 void TextOverlayButton::paintEvent(QPaintEvent *e) | 18 void TextOverlayButton::paintEvent(QPaintEvent *e) |
19 { | 19 { |
20 QToolButton::paintEvent(e); | 20 QToolButton::paintEvent(e); |
21 QPainter painter(this); | 21 QPainter painter(this); |
22 QRect myRect = e->rect().translated(26, -29); | |
23 | |
24 // circle | |
25 QLinearGradient gradient(myRect.topLeft(), | |
26 myRect.bottomRight()); | |
27 gradient.setColorAt(0, Qt::white); | |
28 gradient.setColorAt(0.7, Qt::red); | |
29 QBrush brush(gradient); | |
30 painter.setBrush(brush); | |
31 painter.setPen(Qt::white); | |
32 painter.drawEllipse(75.5, 6, 20, 20); | |
33 | |
34 // font | |
22 QFont font; | 35 QFont font; |
23 QRect myRect = e->rect().translated(0, 10); | 36 font.setPixelSize(11); |
24 | 37 font.setWeight(QFont::Bold); |
25 //font.setFamily("Comic Sans MS"); | |
26 | |
27 font.setPixelSize(14); | |
28 font.setWeight(QFont::DemiBold); | |
29 painter.setFont(font); | 38 painter.setFont(font); |
30 | |
31 //painter.setPen(Qt::white); | |
32 //painter.drawText(myRect.translated(1,1), Qt::AlignCenter, "20"); | |
33 painter.setPen(qApp->palette().color(QPalette::ButtonText)); | |
34 painter.drawText(myRect, Qt::AlignCenter | Qt::AlignVCenter, mOverlay); | 39 painter.drawText(myRect, Qt::AlignCenter | Qt::AlignVCenter, mOverlay); |
35 | 40 |
36 return; | 41 return; |
37 } | 42 } |