From f02d4e5d98783c5bf3487dfaf05caf567751f65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sun, 13 Aug 2023 10:38:49 +0200 Subject: [PATCH] Make BusyIndicator size configurable --- custom_widgets/yacreader_busy_widget.cpp | 9 +++++---- custom_widgets/yacreader_busy_widget.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/custom_widgets/yacreader_busy_widget.cpp b/custom_widgets/yacreader_busy_widget.cpp index 9b86df33..a4cb77f4 100644 --- a/custom_widgets/yacreader_busy_widget.cpp +++ b/custom_widgets/yacreader_busy_widget.cpp @@ -23,10 +23,11 @@ void YACReaderBusyWidget::paintEvent(QPaintEvent *event) painter.drawPixmap(0, 0, width(), height(), QPixmap(":/images/busy_background.png")); } -BusyIndicator::BusyIndicator(QWidget *parent) +BusyIndicator::BusyIndicator(QWidget *parent, int size) : QWidget(parent), startAngle(0), - m_style(StyleArc) + m_style(StyleArc), + size(size) { QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Fixed); policy.setHeightForWidth(true); @@ -177,10 +178,10 @@ void BusyIndicator::paintEvent(QPaintEvent *) QSize BusyIndicator::minimumSizeHint() const { - return QSize(30, 30); + return QSize(size, size); } QSize BusyIndicator::sizeHint() const { - return QSize(30, 30); + return QSize(size, size); } diff --git a/custom_widgets/yacreader_busy_widget.h b/custom_widgets/yacreader_busy_widget.h index 0b6cd5de..83a32c27 100644 --- a/custom_widgets/yacreader_busy_widget.h +++ b/custom_widgets/yacreader_busy_widget.h @@ -20,7 +20,7 @@ public: StyleEllipse, StyleArc }; - explicit BusyIndicator(QWidget *parent = 0); + explicit BusyIndicator(QWidget *parent = 0, int size = 30); void paintEvent(QPaintEvent *); QSize minimumSizeHint() const; @@ -47,6 +47,7 @@ private: IndicatorStyle m_style; QColor fillColor; + int size; }; #endif // BUSYINDICATOR_H