Skip to content

Commit

Permalink
Amélioration couleur texte graph stats par aéronef
Browse files Browse the repository at this point in the history
  • Loading branch information
cvermot committed May 4, 2024
1 parent 1d00982 commit 00f7ce2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/ManageDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,6 @@ AeroDmsTypes::ListeVolSortieOuBalade ManageDb::recupererBaladesEtSorties( const
const float p_proportionRemboursement,
const int p_annee )
{
qDebug() << p_annee;
AeroDmsTypes::ListeVolSortieOuBalade liste;
QSqlQuery query;
if (p_annee == -1)
Expand Down
8 changes: 6 additions & 2 deletions src/StatistiqueDonutCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ StatistiqueDonutCombine::StatistiqueDonutCombine(QGraphicsItem* parent, Qt::Wind

void StatistiqueDonutCombine::addBreakdownSeries(QPieSeries* breakdownSeries, QColor color)
{
QFont font("Arial", 10);
QFont font("Arial", 8);

// add breakdown series as a slice to center pie
auto mainSlice = new StatistiqueDonutCombinePartie(breakdownSeries);
Expand All @@ -33,7 +33,11 @@ void StatistiqueDonutCombine::addBreakdownSeries(QPieSeries* breakdownSeries, QC
// customize the slice
mainSlice->setBrush(color);
mainSlice->setLabelVisible();
mainSlice->setLabelColor(Qt::black);
const float darkness = 0.2126 * color.redF() + 0.7152 * color.greenF() + 0.0722 * color.blueF();
if(darkness > 0.5)
mainSlice->setLabelColor(Qt::black);
else
mainSlice->setLabelColor(Qt::white);
mainSlice->setLabelPosition(QPieSlice::LabelInsideNormal);
mainSlice->setLabelFont(font);

Expand Down

0 comments on commit 00f7ce2

Please sign in to comment.