2016-12-03 14:14:06 +00:00
|
|
|
#ifndef FGCANVASTEXT_H
|
|
|
|
#define FGCANVASTEXT_H
|
|
|
|
|
|
|
|
#include <QFont>
|
|
|
|
#include <QFontMetricsF>
|
|
|
|
|
|
|
|
#include "fgcanvaselement.h"
|
|
|
|
|
|
|
|
class FGCanvasText : public FGCanvasElement
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGCanvasText(FGCanvasGroup* pr, LocalProp* prop);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void doPaint(FGCanvasPaintContext* context) const override;
|
|
|
|
|
|
|
|
virtual void markStyleDirty() override;
|
|
|
|
private:
|
|
|
|
bool onChildAdded(LocalProp *prop) override;
|
|
|
|
|
|
|
|
void onTextChanged(QVariant var);
|
|
|
|
|
|
|
|
void setDrawMode(QVariant var);
|
|
|
|
|
|
|
|
void markFontDirty();
|
2016-12-20 10:31:38 +00:00
|
|
|
|
|
|
|
void onFontLoaded(QByteArray name);
|
2016-12-03 14:14:06 +00:00
|
|
|
private:
|
|
|
|
void rebuildFont() const;
|
|
|
|
void rebuildAlignment(QVariant var) const;
|
|
|
|
|
|
|
|
QString _text;
|
|
|
|
|
|
|
|
mutable Qt::Alignment _alignment;
|
|
|
|
mutable bool _fontDirty = true;
|
|
|
|
mutable QFont _font;
|
|
|
|
mutable QFontMetricsF _metrics;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // FGCANVASTEXT_H
|