mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
43 lines
894 B
C++
43 lines
894 B
C++
|
#pragma once
|
||
|
|
||
|
#include "widgets/basewidget.hpp"
|
||
|
|
||
|
#include <QPainter>
|
||
|
|
||
|
namespace chatterino {
|
||
|
namespace widgets {
|
||
|
|
||
|
class Line : public BaseWidget
|
||
|
{
|
||
|
public:
|
||
|
Line(bool vertical)
|
||
|
: BaseWidget(nullptr)
|
||
|
, vertical_(vertical)
|
||
|
{
|
||
|
if (this->vertical_) {
|
||
|
this->setScaleIndependantWidth(8);
|
||
|
} else {
|
||
|
this->setScaleIndependantHeight(8);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
virtual void paintEvent(QPaintEvent *)
|
||
|
{
|
||
|
QPainter painter(this);
|
||
|
|
||
|
painter.setPen(QColor("#999"));
|
||
|
|
||
|
if (this->vertical_) {
|
||
|
painter.drawLine(this->width() / 2, 0, this->width() / 2, this->height());
|
||
|
} else {
|
||
|
painter.drawLine(0, this->height() / 2, this->width(), this->height() / 2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
bool vertical_;
|
||
|
};
|
||
|
|
||
|
} // namespace widgets
|
||
|
} // namespace chatterino
|