mirror of
https://gitee.com/spark-store-project/spark-web-app-runtime.git
synced 2025-09-19 01:32:22 +08:00
https://github.com/qutebrowser/qutebrowser/issues/4840 启动时判断 DTK 主题颜色,QTWEBENGINE_CHROMIUM_FLAGS 环境变量添加 --blink-settings=preferredColorScheme=0 启用深色模式(或 --force-dark-mode)(Qt >= 5.14,当前仅 Deepin 支持) Log: 支持启动时识别 DTK 主题颜色,判断网页是否需要显示为深色模式
48 lines
870 B
C++
48 lines
870 B
C++
#ifndef WIDGET_H
|
|
#define WIDGET_H
|
|
|
|
#include <DSpinner>
|
|
#include <DGuiApplicationHelper>
|
|
|
|
#include <QWidget>
|
|
#include <QWebEnginePage>
|
|
#include <QStackedLayout>
|
|
|
|
DWIDGET_USE_NAMESPACE
|
|
DGUI_USE_NAMESPACE
|
|
|
|
class WebEngineView;
|
|
class Widget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Widget(QString szUrl = nullptr, QWidget *parent = nullptr);
|
|
~Widget();
|
|
|
|
QWebEnginePage *getPage();
|
|
void goBack();
|
|
void goForward();
|
|
void refresh();
|
|
|
|
private:
|
|
void initUI();
|
|
void initConnections();
|
|
void updateLayout();
|
|
|
|
private slots:
|
|
void on_loadStarted();
|
|
void on_loadFinished();
|
|
|
|
void slotPaletteTypeChanged(DGuiApplicationHelper::ColorType paletteType);
|
|
|
|
private:
|
|
WebEngineView *m_webEngineView = nullptr;
|
|
DSpinner *m_spinner = nullptr;
|
|
QStackedLayout *mainLayout = nullptr;
|
|
|
|
QString m_szUrl;
|
|
};
|
|
|
|
#endif // WIDGET_H
|