Changeset View
Changeset View
Standalone View
Standalone View
kcm/src/declarative/qmlscreen.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 36 | { | |||
---|---|---|---|---|---|
47 | Q_PROPERTY(int enabledOutputsCount | 47 | Q_PROPERTY(int enabledOutputsCount | ||
48 | READ enabledOutputsCount | 48 | READ enabledOutputsCount | ||
49 | NOTIFY enabledOutputsCountChanged) | 49 | NOTIFY enabledOutputsCountChanged) | ||
50 | 50 | | |||
51 | Q_PROPERTY(float outputScale | 51 | Q_PROPERTY(float outputScale | ||
52 | READ outputScale | 52 | READ outputScale | ||
53 | NOTIFY outputScaleChanged) | 53 | NOTIFY outputScaleChanged) | ||
54 | 54 | | |||
55 | Q_PROPERTY(QQmlEngine* engine | | |||
56 | MEMBER m_engine) | | |||
57 | | ||||
58 | public: | 55 | public: | ||
59 | explicit QMLScreen(QQuickItem *parent = nullptr); | 56 | explicit QMLScreen(QQuickItem *parent = nullptr); | ||
60 | 57 | | |||
61 | int connectedOutputsCount() const; | 58 | int connectedOutputsCount() const; | ||
62 | int enabledOutputsCount() const; | 59 | int enabledOutputsCount() const; | ||
63 | 60 | | |||
64 | QMLOutput* primaryOutput() const; | 61 | QMLOutput* primaryOutput() const; | ||
65 | QList<QMLOutput*> outputs() const; | 62 | QList<QMLOutput*> outputs() const; | ||
66 | 63 | | |||
67 | QSize maxScreenSize() const; | 64 | QSize maxScreenSize() const; | ||
68 | 65 | | |||
69 | float outputScale() const; | 66 | float outputScale() const; | ||
70 | 67 | | |||
71 | KScreen::ConfigPtr config() const; | 68 | KScreen::ConfigPtr config() const; | ||
72 | void setConfig(const KScreen::ConfigPtr &config); | 69 | void setConfig(const KScreen::ConfigPtr &config); | ||
73 | 70 | | |||
74 | void updateOutputsPlacement(); | 71 | void updateOutputsPlacement(); | ||
75 | void setEngine(QQmlEngine* engine); | | |||
76 | 72 | | |||
77 | void setActiveOutput(QMLOutput *output); | 73 | void setActiveOutput(QMLOutput *output); | ||
78 | 74 | | |||
79 | public Q_SLOTS: | 75 | public Q_SLOTS: | ||
80 | void setActiveOutput() { | 76 | void setActiveOutput() { | ||
81 | setActiveOutput(qobject_cast<QMLOutput*>(sender())); | 77 | setActiveOutput(qobject_cast<QMLOutput*>(sender())); | ||
82 | } | 78 | } | ||
83 | 79 | | |||
Show All 19 Lines | |||||
103 | private: | 99 | private: | ||
104 | void qmlOutputMoved(QMLOutput *qmlOutput); | 100 | void qmlOutputMoved(QMLOutput *qmlOutput); | ||
105 | void updateCornerOutputs(); | 101 | void updateCornerOutputs(); | ||
106 | 102 | | |||
107 | KScreen::ConfigPtr m_config; | 103 | KScreen::ConfigPtr m_config; | ||
108 | QHash<KScreen::OutputPtr,QMLOutput*> m_outputMap; | 104 | QHash<KScreen::OutputPtr,QMLOutput*> m_outputMap; | ||
109 | int m_connectedOutputsCount = 0; | 105 | int m_connectedOutputsCount = 0; | ||
110 | int m_enabledOutputsCount = 0; | 106 | int m_enabledOutputsCount = 0; | ||
111 | 107 | | |||
112 | QQmlEngine* m_engine = nullptr; | | |||
113 | QMLOutput *m_leftmost = nullptr; | 108 | QMLOutput *m_leftmost = nullptr; | ||
broulik: This entire custom engine handling could be removed, with `QMLScreen` using `qmlEngine(this)`… | |||||
I had briefly tried and got a nullptr from qmlEngine, but I didn't really spend time on it. gladhorn: I had briefly tried and got a nullptr from qmlEngine, but I didn't really spend time on it. | |||||
114 | QMLOutput *m_topmost = nullptr; | 109 | QMLOutput *m_topmost = nullptr; | ||
115 | QMLOutput *m_rightmost = nullptr; | 110 | QMLOutput *m_rightmost = nullptr; | ||
116 | QMLOutput *m_bottommost = nullptr; | 111 | QMLOutput *m_bottommost = nullptr; | ||
117 | 112 | | |||
118 | }; | 113 | }; | ||
119 | 114 | | |||
120 | #endif // QMLSCREEN_H | 115 | #endif // QMLSCREEN_H |
This entire custom engine handling could be removed, with QMLScreen using qmlEngine(this) when creating an QMLOutput