PartDesign: Reorder fields in Hole dialog

This makes order of fields in Hole Parameters more natural with typical
input flow of the parameters, i.e. moves the size of the hole more to
the top as it is the most important parameter.
This commit is contained in:
Kacper Donat
2025-08-25 19:36:47 +02:00
committed by Chris Hennes
parent 66e636f40d
commit 28e1a3b654
2 changed files with 168 additions and 155 deletions

View File

@@ -81,11 +81,15 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare
// read values from the hole properties
auto pcHole = getObject<PartDesign::Hole>();
bool isNone = std::string(pcHole->ThreadType.getValueAsString()) == "None";
bool isThreaded = pcHole->Threaded.getValue();
ui->labelThreading->setHidden(isNone);
ui->labelHoleType->setHidden(isNone);
ui->HoleType->setHidden(isNone);
ui->ThreadSize->setHidden(isNone);
ui->labelSize->setHidden(isNone);
ui->ThreadFit->setHidden(isNone || isThreaded);
ui->labelThreadClearance->setHidden(isNone || isThreaded);
updateHoleTypeCombo();
ui->ThreadType->setCurrentIndex(pcHole->ThreadType.getValue());
@@ -165,10 +169,8 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare
ui->TaperedAngle->setValue(pcHole->TaperedAngle.getValue());
ui->Reversed->setChecked(pcHole->Reversed.getValue());
bool isThreaded = pcHole->Threaded.getValue();
bool isModeled = pcHole->ModelThread.getValue();
ui->ThreadGroupBox->setVisible(isThreaded);
ui->ClearanceWidget->setHidden(isNone || isThreaded);
ui->UseCustomThreadClearance->setChecked(pcHole->UseCustomThreadClearance.getValue());
ui->CustomThreadClearance->setValue(pcHole->CustomThreadClearance.getValue());
ui->ThreadDepthType->setCurrentIndex(pcHole->ThreadDepthType.getValue());
@@ -285,7 +287,6 @@ void TaskHoleParameters::holeTypeChanged(int index)
pcHole->ModelThread.setValue(isModeled);
ui->ThreadGroupBox->setVisible(isThreaded);
ui->ClearanceWidget->setHidden(isThreaded);
// update view not active if modeling threads
// this will also ensure that the feature is recomputed.
ui->UpdateView->setVisible(isModeled);
@@ -656,9 +657,11 @@ void TaskHoleParameters::threadTypeChanged(int index)
ui->ThreadGroupBox->setHidden(isNone || !isThreaded);
ui->ThreadSize->setHidden(isNone);
ui->labelSize->setHidden(isNone);
ui->labelThreading->setHidden(isNone);
ui->labelHoleType->setHidden(isNone);
ui->HoleType->setHidden(isNone);
ui->ClearanceWidget->setHidden(isNone || isThreaded);
ui->ThreadFit->setHidden(isNone || isThreaded);
ui->labelThreadClearance->setHidden(isNone || isThreaded);
if (TypeClass == QByteArray("None")) {
QString noneText = QStringLiteral("-");

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>924</height>
<width>414</width>
<height>945</height>
</rect>
</property>
<property name="sizePolicy">
@@ -33,10 +33,62 @@
<number>6</number>
</property>
<item>
<layout class="QGridLayout" name="TopLayout" columnstretch="2,5">
<layout class="QGridLayout" name="TopLayout" columnstretch="2,2">
<property name="topMargin">
<number>10</number>
</property>
<item row="2" column="0">
<widget class="Gui::ElideLabel" name="labelSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::ElideLabel" name="labelHeadType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string>Head type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ThreadType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::ElideLabel" name="labelThreadType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Standard</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::ElideLabel" name="labelProfileType">
<property name="text">
@@ -44,6 +96,29 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="ThreadSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="HoleCutType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Cut type for screw heads</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="BaseProfileType">
<item>
@@ -63,8 +138,8 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::ElideLabel" name="labelHeadType">
<item row="4" column="0">
<widget class="Gui::ElideLabel" name="labelDepthType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -72,14 +147,14 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LayoutDirection::RightToLeft</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Head type</string>
<string>Depth type</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QComboBox" name="DepthType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
@@ -102,35 +177,6 @@
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::ElideLabel" name="labelDepthType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Depth type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="HoleCutType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Cut type for screw heads</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -214,15 +260,15 @@
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
@@ -263,15 +309,15 @@ the screw's top below the surface</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
@@ -333,12 +379,12 @@ the screw's top below the surface</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
@@ -431,12 +477,12 @@ account for the depth of blind holes</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
@@ -530,12 +576,12 @@ account for the depth of blind holes</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
@@ -598,12 +644,12 @@ over 90: larger hole radius at the bottom</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
@@ -611,57 +657,21 @@ over 90: larger hole radius at the bottom</string>
</layout>
</item>
<item>
<layout class="QGridLayout" name="profileLayout" rowstretch="0,0,0" columnstretch="2,5">
<widget class="QLabel" name="labelThreading">
<property name="text">
<string>&lt;b&gt;Threading&lt;/b&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::RichText</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="profileLayout" rowstretch="0,0" columnstretch="2,2">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="Gui::ElideLabel" name="labelThreadType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Standard</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="ThreadType">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::ElideLabel" name="labelSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ThreadSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="HoleType">
<item>
<property name="text">
@@ -680,13 +690,55 @@ over 90: larger hole radius at the bottom</string>
</item>
</widget>
</item>
<item row="2" column="0">
<item row="0" column="0">
<widget class="Gui::ElideLabel" name="labelHoleType">
<property name="text">
<string>Hole type</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::ElideLabel" name="labelThreadClearance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Clearance</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ThreadFit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Hole clearance
Only available for holes without thread</string>
</property>
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Close</string>
</property>
</item>
<item>
<property name="text">
<string>Wide</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
@@ -697,7 +749,7 @@ over 90: larger hole radius at the bottom</string>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="2,5">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
@@ -710,48 +762,6 @@ over 90: larger hole radius at the bottom</string>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Gui::ElideLabel" name="labelThreadClearance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Clearance</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="ThreadFit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Hole clearance
Only available for holes without thread</string>
</property>
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Close</string>
</property>
</item>
<item>
<property name="text">
<string>Wide</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@@ -770,7 +780,7 @@ Only available for holes without thread</string>
<string notr="true"/>
</property>
<property name="title">
<string/>
<string>Thread</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
@@ -1070,12 +1080,12 @@ Note that the calculation can take some time</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
@@ -1089,7 +1099,7 @@ Note that the calculation can take some time</string>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QDoubleSpinBox</extends>
<extends>QAbstractSpinBox</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>