2022-12-08 14:09:33 +01:00
|
|
|
#include "IconImageProvider.h"
|
|
|
|
|
2023-08-22 16:30:38 +03:00
|
|
|
IconImageProvider::IconImageProvider(std::shared_ptr<IconList> iconList, int iconSize)
|
|
|
|
: QQuickImageProvider(QQuickImageProvider::Pixmap), m_iconList(iconList), m_iconSize(iconSize)
|
|
|
|
{}
|
2022-12-08 14:09:33 +01:00
|
|
|
|
2023-08-22 16:30:38 +03:00
|
|
|
QPixmap IconImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& requestedSize)
|
2022-12-08 14:09:33 +01:00
|
|
|
{
|
|
|
|
if (size)
|
|
|
|
*size = QSize(m_iconSize, m_iconSize);
|
|
|
|
|
|
|
|
QIcon i = m_iconList->getIcon(id);
|
2023-08-22 16:30:38 +03:00
|
|
|
return i.pixmap(requestedSize.width() > 0 ? requestedSize.width() : m_iconSize,
|
|
|
|
requestedSize.height() > 0 ? requestedSize.height() : m_iconSize);
|
2022-12-08 14:09:33 +01:00
|
|
|
}
|