Make the YACReaderBusyWidget customizable (color)

This commit is contained in:
luisangelsm
2026-01-14 15:52:11 +01:00
parent 721da42c8c
commit 1cb2f50057
2 changed files with 16 additions and 4 deletions

View File

@ -9,10 +9,15 @@ YACReaderBusyWidget::YACReaderBusyWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
setFixedSize(70, 70); setFixedSize(70, 70);
BusyIndicator *busy = new BusyIndicator(this); busyIndicator = new BusyIndicator(this);
busy->setIndicatorStyle(BusyIndicator::StyleArc); busyIndicator->setIndicatorStyle(BusyIndicator::StyleArc);
busy->setColor(Qt::white); busyIndicator->setColor(Qt::white);
busy->move(20, 20); busyIndicator->move(20, 20);
}
void YACReaderBusyWidget::setColor(QColor color)
{
busyIndicator->setColor(color);
} }
BusyIndicator::BusyIndicator(QWidget *parent, int size) BusyIndicator::BusyIndicator(QWidget *parent, int size)
@ -48,6 +53,7 @@ void BusyIndicator::setIndicatorStyle(IndicatorStyle style)
void BusyIndicator::setColor(QColor color) void BusyIndicator::setColor(QColor color)
{ {
fillColor = color; fillColor = color;
update();
} }
BusyIndicator::IndicatorStyle BusyIndicator::indicatorStyle() const BusyIndicator::IndicatorStyle BusyIndicator::indicatorStyle() const

View File

@ -4,11 +4,17 @@
#include <QTimer> #include <QTimer>
#include <QWidget> #include <QWidget>
class BusyIndicator;
class YACReaderBusyWidget : public QWidget class YACReaderBusyWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit YACReaderBusyWidget(QWidget *parent = 0); explicit YACReaderBusyWidget(QWidget *parent = 0);
void setColor(QColor color);
private:
BusyIndicator *busyIndicator;
}; };
class BusyIndicator : public QWidget class BusyIndicator : public QWidget