Skip to content

Commit

Permalink
Fix colors for new diagram categories are not randomly picked
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 23, 2024
1 parent 8597513 commit 2c68f29
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/vector/qgsdiagramproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,9 @@ void QgsDiagramProperties::addAttribute( QTreeWidgetItem *item )
newItem->setFlags( ( newItem->flags() | Qt::ItemIsEditable ) & ~Qt::ItemIsDropEnabled );

//set initial color for diagram category
QRandomGenerator colorGenerator;
const int red = colorGenerator.bounded( 1, 256 );
const int green = colorGenerator.bounded( 1, 256 );
const int blue = colorGenerator.bounded( 1, 256 );
const int red = QRandomGenerator::global()->bounded( 1, 256 );
const int green = QRandomGenerator::global()->bounded( 1, 256 );
const int blue = QRandomGenerator::global()->bounded( 1, 256 );
const QColor randomColor( red, green, blue );
newItem->setData( ColumnColor, Qt::EditRole, randomColor );
mDiagramAttributesTreeWidget->addTopLevelItem( newItem );
Expand Down

0 comments on commit 2c68f29

Please sign in to comment.