Add filtering/exclude of rows in SummaryTable (#10193)

- Add selector for excluding rows in table
- Row selection is based on category, vector, threshold
- Move data containers to utils class
- TreeSelectionEditor: Add context menu to invert selection
- Improved naming of menu items
- Guard plotDefinition before connect signal/slots

---------

Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
This commit is contained in:
Jørgen Herje
2023-05-02 11:18:45 +02:00
committed by GitHub
parent c9839fcf93
commit 342f191288
11 changed files with 402 additions and 128 deletions

View File

@@ -232,14 +232,14 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi( const QString& uiConfigName
}
else
{
if ( options.size() == 0 )
if ( options.empty() == 0 )
{
m_toggleAllCheckBox->setChecked( false );
}
else
{
QModelIndexList indices = allVisibleSourceModelIndices();
if ( indices.size() > 0 )
if ( !indices.empty() )
{
size_t editableItems = 0u;
size_t checkedEditableItems = 0u;
@@ -388,7 +388,7 @@ void PdmUiTreeSelectionEditor::customMenuRequested( const QPoint& pos )
}
}
if ( onlyHeadersInSelection && selectedIndexes.size() > 0 )
if ( onlyHeadersInSelection && !selectedIndexes.empty() )
{
{
QAction* act = new QAction( "Sub Items On", this );
@@ -404,24 +404,41 @@ void PdmUiTreeSelectionEditor::customMenuRequested( const QPoint& pos )
menu.addAction( act );
}
}
else if ( selectedIndexes.size() > 0 )
else if ( !selectedIndexes.empty() )
{
{
QAction* act = new QAction( "Set Selected On", this );
QAction* act = new QAction( "Set Selected Checked", this );
connect( act, SIGNAL( triggered() ), SLOT( slotSetSelectedOn() ) );
menu.addAction( act );
}
{
QAction* act = new QAction( "Set Selected Off", this );
QAction* act = new QAction( "Set Selected Unchecked", this );
connect( act, SIGNAL( triggered() ), SLOT( slotSetSelectedOff() ) );
menu.addAction( act );
}
menu.addSeparator();
if ( selectedIndexes.size() == 1 )
{
QAction* act = new QAction( "Invert Checked State Of All", this );
connect( act, SIGNAL( triggered() ), SLOT( slotInvertCheckedStateOfAll() ) );
menu.addAction( act );
}
else
{
QAction* act = new QAction( "Invert Checked States of Selected", this );
connect( act, SIGNAL( triggered() ), SLOT( slotInvertCheckedStateForSelection() ) );
menu.addAction( act );
}
}
if ( menu.actions().size() > 0 )
if ( !menu.actions().empty() )
{
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
QPoint globalPos = m_treeView->viewport()->mapToGlobal( pos );
@@ -509,6 +526,27 @@ void PdmUiTreeSelectionEditor::slotToggleAll()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiTreeSelectionEditor::slotInvertCheckedStateForSelection()
{
QItemSelection selectionInProxyModel = m_treeView->selectionModel()->selection();
QItemSelection selectionInSourceModel = m_proxyModel->mapSelectionToSource( selectionInProxyModel );
m_model->invertCheckedStateForItems( selectionInSourceModel.indexes() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiTreeSelectionEditor::slotInvertCheckedStateOfAll()
{
QModelIndexList indices = allVisibleSourceModelIndices();
m_model->invertCheckedStateForItems( indices );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------