Skip to content

Commit

Permalink
Fix busy indicator in hdpi
Browse files Browse the repository at this point in the history
  • Loading branch information
luisangelsm committed Aug 26, 2023
1 parent dea3d0a commit c5800d9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
11 changes: 2 additions & 9 deletions custom_widgets/yacreader_busy_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ YACReaderBusyWidget::YACReaderBusyWidget(QWidget *parent)
busy->move(20, 20);
}

void YACReaderBusyWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.drawPixmap(0, 0, width(), height(), QPixmap(":/images/busy_background.png"));
}

BusyIndicator::BusyIndicator(QWidget *parent, int size)
: QWidget(parent),
startAngle(0),
Expand Down Expand Up @@ -167,13 +159,14 @@ void BusyIndicator::paintEvent(QPaintEvent *)
.arg(m_style);

QPixmap pixmap;
pixmap.setDevicePixelRatio(devicePixelRatioF());
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);

int side = qMin(width(), height());

if (!QPixmapCache::find(key, &pixmap)) {
pixmap = generatePixmap(side);
pixmap = generatePixmap(side * devicePixelRatioF());
QPixmapCache::insert(key, pixmap);
}

Expand Down
1 change: 0 additions & 1 deletion custom_widgets/yacreader_busy_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class YACReaderBusyWidget : public QWidget
Q_OBJECT
public:
explicit YACReaderBusyWidget(QWidget *parent = 0);
void paintEvent(QPaintEvent *);
};

class BusyIndicator : public QWidget
Expand Down
Binary file removed images/busy_background.png
Binary file not shown.

0 comments on commit c5800d9

Please sign in to comment.