Files
BloomPatched/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/BodyWidget.hpp

50 lines
1.5 KiB
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#pragma once
#include <QWidget>
2021-11-20 19:08:35 +00:00
#include <QPainter>
2021-04-04 21:04:12 +01:00
namespace Bloom::Widgets::InsightTargetWidgets::Dip
2021-04-04 21:04:12 +01:00
{
class BodyWidget: public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor bodyColor READ getBodyColor WRITE setBodyColor DESIGNABLE true)
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
2021-04-04 21:04:12 +01:00
public:
explicit BodyWidget(QWidget* parent, std::size_t pinCount);
2021-04-04 21:04:12 +01:00
2021-06-21 00:14:31 +01:00
[[nodiscard]] QColor getBodyColor() const {
2021-04-04 21:04:12 +01:00
return this->bodyColor;
}
2021-06-21 00:14:31 +01:00
void setBodyColor(const QColor& color) {
2021-04-04 21:04:12 +01:00
this->bodyColor = color;
}
2021-06-21 00:14:31 +01:00
[[nodiscard]] int getDisableAlphaLevel() const {
2021-04-04 21:04:12 +01:00
return this->disableAlphaLevel;
}
void setDisableAlphaLevel(int level) {
this->disableAlphaLevel = level;
}
protected:
void paintEvent(QPaintEvent* event) override;
void drawWidget(QPainter& painter);
private:
static constexpr int MAXIMUM_BODY_HEIGHT = 156;
static constexpr int MINIMUM_BODY_HEIGHT = 80;
static constexpr int MAXIMUM_FIRST_PIN_INDICATOR_HEIGHT = 16;
static constexpr int MINIMUM_FIRST_PIN_INDICATOR_HEIGHT = 12;
// These properties can be modified via Qt style sheets (see Stylesheets/DualInlinePackage.qss)
QColor bodyColor = QColor("#8E8B83");
int disableAlphaLevel = 100;
int firstPinIndicatorDiameter = 14;
int orientationIndicatorDiameter = 16;
2021-04-04 21:04:12 +01:00
};
}