QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgsrecentstylehandler.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrecentstylehandler.h
3  ------------------------
4  begin : September 2021
5  copyright : (C) 2021 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsrecentstylehandler.h"
17 #include "qgssymbol.h"
18 
20 
22 
23 
24 void QgsRecentStyleHandler::pushRecentSymbol( const QString &identifier, QgsSymbol *symbol )
25 {
26  mRecentSymbols[ identifier ] = std::unique_ptr< QgsSymbol >( symbol );
27 }
28 
29 QgsSymbol *QgsRecentStyleHandler::recentSymbol( const QString &identifier ) const
30 {
31  auto it = mRecentSymbols.find( identifier );
32  if ( it != mRecentSymbols.end() )
33  return it->second->clone();
34  else
35  return nullptr;
36 }
void pushRecentSymbol(const QString &identifier, QgsSymbol *symbol)
Pushes a recently used symbol with the specified identifier.
QgsRecentStyleHandler()
Creates a new recent style handler.
QgsSymbol * recentSymbol(const QString &identifier) const
Returns a copy of the recently used symbol with the specified identifier, or nullptr if no symbol wit...
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38