Debian Codegraph @

utils/fgqcanvas/fgqcanvasimage.h

raw symbols SCIP
1 //
2 // Copyright (C) 2017 James Turner [email protected]
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 #ifndef FGQCANVASIMAGE_H
19 #define FGQCANVASIMAGE_H
20
21 #include <QPixmap>
22 #include <QQmlEngine>
23
24 #include "fgcanvaselement.h"
25
26 class ImageQuickItem;
27
28 class FGQCanvasImage : public FGCanvasElement
29 {
30 Q_OBJECT
31 public:
32 FGQCanvasImage(FGCanvasGroup* pr, LocalProp* prop);
33
34 CanvasItem* createQuickItem(QQuickItem *parent) override;
35 CanvasItem* quickItem() const override;
36
37 void dumpElement() override;
38 protected:
39 virtual void doPaint(FGCanvasPaintContext* context) const override;
40
41 virtual void markStyleDirty() override;
42
43 void doDestroy() override;
44
45 void doPolish() override;
46 private slots:
47 void markImageDirty();
48 void markSourceDirty();
49
50 private:
51 bool onChildAdded(LocalProp *prop) override;
52
53 void rebuildImage() const;
54 void recomputeSourceRect() const;
55
56 private:
57 mutable bool _imageDirty;
58 mutable bool _sourceRectDirty = true;
59 mutable QPixmap _image;
60 QString _source;
61 mutable QSizeF _destSize;
62 mutable QRectF _sourceRect;
63
64 ImageQuickItem* _quickItem = nullptr;
65 };
66
67 #endif // FGQCANVASIMAGE_H