Fix list of dimension popup list. Make sure it will always has enough space for values.
This commit is contained in:
parent
433389b798
commit
6e295f7172
|
@ -20,6 +20,7 @@
|
|||
- Fix float-point accuracy issue in multisize measurements dimensions.
|
||||
- Fix compatibility with Richpeace DXF-AAMA/ASTM R12.
|
||||
- Fix seam allowance. Loose requirements to case with prong.
|
||||
- Fix list of dimension popup list. Make sure it will always has enough space for values.
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
|
@ -2905,6 +2905,21 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
|||
InitDimensionYWZItems(bases, labels, control, unit, dimension->IsBodyMeasurement(), fc);
|
||||
}
|
||||
|
||||
// Calculate the width of the largest item using QFontMetrics
|
||||
QFontMetrics fontMetrics(control->font());
|
||||
int maxWidth = 0;
|
||||
for (int i = 0; i < control->count(); ++i)
|
||||
{
|
||||
int itemWidth = TextWidth(fontMetrics, control->itemText(i));
|
||||
if (itemWidth > maxWidth)
|
||||
{
|
||||
maxWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the minimum width of the view to the largest item width
|
||||
control->view()->setMinimumWidth(maxWidth);
|
||||
|
||||
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
||||
// it invalid first
|
||||
control->setCurrentIndex(-1);
|
||||
|
|
|
@ -4918,6 +4918,21 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
|||
InitDimensionYWZGradation(bases, labels, control, dimension->IsBodyMeasurement());
|
||||
}
|
||||
|
||||
// Calculate the width of the largest item using QFontMetrics
|
||||
QFontMetrics fontMetrics(control->font());
|
||||
int maxWidth = 0;
|
||||
for (int i = 0; i < control->count(); ++i)
|
||||
{
|
||||
int itemWidth = TextWidth(fontMetrics, control->itemText(i));
|
||||
if (itemWidth > maxWidth)
|
||||
{
|
||||
maxWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the minimum width of the view to the largest item width
|
||||
control->view()->setMinimumWidth(maxWidth);
|
||||
|
||||
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
||||
// it invalid first
|
||||
control->setCurrentIndex(-1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user