Skip to content

Commit

Permalink
[Gui] improving NaviCube
Browse files Browse the repository at this point in the history
fixes bug 4495

- add missing edge faces
- implement a proper rotation recipe -> rotate towards the nearest possible state
- add preferences settings to turn off this new rotation behavior
- get rid of transparent cube faces to avoid wrong clicks, this way also remove the backfaces
- to make the edge faces fit, use triangles for the corners
- expose cube size setting to preferences dialog
- add new button to view backside
- get rid of bitmaps because as reported in https://forum.freecadweb.org/viewtopic.php?f=3&t=52118&start=20#p481781
the x y z labels are not scaled on HiDPI screens
moreover they are often "in they way" when you want to click on a corner and in principle they don't provide more info since we already have the CS with the axis labels

- also fix an arithmetic overflow compiler warning
- also rename 2 variables
  • Loading branch information
donovaly authored and wwmayer committed Mar 29, 2021
1 parent 033bf61 commit e58ee29
Show file tree
Hide file tree
Showing 3 changed files with 494 additions and 126 deletions.
2 changes: 2 additions & 0 deletions src/Gui/DlgSettingsNavigation.cpp
Expand Up @@ -94,6 +94,7 @@ void DlgSettingsNavigation::saveSettings()
ui->CheckBox_UseAutoRotation->onSave();
ui->qspinNewDocScale->onSave();
ui->prefStepByTurn->onSave();
ui->naviCubeToNearest->onSave();
ui->prefCubeSize->onSave();

bool showNaviCube = ui->groupBoxNaviCube->isChecked();
Expand All @@ -119,6 +120,7 @@ void DlgSettingsNavigation::loadSettings()
ui->CheckBox_UseAutoRotation->onRestore();
ui->qspinNewDocScale->onRestore();
ui->prefStepByTurn->onRestore();
ui->naviCubeToNearest->onRestore();
ui->prefCubeSize->onRestore();

ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
Expand Down
51 changes: 38 additions & 13 deletions src/Gui/DlgSettingsNavigation.ui
Expand Up @@ -7,14 +7,14 @@
<x>0</x>
<y>0</y>
<width>500</width>
<height>363</height>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
<string>Navigation</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBoxNaviCube">
<property name="title">
<string>Navigation cube</string>
Expand All @@ -35,6 +35,9 @@
<property name="toolTip">
<string>Number of steps by turn when using arrows (default = 8 : step angle = 360/8 = 45 deg)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>4</number>
</property>
Expand Down Expand Up @@ -108,6 +111,25 @@
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="Gui::PrefCheckBox" name="naviCubeToNearest">
<property name="toolTip">
<string>Rotates to nearest possible state when clicking a cube face</string>
</property>
<property name="text">
<string>Rotate to nearest</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>NaviRotateToNearest</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>NaviCube</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
Expand All @@ -120,6 +142,9 @@
<property name="toolTip">
<string>Size of the navigation cube</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>10</number>
</property>
Expand All @@ -143,7 +168,7 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QGroupBox" name="GroupBox12">
<property name="enabled">
<bool>true</bool>
Expand Down Expand Up @@ -333,15 +358,15 @@ Turntable: the part will be rotated around the z-axis.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>New document scale</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="PrefUnitSpinBox" name="qspinNewDocScale">
<widget class="PrefUnitSpinBox" name="qspinNewDocScale" native="true">
<property name="minimumSize">
<size>
<width>120</width>
Expand Down Expand Up @@ -527,12 +552,12 @@ Mouse tilting is not disabled by this setting.</string>
</property>
</widget>
</item>
</layout>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -548,6 +573,11 @@ Mouse tilting is not disabled by this setting.</string>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::PrefSpinBox</class>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefCheckBox</class>
<extends>QCheckBox</extends>
Expand All @@ -564,11 +594,6 @@ Mouse tilting is not disabled by this setting.</string>
<header>Gui/PrefWidgets.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>Gui::PrefSpinBox</class>
<extends>QSpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit e58ee29

Please sign in to comment.