sensible implicit size for svgs
if the icon is an svg, try to get the implicit size baked into the file, in reviewed-by:Eike Hein
This commit is contained in:
parent
7487e208b6
commit
8a42b06042
@ -93,8 +93,17 @@ void IconItem::updateImplicitSize()
|
||||
return;
|
||||
}
|
||||
} else if (m_svgIcon) { // FIXME: Check Svg::isValid()? Considered expensive by apidox.
|
||||
const QSize &s = m_svgIcon->size();
|
||||
|
||||
//resize() resets the icon to its implicit size, specified
|
||||
m_svgIcon->resize();
|
||||
QSize s;
|
||||
const QString &sourceString = m_source.toString();
|
||||
//plasma theme icon, where one file contains multiple images
|
||||
if (m_svgIcon->hasElement(sourceString)) {
|
||||
s = m_svgIcon->elementSize(sourceString);
|
||||
//normal icon: one image per file, page size is icon size
|
||||
} else {
|
||||
s = m_svgIcon->size();
|
||||
}
|
||||
if (s.isValid()) {
|
||||
setImplicitSize(s.width(), s.height());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user