Changeset View
Changeset View
Standalone View
Standalone View
plugin/kquickstyleitem.cpp
Show First 20 Lines • Show All 203 Lines • ▼ Show 20 Line(s) | 203 | if (!m_styleoption) | |||
---|---|---|---|---|---|
204 | m_styleoption = new QStyleOptionButton(); | 204 | m_styleoption = new QStyleOptionButton(); | ||
205 | 205 | | |||
206 | QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption); | 206 | QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption); | ||
207 | opt->text = text(); | 207 | opt->text = text(); | ||
208 | 208 | | |||
209 | const QVariant icon = m_properties[QStringLiteral("icon")]; | 209 | const QVariant icon = m_properties[QStringLiteral("icon")]; | ||
210 | if (icon.canConvert<QIcon>()) { | 210 | if (icon.canConvert<QIcon>()) { | ||
211 | opt->icon = icon.value<QIcon>(); | 211 | opt->icon = icon.value<QIcon>(); | ||
212 | } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) { | ||||
213 | opt->icon = QIcon(icon.value<QUrl>().toLocalFile()); | ||||
212 | } else if (icon.canConvert<QString>()) { | 214 | } else if (icon.canConvert<QString>()) { | ||
213 | opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); | 215 | opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); | ||
214 | } | 216 | } | ||
215 | auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); | 217 | auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); | ||
216 | if (iconSize.isEmpty()) { | 218 | if (iconSize.isEmpty()) { | ||
217 | int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); | 219 | int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); | ||
218 | if (iconSize.width() <= 0) { | 220 | if (iconSize.width() <= 0) { | ||
219 | iconSize.setWidth(e); | 221 | iconSize.setWidth(e); | ||
▲ Show 20 Lines • Show All 1531 Lines • Show Last 20 Lines |