Skip to content

Commit 755707d

Browse files
committed
Abort classification upon high number of classes
1 parent 349229f commit 755707d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,19 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
596596
QList<QVariant> unique_vals;
597597
mLayer->uniqueValues( idx, unique_vals );
598598

599+
// ask to abort if too many classes
600+
if ( unique_vals.size() >= 1000 )
601+
{
602+
int res = QMessageBox::warning( 0, tr( "High number of classes!" ),
603+
tr( "Classification would yield %1 entries which might not be expected. Continue?" ).arg( unique_vals.size() ),
604+
QMessageBox::Ok | QMessageBox::Cancel,
605+
QMessageBox::Cancel );
606+
if ( res == QMessageBox::Cancel )
607+
{
608+
return;
609+
}
610+
}
611+
599612
//DlgAddCategories dlg(mStyle, createDefaultSymbol(), unique_vals, this);
600613
//if (!dlg.exec())
601614
// return;

0 commit comments

Comments
 (0)