From 2d7491adae7b6a07faee77003c1a7d6e8be44b2b Mon Sep 17 00:00:00 2001 From: Julien Cabieces Date: Mon, 19 Aug 2024 17:28:41 +0200 Subject: [PATCH] fix(ProjectColors): Set default color according to project color model. Fixes #58323 --- src/app/qgsprojectproperties.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index f34d79b46d18..06d8509a0e6a 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -2621,7 +2621,11 @@ void QgsProjectProperties::setCurrentEllipsoid( const QString &ellipsoidAcronym void QgsProjectProperties::mButtonAddColor_clicked() { - QColor newColor = QgsColorDialog::getColor( QColor(), this->parentWidget(), tr( "Select Color" ), true ); + const Qgis::ColorModel colorModel = mColorModel->currentData().value(); + const QColor defaultColor = colorModel == Qgis::ColorModel::Cmyk ? + QColor::fromCmykF( 0., 1., 1., 0. ) : QColor::fromRgbF( 1., 0., 0. ); + + QColor newColor = QgsColorDialog::getColor( defaultColor, this->parentWidget(), tr( "Select Color" ), true ); if ( !newColor.isValid() ) { return;