添加商店内弹出窗消息

使用SpkUiMessage::SendStoreNotification激活,必须在SpkStore构造函数加载完全局SpkPopup类之后才可
使用。
This commit is contained in:
RigoLigoRLC
2021-07-20 15:15:37 +08:00
parent e3c43198b9
commit 99083d2bcb
12 changed files with 126 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ namespace SpkUi
mLastCheckedBtn = nullptr;
}
else
// QUESTIONABLE:
// NOTE:
// Apparently for checkable buttons, Qt flip their checked property AFTER
// this slot function. So to prevent a checkable button being unchecked,
// we set it to unchecked here. Qt will flip it back to checked later.

View File

@@ -7,6 +7,7 @@
#include <QCheckBox>
#include <QGroupBox>
#include <QTextEdit>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QSlider>
@@ -38,8 +39,12 @@ namespace SpkUi
QSlider *SlideV;
SpkLoading *Loading;
QLineEdit *PopupText;
QPushButton *ShowPopup;
public slots:
void SetStylesheet();
void FetchStylesheet();
void ShowPopupSlot();
};
}

30
inc/spkpopup.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
#include <QLabel>
#include <QWidget>
#include <QHBoxLayout>
#include <QPropertyAnimation>
#include <QSequentialAnimationGroup>
class SpkMainWindow;
namespace SpkUi
{
class SpkPopup : public QWidget
{
Q_OBJECT
public:
SpkPopup(QWidget *parent, int aMillis = 3000);
public slots:
void Show(QString aText);
private:
QPoint MoveOffset;
QLabel *mText;
QHBoxLayout *mBox;
QPropertyAnimation *mAnimFadeIn, *mAnimFadeOut;
QSequentialAnimationGroup *mAnim;
};
}

View File

@@ -16,6 +16,8 @@ namespace SpkUi
enum SpkUiStyle { Light, Dark };
enum SpkButtonStyle { Normal = 0, Recommend, Warn };
class SpkPopup;
constexpr int StackTraceArraySize = 64;
constexpr const char * const StoreIconName = "spark-store";
@@ -40,6 +42,8 @@ namespace SpkUi
extern QStyle *OldSystemStyle;
extern QList<QColor> CurrentColorSet;
extern SpkPopup *Popup;
namespace States
{
extern bool IsDDE, IsUsingDtkPlugin;