2021-10-06 21:12:31 +01:00
|
|
|
#include "PinBodyWidget.hpp"
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
#include <QPainter>
|
|
|
|
|
#include <QEvent>
|
|
|
|
|
|
2021-07-07 20:54:45 +01:00
|
|
|
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
|
2021-05-24 20:58:49 +01:00
|
|
|
using namespace Bloom::Targets;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
void PinBodyWidget::paintEvent(QPaintEvent* event) {
|
|
|
|
|
auto painter = QPainter(this);
|
|
|
|
|
this->drawWidget(painter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PinBodyWidget::drawWidget(QPainter& painter) {
|
|
|
|
|
painter.setRenderHints(QPainter::RenderHint::Antialiasing | QPainter::RenderHint::SmoothPixmapTransform, true);
|
|
|
|
|
auto pinWidth = this->isVertical ? PinBodyWidget::WIDTH : PinBodyWidget::HEIGHT;
|
|
|
|
|
auto pinHeight = this->isVertical ? PinBodyWidget::HEIGHT : PinBodyWidget::WIDTH;
|
|
|
|
|
this->setFixedSize(pinWidth, pinHeight);
|
|
|
|
|
|
|
|
|
|
auto pinColor = this->getBodyColor();
|
|
|
|
|
|
|
|
|
|
painter.setPen(Qt::PenStyle::NoPen);
|
|
|
|
|
painter.setBrush(pinColor);
|
|
|
|
|
|
|
|
|
|
painter.drawRect(
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
pinWidth,
|
|
|
|
|
pinHeight
|
|
|
|
|
);
|
2021-06-21 00:14:31 +01:00
|
|
|
}
|