Files
BloomPatched/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/PinWidget.hpp

53 lines
1.7 KiB
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#pragma once
#include <QWidget>
2021-08-18 22:51:15 +01:00
#include <QBoxLayout>
2021-04-04 21:04:12 +01:00
#include <QLabel>
#include "../TargetPinWidget.hpp"
#include "PinBodyWidget.hpp"
#include "src/Targets/TargetVariant.hpp"
namespace Bloom::Widgets::InsightTargetWidgets::Qfp
2021-04-04 21:04:12 +01:00
{
class PinWidget: public TargetPinWidget
{
Q_OBJECT
private:
2021-08-18 22:51:15 +01:00
QBoxLayout* layout = nullptr;
2021-04-04 21:04:12 +01:00
QLabel* pinNumberLabel = nullptr;
QLabel* pinNameLabel = nullptr;
QLabel* pinDirectionLabel = nullptr;
PinBodyWidget* bodyWidget = nullptr;
bool isLeftLayout = false;
bool isBottomLayout = false;
bool isRightLayout = false;
bool isTopLayout = false;
2021-09-02 21:20:48 +01:00
void setLabelColor(const QString& hexColor);
2021-04-04 21:04:12 +01:00
public:
static const int PIN_WIDGET_LAYOUT_PADDING = 46;
static const int PIN_WIDGET_SPACING = 8;
2021-04-04 21:04:12 +01:00
static const int MAXIMUM_LABEL_COUNT = 3;
static const int LABEL_HEIGHT = 20;
static const int MAXIMUM_LABEL_WIDTH = PinBodyWidget::WIDTH;
static const int MAXIMUM_LABEL_HEIGHT = 20;
static const int MAXIMUM_HORIZONTAL_WIDTH = PinBodyWidget::HEIGHT
+ (PinWidget::MAXIMUM_LABEL_WIDTH * PinWidget::MAXIMUM_LABEL_COUNT);
2021-04-04 21:04:12 +01:00
static const int MAXIMUM_HORIZONTAL_HEIGHT = PinBodyWidget::WIDTH;
static const int MAXIMUM_VERTICAL_HEIGHT = PinBodyWidget::HEIGHT
+ (PinWidget::MAXIMUM_LABEL_HEIGHT * PinWidget::MAXIMUM_LABEL_COUNT);
2021-04-04 21:04:12 +01:00
static const int MAXIMUM_VERTICAL_WIDTH = PinBodyWidget::WIDTH;
PinWidget(
QWidget* parent,
const Targets::TargetPinDescriptor& pinDescriptor,
const Targets::TargetVariant& targetVariant
);
2021-04-04 21:04:12 +01:00
2021-09-02 21:20:48 +01:00
void updatePinState(const Targets::TargetPinState& pinState) override;
2021-04-04 21:04:12 +01:00
};
}