Files
BloomPatched/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/BodyWidget.cpp

50 lines
1.3 KiB
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#include <QPainter>
#include "BodyWidget.hpp"
#include "src/Logger/Logger.hpp"
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
2021-04-04 21:04:12 +01:00
void BodyWidget::paintEvent(QPaintEvent* event) {
auto painter = QPainter(this);
this->drawWidget(painter);
}
void BodyWidget::drawWidget(QPainter& painter) {
painter.setRenderHints(QPainter::RenderHint::Antialiasing | QPainter::RenderHint::SmoothPixmapTransform, true);
auto targetBodyColor = this->getBodyColor();
2021-09-21 23:13:28 +01:00
auto backgroundColor = QColor("#373835");
2021-04-04 21:04:12 +01:00
if (!this->isEnabled()) {
targetBodyColor.setAlpha(this->getDisableAlphaLevel());
}
painter.setPen(Qt::PenStyle::NoPen);
painter.setBrush(targetBodyColor);
auto containerGeometry = this->geometry();
auto targetBodyWidth = containerGeometry.width() - 16;
auto targetBodyHeight = containerGeometry.height() - 16;
auto targetBodyPoint = QPoint(
(containerGeometry.width() / 2) - (targetBodyWidth / 2),
(containerGeometry.height() / 2) - (targetBodyHeight / 2)
);
painter.drawRect(
targetBodyPoint.x(),
targetBodyPoint.y(),
targetBodyWidth,
targetBodyHeight
);
painter.setBrush(backgroundColor);
painter.drawEllipse(QRectF(
targetBodyPoint.x() + 13,
targetBodyPoint.y() + 13,
20,
20
2021-04-04 21:04:12 +01:00
));
}