QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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
17
18#include "qgssymbol.h"
19
21
23
24
25void QgsRecentStyleHandler::pushRecentSymbol( const QString &identifier, QgsSymbol *symbol )
26{
27 mRecentSymbols[ identifier ] = std::unique_ptr< QgsSymbol >( symbol );
28}
29
30QgsSymbol *QgsRecentStyleHandler::recentSymbol( const QString &identifier ) const
31{
32 auto it = mRecentSymbols.find( identifier );
33 if ( it != mRecentSymbols.end() )
34 return it->second->clone();
35 else
36 return nullptr;
37}
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:231
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.