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

@ -15,8 +15,7 @@ class DiveTextItem : public QObject, public QGraphicsItemGroup {
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
DiveTextItem(double dpr, double scale, int alignFlags, QGraphicsItem *parent);
void setText(const QString &text);
void setBrush(const QBrush &brush);
void set(const QString &text, const QBrush &brush);
const QString &text();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
static QFont getFont(double dpr, double scale);