Gui: Add BitmapFactory::empty method

This adds empty(QSize) method to bitmap factory that creates empty
pixmap. This may seem useless, but after creating bitmap one needs to
remember to clear it and to properly set DPR - BitmapFactory will take
care of it.
This commit is contained in:
Kacper Donat
2025-06-04 22:02:49 +02:00
committed by Chris Hennes
parent 2a7498c930
commit 83b2027395
3 changed files with 17 additions and 4 deletions

View File

@@ -521,6 +521,17 @@ QPixmap BitmapFactoryInst::disabled(const QPixmap& p) const
return QApplication::style()->generatedIconPixmap(QIcon::Disabled, p, &opt);
}
QPixmap BitmapFactoryInst::empty(QSize size) const
{
qreal dpr = getMaximumDPR();
QPixmap res(size * dpr);
res.fill(Qt::transparent);
res.setDevicePixelRatio(dpr);
return res;
}
void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const
{
SbVec2s size;