From 53dbc5fc2df5cea4fad95be8aed4fc6206e10db6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 24 May 2020 11:10:06 +0200 Subject: [PATCH] PartDesign: [skip ci] set minimum width of labels to align the spin boxes properly in the chamfer panel --- src/Mod/PartDesign/Gui/TaskChamferParameters.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index da99fb4e92..f36cec8fa3 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -25,6 +25,7 @@ #ifndef _PreComp_ # include +# include # include # include # include @@ -128,6 +129,17 @@ void TaskChamferParameters::setUpUI(PartDesign::Chamfer* pcChamfer) ui->chamferAngle->bind(pcChamfer->Angle); ui->stackedWidget->setFixedHeight(ui->chamferSize2->sizeHint().height()); + + QFontMetrics fm(ui->typeLabel->font()); + int minWidth = fm.width(ui->typeLabel->text()); + minWidth = std::max(minWidth, fm.width(ui->sizeLabel->text())); + minWidth = std::max(minWidth, fm.width(ui->size2Label->text())); + minWidth = std::max(minWidth, fm.width(ui->angleLabel->text())); + minWidth = minWidth + 5; //spacing + ui->typeLabel->setMinimumWidth(minWidth); + ui->sizeLabel->setMinimumWidth(minWidth); + ui->size2Label->setMinimumWidth(minWidth); + ui->angleLabel->setMinimumWidth(minWidth); } void TaskChamferParameters::onSelectionChanged(const Gui::SelectionChanges& msg)