aboutsummaryrefslogtreecommitdiff
path: root/x11-themes
diff options
context:
space:
mode:
authorAdriaan de Groot <adridg@FreeBSD.org>2020-10-09 09:32:08 +0000
committerAdriaan de Groot <adridg@FreeBSD.org>2020-10-09 09:32:08 +0000
commit16ffd4b114ef54dd2b3f7881e78911b60f8af979 (patch)
tree97ae8722ed4acfd261b612a39c29c0165e01bdac /x11-themes
parentaf172d54047abbe3fa0e77799ac2f1327264d197 (diff)
downloadports-16ffd4b114ef54dd2b3f7881e78911b60f8af979.tar.gz
ports-16ffd4b114ef54dd2b3f7881e78911b60f8af979.zip
Notes
Diffstat (limited to 'x11-themes')
-rw-r--r--x11-themes/kf5-qqc2-desktop-style/Makefile2
-rw-r--r--x11-themes/kf5-qqc2-desktop-style/files/patch-git-015891bf58b5f96ae142920bba48b92fe31ea0e4.patch116
2 files changed, 117 insertions, 1 deletions
diff --git a/x11-themes/kf5-qqc2-desktop-style/Makefile b/x11-themes/kf5-qqc2-desktop-style/Makefile
index bb87a50162a3..0ad97458e720 100644
--- a/x11-themes/kf5-qqc2-desktop-style/Makefile
+++ b/x11-themes/kf5-qqc2-desktop-style/Makefile
@@ -2,7 +2,7 @@
PORTNAME= qqc2-desktop-style
DISTVERSION= ${KDE_FRAMEWORKS_VERSION}
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= x11-themes kde kde-frameworks
MAINTAINER= kde@FreeBSD.org
diff --git a/x11-themes/kf5-qqc2-desktop-style/files/patch-git-015891bf58b5f96ae142920bba48b92fe31ea0e4.patch b/x11-themes/kf5-qqc2-desktop-style/files/patch-git-015891bf58b5f96ae142920bba48b92fe31ea0e4.patch
new file mode 100644
index 000000000000..426cb069ffc5
--- /dev/null
+++ b/x11-themes/kf5-qqc2-desktop-style/files/patch-git-015891bf58b5f96ae142920bba48b92fe31ea0e4.patch
@@ -0,0 +1,116 @@
+Add support for qrc icons to StyleItem
+
+BUG: 427449
+
+diff --git plugin/kquickstyleitem.cpp plugin/kquickstyleitem.cpp
+index b1cf5b1..f280661 100644
+--- plugin/kquickstyleitem.cpp
++++ plugin/kquickstyleitem.cpp
+@@ -179,14 +179,8 @@ void KQuickStyleItem::initStyleOption()
+ QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption);
+ opt->text = text();
+
+- const QVariant icon = m_properties[QStringLiteral("icon")];
+- if (icon.canConvert<QIcon>()) {
+- opt->icon = icon.value<QIcon>();
+- } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) {
+- opt->icon = QIcon(icon.value<QUrl>().toLocalFile());
+- } else if (icon.canConvert<QString>()) {
+- opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>());
+- }
++ opt->icon = iconFromIconProperty();
++
+ auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt());
+ if (iconSize.isEmpty()) {
+ int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr);
+@@ -303,12 +297,9 @@ void KQuickStyleItem::initStyleOption()
+
+ opt->activeSubControls = QStyle::SC_ToolButton;
+ opt->text = text();
+- const QVariant icon = m_properties[QStringLiteral("icon")];
+- if (icon.canConvert<QIcon>()) {
+- opt->icon = icon.value<QIcon>();
+- } else if (icon.canConvert<QString>()) {
+- opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>());
+- }
++
++ opt->icon = iconFromIconProperty();
++
+ auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt());
+ if (iconSize.isEmpty()) {
+ int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr);
+@@ -483,8 +474,7 @@ void KQuickStyleItem::initStyleOption()
+ QStyleOptionMenuItem::NonExclusive;
+ }
+ }
+- if (m_properties[QStringLiteral("icon")].canConvert<QIcon>())
+- opt->icon = m_properties[QStringLiteral("icon")].value<QIcon>();
++ opt->icon = iconFromIconProperty();
+ setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool());
+
+ const QFont font = qApp->font(m_itemType == ComboBoxItem ?"QComboMenuItem" : "QMenu");
+@@ -507,14 +497,8 @@ void KQuickStyleItem::initStyleOption()
+ opt->state |= QStyle::State_NoChange;
+ opt->text = text();
+
+- const QVariant icon = m_properties[QStringLiteral("icon")];
+- if (icon.canConvert<QIcon>()) {
+- opt->icon = icon.value<QIcon>();
+- } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) {
+- opt->icon = QIcon(icon.value<QUrl>().toLocalFile());
+- } else if (icon.canConvert<QString>()) {
+- opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>());
+- }
++ opt->icon = iconFromIconProperty();
++
+ auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt());
+ if (iconSize.isEmpty()) {
+ int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr);
+@@ -742,6 +726,35 @@ void KQuickStyleItem::initStyleOption()
+
+ }
+
++QIcon KQuickStyleItem::iconFromIconProperty() const
++{
++ QIcon icon;
++ const QVariant iconProperty = m_properties[QStringLiteral("icon")];
++ switch(iconProperty.type()){
++ case QVariant::Icon:
++ icon = iconProperty.value<QIcon>();
++ break;
++ case QVariant::Url:
++ case QVariant::String: {
++ QString iconSource = iconProperty.toString();
++ if (iconSource.startsWith(QLatin1String("qrc:/"))) {
++ iconSource = iconSource.mid(3);
++ } else if (iconSource.startsWith(QLatin1String("file:/"))) {
++ iconSource = QUrl(iconSource).path();
++ }
++ if (iconSource.contains(QLatin1String("/"))) {
++ icon = QIcon(iconSource);
++ } else {
++ icon = m_theme->iconFromTheme(iconSource, m_properties[QStringLiteral("iconColor")].value<QColor>());
++ }
++ }
++ break;
++ default:
++ break;
++ }
++ return icon;
++}
++
+ const char* KQuickStyleItem::classNameForItem() const
+ {
+ switch(m_itemType) {
+diff --git plugin/kquickstyleitem_p.h plugin/kquickstyleitem_p.h
+index 5dbfebf..80c0958 100644
+--- plugin/kquickstyleitem_p.h
++++ plugin/kquickstyleitem_p.h
+@@ -256,6 +256,7 @@ protected:
+ bool eventFilter(QObject *watched, QEvent *event) override;
+
+ private:
++ QIcon iconFromIconProperty() const;
+ const char* classNameForItem() const;
+ QSize sizeFromContents(int width, int height);
+ qreal baselineOffset();