mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1889 Curve Creator : Add stretch to bottom field layout
This commit is contained in:
parent
6855d63394
commit
c00fb2d1f9
@ -23,6 +23,10 @@
|
||||
class RicSummaryCurveCreatorSplitterUi;
|
||||
class RicSummaryCurveCreator;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSummaryCurveCreatorDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
#include "RicSummaryCurveCreatorUiKeywords.h"
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiGroup.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
@ -93,8 +96,10 @@ void RicSummaryCurveCreatorSplitterUi::recursivelyConfigureAndUpdateTopLevelUiIt
|
||||
|
||||
m_secondRowLayout->insertWidget(1, getOrCreatePlotWidget());
|
||||
|
||||
// NB! Only groups at top level are handled, fields at top level are not added to layout
|
||||
|
||||
// Fields at bottom of dialog
|
||||
|
||||
configureAndUpdateFields(1, m_bottomFieldLayout, topLevelUiItems, uiConfigName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -125,6 +130,10 @@ QWidget* RicSummaryCurveCreatorSplitterUi::createWidget(QWidget* parent)
|
||||
|
||||
m_layout->addWidget(m_firstColumnSplitter);
|
||||
|
||||
m_bottomFieldLayout = new QHBoxLayout;
|
||||
m_layout->addLayout(m_bottomFieldLayout);
|
||||
m_bottomFieldLayout->insertStretch(0, 1);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@ -192,3 +201,72 @@ QWidget* RicSummaryCurveCreatorSplitterUi::getOrCreatePlotWidget()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreatorSplitterUi::configureAndUpdateFields(int widgetStartIndex,
|
||||
QBoxLayout* layout,
|
||||
const std::vector<caf::PdmUiItem *>& uiItems,
|
||||
const QString& uiConfigName)
|
||||
{
|
||||
int currentWidgetIndex = widgetStartIndex;
|
||||
|
||||
for (size_t i = 0; i < uiItems.size(); ++i)
|
||||
{
|
||||
if (uiItems[i]->isUiHidden(uiConfigName)) continue;
|
||||
if (uiItems[i]->isUiGroup()) continue;
|
||||
|
||||
{
|
||||
caf::PdmUiFieldHandle* field = dynamic_cast<caf::PdmUiFieldHandle*>(uiItems[i]);
|
||||
|
||||
caf::PdmUiFieldEditorHandle* fieldEditor = findOrCreateFieldEditor(this->widget(), field, uiConfigName);
|
||||
|
||||
if (fieldEditor)
|
||||
{
|
||||
fieldEditor->setField(field);
|
||||
|
||||
// Place the widget(s) into the correct parent and layout
|
||||
QWidget* fieldCombinedWidget = fieldEditor->combinedWidget();
|
||||
|
||||
if (fieldCombinedWidget)
|
||||
{
|
||||
fieldCombinedWidget->setParent(this->widget());
|
||||
layout->insertWidget(currentWidgetIndex++, fieldCombinedWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmUiItemInfo::LabelPosType labelPos = field->uiLabelPosition(uiConfigName);
|
||||
|
||||
QWidget* fieldEditorWidget = fieldEditor->editorWidget();
|
||||
|
||||
if (labelPos != caf::PdmUiItemInfo::HIDDEN)
|
||||
{
|
||||
QWidget* fieldLabelWidget = fieldEditor->labelWidget();
|
||||
if (fieldLabelWidget)
|
||||
{
|
||||
fieldLabelWidget->setParent(this->widget());
|
||||
|
||||
layout->insertWidget(currentWidgetIndex++, fieldLabelWidget);
|
||||
|
||||
fieldLabelWidget->show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QWidget* fieldLabelWidget = fieldEditor->labelWidget();
|
||||
if (fieldLabelWidget) fieldLabelWidget->hide();
|
||||
}
|
||||
|
||||
if (fieldEditorWidget)
|
||||
{
|
||||
fieldEditorWidget->setParent(this->widget()); // To make sure this widget has the current group box as parent.
|
||||
|
||||
layout->insertWidget(currentWidgetIndex++, fieldEditorWidget);
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor->updateUi(uiConfigName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,17 +24,22 @@
|
||||
|
||||
class RicSummaryCurveCreator;
|
||||
|
||||
class QHBoxLayout;
|
||||
class QMinimizePanel;
|
||||
class QSplitter;
|
||||
class QString;
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QBoxLayout;
|
||||
|
||||
namespace caf {
|
||||
class PdmUiItem;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSummaryCurveCreatorSplitterUi : public caf::PdmUiWidgetBasedObjectEditor
|
||||
{
|
||||
public:
|
||||
@ -54,6 +59,11 @@ private:
|
||||
const QString& keyword,
|
||||
const QString& uiConfigName);
|
||||
|
||||
void configureAndUpdateFields(int widgetStartIndex,
|
||||
QBoxLayout* layout,
|
||||
const std::vector<caf::PdmUiItem *>& topLevelUiItems,
|
||||
const QString& uiConfigName);
|
||||
|
||||
private:
|
||||
QPointer<QVBoxLayout> m_layout;
|
||||
QPointer<QSplitter> m_firstColumnSplitter;
|
||||
@ -63,4 +73,6 @@ private:
|
||||
QPointer<QHBoxLayout> m_firstRowLayout;
|
||||
QPointer<QHBoxLayout> m_secondRowLayout;
|
||||
QPointer<QVBoxLayout> m_lowerLeftLayout;
|
||||
|
||||
QPointer<QHBoxLayout> m_bottomFieldLayout;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user