summary refs log tree commit diff
path: root/src/ui/SnackBar.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-25 23:07:56 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-25 23:07:56 +0300
commit1f47a6af3a1c09e18ce49b67a635be981557a6e0 (patch)
tree20e00db7e8bc9315642b12890770ee170517f05d /src/ui/SnackBar.h
parentEnable scrollbar on the room list for macOS (#174) (diff)
downloadnheko-1f47a6af3a1c09e18ce49b67a635be981557a6e0.tar.xz
Improve the style of snackbar a bit
Diffstat (limited to 'src/ui/SnackBar.h')
-rw-r--r--src/ui/SnackBar.h50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/ui/SnackBar.h b/src/ui/SnackBar.h

index eed59c87..15cbf626 100644 --- a/src/ui/SnackBar.h +++ b/src/ui/SnackBar.h
@@ -17,12 +17,30 @@ class SnackBar : public OverlayWidget { Q_OBJECT + Q_PROPERTY(QColor bgColor READ backgroundColor WRITE setBackgroundColor) + Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) + public: explicit SnackBar(QWidget *parent); - inline void setBackgroundColor(const QColor &color); - inline void setTextColor(const QColor &color); - inline void setPosition(SnackBarPosition pos); + QColor backgroundColor() const { return bgColor_; } + void setBackgroundColor(const QColor &color) + { + bgColor_ = color; + update(); + } + + QColor textColor() const { return textColor_; } + void setTextColor(const QColor &color) + { + textColor_ = color; + update(); + } + void setPosition(SnackBarPosition pos) + { + position_ = pos; + update(); + } public slots: void showMessage(const QString &msg); @@ -49,31 +67,7 @@ private: QTimer showTimer_; QTimer hideTimer_; - int duration_; - int boxWidth_; - int boxHeight_; - int boxPadding_; + double boxHeight_; SnackBarPosition position_; }; - -inline void -SnackBar::setPosition(SnackBarPosition pos) -{ - position_ = pos; - update(); -} - -inline void -SnackBar::setBackgroundColor(const QColor &color) -{ - bgColor_ = color; - update(); -} - -inline void -SnackBar::setTextColor(const QColor &color) -{ - textColor_ = color; - update(); -}