diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp
index 461d68edc..776da73f2 100644
--- a/src/Gui/PropertyView.cpp
+++ b/src/Gui/PropertyView.cpp
@@ -29,6 +29,7 @@
#endif
/// Here the FreeCAD includes sorted by Base,App,Gui......
+#include
#include
#include
#include
@@ -73,9 +74,22 @@ PropertyView::PropertyView(QWidget *parent)
propertyEditorView = new Gui::PropertyEditor::PropertyEditor();
propertyEditorView->setAutomaticDocumentUpdate(false);
tabs->addTab(propertyEditorView, tr("View"));
+
propertyEditorData = new Gui::PropertyEditor::PropertyEditor();
propertyEditorData->setAutomaticDocumentUpdate(true);
tabs->addTab(propertyEditorData, tr("Data"));
+
+ ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().
+ GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("PropertyView");
+ if ( hGrp ) {
+ int preferredTab = hGrp->GetInt("LastTabIndex", 1);
+
+ if ( preferredTab > 0 && preferredTab < tabs->count() )
+ tabs->setCurrentIndex(preferredTab);
+ }
+
+ // connect after adding all tabs, so adding doesn't thrash the parameter
+ connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
}
PropertyView::~PropertyView()
@@ -192,6 +206,15 @@ void PropertyView::onSelectionChanged(const SelectionChanges& msg)
propertyEditorView->buildUp(viewProps);
}
+void PropertyView::tabChanged(int index)
+{
+ ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().
+ GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("PropertyView");
+ if (hGrp) {
+ hGrp->SetInt("LastTabIndex", index);
+ }
+}
+
void PropertyView::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
diff --git a/src/Gui/PropertyView.h b/src/Gui/PropertyView.h
index 532ef0fc9..a1b59c105 100644
--- a/src/Gui/PropertyView.h
+++ b/src/Gui/PropertyView.h
@@ -62,6 +62,10 @@ public:
Gui::PropertyEditor::PropertyEditor* propertyEditorView;
Gui::PropertyEditor::PropertyEditor* propertyEditorData;
+public Q_SLOTS:
+ /// Stores a preference for the last tab selected
+ void tabChanged(int index);
+
protected:
void changeEvent(QEvent *e);