mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 12:52:04 +08:00
新增SpkIconButton为主题和按钮工作减负
This commit is contained in:
30
inc/spkiconbutton.h
Normal file
30
inc/spkiconbutton.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef SPKICONBUTTON_H
|
||||
#define SPKICONBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include "spkui_general.h"
|
||||
|
||||
class SpkIconButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpkIconButton(QWidget *parent = nullptr);
|
||||
~SpkIconButton() {};
|
||||
|
||||
void SetIcon(QIcon, QSize);
|
||||
void SetIcon(QPixmap);
|
||||
void SetIconSize(QSize);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
|
||||
private:
|
||||
static enum { Dark, Light } sCurrentTheme;
|
||||
QPixmap mPmapPaintedIcon;
|
||||
QSize mPmapSize;
|
||||
|
||||
static constexpr int IconMargin = 8; // shall we make it changable?
|
||||
};
|
||||
|
||||
#endif // SPKICONBUTTON_H
|
||||
Reference in New Issue
Block a user