profile: set text and brush of DiveTextItem concurrently

The text and the brush are the two properties of text items
that change dynamically. To avoid complexities concerning
redrawing, set them concurrently instead of in two separate
calls.

Since setting one of the properties requires a full redraw,
there is no performance advantage in setting them individually.

This fixes a theoretical bug: the colors of axis labels were not
updated appropriately. However, it seems like value-dependent
labels weren't used anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-13 09:56:46 +02:00 committed by Dirk Hohndel
parent 2ebe6e3684
commit 04e0d96bae
6 changed files with 18 additions and 35 deletions

View file

@ -52,8 +52,7 @@ void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
rect->setPen(QPen(QBrush(), 0.0)); // get rid of the thick line around the rectangle
rects.push_back(rect);
DiveTextItem *label = new DiveTextItem(dpr, 1.0, Qt::AlignBottom | Qt::AlignRight, rect);
label->setText(gasname(gas));
label->setBrush(Qt::black);
label->set(gasname(gas), Qt::black);
label->setPos(x + 1, 0);
#ifdef SUBSURFACE_MOBILE
label->setPos(x + 1, -2.5);