Added tooltips to pin body widgets and moved constructors to implementation files

This commit is contained in:
Nav
2021-12-30 18:10:40 +00:00
parent b9a43b4f39
commit 3b4284be5f
6 changed files with 24 additions and 22 deletions

View File

@@ -7,6 +7,11 @@
using namespace Bloom::Widgets::InsightTargetWidgets::Dip;
using namespace Bloom::Targets;
PinBodyWidget::PinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor)
: TargetPinBodyWidget(parent, std::move(pinDescriptor)) {
this->setFixedSize(PinBodyWidget::WIDTH, PinBodyWidget::HEIGHT);
}
void PinBodyWidget::paintEvent(QPaintEvent* event) {
auto painter = QPainter(this);
this->drawWidget(painter);

View File

@@ -17,13 +17,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Dip
static const int WIDTH = 19;
static const int HEIGHT = 28;
PinBodyWidget(
QWidget* parent,
Targets::TargetPinDescriptor pinDescriptor
): TargetPinBodyWidget(parent, std::move(pinDescriptor)) {
this->setFixedSize(PinBodyWidget::WIDTH, PinBodyWidget::HEIGHT);
this->setObjectName("target-pin-body");
}
PinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor);
protected:
void paintEvent(QPaintEvent* event) override;

View File

@@ -6,6 +6,16 @@
using namespace Bloom::Widgets::InsightTargetWidgets::Qfp;
using namespace Bloom::Targets;
PinBodyWidget::PinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor, bool isVertical)
: TargetPinBodyWidget(parent, std::move(pinDescriptor)), isVertical(isVertical) {
if (isVertical) {
this->setFixedSize(PinBodyWidget::WIDTH, PinBodyWidget::HEIGHT);
} else {
this->setFixedSize(PinBodyWidget::HEIGHT, PinBodyWidget::WIDTH);
}
}
void PinBodyWidget::paintEvent(QPaintEvent* event) {
auto painter = QPainter(this);
this->drawWidget(painter);

View File

@@ -18,17 +18,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
static const int WIDTH = 19;
static const int HEIGHT = 28;
PinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor, bool isVertical):
TargetPinBodyWidget(parent, std::move(pinDescriptor)), isVertical(isVertical) {
this->setObjectName("target-pin-body");
if (isVertical) {
this->setFixedSize(PinBodyWidget::WIDTH, PinBodyWidget::HEIGHT);
} else {
this->setFixedSize(PinBodyWidget::HEIGHT, PinBodyWidget::WIDTH);
}
}
PinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor, bool isVertical);
protected:
void paintEvent(QPaintEvent* event) override;

View File

@@ -5,6 +5,12 @@
using namespace Bloom::Widgets::InsightTargetWidgets;
using namespace Bloom::Targets;
TargetPinBodyWidget::TargetPinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor)
:QWidget(parent), pinDescriptor(std::move(pinDescriptor)) {
this->setObjectName("target-pin-body");
this->setToolTip(QString::fromStdString(this->pinDescriptor.name).toUpper());
}
QColor TargetPinBodyWidget::getBodyColor() {
auto pinColor = this->defaultBodyColor;

View File

@@ -24,10 +24,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
Q_PROPERTY(int disableAlphaLevel READ getDisableAlphaLevel WRITE setDisableAlphaLevel DESIGNABLE true)
public:
TargetPinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor):
QWidget(parent), pinDescriptor(std::move(pinDescriptor)) {
this->setObjectName("target-pin-body");
}
TargetPinBodyWidget(QWidget* parent, Targets::TargetPinDescriptor pinDescriptor);
void setPinState(const Targets::TargetPinState& pinState) {
this->pinState = pinState;