mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Allow updating gpl based color schemes which are set to the
default random color scheme Allows users to edit the color scheme inside QGIS and see the effects immediately on next layer load
This commit is contained in:
parent
bc449c401b
commit
149b23e08b
@ -16,6 +16,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgscolorscheme.h"
|
||||
#include "qgscolorschemeregistry.h"
|
||||
|
||||
#include "qgsproject.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
@ -278,7 +279,19 @@ bool QgsGplColorScheme::setColors( const QgsNamedColorList &colors, const QStrin
|
||||
}
|
||||
|
||||
QFile destFile( destFilePath );
|
||||
return QgsSymbolLayerUtils::saveColorsToGpl( destFile, schemeName(), colors );
|
||||
if ( QgsSymbolLayerUtils::saveColorsToGpl( destFile, schemeName(), colors ) )
|
||||
{
|
||||
if ( QgsApplication::colorSchemeRegistry()->randomStyleColorScheme() == this )
|
||||
{
|
||||
// force a re-generation of the random style color list, since the color list has changed
|
||||
QgsApplication::colorSchemeRegistry()->setRandomStyleColorScheme( this );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -315,6 +328,12 @@ QgsUserColorScheme::QgsUserColorScheme( const QString &filename )
|
||||
{
|
||||
mName = mFilename;
|
||||
}
|
||||
|
||||
// we consider this scheme writable if the user has permission, OR
|
||||
// if it DOESN'T already exist (since new schemes are only created when
|
||||
// first written to)
|
||||
QFileInfo sourceFileInfo( gplFilePath() );
|
||||
mEditable = !sourceFileInfo.exists() || sourceFileInfo.isWritable();
|
||||
}
|
||||
|
||||
QString QgsUserColorScheme::schemeName() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user