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
|