#include "RoundedIcon.h" #include #include #include #include RoundedIcon::RoundedIcon(const QString& iconName, const QskGradient& gradient, QQuickItem* parent) : QskBox(parent) , m_iconName(iconName) , m_gradient(gradient) { setPanel(true); setPolishOnResize( true ); setGradientHint(Panel, gradient); setBoxShapeHint(Panel, 6 ); QString fileName = ":/images/" + iconName + ".png"; if(QFile::exists(fileName)) { QImage image( fileName ); auto graphic = QskGraphic::fromImage( image ); m_graphicLabel = new QskGraphicLabel( graphic, this ); } } void RoundedIcon::updateLayout() { if(m_graphicLabel) { m_graphicLabel->setSize( {36, 36}); m_graphicLabel->setPosition( { ( width() - m_graphicLabel->width() ) / 2, ( height() - m_graphicLabel->height() ) / 2 } ); } }