diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/DualInlinePackageWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/DualInlinePackageWidget.cpp index f2f59aad..6ccb4349 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/DualInlinePackageWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/DIP/DualInlinePackageWidget.cpp @@ -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), diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/PinWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/PinWidget.hpp index f5b90b56..c2234e5e 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/PinWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/PinWidget.hpp @@ -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( diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/QuadFlatPackageWidget.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/QuadFlatPackageWidget.cpp index 9d651b70..c01e6fb8 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/QuadFlatPackageWidget.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/QFP/QuadFlatPackageWidget.cpp @@ -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), diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.hpp index 643c5fec..014b6f60 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetWidgets/TargetPackageWidget.hpp @@ -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(); + } }; }