2016-12-03 14:14:06 +00:00
|
|
|
#ifndef FGQCANVASIMAGE_H
|
|
|
|
#define FGQCANVASIMAGE_H
|
|
|
|
|
|
|
|
#include <QPixmap>
|
|
|
|
|
|
|
|
#include "fgcanvaselement.h"
|
|
|
|
|
|
|
|
class FGQCanvasImage : public FGCanvasElement
|
|
|
|
{
|
2016-12-21 10:25:58 +00:00
|
|
|
Q_OBJECT
|
2016-12-03 14:14:06 +00:00
|
|
|
public:
|
|
|
|
FGQCanvasImage(FGCanvasGroup* pr, LocalProp* prop);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void doPaint(FGCanvasPaintContext* context) const override;
|
|
|
|
|
|
|
|
virtual void markStyleDirty() override;
|
|
|
|
|
2016-12-21 10:25:58 +00:00
|
|
|
private slots:
|
|
|
|
void markImageDirty();
|
2016-12-21 15:26:20 +00:00
|
|
|
void markSourceDirty();
|
2016-12-21 10:25:58 +00:00
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
private:
|
|
|
|
bool onChildAdded(LocalProp *prop) override;
|
|
|
|
|
|
|
|
void rebuildImage() const;
|
2016-12-21 15:26:20 +00:00
|
|
|
void recomputeSourceRect() const;
|
2016-12-21 10:25:58 +00:00
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
private:
|
|
|
|
mutable bool _imageDirty;
|
2016-12-21 15:26:20 +00:00
|
|
|
mutable bool _sourceRectDirty = true;
|
2016-12-03 14:14:06 +00:00
|
|
|
mutable QPixmap _image;
|
|
|
|
QString _source;
|
2016-12-18 23:52:16 +00:00
|
|
|
mutable QSizeF _destSize;
|
2016-12-21 15:26:20 +00:00
|
|
|
mutable QRectF _sourceRect;
|
2016-12-03 14:14:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FGQCANVASIMAGE_H
|