<table><tr><td style="">masonm created this revision.<br />masonm added reviewers: VDG, Kirigami, mart.<br />masonm added a project: Kirigami.<br />masonm requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D27225">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>PlatformTheme::qmlAttachedProperties is currently not looking for static KirigamiPluginFactory plugins. This change will search for static plugins for static builds, otherwise it will search shared object plugins.</p>
<p>It also includes a fix for missing QIcon header.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Register a custom, static KirigamiPluginFactory plugin using Q_IMPORT_PLUGIN and verify the attached properties work as expected. For example, regardless of what the style is set to when building with KIRIGAMI_BUILD_TYPE_STATIC below the theme should load with bright-green components:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">// In main.cpp
#ifdef KIRIGAMI_BUILD_TYPE_STATIC
#include <kirigami/src/kirigamiplugin.h>
#include <KirigamiThemes/Default/defaulttheme.h>
Q_IMPORT_PLUGIN(DefaultThemeFactory)
#endif
int main(int argc, char argv[]) {
// ...
#ifdef KIRIGAMI_BUILD_TYPE_STATIC
KirigamiPlugin::registerTypes();
#endif
// ...
}
// In KirigamiThemes/Default/defaulttheme.h
#ifndef DEFAULTTHEME_H
#define DEFAULTTHEME_H
#include "../KirigamiThemes_global.h"
#include <KirigamiPluginFactory>
class KIRIGAMITHEMES_EXPORT DefaultTheme : public Kirigami::PlatformTheme
{
Q_OBJECT
QPalette lightPalette;
public:
explicit DefaultTheme(QObject* parent = nullptr);
};
class KIRIGAMITHEMES_EXPORT DefaultThemeFactory
: public Kirigami::KirigamiPluginFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID KirigamiPluginFactory_iid)
Q_INTERFACES(Kirigami::KirigamiPluginFactory)
public:
explicit DefaultThemeFactory(QObject* parent = nullptr)
: Kirigami::KirigamiPluginFactory(parent)
{
}
Kirigami::PlatformTheme *createPlatformTheme(QObject *parent) override;
};
#endif
// In KirigamiThemes/Default/defaulttheme.cpp
#include "defaulttheme.h"
DefaultTheme::DefaultTheme(QObject* parent) : Kirigami::PlatformTheme(parent)
{
for (auto group : {QPalette::Active, QPalette::Inactive, QPalette::Disabled}) {
lightPalette.setColor(group, QPalette::WindowText, "#00FF00");
lightPalette.setColor(group, QPalette::Window, "#00FF00");
lightPalette.setColor(group, QPalette::Base, "#00FF00");
lightPalette.setColor(group, QPalette::Text, "#00FF00");
lightPalette.setColor(group, QPalette::Button, "#00FF00");
lightPalette.setColor(group, QPalette::ButtonText, "#00FF00");
lightPalette.setColor(group, QPalette::Highlight, "#00FF00");
lightPalette.setColor(group, QPalette::HighlightedText, "#00FF00");
lightPalette.setColor(group, QPalette::ToolTipBase, "#00FF00");
lightPalette.setColor(group, QPalette::ToolTipText, "#00FF00");
lightPalette.setColor(group, QPalette::Link, "#00FF00");
lightPalette.setColor(group, QPalette::LinkVisited, "#00FF00");
}
setTextColor(lightPalette.color(QPalette::Active, QPalette::WindowText));
setBackgroundColor(lightPalette.color(QPalette::Active, QPalette::Window));
setHighlightColor(lightPalette.color(QPalette::Active, QPalette::Highlight));
setHighlightedTextColor(lightPalette.color(QPalette::Active, QPalette::HighlightedText));
setLinkColor(lightPalette.color(QPalette::Active, QPalette::Link));
setVisitedLinkColor(lightPalette.color(QPalette::Active, QPalette::LinkVisited));
}
Kirigami::PlatformTheme *DefaultThemeFactory::createPlatformTheme(QObject *parent)
{
return new DefaultTheme(parent);
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R169 Kirigami</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27225">https://phabricator.kde.org/D27225</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/libkirigami/platformtheme.cpp<br />
src/libkirigami/platformtheme.h</div></div></div><br /><div><strong>To: </strong>masonm, VDG, Kirigami, mart<br /><strong>Cc: </strong>plasma-devel, fbampaloukas, GB_2, domson, dkardarakos, ngraham, apol, ahiemstra, davidedmundson, mart, hein<br /></div>