Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make sure we have a color ramp when creating categories/ranges.
- Loading branch information
|
@@ -12,6 +12,7 @@ |
|
|
#include "qgsvectorlayer.h" |
|
|
#include "qgsvectordataprovider.h" // for uniqueValues |
|
|
|
|
|
#include <QMessageBox> |
|
|
#include <QStandardItemModel> |
|
|
#include <QStandardItem> |
|
|
|
|
@@ -256,6 +257,15 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories() |
|
|
else |
|
|
ramp = mStyle->colorRamp( rampName ); |
|
|
|
|
|
if ( ramp == NULL ) |
|
|
{ |
|
|
if ( cboCategorizedColorRamp->count() == 0 ) |
|
|
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") ); |
|
|
else |
|
|
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") ); |
|
|
return; |
|
|
} |
|
|
|
|
|
QgsCategoryList cats; |
|
|
_createCategories( cats, unique_vals, mCategorizedSymbol, ramp ); |
|
|
|
|
|
|
@@ -11,6 +11,7 @@ |
|
|
|
|
|
#include "qgssymbolv2selectordialog.h" |
|
|
|
|
|
#include <QMessageBox> |
|
|
#include <QStandardItemModel> |
|
|
#include <QStandardItem> |
|
|
|
|
@@ -157,6 +158,15 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() |
|
|
else |
|
|
ramp = mStyle->colorRamp( rampName ); |
|
|
|
|
|
if ( ramp == NULL ) |
|
|
{ |
|
|
if ( cboGraduatedColorRamp->count() == 0 ) |
|
|
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") ); |
|
|
else |
|
|
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") ); |
|
|
return; |
|
|
} |
|
|
|
|
|
QgsGraduatedSymbolRendererV2::Mode mode; |
|
|
if (cboGraduatedMode->currentIndex() == 0) |
|
|
mode = QgsGraduatedSymbolRendererV2::EqualInterval; |
|
|