#4687 Summary Template : Add UI to select template

#4705 Summary Template : Add icon and use from features and dialogs
This commit is contained in:
Magne Sjaastad
2019-09-12 08:43:09 +02:00
parent d045c0aade
commit 7fc0a47443
11 changed files with 256 additions and 57 deletions

View File

@@ -74,6 +74,15 @@ std::vector<RimPlotTemplateFolderItem*> RimPlotTemplateFolderItem::subFolders()
return m_subFolders.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotTemplateFolderItem::appendOptionItemsForPlotTemplates( QList<caf::PdmOptionItemInfo>& options,
RimPlotTemplateFolderItem* templateFolderItem )
{
appendOptionItemsForPlotTemplatesRecursively( options, templateFolderItem, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -176,6 +185,37 @@ void RimPlotTemplateFolderItem::defineEditorAttribute( const caf::PdmFieldHandle
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotTemplateFolderItem::appendOptionItemsForPlotTemplatesRecursively(
QList<caf::PdmOptionItemInfo>& options, RimPlotTemplateFolderItem* templateFolderItem, int menuLevel )
{
{
auto subFolders = templateFolderItem->subFolders();
for ( auto sub : subFolders )
{
caf::PdmOptionItemInfo optionInfo = caf::PdmOptionItemInfo::createHeader( sub->uiName(), true );
optionInfo.setLevel( menuLevel );
options.push_back( optionInfo );
appendOptionItemsForPlotTemplatesRecursively( options, sub, menuLevel + 1 );
}
}
caf::QIconProvider templateIcon( ":/SummaryTemplate16x16.png" );
auto files = templateFolderItem->fileNames();
for ( auto file : files )
{
caf::PdmOptionItemInfo optionInfo( file->uiName(), file, false, templateIcon );
optionInfo.setLevel( menuLevel );
options.push_back( optionInfo );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------