QFP pin widget tidying
This commit is contained in:
@@ -99,3 +99,30 @@ PinWidget::PinWidget(QWidget* parent, const TargetPinDescriptor& pinDescriptor,
|
|||||||
|
|
||||||
connect(this->bodyWidget, &PinBodyWidget::clicked, this, &TargetPinWidget::onWidgetBodyClicked);
|
connect(this->bodyWidget, &PinBodyWidget::clicked, this, &TargetPinWidget::onWidgetBodyClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PinWidget::updatePinState(const Targets::TargetPinState& pinState) {
|
||||||
|
TargetPinWidget::updatePinState(pinState);
|
||||||
|
|
||||||
|
if (pinState.ioDirection.has_value()) {
|
||||||
|
this->pinDirectionLabel->setText(
|
||||||
|
pinState.ioDirection.value() == Targets::TargetPinState::IoDirection::INPUT ? "IN" : "OUT"
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this->pinDirectionLabel->setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->bodyWidget != nullptr) {
|
||||||
|
this->bodyWidget->setPinState(pinState);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setLabelColor(this->pinStateChanged ? "#4d7bba" : "#a6a7aa");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PinWidget::setLabelColor(const QString& hexColor) {
|
||||||
|
auto style = QString("QLabel { color: " + hexColor + "; }");
|
||||||
|
|
||||||
|
if (this->pinNameLabel != nullptr) {
|
||||||
|
this->pinNameLabel->setStyleSheet(style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,13 +25,7 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
|||||||
bool isRightLayout = false;
|
bool isRightLayout = false;
|
||||||
bool isTopLayout = false;
|
bool isTopLayout = false;
|
||||||
|
|
||||||
void setLabelColor(const QString& hexColor) {
|
void setLabelColor(const QString& hexColor);
|
||||||
auto style = QString("QLabel { color: " + hexColor + "; }");
|
|
||||||
|
|
||||||
if (this->pinNameLabel != nullptr) {
|
|
||||||
this->pinNameLabel->setStyleSheet(style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int PIN_WIDGET_LAYOUT_PADDING = 46;
|
static const int PIN_WIDGET_LAYOUT_PADDING = 46;
|
||||||
@@ -53,23 +47,6 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
|
|||||||
const Targets::TargetVariant& targetVariant
|
const Targets::TargetVariant& targetVariant
|
||||||
);
|
);
|
||||||
|
|
||||||
void updatePinState(const Targets::TargetPinState& pinState) override {
|
void updatePinState(const Targets::TargetPinState& pinState) override;
|
||||||
TargetPinWidget::updatePinState(pinState);
|
|
||||||
|
|
||||||
if (pinState.ioDirection.has_value()) {
|
|
||||||
this->pinDirectionLabel->setText(
|
|
||||||
pinState.ioDirection.value() == Targets::TargetPinState::IoDirection::INPUT ? "IN" : "OUT"
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this->pinDirectionLabel->setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->bodyWidget != nullptr) {
|
|
||||||
this->bodyWidget->setPinState(pinState);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setLabelColor(this->pinStateChanged ? "#4d7bba" : "#a6a7aa");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user