mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-02 20:30:46 -06:00
25 lines
730 B
C++
25 lines
730 B
C++
#include "cafPdmUiAttributeTools.h"
|
|
|
|
#include "cafPdmUiItem.h"
|
|
|
|
#include <functional>
|
|
|
|
namespace caf
|
|
{
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::optional<QString>
|
|
PdmUiAttributeTools::stringAttribute( const PdmUiItem* uiItem, const QString& key, const QString& uiConfigName )
|
|
{
|
|
if ( auto callback = uiItem->attribute<std::function<QString()>>( key, uiConfigName ) )
|
|
{
|
|
if ( callback.value() ) return callback.value()();
|
|
return std::nullopt;
|
|
}
|
|
|
|
return uiItem->attribute<QString>( key, uiConfigName );
|
|
}
|
|
|
|
} // end namespace caf
|