Skip to content

Commit

Permalink
fix icon oblate, shrink icon to have spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
sonichy committed Jan 9, 2019
1 parent d3049b1 commit 2e15c40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion weatherplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void WeatherPlugin::invokedMenuItem(const QString &itemKey, const QString &menuI

void WeatherPlugin::MBAbout()
{
QMessageBox aboutMB(QMessageBox::NoIcon, "HTYWeather 5.3", "About\n\nDeepin Linux Dock Weather Plugin.\nAuthor: 黄颖\nE-mail: [email protected]\nSource: https://github.com/sonichy/WEATHER_DDE_DOCK\nAPI: https://openweathermap.org/forecast5");
QMessageBox aboutMB(QMessageBox::NoIcon, "HTYWeather 5.3.1", "About\n\nDeepin Linux Dock Weather Plugin.\nAuthor: 黄颖\nE-mail: [email protected]\nSource: https://github.com/sonichy/WEATHER_DDE_DOCK\nAPI: https://openweathermap.org/forecast5");
aboutMB.setIconPixmap(QPixmap(":/icon/Default/01d.png"));
aboutMB.exec();
}
Expand Down
10 changes: 5 additions & 5 deletions weatherwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#include "weatherwidget.h"
#include <QApplication>
#include <QPainter>
#include <QDebug>
//#include <QSvgRenderer>
#include <QMouseEvent>

#define PLUGIN_STATE_KEY "enable"
Expand Down Expand Up @@ -56,11 +54,13 @@ void WeatherWidget::paintEvent(QPaintEvent *e)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
painter.setPen(Qt::white);
if (displayMode == Dock::Efficient) {
painter.setPen(Qt::white);
painter.drawText(rect(), Qt::AlignCenter, sw + "\n" + temp);
} else {
painter.drawPixmap(rect(), pixmap);
int w = qMin(width(), height());
pixmap = pixmap.scaled(w*0.8, w*0.8, Qt::KeepAspectRatio, Qt::SmoothTransformation);
painter.drawPixmap(rect().center() - pixmap.rect().center(), pixmap);
}
}

Expand All @@ -77,4 +77,4 @@ void WeatherWidget::mousePressEvent(QMouseEvent *e)
}

QWidget::mousePressEvent(e);
}
}

0 comments on commit 2e15c40

Please sign in to comment.