From fd4b388975fedb3b908585a5c6524c9d5013fcdd Mon Sep 17 00:00:00 2001 From: Max-Wilhelm Bruker Date: Sat, 17 Oct 2009 20:59:34 +0200 Subject: [PATCH] prettier ping widget --- cockatrice/src/window_main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index a92f440e..3e78a110 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -39,19 +39,24 @@ #include "chatwidget.h" PingWidget::PingWidget(QWidget *parent) - : QWidget(parent), color(Qt::black) + : QWidget(parent) { + setPercentage(0, -1); } QSize PingWidget::sizeHint() const { - return QSize(10, 10); + return QSize(15, 15); } void PingWidget::paintEvent(QPaintEvent */*event*/) { QPainter painter(this); - painter.fillRect(0, 0, width(), height(), color); + QRadialGradient g(QPointF((double) width() / 2, (double) height() / 2), qMin(width(), height()) / 2.0); + g.setColorAt(0, color); + g.setColorAt(1, Qt::transparent); + painter.setBrush(QBrush(g)); + painter.setPen(Qt::black); } void PingWidget::setPercentage(int value, int max)