2022-03-02 11:24:54 +08:00
|
|
|
#ifndef PIXMAPLABEL_H
|
|
|
|
#define PIXMAPLABEL_H
|
|
|
|
|
|
|
|
#include <QSize>
|
2022-03-30 11:22:13 +08:00
|
|
|
#include "clicklabel.h"
|
2022-03-02 11:24:54 +08:00
|
|
|
|
2022-03-30 11:22:13 +08:00
|
|
|
class PixmapLabel : public ClickLabel
|
2022-03-02 11:24:54 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit PixmapLabel(QWidget *parent = nullptr);
|
|
|
|
~PixmapLabel();
|
|
|
|
|
2022-03-31 11:22:14 +08:00
|
|
|
// 应用场景一:设置深浅主题分别展示的图片
|
2022-03-02 11:24:54 +08:00
|
|
|
void setLightAndDarkPixmap(const QString &light, const QString &dark);
|
|
|
|
|
2022-03-31 11:22:14 +08:00
|
|
|
// 应用场景二:设置跟随主题风格图标,不随深浅背景色变化
|
2022-03-02 11:24:54 +08:00
|
|
|
void setUkuiIconSchema(const QString &schema, QSize size = QSize(24, 24));
|
2022-03-31 11:22:14 +08:00
|
|
|
// 应用场景三:设置跟随主题风格图标(主题中也可能不存在该图标),随深浅色背景色变化
|
2022-03-30 11:22:13 +08:00
|
|
|
void setUkuiIconSchema(const QString &schema, const QString &schemaDefault, QSize size = QSize(16, 16));
|
2022-03-02 11:24:54 +08:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_styleNameChanged(bool isDark);
|
|
|
|
void on_themeIconChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// 浅色背景时显示图
|
|
|
|
QString m_light;
|
|
|
|
// 深色背景时显示图
|
|
|
|
QString m_dark;
|
|
|
|
|
|
|
|
// 主题图标
|
|
|
|
QString m_iconTheme;
|
2022-03-30 11:22:13 +08:00
|
|
|
QString m_iconThemeDefault;
|
2022-03-02 11:24:54 +08:00
|
|
|
// 主题图标大小
|
|
|
|
QSize m_iconSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PIXMAPLABEL_H
|