Gui: add overloaded method pixmapFromSvg() to pass the device pixel ratio of a widget
This commit is contained in:
@@ -285,7 +285,7 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const
|
||||
}
|
||||
|
||||
QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSizeF& size,
|
||||
const std::map<unsigned long, unsigned long>& colorMapping) const
|
||||
const ColorMap& colorMapping) const
|
||||
{
|
||||
// If an absolute path is given
|
||||
QPixmap icon;
|
||||
@@ -321,8 +321,18 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSizeF& size,
|
||||
return icon;
|
||||
}
|
||||
|
||||
QPixmap BitmapFactoryInst::pixmapFromSvg(const char* name, const QSizeF& size, qreal dpr,
|
||||
const ColorMap& colorMapping) const
|
||||
{
|
||||
qreal width = size.width() * dpr;
|
||||
qreal height = size.height() * dpr;
|
||||
QPixmap px(pixmapFromSvg(name, QSizeF(width, height), colorMapping));
|
||||
px.setDevicePixelRatio(dpr);
|
||||
return px;
|
||||
}
|
||||
|
||||
QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& originalContents, const QSizeF& size,
|
||||
const std::map<unsigned long, unsigned long>& colorMapping) const
|
||||
const ColorMap& colorMapping) const
|
||||
{
|
||||
QString stringContents = QString::fromUtf8(originalContents);
|
||||
for ( const auto &colorToColor : colorMapping ) {
|
||||
|
||||
Reference in New Issue
Block a user