mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-13 12:22:05 +08:00
新增SpkIconButton为主题和按钮工作减负
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QSlider>
|
||||
#include <QProgressBar>
|
||||
#include "spkappitem.h"
|
||||
#include "spkstretchlayout.h"
|
||||
#include "page/spkpageappdetails.h"
|
||||
#include "spkiconbutton.h"
|
||||
|
||||
#include "spkloading.h"
|
||||
|
||||
@@ -40,6 +42,8 @@ namespace SpkUi
|
||||
QGroupBox *Group;
|
||||
QSlider *SlideH;
|
||||
QSlider *SlideV;
|
||||
SpkIconButton *IconBtn;
|
||||
QProgressBar *Prog;
|
||||
SpkLoading *Loading;
|
||||
SpkAppItem *AppItem;
|
||||
SpkStretchLayout *DetailsLay;
|
||||
|
||||
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
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QPointer>
|
||||
#include <QTimeLine>
|
||||
#include "spkfocuslineedit.h"
|
||||
#include "spkiconbutton.h"
|
||||
#include "page/spkpageuitest.h"
|
||||
#include "page/spkpageapplist.h"
|
||||
#include "page/spkpageappdetails.h"
|
||||
@@ -144,7 +145,7 @@ namespace SpkUi
|
||||
QVBoxLayout *VLaySidebar;
|
||||
QHBoxLayout *HLaySideTop;
|
||||
QLabel *StoreIcon;
|
||||
QPushButton *BtnSettings, *BtnFeedback, *BtnLogs, *BtnDayNight;
|
||||
SpkIconButton *BtnSettings, *BtnFeedback, *BtnLogs, *BtnDayNight;
|
||||
SpkSidebarTree *CategoryWidget;
|
||||
QMap<int, QTreeWidgetItem> *CategoryItemMap;
|
||||
SpkSidebarSelector *SidebarMgr;
|
||||
@@ -184,7 +185,7 @@ class SpkMainWindow : public SpkWindow
|
||||
mCategoryAppListGetReply,
|
||||
mAppDetailsGetReply;
|
||||
SpkUi::SpkStackedPages mCurrentPage = SpkUi::PgInvalid;
|
||||
QList<QPair<QPushButton*, QString>> mThemedUiIconReferences;
|
||||
QList<QPair<SpkIconButton*, QString>> mThemedUiIconReferences;
|
||||
|
||||
public slots:
|
||||
void ReloadThemedUiIcons();
|
||||
|
||||
@@ -39,7 +39,9 @@ namespace SpkUi
|
||||
extern UiMetaObject SpkUiMetaObject;
|
||||
extern SpkUiStyle CurrentStyle;
|
||||
extern QString StylesheetBase, CurrentStylesheet;
|
||||
extern QColor ColorLine, ColorBack;
|
||||
extern QColor ColorLine, ColorBack,
|
||||
ColorBtnMaskUnselected, ///< SpkIconButton icon mask colors, unselected & selected
|
||||
ColorBtnMaskSelected;
|
||||
extern QSize PrimaryScreenSize;
|
||||
extern SpkDtkPlugin *DtkPlugin;
|
||||
extern QStyle *OldSystemStyle;
|
||||
|
||||
Reference in New Issue
Block a user