-void SegmentedControl::drawButton (QPainter *painter,
- const QRect& rect,
- const QAction *action) {
- if (action == d->checkedAction)
- drawSelectedButton(painter, rect, action);
- else
- drawUnselectedButton(painter, rect, action);
-}
-
-void SegmentedControl::drawUnselectedButton (QPainter *painter,
- const QRect& rect,
- const QAction *action) {
- paintButton(painter, rect, action);
-}
-
-void SegmentedControl::drawSelectedButton (QPainter *painter,
- const QRect& rect,
- const QAction *action) {
- painter->save();
- painter->translate(rect.topLeft());
-
- const int width = rect.width();
- const int height = rect.height();
- const int hCenter = width * .5;
- QRadialGradient gradient(hCenter, 0,
- width,
- hCenter, 0);
- gradient.setColorAt(1, Qt::black);
- gradient.setColorAt(0, QColor(0x33, 0x33, 0x33));
- painter->fillRect(0, 0, width, height, QBrush(gradient));
-
- painter->restore();
- paintButton(painter, rect, action);
-}
-
-void SegmentedControl::paintButton(QPainter *painter, const QRect& rect, const QAction *action) {