Debian Codegraph @

utils/fgqcanvas/canvasdisplay.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 CANVASDISPLAY_H
19 #define CANVASDISPLAY_H
20
21 #include <memory>
22
23 #include <QQuickItem>
24
25 class CanvasConnection;
26 class FGCanvasGroup;
27 class QQuickItem;
28
29 class CanvasDisplay : public QQuickItem
30 {
31 Q_OBJECT
32
33 Q_PROPERTY(CanvasConnection* canvas READ canvas WRITE setCanvas NOTIFY canvasChanged)
34
35 public:
36 CanvasDisplay(QQuickItem* parent = nullptr);
37 ~CanvasDisplay();
38
39 CanvasConnection* canvas() const
40 {
41 return m_connection;
42 }
43
44 signals:
45
46 void canvasChanged(CanvasConnection* canvas);
47
48 public slots:
49
50 void setCanvas(CanvasConnection* canvas);
51
52 protected:
53 void updatePolish() override;
54
55 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
56
57 private slots:
58 void onConnectionStatusChanged();
59
60 void onConnectionUpdated();
61
62 void onCanvasSizeChanged();
63 void onConnectionDestroyed();
64
65 private:
66 void recomputeScaling();
67
68 CanvasConnection* m_connection = nullptr;
69 std::unique_ptr<FGCanvasGroup> m_rootElement;
70 QQuickItem* m_rootItem = nullptr;
71 QSizeF m_sourceSize;
72 };
73
74 #endif // CANVASDISPLAY_H