parent
02d6315287
commit
f0ff236203
|
@ -18,6 +18,8 @@ Humidity::Humidity(QQuickItem *parent)
|
|||
|
||||
QskGradient gradient(QskGradient::Vertical, "#6776FF", "#6100FF");
|
||||
auto* icon = new RoundedIcon("humidity", gradient, this);
|
||||
icon->setMinimumWidth(68);
|
||||
icon->setFixedSize(68, 68); // ### fix properly
|
||||
|
||||
auto *titleAndValue = new QskLinearBox(Qt::Vertical, this);
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ IndoorTemperature::IndoorTemperature(QQuickItem *parent)
|
|||
|
||||
QskGradient gradient(QskGradient::Vertical, "#ff7d34", "#ff3122");
|
||||
auto* icon = new RoundedIcon("indoor-temperature", gradient, this);
|
||||
icon->setMinimumWidth(68);
|
||||
icon->setFixedSize(68, 68); // ### fix properly
|
||||
|
||||
auto *titleAndValue = new QskLinearBox(Qt::Vertical, this);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace {
|
|||
|
||||
m_icon = new RoundedIcon(QString(), gradient, this);
|
||||
m_icon->setOpacity(0.15);
|
||||
m_icon->setPreferredWidth(60);
|
||||
addItem(m_icon);
|
||||
|
||||
auto* textLabel = new QskTextLabel(name, this);
|
||||
|
|
|
@ -16,6 +16,8 @@ RoundedIcon::RoundedIcon(const QString& iconName, const QskGradient& gradient, Q
|
|||
setGradientHint(Panel, gradient);
|
||||
setBoxShapeHint(Panel, 6 );
|
||||
|
||||
setSizePolicy(QskSizePolicy::Minimum, QskSizePolicy::Constrained);
|
||||
|
||||
QString fileName = ":/images/" + iconName + ".png";
|
||||
|
||||
if(QFile::exists(fileName))
|
||||
|
@ -34,3 +36,11 @@ void RoundedIcon::updateLayout()
|
|||
m_graphicLabel->setPosition( { ( width() - m_graphicLabel->width() ) / 2, ( height() - m_graphicLabel->height() ) / 2 } );
|
||||
}
|
||||
}
|
||||
|
||||
QSizeF RoundedIcon::contentsSizeHint( Qt::SizeHint /*which*/, const QSizeF& size ) const
|
||||
{
|
||||
QSizeF ret = size;
|
||||
ret.setHeight( size.width() );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
|
||||
protected:
|
||||
void updateLayout() override;
|
||||
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
private:
|
||||
QString m_iconName;
|
||||
|
|
Loading…
Reference in New Issue