mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
使主题色依照DDE主题色改变
因为AUTOMOC不会在编译主程序的时候再对插件接口类进行MOC,所以需要在主程序内加一份一模一样的插件接口类定义。
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
#include <DGuiApplicationHelper>
|
||||
#include <DPlatformWindowHandle>
|
||||
#include <DPlatformTheme>
|
||||
#include "spkdtkplugin_impl.h"
|
||||
|
||||
using Dtk::Widget::DPlatformWindowHandle;
|
||||
|
||||
void SpkDtkPluginImpl::Initialize()
|
||||
{
|
||||
connect(DGuiApplicationHelper::instance()->systemTheme(),
|
||||
&DPlatformTheme::activeColorChanged,
|
||||
this,
|
||||
&SpkDtkPluginImpl::AccentColorChanged);
|
||||
}
|
||||
|
||||
void SpkDtkPluginImpl::addWindow(QWidget *w, QObject *parent)
|
||||
{
|
||||
DPlatformWindowHandle *h = new DPlatformWindowHandle(w, parent);
|
||||
Q_UNUSED(h);
|
||||
}
|
||||
|
||||
QColor SpkDtkPluginImpl::GetAccentColor()
|
||||
{
|
||||
return DGuiApplicationHelper::instance()->systemTheme()->activeColor();
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class SpkDtkPlugin
|
||||
class SpkDtkPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual ~SpkDtkPlugin() = default;
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
virtual void addWindow(QWidget* w, QObject* parent) = 0;
|
||||
virtual QColor GetAccentColor() = 0;
|
||||
|
||||
signals:
|
||||
void AccentColorChanged(QColor);
|
||||
};
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_INTERFACE(SpkDtkPlugin, "org.spark-store.client.dtkplugin")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QtPlugin>
|
||||
#include "spkdtkplugin.h"
|
||||
|
||||
class SpkDtkPluginImpl : public QObject, SpkDtkPlugin
|
||||
class SpkDtkPluginImpl : public SpkDtkPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.spark-store.client.dtkplugin")
|
||||
@@ -13,4 +13,6 @@ class SpkDtkPluginImpl : public QObject, SpkDtkPlugin
|
||||
|
||||
public:
|
||||
void addWindow(QWidget* w, QObject* parent) override;
|
||||
void Initialize() override;
|
||||
QColor GetAccentColor() override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user