mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into dev-deeper
This commit is contained in:
commit
8b7b110440
@ -22,6 +22,8 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -33,4 +33,19 @@ class RiaStatisticsTools
|
||||
{
|
||||
public:
|
||||
static const QString replacePercentileByPValueText(const QString& percentile);
|
||||
|
||||
|
||||
template<class NumberType> static bool isInvalidNumber(NumberType value)
|
||||
{
|
||||
return !isValidNumber<NumberType>(value);
|
||||
}
|
||||
|
||||
template<class NumberType> static bool isValidNumber(NumberType value)
|
||||
{
|
||||
if (std::isinf(value)) return false;
|
||||
if (std::isnan(value)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -325,23 +325,32 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
{
|
||||
for (auto wellPath : usedWellPaths)
|
||||
{
|
||||
std::vector<RigCompletionData> wellCompletions;
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for (const auto& completion : completions)
|
||||
{
|
||||
if (completion.wellName() == wellPath->completions()->wellNameForExport())
|
||||
{
|
||||
wellCompletions.push_back(completion);
|
||||
completionsForWell.push_back(completion);
|
||||
}
|
||||
}
|
||||
|
||||
if (wellCompletions.empty()) continue;
|
||||
if (completionsForWell.empty()) continue;
|
||||
|
||||
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
|
||||
for (const auto& fracItem : fractureDataReportItems)
|
||||
{
|
||||
if (fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport())
|
||||
{
|
||||
reportItemsForWell.push_back(fracItem);
|
||||
}
|
||||
}
|
||||
|
||||
QString fileName = QString("%1_unifiedCompletions_%2").arg(wellPath->name()).arg(eclipseCaseName);
|
||||
sortAndExportCompletionsToFile(exportSettings.caseToApply,
|
||||
exportSettings.folder,
|
||||
fileName,
|
||||
wellCompletions,
|
||||
fractureDataReportItems,
|
||||
completionsForWell,
|
||||
reportItemsForWell,
|
||||
exportSettings.compdatExport);
|
||||
progress.incrementProgress();
|
||||
}
|
||||
@ -357,17 +366,17 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
{
|
||||
for (auto wellPath : usedWellPaths)
|
||||
{
|
||||
std::vector<RigCompletionData> wellCompletions;
|
||||
std::vector<RigCompletionData> completionsForWell;
|
||||
for (const auto& completion : completions)
|
||||
{
|
||||
if (completion.wellName() == wellPath->completions()->wellNameForExport() &&
|
||||
completionType == completion.completionType())
|
||||
{
|
||||
wellCompletions.push_back(completion);
|
||||
completionsForWell.push_back(completion);
|
||||
}
|
||||
}
|
||||
|
||||
if (wellCompletions.empty()) continue;
|
||||
if (completionsForWell.empty()) continue;
|
||||
|
||||
{
|
||||
QString completionTypeText;
|
||||
@ -378,11 +387,20 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
QString fileName = QString("%1_%2_%3").arg(wellPath->name()).arg(completionTypeText).arg(eclipseCaseName);
|
||||
if (completionType == RigCompletionData::FRACTURE)
|
||||
{
|
||||
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
|
||||
for (const auto& fracItem : fractureDataReportItems)
|
||||
{
|
||||
if (fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport())
|
||||
{
|
||||
reportItemsForWell.push_back(fracItem);
|
||||
}
|
||||
}
|
||||
|
||||
sortAndExportCompletionsToFile(exportSettings.caseToApply,
|
||||
exportSettings.folder,
|
||||
fileName,
|
||||
wellCompletions,
|
||||
fractureDataReportItems,
|
||||
completionsForWell,
|
||||
reportItemsForWell,
|
||||
exportSettings.compdatExport);
|
||||
}
|
||||
else
|
||||
@ -391,7 +409,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
|
||||
sortAndExportCompletionsToFile(exportSettings.caseToApply,
|
||||
exportSettings.folder,
|
||||
fileName,
|
||||
wellCompletions,
|
||||
completionsForWell,
|
||||
emptyReportItemVector,
|
||||
exportSettings.compdatExport);
|
||||
}
|
||||
|
@ -25,11 +25,11 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellPathFractureReportItem::RicWellPathFractureReportItem(const QString& wellPathName,
|
||||
RicWellPathFractureReportItem::RicWellPathFractureReportItem(const QString& wellPathNameForExport,
|
||||
const QString& fractureName,
|
||||
const QString& fractureTemplateName,
|
||||
double measuredDepth)
|
||||
: m_wellPathNameForExport(wellPathName)
|
||||
: m_wellPathNameForExport(wellPathNameForExport)
|
||||
, m_wellPathFracture(fractureName)
|
||||
, m_wellPathFractureTemplate(fractureTemplateName)
|
||||
, m_mesuredDepth(measuredDepth)
|
||||
|
@ -80,14 +80,28 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
|
||||
|
||||
textStream << lineStart << "\n";
|
||||
|
||||
auto proj = RiaApplication::instance()->project();
|
||||
auto fractureTemplates = proj->activeOilField()->fractureDefinitionCollection()->fractureTemplates();
|
||||
|
||||
std::vector<RimStimPlanFractureTemplate*> stimPlanTemplates;
|
||||
std::vector<RimEllipseFractureTemplate*> ellipseTemplates;
|
||||
|
||||
|
||||
{
|
||||
auto proj = RiaApplication::instance()->project();
|
||||
auto fractureTemplates = proj->activeOilField()->fractureDefinitionCollection()->fractureTemplates();
|
||||
|
||||
std::set<QString> usedFractureTemplateNames;
|
||||
for (const auto& item : wellPathFractureReportItems)
|
||||
{
|
||||
usedFractureTemplateNames.insert(item.fractureTemplateName());
|
||||
}
|
||||
|
||||
for (const auto fracTemplate : fractureTemplates)
|
||||
{
|
||||
if (usedFractureTemplateNames.find(fracTemplate->name()) == usedFractureTemplateNames.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
auto stimPlanTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(fracTemplate);
|
||||
if (stimPlanTemplate)
|
||||
{
|
||||
@ -100,6 +114,7 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
|
||||
ellipseTemplates.push_back(ellipseTemplate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!RiaRegressionTestRunner::instance()->isRunningRegressionTests())
|
||||
{
|
||||
@ -136,7 +151,11 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(
|
||||
}
|
||||
|
||||
{
|
||||
QString tableText = createFractureText(fractureTemplates);
|
||||
std::vector<RimFractureTemplate*> fracTemplates;
|
||||
fracTemplates.insert(fracTemplates.end(), ellipseTemplates.begin(), ellipseTemplates.end());
|
||||
fracTemplates.insert(fracTemplates.end(), stimPlanTemplates.begin(), stimPlanTemplates.end());
|
||||
|
||||
QString tableText = createFractureText(fracTemplates);
|
||||
textStream << tableText;
|
||||
textStream << lineStart << "\n";
|
||||
}
|
||||
@ -698,7 +717,8 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicWellPathFractureTextReportFeatureImpl::createFracturePressureDepletionSummaryText(const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems) const
|
||||
QString RicWellPathFractureTextReportFeatureImpl::createFracturePressureDepletionSummaryText(
|
||||
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems) const
|
||||
{
|
||||
QString tableText;
|
||||
|
||||
@ -706,13 +726,11 @@ QString RicWellPathFractureTextReportFeatureImpl::createFracturePressureDepletio
|
||||
RifEclipseDataTableFormatter formatter(stream);
|
||||
configureFormatter(&formatter);
|
||||
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
std::vector<RifEclipseOutputTableColumn> header = {RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("Fracture"),
|
||||
RifEclipseOutputTableColumn("Actual WBHP"),
|
||||
RifEclipseOutputTableColumn("Min Pressure Drop"),
|
||||
RifEclipseOutputTableColumn("Max Pressure Drop")
|
||||
};
|
||||
RifEclipseOutputTableColumn("Max Pressure Drop")};
|
||||
|
||||
bool createdTable = false;
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimVirtualPerforationResults.h"
|
||||
@ -121,16 +122,30 @@ void RivWellConnectionFactorPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode
|
||||
}
|
||||
}
|
||||
|
||||
bool showConnectionFactorOnWellPath = true;
|
||||
{
|
||||
for (const auto& completion : completionsForCell.second)
|
||||
{
|
||||
auto fracture = dynamic_cast<const RimFracture*>(completion.sourcePdmObject());
|
||||
if (fracture)
|
||||
{
|
||||
showConnectionFactorOnWellPath = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t reservoirCellIndex = completionsForCell.first;
|
||||
|
||||
const RigCell& rigCell = mainGrid->cell(reservoirCellIndex);
|
||||
|
||||
cvf::Vec3d locationInDomainCoord = rigCell.center();
|
||||
cvf::Vec3d direction = cvf::Vec3d::X_AXIS;
|
||||
bool foundLocation = false;
|
||||
|
||||
if (showConnectionFactorOnWellPath)
|
||||
{
|
||||
size_t i = 0;
|
||||
bool foundLocation = false;
|
||||
|
||||
while (!foundLocation && (i < wellPathCellIntersections.size()))
|
||||
{
|
||||
const WellPathCellIntersectionInfo& intersectionInfo = wellPathCellIntersections[i];
|
||||
|
@ -42,7 +42,7 @@ void RigStatisticsMath::calculateBasicStatistics(const std::vector<double>& valu
|
||||
for (size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
double val = values[i];
|
||||
if (val == HUGE_VAL) continue;
|
||||
if (RiaStatisticsTools::isInvalidNumber<double>(val)) continue;
|
||||
|
||||
validValueCount++;
|
||||
|
||||
@ -57,7 +57,6 @@ void RigStatisticsMath::calculateBasicStatistics(const std::vector<double>& valu
|
||||
{
|
||||
m_mean = m_sum / validValueCount;
|
||||
|
||||
|
||||
// http://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods
|
||||
// Running standard deviation
|
||||
|
||||
@ -91,7 +90,7 @@ std::vector<double> RigStatisticsMath::calculateNearestRankPercentiles(const std
|
||||
|
||||
for (size_t i = 0; i < inputValues.size(); ++i)
|
||||
{
|
||||
if (inputValues[i] != HUGE_VAL)
|
||||
if (RiaStatisticsTools::isValidNumber<double>(inputValues[i]))
|
||||
{
|
||||
sortedValues.push_back(inputValues[i]);
|
||||
}
|
||||
@ -130,7 +129,7 @@ std::vector<double> RigStatisticsMath::calculateInterpolatedPercentiles(const st
|
||||
|
||||
for (size_t i = 0; i < inputValues.size(); ++i)
|
||||
{
|
||||
if (inputValues[i] != HUGE_VAL)
|
||||
if (RiaStatisticsTools::isValidNumber<double>(inputValues[i]))
|
||||
{
|
||||
sortedValues.push_back(inputValues[i]);
|
||||
}
|
||||
@ -195,10 +194,7 @@ RigHistogramCalculator::RigHistogramCalculator(double min, double max, size_t nB
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigHistogramCalculator::addValue(double value)
|
||||
{
|
||||
if (value == HUGE_VAL || value != value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (RiaStatisticsTools::isInvalidNumber<double>(value)) return;
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
@ -262,5 +258,6 @@ double RigHistogramCalculator::calculatePercentil(double pVal)
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RiaStatisticsTools.h"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
@ -82,11 +84,8 @@ public:
|
||||
|
||||
void addValue(double value)
|
||||
{
|
||||
if (value == HUGE_VAL) // TODO
|
||||
if (RiaStatisticsTools::isValidNumber<double>(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (value < min)
|
||||
{
|
||||
min = value;
|
||||
@ -97,6 +96,7 @@ public:
|
||||
max = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double max;
|
||||
double min;
|
||||
@ -126,11 +126,8 @@ public:
|
||||
|
||||
void addValue(double value)
|
||||
{
|
||||
if (value == HUGE_VAL)
|
||||
if (RiaStatisticsTools::isValidNumber<double>(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (value < pos && value > 0)
|
||||
{
|
||||
pos = value;
|
||||
@ -141,6 +138,7 @@ public:
|
||||
neg = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double pos;
|
||||
double neg;
|
||||
@ -170,14 +168,12 @@ public:
|
||||
|
||||
void addValue(double value)
|
||||
{
|
||||
if (value == HUGE_VAL || value != value)
|
||||
if (RiaStatisticsTools::isValidNumber<double>(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
valueSum += value;
|
||||
++sampleCount;
|
||||
}
|
||||
}
|
||||
|
||||
double valueSum;
|
||||
size_t sampleCount;
|
||||
@ -207,9 +203,12 @@ public:
|
||||
}
|
||||
|
||||
void addValue(double value)
|
||||
{
|
||||
if (RiaStatisticsTools::isValidNumber<double>(value))
|
||||
{
|
||||
uniqueValues.insert(static_cast<int>(value));
|
||||
}
|
||||
}
|
||||
|
||||
std::set<int> uniqueValues;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ TEST(RigStatisticsMath, BasicTest)
|
||||
values.push_back(80720.4378655615000);
|
||||
values.push_back(-98649.8109937874000);
|
||||
values.push_back(99372.9362079615000);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(-HUGE_VAL);
|
||||
values.push_back(-57020.4389966513000);
|
||||
|
||||
double min, max, sum, range, mean, stdev;
|
||||
@ -65,7 +65,7 @@ TEST(RigStatisticsMath, BasicTest)
|
||||
TEST(RigStatisticsMath, RankPercentiles)
|
||||
{
|
||||
std::vector<double> values;
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(-HUGE_VAL);
|
||||
values.push_back(2788.2723335651900);
|
||||
values.push_back(-22481.0927881701000);
|
||||
values.push_back(68778.6851686236000);
|
||||
@ -113,8 +113,8 @@ TEST(RigStatisticsMath, HistogramPercentiles)
|
||||
values.push_back(6391.97999909729003);
|
||||
values.push_back(65930.1200169780000);
|
||||
values.push_back(-27696.2320267235000);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(-HUGE_VAL);
|
||||
values.push_back(-HUGE_VAL);
|
||||
values.push_back(96161.7546348456000);
|
||||
values.push_back(73875.6716288563000);
|
||||
values.push_back(80720.4378655615000);
|
||||
@ -179,3 +179,52 @@ TEST(RigStatisticsMath, InterpolatedPercentiles)
|
||||
EXPECT_DOUBLE_EQ( 6391.9799990972897, pVals[2]);
|
||||
EXPECT_DOUBLE_EQ( 93073.49128098879, pVals[3]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigStatisticsMath, Accumulators)
|
||||
{
|
||||
std::vector<double> values;
|
||||
|
||||
const double v1 = 2788.2723335651900;
|
||||
const double v2 = 68778.6851686236000;
|
||||
const double v3 = -98649.8109937874000;
|
||||
const double v4 = -57020.4389966513000;
|
||||
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(v1);
|
||||
values.push_back(v2);
|
||||
values.push_back(-HUGE_VAL);
|
||||
values.push_back(v3);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(v4);
|
||||
|
||||
{
|
||||
MinMaxAccumulator acc;
|
||||
acc.addData(values);
|
||||
|
||||
EXPECT_DOUBLE_EQ(v3, acc.min);
|
||||
EXPECT_DOUBLE_EQ(v2, acc.max);
|
||||
}
|
||||
|
||||
{
|
||||
PosNegAccumulator acc;
|
||||
acc.addData(values);
|
||||
|
||||
EXPECT_DOUBLE_EQ(v1, acc.pos);
|
||||
EXPECT_DOUBLE_EQ(v4, acc.neg);
|
||||
}
|
||||
|
||||
{
|
||||
SumCountAccumulator acc;
|
||||
acc.addData(values);
|
||||
|
||||
const double sum = v1 + v2 + v3 + v4;
|
||||
|
||||
EXPECT_FALSE(std::isinf(acc.valueSum));
|
||||
|
||||
EXPECT_DOUBLE_EQ(sum, acc.valueSum);
|
||||
EXPECT_EQ(4u, acc.sampleCount);
|
||||
}
|
||||
}
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
@ -89,6 +90,21 @@ public:
|
||||
m_heightHint = heightHint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QTreeView::keyPressEvent(event);
|
||||
|
||||
if (event->key() == Qt::Key_Down || event->key() == Qt::Key_Up ||
|
||||
event->key() == Qt::Key_Home || event->key() == Qt::Key_End ||
|
||||
event->key() == Qt::Key_PageDown || event->key() == Qt::Key_PageUp)
|
||||
{
|
||||
emit clicked(currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int m_heightHint;
|
||||
};
|
||||
@ -244,8 +260,8 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
m_treeView->setModel(m_proxyModel);
|
||||
|
||||
connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||
this, SLOT(slotCurrentChanged(QModelIndex, QModelIndex)));
|
||||
connect(m_treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
|
||||
|
||||
}
|
||||
|
||||
bool optionsOnly = true;
|
||||
@ -291,7 +307,7 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
}
|
||||
|
||||
connect(m_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotClicked(QModelIndex)));
|
||||
connect(m_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotClicked(QModelIndex)), Qt::UniqueConnection);
|
||||
|
||||
if (!m_attributes.showTextFilter)
|
||||
{
|
||||
@ -471,6 +487,14 @@ void PdmUiTreeSelectionEditor::customMenuRequested(const QPoint& pos)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
|
||||
{
|
||||
currentChanged(current);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -574,7 +598,27 @@ void PdmUiTreeSelectionEditor::slotTextFilterChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous)
|
||||
void PdmUiTreeSelectionEditor::slotClicked(const QModelIndex& index)
|
||||
{
|
||||
if (m_attributes.setCurrentIndexWhenItemIsChecked && index.isValid())
|
||||
{
|
||||
QModelIndexList selectedIndexes = m_treeView->selectionModel()->selectedIndexes();
|
||||
if (selectedIndexes.size() < 2)
|
||||
{
|
||||
QVariant v = m_proxyModel->data(index, Qt::CheckStateRole);
|
||||
if (v == Qt::Checked)
|
||||
{
|
||||
m_treeView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
currentChanged(index);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::currentChanged(const QModelIndex& current)
|
||||
{
|
||||
if (m_attributes.singleSelectionMode)
|
||||
{
|
||||
@ -593,25 +637,6 @@ void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, co
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::slotClicked(const QModelIndex& index)
|
||||
{
|
||||
if (m_attributes.setCurrentIndexWhenItemIsChecked && index.isValid())
|
||||
{
|
||||
QModelIndexList selectedIndexes = m_treeView->selectionModel()->selectedIndexes();
|
||||
if (selectedIndexes.size() < 2)
|
||||
{
|
||||
QVariant v = m_proxyModel->data(index, Qt::CheckStateRole);
|
||||
if (v == Qt::Checked)
|
||||
{
|
||||
m_treeView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -103,6 +103,7 @@ protected:
|
||||
private slots:
|
||||
void customMenuRequested(const QPoint& pos);
|
||||
|
||||
void slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
void slotSetSelectedOn();
|
||||
void slotSetSelectedOff();
|
||||
void slotSetSubItemsOn();
|
||||
@ -112,10 +113,11 @@ private slots:
|
||||
|
||||
void slotTextFilterChanged();
|
||||
|
||||
void slotCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
void slotClicked(const QModelIndex& index);
|
||||
|
||||
private:
|
||||
void currentChanged(const QModelIndex& current);
|
||||
|
||||
void setCheckedStateOfSelected(bool checked);
|
||||
void setCheckedStateForSubItemsOfSelected(bool checked);
|
||||
void checkAllItems();
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -485,7 +486,7 @@ bool caf::PdmUiTreeSelectionQModel::setData(const QModelIndex &index, const QVar
|
||||
}
|
||||
|
||||
PdmUiCommandSystemProxy::instance()->setUiValueToField(m_uiFieldHandle->uiField(), fieldValueSelection);
|
||||
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user