Core: PropertyEditor : save properly the size of the first column.
This commit is contained in:
@@ -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"));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user