From bea47db64326c562554edcf2b39b25bbc0f29d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 4 Feb 2024 17:58:15 +0100 Subject: [PATCH] Update powerkit_dialog.cpp --- src/powerkit_dialog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/powerkit_dialog.cpp b/src/powerkit_dialog.cpp index de4e077..f8632aa 100644 --- a/src/powerkit_dialog.cpp +++ b/src/powerkit_dialog.cpp @@ -869,6 +869,7 @@ void Dialog::drawBattery() QString batteryTime = QDateTime::fromTime_t(onBattery ? Client::timeToEmpty(dbus) : Client::timeToFull(dbus)).toUTC().toString("hh:mm"); QColor colorBg = Qt::green; QColor colorFg = Qt::white; + QString status = QString("%1%\n%2").arg(QString::number(battery), batteryTime); if (onBattery) { if (battery >= 51) { colorBg = Qt::yellow; @@ -878,14 +879,17 @@ void Dialog::drawBattery() colorBg = Qt::red; } } else { - if (battery == 100) { colorFg = Qt::green; } + if (battery == 100) { + colorFg = Qt::green; + status = QString("%1%").arg(QString::number(battery)); + } } batteryStatusLabel->setPixmap(Theme::drawCircleProgress(battery, 64, 4, 4, true, - QString("%1%\n%2").arg(QString::number(battery), batteryTime), + status, colorBg, colorFg)); }