Made DIP and QFP package widgets look nicer with the new panels

This commit is contained in:
Nav
2021-10-06 00:40:30 +01:00
parent 104f09f7c9
commit 2679979988
4 changed files with 21 additions and 3 deletions

View File

@@ -77,6 +77,8 @@ DualInlinePackageWidget::DualInlinePackageWidget(
this->topPinLayout->setContentsMargins(23, 0, 23, 0);
this->bottomPinLayout->setContentsMargins( 23, 0, 23, 0);
this->setFixedSize(width, height);
this->setGeometry(
(parent->width() / 2) - (width / 2),
(parent->height() / 2) - (height / 2),

View File

@@ -35,10 +35,10 @@ namespace Bloom::Widgets::InsightTargetWidgets::Qfp
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);
+ ((PinWidget::MAXIMUM_LABEL_WIDTH + 12) * (PinWidget::MAXIMUM_LABEL_COUNT - 1)) - 12;
static const int MAXIMUM_HORIZONTAL_HEIGHT = PinBodyWidget::WIDTH;
static const int MAXIMUM_VERTICAL_HEIGHT = PinBodyWidget::HEIGHT
+ (PinWidget::MAXIMUM_LABEL_HEIGHT * PinWidget::MAXIMUM_LABEL_COUNT);
+ ((PinWidget::MAXIMUM_LABEL_HEIGHT + 8) * PinWidget::MAXIMUM_LABEL_COUNT) - 8;
static const int MAXIMUM_VERTICAL_WIDTH = PinBodyWidget::WIDTH;
PinWidget(

View File

@@ -99,8 +99,14 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
const auto verticalLayoutWidth = ((verticalPinWidgetWidth + PinWidget::WIDTH_SPACING) * pinCountPerLayout
+ PinWidget::PIN_WIDGET_LAYOUT_PADDING - PinWidget::WIDTH_SPACING);
const auto width = verticalLayoutWidth + (horizontalPinWidgetWidth * 2);
/*
* + 16 for the spacing between the package body and the pins (8 pixels on each side)
*
* Also, the width is a little smaller than the height because of the layout of the horizontal pin labels, but
* we just use the same value as the height here (to contain and center the widget), as it looks nicer.
*/
const auto height = horizontalLayoutHeight + (verticalPinWidgetHeight * 2);
const auto width = height;
this->topPinLayout->insertSpacing(0, horizontalPinWidgetWidth);
this->topPinLayout->addSpacing(horizontalPinWidgetWidth);
@@ -154,6 +160,8 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
pinWidgetLayoutMargin
);
this->setFixedSize(width, height);
// Set the fixed size and center the widget
this->setGeometry(
(parent->width() / 2) - (width / 2),

View File

@@ -38,5 +38,13 @@ namespace Bloom::Widgets::InsightTargetWidgets
virtual void setTargetState(Targets::TargetState targetState) {
this->targetState = targetState;
}
QSize sizeHint() const override {
return this->minimumSize();
}
QSize minimumSizeHint() const override {
return this->sizeHint();
}
};
}