dde-dock/frame/item/components/multiquickitem.h
donghualin 9ebbd85dde fix: 修复快捷面板没有自动刷新图标的问题
在快捷面板图标中增加updateShow方法,在插件更新的时候,调用该方法来更新界面

Log:
Influence: 执行快捷面板中的截图图标,观察图标是否发生变化
Task: https://pms.uniontech.com/task-view-220599.html
Change-Id: I252fdd4f562e7da4d6a8033ae0ce5ddbb5b233f3
2022-11-28 17:31:27 +08:00

76 lines
1.9 KiB
C++

/*
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: donghualin <donghualin@uniontech.com>
*
* Maintainer: donghualin <donghualin@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MULTIQUICKITEM_H
#define MULTIQUICKITEM_H
#include <quicksettingitem.h>
class QuickIconWidget;
class MultiQuickItem : public QuickSettingItem
{
Q_OBJECT
public:
MultiQuickItem(PluginsItemInterface *const pluginInter, QWidget *parent = nullptr);
~MultiQuickItem() override;
void updateShow() override;
QuickSettingType type() const override;
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
void initUi();
QString expandFileName() const;
private:
QuickIconWidget *m_iconWidget;
QLabel *m_nameLabel;
QLabel *m_stateLabel;
};
/**
* @brief The QuickIconWidget class
* 图标的Widget
*/
class QuickIconWidget : public QWidget
{
Q_OBJECT
public:
explicit QuickIconWidget(PluginsItemInterface *pluginInter, const QString &itemKey, QWidget *parent = Q_NULLPTR);
protected:
void paintEvent(QPaintEvent *event) override;
private:
QColor foregroundColor() const;
QPixmap pluginIcon(bool contailGrab = false) const;
private:
PluginsItemInterface *m_pluginInter;
QString m_itemKey;
};
#endif // MULTIQUICKITEM_H