mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added toggle state to property filter collection
p4#: 21429
This commit is contained in:
parent
7b2ec05383
commit
47eb6c7589
@ -35,6 +35,8 @@ RimCellPropertyFilterCollection::RimCellPropertyFilterCollection()
|
||||
CAF_PDM_InitObject("Cell Property Filters", ":/CellFilter_Values.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -76,6 +78,8 @@ RimReservoirView* RimCellPropertyFilterCollection::reservoirView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
updateIconState();
|
||||
|
||||
m_reservoirView->fieldChangedByUi(&(m_reservoirView->propertyFilterCollection), oldValue, newValue);
|
||||
}
|
||||
|
||||
@ -142,6 +146,8 @@ void RimCellPropertyFilterCollection::remove(RimCellPropertyFilter* propertyFilt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellPropertyFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
@ -156,6 +162,8 @@ bool RimCellPropertyFilterCollection::hasActiveFilters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
@ -164,3 +172,36 @@ bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellPropertyFilterCollection::updateIconState()
|
||||
{
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon(QIcon());
|
||||
// Get static one
|
||||
QIcon icon = this->uiIcon();
|
||||
|
||||
// Get a pixmap, and modify it
|
||||
|
||||
QPixmap icPixmap;
|
||||
icPixmap = icon.pixmap(16, 16, QIcon::Normal);
|
||||
|
||||
if (!active)
|
||||
{
|
||||
QIcon temp(icPixmap);
|
||||
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
|
||||
}
|
||||
|
||||
QIcon newIcon(icPixmap);
|
||||
this->setUiIcon(newIcon);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellPropertyFilterCollection::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
@ -33,22 +33,27 @@ public:
|
||||
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField< std::list< caf::PdmPointer< RimCellPropertyFilter > > > propertyFilters;
|
||||
|
||||
// Methods
|
||||
RimCellPropertyFilter* createAndAppendPropertyFilter();
|
||||
void remove(RimCellPropertyFilter* propertyFilter);
|
||||
RimCellPropertyFilter* createAndAppendPropertyFilter();
|
||||
void remove(RimCellPropertyFilter* propertyFilter);
|
||||
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveDynamicFilters() const;
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveDynamicFilters() const;
|
||||
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
|
||||
void updateIconState();
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
|
Loading…
Reference in New Issue
Block a user