mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
#1940 Curve Creator : Always recreate curve creator to ensure stable init
This commit is contained in:
parent
fd1b8c83ff
commit
eec974c53d
@ -30,7 +30,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog(QWidget* parent, RicSummaryCurveCreator* summaryCurveCreator)
|
||||
RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_curveCreatorSplitterUi = new RicSummaryCurveCreatorSplitterUi(this);
|
||||
@ -41,9 +41,6 @@ RicSummaryCurveCreatorDialog::RicSummaryCurveCreatorDialog(QWidget* parent, RicS
|
||||
dummy->setContentsMargins(0, 0, 0, 0);
|
||||
dummy->addWidget(propertyWidget);
|
||||
|
||||
m_curveCreatorSplitterUi->setPdmObject(summaryCurveCreator);
|
||||
m_curveCreatorSplitterUi->updateUi();
|
||||
|
||||
setWindowTitle("ResInsight: Plot Editor");
|
||||
resize(1200, 800);
|
||||
connect(m_curveCreatorSplitterUi, SIGNAL(signalCloseButtonPressed()), this, SLOT(accept()));
|
||||
@ -58,6 +55,15 @@ RicSummaryCurveCreatorDialog::~RicSummaryCurveCreatorDialog()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreatorDialog::setCurveCreator(RicSummaryCurveCreator* summaryCurveCreator)
|
||||
{
|
||||
m_curveCreatorSplitterUi->setPdmObject(summaryCurveCreator);
|
||||
m_curveCreatorSplitterUi->updateUi();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -31,9 +31,11 @@ class RicSummaryCurveCreatorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RicSummaryCurveCreatorDialog(QWidget* parent, RicSummaryCurveCreator* summaryCurveCreator);
|
||||
RicSummaryCurveCreatorDialog(QWidget* parent);
|
||||
~RicSummaryCurveCreatorDialog();
|
||||
|
||||
void setCurveCreator(RicSummaryCurveCreator* summaryCurveCreator);
|
||||
|
||||
private slots:
|
||||
void slotDialogFinished();
|
||||
|
||||
|
@ -28,8 +28,8 @@ RicSummaryCurveCreatorFactoryImpl* RicSummaryCurveCreatorFactoryImpl::ms_instanc
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCreatorFactoryImpl::RicSummaryCurveCreatorFactoryImpl()
|
||||
{
|
||||
m_curveCreator = new RicSummaryCurveCreator();
|
||||
m_dialogWithSplitter = new RicSummaryCurveCreatorDialog(nullptr, m_curveCreator);
|
||||
m_dialogWithSplitter = new RicSummaryCurveCreatorDialog(nullptr);
|
||||
m_curveCreator = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -48,8 +48,20 @@ RicSummaryCurveCreatorFactoryImpl::~RicSummaryCurveCreatorFactoryImpl()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSummaryCurveCreator* RicSummaryCurveCreatorFactoryImpl::curveCreator()
|
||||
{
|
||||
if (m_curveCreator == nullptr)
|
||||
m_curveCreator = new RicSummaryCurveCreator();
|
||||
if (m_curveCreator)
|
||||
{
|
||||
delete m_curveCreator;
|
||||
m_curveCreator = nullptr;
|
||||
}
|
||||
|
||||
// Recreate curve creator to make sure initialization is stable
|
||||
m_curveCreator = new RicSummaryCurveCreator();
|
||||
|
||||
if (m_dialogWithSplitter)
|
||||
{
|
||||
m_dialogWithSplitter->setCurveCreator(m_curveCreator);
|
||||
}
|
||||
|
||||
return m_curveCreator;
|
||||
}
|
||||
|
||||
@ -59,7 +71,8 @@ RicSummaryCurveCreator* RicSummaryCurveCreatorFactoryImpl::curveCreator()
|
||||
RicSummaryCurveCreatorDialog* RicSummaryCurveCreatorFactoryImpl::dialog()
|
||||
{
|
||||
if (m_dialogWithSplitter == nullptr)
|
||||
m_dialogWithSplitter = new RicSummaryCurveCreatorDialog(nullptr, curveCreator());
|
||||
m_dialogWithSplitter = new RicSummaryCurveCreatorDialog(nullptr);
|
||||
|
||||
return m_dialogWithSplitter;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user