Skip to content

Commit

Permalink
dev-qt/qtstyleplugins: New package
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/579880
Package-Manager: Portage-3.0.6, Repoman-3.0.1
Signed-off-by: James Le Cuirot <[email protected]>
  • Loading branch information
chewi committed Sep 30, 2020
1 parent 9b824f6 commit dbec674
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-qt/qtstyleplugins/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST qtstyleplugins-5.0.0_p20170311.tar.gz 306394 BLAKE2B a59343602062ec1d0f215acf568322a5be874552b0c03dec75f268cec2123b1baa30bee524e36c9d522a8c935a58f204b5362feaf028df87ca10ea01dd29b3fb SHA512 e8c2d0e9c6b0a47cab04ffd2e9384606638905b63a7c1580f9b629bbcc84ebff19743363ffee3dbd31c3de1dcda684211ad3052932b5aa0081e529afd9cbb14d
47 changes: 47 additions & 0 deletions dev-qt/qtstyleplugins/files/fix-build-qt5.15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From: Fabian Vogt <[email protected]>
Subject: Fix build against Qt 5.15

With 0a93db4d82c051164923a10e4382b12de9049b45
("Unify application palette handling between QGuiApplication and QApplication")
QApplicationPrivate::setSystemPalette does no longer exist.

This style does explictly not support "system colors" defined by the platform
theme, which have priority over the style provided palette. To prevent the
theme from overriding the colors, it previously used the system palette
mechanism (which has priority over the theme), but that way does not work
anymore. Instead, simply use QApplication::setPalette. While that has
different behaviour and might break in some applications, it's better than
having a completely messed up palette with certain themes.
This is the same change as suggested by gamezelda on
https://aur.archlinux.org/packages/qt5-styleplugins/#comment-749190.

Index: qtstyleplugins-opensource-src-5.0.0+git20170311/src/plugins/styles/gtk2/qgtkstyle.cpp
===================================================================
--- qtstyleplugins-opensource-src-5.0.0+git20170311.orig/src/plugins/styles/gtk2/qgtkstyle.cpp
+++ qtstyleplugins-opensource-src-5.0.0+git20170311/src/plugins/styles/gtk2/qgtkstyle.cpp
@@ -440,7 +440,11 @@ void QGtkStyle::polish(QApplication *app
// not supported as these should be entirely determined by
// current Gtk settings
if (app->desktopSettingsAware() && d->isThemeAvailable()) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QApplicationPrivate::setSystemPalette(standardPalette());
+#else
+ QApplication::setPalette(standardPalette());
+#endif
QApplicationPrivate::setSystemFont(d->getThemeFont());
d->applyCustomPaletteHash();
if (!d->isKDE4Session())
Index: qtstyleplugins-opensource-src-5.0.0+git20170311/src/plugins/styles/gtk2/qgtkstyle_p.cpp
===================================================================
--- qtstyleplugins-opensource-src-5.0.0+git20170311.orig/src/plugins/styles/gtk2/qgtkstyle_p.cpp
+++ qtstyleplugins-opensource-src-5.0.0+git20170311/src/plugins/styles/gtk2/qgtkstyle_p.cpp
@@ -508,7 +508,9 @@ void QGtkStyleUpdateScheduler::updateThe
if (oldTheme != QGtkStylePrivate::getThemeName()) {
oldTheme = QGtkStylePrivate::getThemeName();
QPalette newPalette = qApp->style()->standardPalette();
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QApplicationPrivate::setSystemPalette(newPalette);
+#endif
QApplication::setPalette(newPalette);
if (!QGtkStylePrivate::instances.isEmpty()) {
QGtkStylePrivate::instances.last()->initGtkWidgets();
11 changes: 11 additions & 0 deletions dev-qt/qtstyleplugins/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>James Le Cuirot</name>
</maintainer>
<upstream>
<remote-id type="github">qt/qtstyleplugins</remote-id>
</upstream>
</pkgmetadata>
46 changes: 46 additions & 0 deletions dev-qt/qtstyleplugins/qtstyleplugins-5.0.0_p20170311.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit qmake-utils

COMMIT="335dbece103e2cbf6c7cf819ab6672c2956b17b3"
DESCRIPTION="Additional style plugins for Qt5 (gtk2, cleanlook, plastic, motif)"
HOMEPAGE="https://github.com/qt/qtstyleplugins"
SRC_URI="https://github.com/qt/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-2.1"
SLOT="5"
KEYWORDS="~amd64"

DEPEND="
dev-qt/qtcore:5=
dev-qt/qtgui:5=
dev-qt/qtwidgets:5=
x11-libs/gtk+:2
x11-libs/libX11
x11-libs/pango
"

RDEPEND="
${DEPEND}
"

S="${WORKDIR}/${PN}-${COMMIT}"

PATCHES=(
"${FILESDIR}"/fix-build-qt5.15.patch
)

src_configure() {
eqmake5
}

src_install() {
emake INSTALL_ROOT="${D}" install
}

pkg_postinst() {
elog "To make Qt5 use the gtk2 style, set this in your environment:"
elog " QT_QPA_PLATFORMTHEME=gtk2"
}

0 comments on commit dbec674

Please sign in to comment.