22 #include <QFileInfoList> 53 qDeleteAll( mColorSchemeList );
54 mColorSchemeList.clear();
63 QList< QgsColorScheme* >::iterator it = schemeList.begin();
64 for ( ; it != schemeList.end(); ++it )
84 if ( !localDir.mkpath( palettesDir ) )
89 QFileInfoList fileInfoList = QDir( palettesDir ).entryInfoList( QStringList(
"*.gpl" ), QDir::Files );
90 QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
91 for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
99 mColorSchemeList.append( scheme );
104 QList< QgsColorScheme* > allSchemes;
105 QList<QgsColorScheme*>::const_iterator schemeIt;
106 for ( schemeIt = mColorSchemeList.constBegin(); schemeIt != mColorSchemeList.constEnd(); ++schemeIt )
108 allSchemes.append(( *schemeIt ) );
115 QList< QgsColorScheme* > matchingSchemes;
116 QList<QgsColorScheme*>::const_iterator schemeIt;
117 for ( schemeIt = mColorSchemeList.constBegin(); schemeIt != mColorSchemeList.constEnd(); ++schemeIt )
119 if (( *schemeIt )->flags().testFlag( flag ) )
121 matchingSchemes.append(( *schemeIt ) );
124 return matchingSchemes;
129 if ( mColorSchemeList.indexOf( scheme ) != -1 )
131 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...
Registry of color schemes.
virtual ~QgsColorSchemeRegistry()
Abstract base class for color schemes.
bool removeColorScheme(QgsColorScheme *scheme)
Removes all matching color schemes from the registry.
static const QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
void addUserSchemes()
Creates schemes for all gpl palettes in the user's palettes folder.
QgsColorSchemeRegistry()
Constructor for an empty color scheme registry.
void addColorScheme(QgsColorScheme *scheme)
Adds a color scheme to the registry.
A color scheme which contains the most recently used colors.
static QgsColorSchemeRegistry * instance()
Returns the global instance pointer, creating the object on the first call.
SchemeFlag
Flags for controlling behaviour of color scheme.
QList< QgsColorScheme * > schemes() const
Returns all color schemes in the registry.