mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
fix qpixmap generation
This commit is contained in:
parent
22586811de
commit
d01d8f95e5
@ -20,6 +20,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QGraphicsEllipseItem>
|
#include <QGraphicsEllipseItem>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -54,9 +55,9 @@ void GraphicalItemHelper::setParameters(const QString active,
|
|||||||
m_activePen.setBrush(QBrush(stringToColor(active)));
|
m_activePen.setBrush(QBrush(stringToColor(active)));
|
||||||
} else {
|
} else {
|
||||||
qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << active;
|
qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << active;
|
||||||
QPixmap pixmap = QPixmap(active);
|
QPixmap pixmap = QPixmap(QUrl(active).toLocalFile());
|
||||||
if (pixmap.isNull()) {
|
if (pixmap.isNull()) {
|
||||||
qCInfo(LOG_LIB) << "Invalid pixmap found" << active;
|
qCWarning(LOG_LIB) << "Invalid pixmap found" << active;
|
||||||
m_activePen.setBrush(QBrush(QColor(0, 0, 0, 130)));
|
m_activePen.setBrush(QBrush(QColor(0, 0, 0, 130)));
|
||||||
} else {
|
} else {
|
||||||
m_activePen.setBrush(QBrush(pixmap.scaled(width, height)));
|
m_activePen.setBrush(QBrush(pixmap.scaled(width, height)));
|
||||||
@ -66,9 +67,9 @@ void GraphicalItemHelper::setParameters(const QString active,
|
|||||||
m_inactivePen.setBrush(QBrush(stringToColor(inactive)));
|
m_inactivePen.setBrush(QBrush(stringToColor(inactive)));
|
||||||
} else {
|
} else {
|
||||||
qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << inactive;
|
qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << inactive;
|
||||||
QPixmap pixmap = QPixmap(inactive);
|
QPixmap pixmap = QPixmap(QUrl(inactive).toLocalFile());
|
||||||
if (pixmap.isNull()) {
|
if (pixmap.isNull()) {
|
||||||
qCInfo(LOG_LIB) << "Invalid pixmap found" << inactive;
|
qCWarning(LOG_LIB) << "Invalid pixmap found" << inactive;
|
||||||
m_inactivePen.setBrush(QBrush(QColor(255, 255, 255, 130)));
|
m_inactivePen.setBrush(QBrush(QColor(255, 255, 255, 130)));
|
||||||
} else {
|
} else {
|
||||||
m_inactivePen.setBrush(QBrush(pixmap.scaled(width, height)));
|
m_inactivePen.setBrush(QBrush(pixmap.scaled(width, height)));
|
||||||
|
Loading…
Reference in New Issue
Block a user