22 #include <QFileInfoList> 27 qDeleteAll( mColorSchemeList );
28 mColorSchemeList.clear();
37 QList< QgsColorScheme * >::iterator it = schemeList.begin();
38 for ( ; it != schemeList.end(); ++it )
58 if ( !localDir.mkpath( palettesDir ) )
63 QFileInfoList fileInfoList = QDir( palettesDir ).entryInfoList( QStringList( QStringLiteral(
"*.gpl" ) ), QDir::Files );
64 QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
65 for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
73 mColorSchemeList.append( scheme );
78 QList< QgsColorScheme * > allSchemes;
79 QList<QgsColorScheme *>::const_iterator schemeIt;
80 for ( schemeIt = mColorSchemeList.constBegin(); schemeIt != mColorSchemeList.constEnd(); ++schemeIt )
82 allSchemes.append( ( *schemeIt ) );
89 QList< QgsColorScheme * > matchingSchemes;
90 QList<QgsColorScheme *>::const_iterator schemeIt;
91 for ( schemeIt = mColorSchemeList.constBegin(); schemeIt != mColorSchemeList.constEnd(); ++schemeIt )
93 if ( ( *schemeIt )->flags().testFlag( flag ) )
95 matchingSchemes.append( ( *schemeIt ) );
98 return matchingSchemes;
103 if ( mColorSchemeList.indexOf( scheme ) != -1 )
105 mColorSchemeList.removeAll( scheme );
void populateFromInstance()
Adds all color schemes from the global instance to this color scheme.
A color scheme which contains custom colors set through QGIS app options dialog.
A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the ...
void addDefaultSchemes()
Adds all default color schemes to this color scheme.
A color scheme which contains project specific colors set through project properties dialog...
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
virtual ~QgsColorSchemeRegistry()
Abstract base class for color schemes.
bool removeColorScheme(QgsColorScheme *scheme)
Removes all matching color schemes from the registry.
QList< QgsColorScheme * > schemes() const
Returns all color schemes in the registry.
void addUserSchemes()
Creates schemes for all gpl palettes in the user's palettes folder.
void addColorScheme(QgsColorScheme *scheme)
Adds a color scheme to the registry.
A color scheme which contains the most recently used colors.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes. ...
SchemeFlag
Flags for controlling behavior of color scheme.