mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1977 Curve Calculator : Add button box to dialogs
This commit is contained in:
parent
e95b9a66a5
commit
650e29d6d5
@ -18,10 +18,11 @@
|
||||
|
||||
#include "RicSummaryCurveCalculatorDialog.h"
|
||||
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include "RicSummaryCurveCalculatorWidget.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -46,11 +47,17 @@ RicSummaryCurveCalculatorDialog::~RicSummaryCurveCalculatorDialog()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCalculatorDialog::setUp()
|
||||
{
|
||||
QVBoxLayout* dummy = new QVBoxLayout(this);
|
||||
dummy->setContentsMargins(0, 0, 0, 0);
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
RicSummaryCurveCalculatorWidget* w = new RicSummaryCurveCalculatorWidget(this);
|
||||
dummy->addWidget(w->getOrCreateWidget(this));
|
||||
mainLayout->addWidget(w->getOrCreateWidget(this));
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
mainLayout->addWidget(buttonBox);
|
||||
|
||||
w->updateUi();
|
||||
}
|
||||
|
@ -61,24 +61,28 @@ void RimCalculationVariable::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
{
|
||||
if (changedField == &m_button)
|
||||
{
|
||||
RiuSummaryCurveDefSelectionDialog dlg(nullptr);
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> sumCasePairs;
|
||||
sumCasePairs.push_back(RiaSummaryCurveDefinition(m_case(), m_summaryAddress->address()));
|
||||
|
||||
dlg.summaryAddressSelection()->setSelectedCurveDefinitions(sumCasePairs);
|
||||
dlg.summaryAddressSelection()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> sumCasePairs = dlg.summaryAddressSelection()->selectedCurveDefinitions();
|
||||
if (sumCasePairs.size() == 1)
|
||||
RiuSummaryCurveDefSelectionDialog dlg(nullptr);
|
||||
{
|
||||
m_case = sumCasePairs[0].summaryCase();
|
||||
m_summaryAddress->setAddress(sumCasePairs[0].summaryAddress());
|
||||
std::vector<RiaSummaryCurveDefinition> sumCasePairs;
|
||||
sumCasePairs.push_back(RiaSummaryCurveDefinition(m_case(), m_summaryAddress->address()));
|
||||
|
||||
dlg.summaryAddressSelection()->setSelectedCurveDefinitions(sumCasePairs);
|
||||
dlg.summaryAddressSelection()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> sumCasePairs = dlg.summaryAddressSelection()->selectedCurveDefinitions();
|
||||
if (sumCasePairs.size() == 1)
|
||||
{
|
||||
m_case = sumCasePairs[0].summaryCase();
|
||||
m_summaryAddress->setAddress(sumCasePairs[0].summaryAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +91,21 @@ void RimCalculationVariable::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCalculationVariable::summaryAddressDisplayString() const
|
||||
{
|
||||
return "test";
|
||||
QString caseName;
|
||||
if (m_case()) caseName = m_case->shortName();
|
||||
|
||||
QString summaryCurvename = QString::fromStdString(m_summaryAddress()->address().uiText());
|
||||
|
||||
QString txt;
|
||||
if (!caseName.isEmpty())
|
||||
{
|
||||
txt = caseName;
|
||||
txt += " : ";
|
||||
}
|
||||
|
||||
txt += summaryCurvename;
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiuSummaryCurveDefSelectionWidget.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -31,12 +32,18 @@ RiuSummaryCurveDefSelectionDialog::RiuSummaryCurveDefSelectionDialog(QWidget* pa
|
||||
m_addrSelWidget = new RiuSummaryCurveDefSelectionWidget(this);
|
||||
QWidget* addrWidget = m_addrSelWidget->getOrCreateWidget(this);
|
||||
|
||||
QVBoxLayout* dummy = new QVBoxLayout(this);
|
||||
dummy->setContentsMargins(0, 0, 0, 0);
|
||||
dummy->addWidget(addrWidget);
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->addWidget(addrWidget);
|
||||
|
||||
setWindowTitle("Summary Address Selection");
|
||||
resize(1200, 800);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
mainLayout->addWidget(buttonBox);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user