summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-25 15:37:43 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-25 15:38:25 +0300
commit31f5fbf89135a22735836aa52178d28eab811fe2 (patch)
treef24335bf78685a99abf3688420018431e2d7776d /include
parentFix signal redefinition warning (diff)
downloadnheko-31f5fbf89135a22735836aa52178d28eab811fe2.tar.xz
Improve the date separator widget
Diffstat (limited to 'include')
-rw-r--r--include/timeline/TimelineView.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h

index 6f70dd1c..f94d0c47 100644 --- a/include/timeline/TimelineView.h +++ b/include/timeline/TimelineView.h
@@ -75,6 +75,42 @@ enum class TimelineDirection Bottom, }; +class DateSeparator : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor) + Q_PROPERTY(QColor boxColor WRITE setBoxColor READ boxColor) + +public: + DateSeparator(QDateTime datetime, QWidget *parent = nullptr); + + QSize sizeHint() const override { return QSize(width(), height_ + 2 * HMargin); } + + void setTextColor(QColor color) { textColor_ = color; } + void setBoxColor(QColor color) { boxColor_ = color; } + + QColor textColor() const { return textColor_; } + QColor boxColor() const { return boxColor_; } + +protected: + void paintEvent(QPaintEvent *event) override; + +private: + static constexpr int VPadding = 6; + static constexpr int HPadding = 12; + static constexpr int HMargin = 20; + + int width_; + int height_; + + QString msg_; + QFont font_; + + QColor textColor_ = QColor("black"); + QColor boxColor_ = QColor("white"); +}; + class TimelineView : public QWidget { Q_OBJECT