diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index fb0dda47d1..535f54fa2c 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -67,7 +67,7 @@ static ParameterGrp::handle _GetParam() { * Provides two Gui::PropertyEditor::PropertyEditor widgets, for "View" and "Data", * in two tabs. */ -PropertyView::PropertyView(QWidget *parent, int sizeOfFirstColumn) +PropertyView::PropertyView(QWidget *parent) : QWidget(parent), SelectionObserver(false, ResolveMode::NoResolve) { auto pLayout = new QGridLayout( this ); @@ -83,12 +83,12 @@ PropertyView::PropertyView(QWidget *parent, int sizeOfFirstColumn) tabs->setTabPosition(QTabWidget::South); pLayout->addWidget(tabs, 0, 0); - propertyEditorView = new Gui::PropertyEditor::PropertyEditor(parent, sizeOfFirstColumn); + propertyEditorView = new Gui::PropertyEditor::PropertyEditor(); propertyEditorView->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionView", false)); propertyEditorView->setAutomaticExpand(_GetParam()->GetBool("AutoExpandView", false)); tabs->addTab(propertyEditorView, tr("View")); - propertyEditorData = new Gui::PropertyEditor::PropertyEditor(parent, sizeOfFirstColumn); + propertyEditorData = new Gui::PropertyEditor::PropertyEditor(); propertyEditorData->setAutomaticDocumentUpdate(_GetParam()->GetBool("AutoTransactionData", true)); propertyEditorData->setAutomaticExpand(_GetParam()->GetBool("AutoExpandData", false)); tabs->addTab(propertyEditorData, tr("Data")); diff --git a/src/Gui/PropertyView.h b/src/Gui/PropertyView.h index cf539df318..a058fcd04e 100644 --- a/src/Gui/PropertyView.h +++ b/src/Gui/PropertyView.h @@ -56,7 +56,7 @@ class PropertyView : public QWidget, public Gui::SelectionObserver Q_OBJECT public: - explicit PropertyView(QWidget *parent=nullptr, int sizeOfFirstColumn = 0); + explicit PropertyView(QWidget *parent=nullptr); ~PropertyView() override; Gui::PropertyEditor::PropertyEditor* propertyEditorView; diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 212eb7db24..fe830d468f 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -61,7 +61,6 @@ #include "Macro.h" #include "MainWindow.h" #include "MenuManager.h" -#include "PropertyView.h" #include "TreeParams.h" #include "View3DInventor.h" #include "ViewProviderDocumentObject.h" @@ -891,7 +890,8 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) QMenu editMenu; QActionGroup subMenuGroup(&subMenu); subMenuGroup.setExclusive(true); - connect(&subMenuGroup, &QActionGroup::triggered, this, &TreeWidget::onActivateDocument); + connect(&subMenuGroup, &QActionGroup::triggered, + this, &TreeWidget::onActivateDocument); MenuManager::getInstance()->setupContextMenu(&view, contextMenu); // get the current item diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 184d0420dd..e9aa88ca2d 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -51,7 +51,7 @@ FC_LOG_LEVEL_INIT("PropertyView", true, true) using namespace Gui::PropertyEditor; -PropertyEditor::PropertyEditor(QWidget *parent, int sizeOfFirstColumn) +PropertyEditor::PropertyEditor(QWidget *parent) : QTreeView(parent) , autoexpand(false) , autoupdate(false) @@ -100,8 +100,10 @@ PropertyEditor::PropertyEditor(QWidget *parent, int sizeOfFirstColumn) viewport()->installEventFilter(this); viewport()->setMouseTracking(true); - if (sizeOfFirstColumn != 0) { - header()->resizeSection(0, sizeOfFirstColumn); + auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/DockWindows/PropertyView"); + int firstColumnSize = hGrp->GetInt("FirstColumnSize", 0); + if (firstColumnSize != 0) { + header()->resizeSection(0, firstColumnSize); } } @@ -872,6 +874,9 @@ bool PropertyEditor::eventFilter(QObject* object, QEvent* event) { else if (mouse_event->type() == QEvent::MouseButtonRelease && mouse_event->button() == Qt::LeftButton && dragInProgress) { dragInProgress = false; + + auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/DockWindows/PropertyView"); + hGrp->SetInt("FirstColumnSize", header()->sectionSize(0)); return true; } } diff --git a/src/Gui/propertyeditor/PropertyEditor.h b/src/Gui/propertyeditor/PropertyEditor.h index 5c5342d129..bd01c2f99e 100644 --- a/src/Gui/propertyeditor/PropertyEditor.h +++ b/src/Gui/propertyeditor/PropertyEditor.h @@ -67,7 +67,7 @@ class PropertyEditor : public QTreeView Q_PROPERTY(QBrush itemBackground READ itemBackground WRITE setItemBackground DESIGNABLE true SCRIPTABLE true) // clazy:exclude=qproperty-without-notify public: - PropertyEditor(QWidget *parent = nullptr, int sizeOfFirstColumn = 0); + PropertyEditor(QWidget *parent = nullptr); ~PropertyEditor() override; /** Builds up the list view with the properties. */