void SvgItem::setSvg(Plasma::Svg *svg) { if (m_svg) { disconnect(m_svg.data(), 0, this, 0); } m_svg = svg; updateDevicePixelRatio(); if (svg) { connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded())); connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged())); connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged())); } if (implicitWidth() <= 0) { setImplicitWidth(naturalSize().width()); } if (implicitHeight() <= 0) { setImplicitHeight(naturalSize().height()); } scheduleImageUpdate(); emit svgChanged(); emit naturalSizeChanged(); }
void FrameSvgItem::setImagePath(const QString &path) { if (m_frameSvg->imagePath() == path) { return; } updateDevicePixelRatio(); m_frameSvg->setImagePath(path); m_frameSvg->setElementPrefix(m_prefix); if (implicitWidth() <= 0) { setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin)); } if (implicitHeight() <= 0) { setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin)); } emit imagePathChanged(); m_margins->update(); m_fixedMargins->update(); if (isComponentComplete()) { m_frameSvg->resizeFrame(QSizeF(width(), height())); m_textureChanged = true; update(); } }
void QMLProfile::setDevicePixelRatio(qreal dpr) { if (dpr != m_devicePixelRatio) { m_devicePixelRatio = dpr; m_profileWidget->setFontPrintScale(0.8 * dpr); updateDevicePixelRatio(dpr); emit devicePixelRatioChanged(); } }