[plasmalnf] Introduce an index-lookup function

- for signalling model changes, also need to know indexes / row
This commit is contained in:
Adriaan de Groot 2020-11-17 00:25:48 +01:00
parent f9e99da468
commit f93cec031b

View File

@ -52,6 +52,20 @@ struct ThemeInfo
class ThemeInfoList : public QList< ThemeInfo >
{
public:
std::pair< int, ThemeInfo* > indexById( const QString& id )
{
int index = 0;
for ( ThemeInfo& i : *this )
{
if ( i.id == id )
{
return { index, &i };
}
}
return { -1, nullptr };
}
/** @brief Looks for a given @p id in the list of themes, returns nullptr if not found. */
ThemeInfo* findById( const QString& id )
{