summary refs log tree commit diff
path: root/src/ui/SnackBar.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/SnackBar.h')
-rw-r--r--src/ui/SnackBar.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ui/SnackBar.h b/src/ui/SnackBar.h

index 5459159e..8d127933 100644 --- a/src/ui/SnackBar.h +++ b/src/ui/SnackBar.h
@@ -6,6 +6,7 @@ #include <QCoreApplication> #include <QPaintEvent> +#include <QPropertyAnimation> #include <QTimer> #include <deque> @@ -23,6 +24,7 @@ class SnackBar : public OverlayWidget Q_PROPERTY(QColor bgColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) + Q_PROPERTY(double offset READ offset WRITE setOffset NOTIFY offsetChanged) public: explicit SnackBar(QWidget *parent); @@ -46,9 +48,21 @@ public: update(); } + double offset() { return offset_; } + void setOffset(double offset) + { + if (offset != offset_) { + offset_ = offset; + emit offsetChanged(); + } + } + public slots: void showMessage(const QString &msg); +signals: + void offsetChanged(); + protected: void paintEvent(QPaintEvent *event) override; void mousePressEvent(QMouseEvent *event) override; @@ -68,10 +82,11 @@ private: std::deque<QString> messages_; - QTimer showTimer_; QTimer hideTimer_; double boxHeight_; + QPropertyAnimation offset_anim; + SnackBarPosition position_; };