Set fixed height for the DateSeparator & TextLabel

remotes/origin/HEAD
Konstantinos Sideris 7 years ago
parent bcba977f4c
commit 90595beb16
  1. 4
      include/timeline/TimelineItem.h
  2. 2
      include/timeline/TimelineView.h
  3. 2
      src/timeline/TimelineView.cc

@ -68,12 +68,14 @@ public:
this, this,
&TextLabel::adjustHeight); &TextLabel::adjustHeight);
document()->setDocumentMargin(0); document()->setDocumentMargin(0);
setFixedHeight(20);
} }
void wheelEvent(QWheelEvent *event) override { event->ignore(); } void wheelEvent(QWheelEvent *event) override { event->ignore(); }
private slots: private slots:
void adjustHeight(const QSizeF &size) { setMinimumHeight(size.height()); } void adjustHeight(const QSizeF &size) { setFixedHeight(size.height()); }
}; };
class TimelineItem : public QWidget class TimelineItem : public QWidget

@ -86,8 +86,6 @@ class DateSeparator : public QWidget
public: public:
DateSeparator(QDateTime datetime, QWidget *parent = nullptr); DateSeparator(QDateTime datetime, QWidget *parent = nullptr);
QSize sizeHint() const override { return QSize(width(), height_ + 2 * HMargin); }
void setTextColor(QColor color) { textColor_ = color; } void setTextColor(QColor color) { textColor_ = color; }
void setBoxColor(QColor color) { boxColor_ = color; } void setBoxColor(QColor color) { boxColor_ = color; }

@ -60,6 +60,8 @@ DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
QFontMetrics fm{font_}; QFontMetrics fm{font_};
width_ = fm.width(msg_) + HPadding * 2; width_ = fm.width(msg_) + HPadding * 2;
height_ = fm.ascent() + 2 * VPadding; height_ = fm.ascent() + 2 * VPadding;
setFixedHeight(height_ + 2 * HMargin);
} }
void void

Loading…
Cancel
Save