Corrected pin body size handing within target widgets

This commit is contained in:
Nav
2021-10-23 12:41:29 +01:00
parent 3802cc11f6
commit 077127315c
3 changed files with 13 additions and 9 deletions

View File

@@ -28,14 +28,16 @@ DualInlinePackageWidget::DualInlinePackageWidget(
this->pinWidgets.reserve(targetVariant.pinDescriptorsByNumber.size());
this->layout = new QVBoxLayout();
this->layout->setSpacing(8);
this->layout->setSpacing(PinWidget::WIDTH_SPACING);
this->layout->setContentsMargins(0, 0, 0, 0);
this->topPinLayout = new QHBoxLayout();
this->topPinLayout->setSpacing(PinWidget::WIDTH_SPACING);
this->topPinLayout->setSpacing(0);
this->topPinLayout->setDirection(QBoxLayout::Direction::RightToLeft);
this->topPinLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
this->bottomPinLayout = new QHBoxLayout();
this->bottomPinLayout->setSpacing(PinWidget::WIDTH_SPACING);
this->bottomPinLayout->setSpacing(0);
this->bottomPinLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
for (const auto& [targetPinNumber, targetPinDescriptor]: targetVariant.pinDescriptorsByNumber) {
auto pinWidget = new PinWidget(targetPinDescriptor, targetVariant, insightWorker, this);
@@ -44,7 +46,7 @@ DualInlinePackageWidget::DualInlinePackageWidget(
if (targetPinNumber <= (targetVariant.pinDescriptorsByNumber.size() / 2)) {
this->bottomPinLayout->addWidget(pinWidget, 0, Qt::AlignmentFlag::AlignHCenter);
} else {
this->topPinLayout->addWidget(pinWidget, 0, Qt::AlignmentFlag::AlignRight);
this->topPinLayout->addWidget(pinWidget, 0, Qt::AlignmentFlag::AlignHCenter);
}
}
@@ -55,18 +57,18 @@ DualInlinePackageWidget::DualInlinePackageWidget(
this->setLayout(this->layout);
const auto bodyWidgetWidth = ((PinWidget::MINIMUM_WIDTH + PinWidget::WIDTH_SPACING)
* static_cast<int>(this->pinWidgets.size() / 2)) - PinWidget::WIDTH_SPACING + 46;
* static_cast<int>(this->pinWidgets.size() / 2)) + 46;
const auto bodyWidgetHeight = 150;
const auto width = bodyWidgetWidth;
const auto height = (PinWidget::MAXIMUM_HEIGHT * 2) + bodyWidgetHeight + (8 * 3);
const auto height = (PinWidget::MAXIMUM_HEIGHT * 2) + bodyWidgetHeight + (PinWidget::WIDTH_SPACING * 2);
this->bodyWidget->setGeometry(0, PinWidget::MAXIMUM_HEIGHT + 8, width, bodyWidgetHeight);
this->bodyWidget->setGeometry(0, PinWidget::MAXIMUM_HEIGHT + PinWidget::WIDTH_SPACING, width, bodyWidgetHeight);
this->topPinLayout->setGeometry(QRect(0, 0, width, PinWidget::MAXIMUM_HEIGHT));
this->bottomPinLayout->setGeometry(
QRect(
0,
(PinWidget::MAXIMUM_HEIGHT + bodyWidgetHeight + (8 * 2)),
(PinWidget::MAXIMUM_HEIGHT + bodyWidgetHeight + (PinWidget::WIDTH_SPACING * 2)),
width,
PinWidget::MAXIMUM_HEIGHT
)

View File

@@ -22,7 +22,7 @@ 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 + 12) * (PinWidget::MAXIMUM_LABEL_COUNT - 1)) - 12;
+ ((PinWidget::MAXIMUM_LABEL_WIDTH + 15) * (PinWidget::MAXIMUM_LABEL_COUNT - 1)) - 15;
static const int MAXIMUM_HORIZONTAL_HEIGHT = PinBodyWidget::WIDTH;
static const int MAXIMUM_VERTICAL_HEIGHT = PinBodyWidget::HEIGHT
+ ((PinWidget::MAXIMUM_LABEL_HEIGHT + 8) * PinWidget::MAXIMUM_LABEL_COUNT) - 8;

View File

@@ -41,6 +41,7 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
this->topPinLayout = new QHBoxLayout();
this->topPinLayout->setSpacing(PinWidget::WIDTH_SPACING);
this->topPinLayout->setDirection(QBoxLayout::Direction::RightToLeft);
this->topPinLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
this->rightPinLayout = new QVBoxLayout();
this->rightPinLayout->setSpacing(PinWidget::WIDTH_SPACING);
@@ -49,6 +50,7 @@ QuadFlatPackageWidget::QuadFlatPackageWidget(
this->bottomPinLayout = new QHBoxLayout();
this->bottomPinLayout->setSpacing(PinWidget::WIDTH_SPACING);
this->bottomPinLayout->setDirection(QBoxLayout::Direction::LeftToRight);
this->bottomPinLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
this->leftPinLayout = new QVBoxLayout();
this->leftPinLayout->setSpacing(PinWidget::WIDTH_SPACING);