[Gui] Add corner cross size as a preference in Display/3D View/General

This commit is contained in:
0penBrain
2021-11-17 18:04:12 +01:00
committed by wmayer
parent e998f61d2c
commit f30fa54038
4 changed files with 91 additions and 17 deletions

View File

@@ -24,24 +24,76 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_CornerCoordSystem">
<property name="toolTip">
<string>Main coordinate system will always be shown in
<layout class="QHBoxLayout" name="horizontalLayoutCoord">
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_CornerCoordSystem">
<property name="toolTip">
<string>Main coordinate system will always be shown in
lower right corner within opened files</string>
</property>
<property name="text">
<string>Show coordinate system in the corner</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>CornerCoordSystem</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</property>
<property name="text">
<string>Show coordinate system in the corner</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>CornerCoordSystem</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacerCoord">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelCoordSize">
<property name="text">
<string>Relative size : </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="SpinBox_CornerCoordSystemSize">
<property name="toolTip">
<string>Size of main coordinate system representation
in the corner -- in % of height/width of viewport</string>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>CornerCoordSystemSize</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_ShowAxisCross">
@@ -626,6 +678,11 @@ bounding box size of the 3D object that is currently displayed.</string>
<extends>QDoubleSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefSpinBox</class>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
@@ -677,5 +734,11 @@ bounding box size of the 3D object that is currently displayed.</string>
</hint>
</hints>
</connection>
<connection>
<sender>CheckBox_CornerCoordSystem</sender>
<signal>toggled(bool)</signal>
<receiver>SpinBox_CornerCoordSystemSize</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
</ui>

View File

@@ -89,6 +89,7 @@ void DlgSettings3DViewImp::saveSettings()
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
ui->CheckBox_CornerCoordSystem->onSave();
ui->SpinBox_CornerCoordSystemSize->onSave();
ui->CheckBox_ShowAxisCross->onSave();
ui->CheckBox_WbByTab->onSave();
ui->CheckBox_ShowFPS->onSave();
@@ -106,6 +107,7 @@ void DlgSettings3DViewImp::saveSettings()
void DlgSettings3DViewImp::loadSettings()
{
ui->CheckBox_CornerCoordSystem->onRestore();
ui->SpinBox_CornerCoordSystemSize->onRestore();
ui->CheckBox_ShowAxisCross->onRestore();
ui->CheckBox_WbByTab->onRestore();
ui->CheckBox_ShowFPS->onRestore();

View File

@@ -98,6 +98,7 @@ void AbstractSplitView::setupSettings()
// apply the user settings
OnChange(*hGrp,"EyeDistance");
OnChange(*hGrp,"CornerCoordSystem");
OnChange(*hGrp,"CornerCoordSystemSize");
OnChange(*hGrp,"UseAutoRotation");
OnChange(*hGrp,"Gradient");
OnChange(*hGrp,"BackgroundColor");
@@ -248,6 +249,10 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it)
(*it)->setFeedbackVisibility(rGrp.GetBool("CornerCoordSystem",true));
}
else if (strcmp(Reason,"CornerCoordSystemSize") == 0) {
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it)
(*it)->setFeedbackSize(rGrp.GetInt("CornerCoordSystemSize",10));
}
else if (strcmp(Reason,"UseAutoRotation") == 0) {
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it)
(*it)->setAnimationEnabled(rGrp.GetBool("UseAutoRotation",false));

View File

@@ -162,6 +162,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
// apply the user settings
OnChange(*hGrp,"EyeDistance");
OnChange(*hGrp,"CornerCoordSystem");
OnChange(*hGrp,"CornerCoordSystemSize");
OnChange(*hGrp,"ShowAxisCross");
OnChange(*hGrp,"UseAutoRotation");
OnChange(*hGrp,"Gradient");
@@ -378,6 +379,9 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"CornerCoordSystem") == 0) {
_viewer->setFeedbackVisibility(rGrp.GetBool("CornerCoordSystem",true));
}
else if (strcmp(Reason,"CornerCoordSystemSize") == 0) {
_viewer->setFeedbackSize(rGrp.GetInt("CornerCoordSystemSize",10));
}
else if (strcmp(Reason,"ShowAxisCross") == 0) {
_viewer->setAxisCross(rGrp.GetBool("ShowAxisCross",false));
}