mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
#3564 System : Recreate QGridLayout for each property editor
If the layout is reused, the rows grow over time. This causes the Cell Result to not fill all available space.
This commit is contained in:
parent
7febeba433
commit
f6c92a15a6
@ -50,7 +50,6 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
// Register default field editor for selected types
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiCheckBoxEditor, bool);
|
||||
|
||||
@ -68,43 +67,50 @@ CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<float>);
|
||||
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiFilePathEditor, FilePath);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiDefaultObjectEditor::PdmUiDefaultObjectEditor() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiDefaultObjectEditor::PdmUiDefaultObjectEditor()
|
||||
{
|
||||
}
|
||||
|
||||
PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiDefaultObjectEditor::createWidget(QWidget* parent)
|
||||
{
|
||||
QWidget* widget = new QWidget(parent);
|
||||
|
||||
QGridLayout* gridLayout = new QGridLayout();
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
widget->setLayout(gridLayout);
|
||||
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiDefaultObjectEditor::recursivelyConfigureAndUpdateTopLevelUiOrdering(const PdmUiOrdering& topLevelUiOrdering, const QString& uiConfigName)
|
||||
void PdmUiDefaultObjectEditor::recursivelyConfigureAndUpdateTopLevelUiOrdering(const PdmUiOrdering& topLevelUiOrdering,
|
||||
const QString& uiConfigName)
|
||||
{
|
||||
CAF_ASSERT(this->widget());
|
||||
|
||||
// Recreate layout object, as the content of the grid layout grows. This causes Cell Result to have a lot of space at the
|
||||
// bottom and no other solution has been found. Similar issues might also be the case for the grid layout inside group boxes
|
||||
{
|
||||
auto currentLayout = this->widget()->layout();
|
||||
if (currentLayout)
|
||||
{
|
||||
delete currentLayout;
|
||||
}
|
||||
}
|
||||
|
||||
CAF_ASSERT(this->widget()->layout() == nullptr);
|
||||
|
||||
QGridLayout* gridLayout = new QGridLayout();
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
this->widget()->setLayout(gridLayout);
|
||||
|
||||
recursivelyConfigureAndUpdateUiOrderingInGridLayoutColumn(topLevelUiOrdering, this->widget(), uiConfigName);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUiFormLayoutObjectEditor.h"
|
||||
@ -44,14 +43,12 @@
|
||||
class QGridLayout;
|
||||
class QString;
|
||||
|
||||
namespace caf
|
||||
namespace caf
|
||||
{
|
||||
|
||||
class PdmUiFieldEditorHandle;
|
||||
class PdmUiItem;
|
||||
class PdmUiGroup;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
/// The default editor for PdmObjects. Manages the field editors in a grid layout vertically
|
||||
//==================================================================================================
|
||||
@ -65,9 +62,7 @@ public:
|
||||
private:
|
||||
QWidget* createWidget(QWidget* parent) override;
|
||||
void recursivelyConfigureAndUpdateTopLevelUiOrdering(const PdmUiOrdering& topLevelUiItems,
|
||||
const QString& uiConfigName) override;
|
||||
|
||||
const QString& uiConfigName) override;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace caf
|
||||
|
Loading…
Reference in New Issue
Block a user