dde-dock/plugins/onboard/onboarditem.h
donghualin a1748e3ca1 fix: 调整插件的尺寸
调整任务栏插件尺寸

Log: 调整插件尺寸
Influence: 观察任务栏插件是否对齐
Task: https://pms.uniontech.com/task-view-222353.html
Change-Id: I30b9e1b1862fd9ba5ff3a2a931cd73204ead4292
2023-01-12 13:54:06 +08:00

57 lines
1.6 KiB
C++

/*
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: listenerri <listenerri@gmail.com>
*
* Maintainer: listenerri <listenerri@gmail.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 ONBOARDITEM_H
#define ONBOARDITEM_H
#include "constants.h"
#include <QWidget>
#include <QIcon>
class OnboardItem : public QWidget
{
Q_OBJECT
public:
explicit OnboardItem(QWidget *parent = nullptr);
QPixmap iconPixmap(int iconWidth, int iconHeight) const;
protected:
void paintEvent(QPaintEvent *e) override;
private:
const QPixmap loadSvg(const QString &fileName, const QSize &size) const;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void leaveEvent(QEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
private:
Dock::DisplayMode m_displayMode;
bool m_hover;
bool m_pressed;
QIcon m_icon;
};
#endif // ONBOARDITEM_H