mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
176a62f752
The time axis might need some space and the average depth item puts a formatted depth at to right of the profile. Consider these when calculating the right border. Since I found no way to turn of the average depth, this creates a permanent border, which might or might not be a good thing. Contains some refactoring of the label-size functions provided by DiveTextItem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVETEXTITEM_H
|
|
#define DIVETEXTITEM_H
|
|
|
|
#include <QObject>
|
|
#include <QFont>
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
class QBrush;
|
|
|
|
/* A Line Item that has animated-properties. */
|
|
class DiveTextItem : public QObject, public QGraphicsPixmapItem {
|
|
Q_OBJECT
|
|
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
|
public:
|
|
// Note: vertical centring is based on the actual rendered text, not on the font metrics.
|
|
// This is fine for placing text in the "tankbar", but it will look disastrous when
|
|
// placing text items next to each other. This may have to be fixed.
|
|
DiveTextItem(double dpr, double scale, int alignFlags, QGraphicsItem *parent);
|
|
void set(const QString &text, const QBrush &brush);
|
|
const QString &text();
|
|
static double fontHeight(double dpr, double scale);
|
|
static std::pair<double, double> getLabelSize(double dpr, double scale, const QString &label);
|
|
double height() const;
|
|
|
|
private:
|
|
int internalAlignFlags;
|
|
QString internalText;
|
|
double dpr;
|
|
double scale;
|
|
};
|
|
|
|
#endif // DIVETEXTITEM_H
|