Gui: remove moved controls from 3D view settings page

This commit is contained in:
wmayer
2020-03-15 14:00:04 +01:00
parent 8ec97a32e0
commit efc67edc7d
5 changed files with 49 additions and 698 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>477</width>
<height>763</height>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,12 +15,13 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="GroupBox12">
<widget class="QGroupBox" name="GroupBoxGeneral">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>3D View settings</string>
<string>General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -43,6 +44,23 @@ lower right corner within opened files</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_ShowFPS">
<property name="toolTip">
<string>Time needed for last operation and resulting frame rate
will be shown at the lower left corner in opened files</string>
</property>
<property name="text">
<string>Show counter of frames per second</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowFPS</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_WbByTab">
<property name="toolTip">
@@ -62,139 +80,17 @@ lower right corner within opened files</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_ShowFPS">
<property name="toolTip">
<string>Time needed for last operation and resulting frame rate
will be shown at the lower left corner in opened files</string>
</property>
<property name="text">
<string>Show counter of frames per second</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowFPS</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_NaviCube">
<property name="toolTip">
<string>Navigation cube will always be shown in opened files </string>
</property>
<property name="text">
<string>Show navigation cube</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowNaviCube</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="stepLabel">
<property name="text">
<string>Steps by turn</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="prefStepByTurn">
<property name="toolTip">
<string>Number of steps by turn when using arrows (default = 8 : step angle = 360/8 = 45 deg)</string>
</property>
<property name="minimum">
<number>4</number>
</property>
<property name="maximum">
<number>36</number>
</property>
<property name="value">
<number>8</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>NaviStepByTurn</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="cornerLabel">
<property name="text">
<string>Corner</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="naviCubeCorner">
<property name="toolTip">
<string>Corner where navigation cube is shown</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Top left</string>
</property>
</item>
<item>
<property name="text">
<string>Top right</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom left</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom right</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="GroupBox12">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Rendering</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="Gui::PrefCheckBox" name="CheckBox_useVBO">
@@ -260,104 +156,13 @@ but slower response to any scene changes.</string>
</widget>
</item>
<item row="2" column="0">
<widget class="Gui::PrefCheckBox" name="CheckBox_UseAutoRotation">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Enable animated rotations</string>
</property>
<property name="text">
<string>Enable animation</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseAutoRotation</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="navigationLabel">
<property name="text">
<string>3D Navigation</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="comboNavigationStyle">
<property name="toolTip">
<string>Navigation settings set</string>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="mouseButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>84</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>List the mouse button configs for each chosen navigation setting.
Select a set and then press the button to view said configurations.</string>
</property>
<property name="text">
<string>Mouse...</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="orbitLabel">
<property name="text">
<string>Orbit style</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QComboBox" name="comboOrbitStyle">
<property name="toolTip">
<string>Rotation orbit style.
Trackball: moving the mouse horizontally will rotate the part around the y-axis
Turntable: the part will be rotated around the z-axis.</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Turntable</string>
</property>
</item>
<item>
<property name="text">
<string>Trackball</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="aliasingLAbel">
<property name="text">
<string>Anti-Aliasing</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<item row="2" column="1" colspan="3">
<widget class="Gui::PrefComboBox" name="comboAliasing">
<property name="toolTip">
<string>What kind of multisample anti-aliasing is used </string>
@@ -395,182 +200,7 @@ Turntable: the part will be rotated around the z-axis.</string>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="newDocViewLabel">
<property name="text">
<string>New document camera orientation</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QComboBox" name="comboNewDocView">
<property name="toolTip">
<string>Camera orientation for new documents</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>New document scale</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="PrefUnitSpinBox" name="qspinNewDocScale" native="true">
<property name="toolTip">
<string>Sets camera zoom for new documents.
The value is the diameter of the sphere to fit on the screen.</string>
</property>
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum" stdset="0">
<double>0.000010000000000</double>
</property>
<property name="maximum" stdset="0">
<double>10000000.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>NewDocumentCameraScale</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
<property name="rawValue" stdset="0">
<double>100.000000000000000</double>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxZoomAtCursor">
<property name="toolTip">
<string>Zoom operations will be performed at position of mouse pointer</string>
</property>
<property name="text">
<string>Zoom at cursor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>ZoomAtCursor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="8" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Zoom step</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="spinBoxZoomStep">
<property name="toolTip">
<string>How much will be zoomed.
Zoom step of '1' means a factor of 7.5 for every zoom step. </string>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="value">
<double>0.200000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>ZoomStep</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="9" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxInvertZoom">
<property name="toolTip">
<string>Direction of zoom operations will be inverted</string>
</property>
<property name="text">
<string>Invert zoom</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>InvertZoom</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxDisableTilt">
<property name="toolTip">
<string>Prevents view tilting when pinch-zooming.
Affects only gesture navigation style.
Mouse tilting is not disabled by this setting.</string>
</property>
<property name="text">
<string>Disable touchscreen tilt gesture</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>DisableTouchTilt</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxDragAtCursor">
<property name="toolTip">
<string>Rotations in 3D will use current cursor position as center for rotation</string>
</property>
<property name="text">
<string>Rotate at cursor</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>DragAtCursor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="3" column="0">
<widget class="QLabel" name="markerSizeLabel">
<property name="toolTip">
<string/>
@@ -580,21 +210,21 @@ Mouse tilting is not disabled by this setting.</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="3">
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="boxMarkerSize">
<property name="toolTip">
<string>Size of vertices in the Sketcher workbench</string>
</property>
</widget>
</item>
<item row="13" column="0">
<item row="4" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Eye to eye distance for stereo modes</string>
</property>
</widget>
</item>
<item row="13" column="1" colspan="3">
<item row="4" column="1" colspan="3">
<widget class="Gui::PrefDoubleSpinBox" name="FloatSpinBox_EyeDistance">
<property name="toolTip">
<string>Eye-to-eye distance used for stereo projections.
@@ -624,7 +254,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="14" column="0">
<item row="5" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxBacklight">
<property name="toolTip">
<string>Backlight is enabled with the defined color</string>
@@ -640,7 +270,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="5" column="1">
<widget class="Gui::PrefColorButton" name="backlightColor">
<property name="enabled">
<bool>false</bool>
@@ -663,20 +293,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="14" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="3">
<item row="5" column="2">
<widget class="QLabel" name="backlightLabel">
<property name="enabled">
<bool>false</bool>
@@ -687,9 +304,12 @@ bounding box size of the 3D object that is currently displayed. </string>
<property name="text">
<string>Intensity</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="14" column="4">
<item row="5" column="3">
<widget class="Gui::PrefSlider" name="sliderIntensity">
<property name="enabled">
<bool>false</bool>
@@ -730,8 +350,6 @@ bounding box size of the 3D object that is currently displayed. </string>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>

View File

@@ -58,10 +58,8 @@ bool DlgSettings3DViewImp::showMsg = true;
DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent)
: PreferencePage( parent )
, ui(new Ui_DlgSettings3DView)
, q0(0), q1(0), q2(0), q3(1)
{
ui->setupUi(this);
retranslate();
}
/**
@@ -78,97 +76,51 @@ void DlgSettings3DViewImp::saveSettings()
// where we set some attributes afterwards
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole);
hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray());
int index = ui->comboOrbitStyle->currentIndex();
hGrp->SetInt("OrbitStyle", index);
index = ui->comboAliasing->currentIndex();
int index = ui->comboAliasing->currentIndex();
hGrp->SetInt("AntiAliasing", index);
index = ui->naviCubeCorner->currentIndex();
hGrp->SetInt("CornerNaviCube", index);
index = ui->renderCache->currentIndex();
hGrp->SetInt("RenderCache", index);
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
ui->checkBoxZoomAtCursor->onSave();
ui->checkBoxInvertZoom->onSave();
ui->checkBoxDisableTilt->onSave();
ui->spinBoxZoomStep->onSave();
ui->checkBoxDragAtCursor->onSave();
ui->CheckBox_CornerCoordSystem->onSave();
ui->CheckBox_WbByTab->onSave();
ui->CheckBox_ShowFPS->onSave();
ui->CheckBox_useVBO->onSave();
ui->CheckBox_NaviCube->onSave();
ui->CheckBox_UseAutoRotation->onSave();
ui->FloatSpinBox_EyeDistance->onSave();
ui->checkBoxBacklight->onSave();
ui->backlightColor->onSave();
ui->sliderIntensity->onSave();
ui->radioPerspective->onSave();
ui->radioOrthographic->onSave();
ui->qspinNewDocScale->onSave();
ui->prefStepByTurn->onSave();
QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), Qt::UserRole);
hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray());
if (camera == QByteArray("Custom")) {
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
hCustom->SetFloat("Q0", q0);
hCustom->SetFloat("Q1", q1);
hCustom->SetFloat("Q2", q2);
hCustom->SetFloat("Q3", q3);
}
}
void DlgSettings3DViewImp::loadSettings()
{
ui->checkBoxZoomAtCursor->onRestore();
ui->checkBoxInvertZoom->onRestore();
ui->checkBoxDisableTilt->onRestore();
ui->spinBoxZoomStep->onRestore();
ui->checkBoxDragAtCursor->onRestore();
ui->CheckBox_CornerCoordSystem->onRestore();
ui->CheckBox_WbByTab->onRestore();
ui->CheckBox_ShowFPS->onRestore();
ui->CheckBox_useVBO->onRestore();
ui->CheckBox_NaviCube->onRestore();
ui->CheckBox_UseAutoRotation->onRestore();
ui->FloatSpinBox_EyeDistance->onRestore();
ui->checkBoxBacklight->onRestore();
ui->backlightColor->onRestore();
ui->sliderIntensity->onRestore();
ui->radioPerspective->onRestore();
ui->radioOrthographic->onRestore();
ui->qspinNewDocScale->onRestore();
ui->prefStepByTurn->onRestore();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
std::string model = hGrp->GetASCII("NavigationStyle",CADNavigationStyle::getClassTypeId().getName());
int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str()));
if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index);
index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball));
index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1);
ui->comboOrbitStyle->setCurrentIndex(index);
index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
int index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
ui->comboAliasing->setCurrentIndex(index);
// connect after setting current item of the combo box
connect(ui->comboAliasing, SIGNAL(currentIndexChanged(int)),
this, SLOT(onAliasingChanged(int)));
index = hGrp->GetInt("CornerNaviCube", 1);
ui->naviCubeCorner->setCurrentIndex(index);
index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index);
@@ -182,56 +134,6 @@ void DlgSettings3DViewImp::loadSettings()
index = ui->boxMarkerSize->findData(QVariant(current));
if (index < 0) index = 2;
ui->boxMarkerSize->setCurrentIndex(index);
ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric"));
ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric"));
ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric"));
ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top"));
ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front"));
ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left"));
ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right"));
ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear"));
ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom"));
ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom"));
std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric");
index = ui->comboNewDocView->findData(QByteArray(camera.c_str()));
if (index > -1) ui->comboNewDocView->setCurrentIndex(index);
if (camera == "Custom") {
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
q0 = hCustom->GetFloat("Q0", q0);
q1 = hCustom->GetFloat("Q1", q1);
q2 = hCustom->GetFloat("Q2", q2);
q3 = hCustom->GetFloat("Q3", q3);
}
connect(ui->comboNewDocView, SIGNAL(currentIndexChanged(int)),
this, SLOT(onNewDocViewChanged(int)));
}
void DlgSettings3DViewImp::on_mouseButton_clicked()
{
QDialog dlg(this);
Ui_MouseButtons uimb;
uimb.setupUi(&dlg);
QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole);
void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray());
std::unique_ptr<UserNavigationStyle> ns(static_cast<UserNavigationStyle*>(instance));
uimb.groupBox->setTitle(uimb.groupBox->title()+QString::fromLatin1(" ")+ui->comboNavigationStyle->currentText());
QString descr;
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION));
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.selectionLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.panningLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.rotationLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING));
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
uimb.zoomingLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
dlg.exec();
}
/**
@@ -241,37 +143,16 @@ void DlgSettings3DViewImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
ui->comboAliasing->blockSignals(true);
int navigation = ui->comboNavigationStyle->currentIndex();
int orbit = ui->comboOrbitStyle->currentIndex();
int aliasing = ui->comboAliasing->currentIndex();
int corner = ui->naviCubeCorner->currentIndex();
ui->retranslateUi(this);
retranslate();
ui->comboNavigationStyle->setCurrentIndex(navigation);
ui->comboOrbitStyle->setCurrentIndex(orbit);
ui->comboAliasing->setCurrentIndex(aliasing);
ui->comboAliasing->blockSignals(false);
ui->naviCubeCorner->setCurrentIndex(corner);
}
else {
QWidget::changeEvent(e);
}
}
void DlgSettings3DViewImp::retranslate()
{
ui->comboNavigationStyle->clear();
// add submenu at the end to select navigation style
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
for (std::map<Base::Type, std::string>::iterator it = styles.begin(); it != styles.end(); ++it) {
QByteArray data(it->first.getName());
QString name = QApplication::translate(it->first.getName(), it->second.c_str());
ui->comboNavigationStyle->addItem(name, data);
}
}
void DlgSettings3DViewImp::onAliasingChanged(int index)
{
if (index < 0 || !isVisible())
@@ -285,126 +166,5 @@ void DlgSettings3DViewImp::onAliasingChanged(int index)
}
}
void DlgSettings3DViewImp::onNewDocViewChanged(int index)
{
QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole);
if (camera == QByteArray("Custom")) {
CameraDialog dlg(this);
dlg.setValues(q0, q1, q2, q3);
if (dlg.exec()) {
dlg.getValues(q0, q1, q2, q3);
}
}
}
// ----------------------------------------------------------------------------
CameraDialog::CameraDialog(QWidget* parent)
: QDialog(parent)
{
this->setWindowTitle(tr("Camera settings"));
QGridLayout *gridLayout;
gridLayout = new QGridLayout(this);
QGroupBox *groupBox;
groupBox = new QGroupBox(this);
groupBox->setTitle(tr("Orientation"));
gridLayout->addWidget(groupBox, 0, 0, 1, 1);
QDialogButtonBox *buttonBox;
buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
gridLayout->addWidget(buttonBox, 3, 0, 1, 1);
QGridLayout *layout;
layout = new QGridLayout(groupBox);
// Q0
QLabel* label0 = new QLabel(groupBox);
label0->setText(tr("Q0"));
layout->addWidget(label0, 0, 0, 1, 1);
sb0 = new QDoubleSpinBox(groupBox);
sb0->setRange(-1, 1);
sb0->setSingleStep(0.1);
layout->addWidget(sb0, 0, 1, 1, 1);
// Q1
QLabel* label1 = new QLabel(groupBox);
label1->setText(tr("Q1"));
layout->addWidget(label1, 1, 0, 1, 1);
sb1 = new QDoubleSpinBox(groupBox);
sb1->setRange(-1, 1);
sb1->setSingleStep(0.1);
layout->addWidget(sb1, 1, 1, 1, 1);
// Q2
QLabel* label2 = new QLabel(groupBox);
label2->setText(tr("Q2"));
layout->addWidget(label2, 2, 0, 1, 1);
sb2 = new QDoubleSpinBox(groupBox);
sb2->setRange(-1, 1);
sb2->setSingleStep(0.1);
layout->addWidget(sb2, 2, 1, 1, 1);
// Q3
QLabel* label3 = new QLabel(groupBox);
label3->setText(tr("Q3"));
layout->addWidget(label3, 3, 0, 1, 1);
sb3 = new QDoubleSpinBox(groupBox);
sb3->setRange(-1, 1);
sb3->setSingleStep(0.1);
layout->addWidget(sb3, 3, 1, 1, 1);
QPushButton *currentViewButton;
currentViewButton = new QPushButton(this);
currentViewButton->setText(tr("Current view"));
currentViewButton->setObjectName(QString::fromLatin1("currentView"));
layout->addWidget(currentViewButton, 4, 1, 2, 1);
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QMetaObject::connectSlotsByName(this);
}
CameraDialog::~CameraDialog()
{
}
void CameraDialog::setValues(double q0, double q1, double q2, double q3)
{
sb0->setValue(q0);
sb1->setValue(q1);
sb2->setValue(q2);
sb3->setValue(q3);
}
void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) const
{
q0 = sb0->value();
q1 = sb1->value();
q2 = sb2->value();
q3 = sb3->value();
}
void CameraDialog::on_currentView_clicked()
{
View3DInventor* mdi = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if (mdi) {
SbRotation rot = mdi->getViewer()->getCameraOrientation();
const float* q = rot.getValue();
sb0->setValue(q[0]);
sb1->setValue(q[1]);
sb2->setValue(q[2]);
sb3->setValue(q[3]);
}
}
#include "moc_DlgSettings3DViewImp.cpp"

View File

@@ -50,39 +50,14 @@ public:
void loadSettings();
private Q_SLOTS:
void on_mouseButton_clicked();
void onAliasingChanged(int);
void onNewDocViewChanged(int);
protected:
void changeEvent(QEvent *e);
void retranslate();
private:
std::unique_ptr<Ui_DlgSettings3DView> ui;
static bool showMsg;
double q0, q1, q2, q3;
};
class CameraDialog : public QDialog
{
Q_OBJECT
public:
CameraDialog(QWidget* parent=0);
~CameraDialog();
void setValues(double q0, double q1, double q2, double q3);
void getValues(double& q0, double& q1, double& q2, double& q3) const;
private Q_SLOTS:
void on_currentView_clicked();
private:
QDoubleSpinBox* sb0;
QDoubleSpinBox* sb1;
QDoubleSpinBox* sb2;
QDoubleSpinBox* sb3;
};
} // namespace Dialog

View File

@@ -219,7 +219,6 @@ void DlgSettingsNavigation::retranslate()
}
}
#include "DlgSettings3DViewImp.h"
void DlgSettingsNavigation::onNewDocViewChanged(int index)
{
QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole);
@@ -233,7 +232,7 @@ void DlgSettingsNavigation::onNewDocViewChanged(int index)
}
// ----------------------------------------------------------------------------
#if 0
CameraDialog::CameraDialog(QWidget* parent)
: QDialog(parent)
{
@@ -339,7 +338,6 @@ void CameraDialog::on_currentView_clicked()
sb3->setValue(q[3]);
}
}
#endif
#include "moc_DlgSettingsNavigation.cpp"

View File

@@ -61,7 +61,7 @@ private:
std::unique_ptr<Ui_DlgSettingsNavigation> ui;
double q0, q1, q2, q3;
};
#if 0
class CameraDialog : public QDialog
{
Q_OBJECT
@@ -82,7 +82,7 @@ private:
QDoubleSpinBox* sb2;
QDoubleSpinBox* sb3;
};
#endif
} // namespace Dialog
} // namespace Gui