-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojectmitem.cpp
More file actions
executable file
·32 lines (26 loc) · 883 Bytes
/
projectmitem.cpp
File metadata and controls
executable file
·32 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "projectmitem.h"
ProjectMItem::ProjectMItem(QQuickItem* parent) : QQuickItem(parent) {
setFlag(ItemHasContents, true);
}
QSGNode* ProjectMItem::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) {
auto* node = static_cast<ProjectMRenderNode*>(oldNode);
if (!node) {
node = new ProjectMRenderNode(x(), y(), width(), height());
}
else {
const auto mapped = this->mapToScene(QPoint(x(), y()));
node->setSize(width(), height());
node->setPosition(mapped.x(), mapped.y());
}
return node;
}
void ProjectMItem::componentComplete() {
QQuickItem::componentComplete();
//update milkdrop's openGL scene together with qml's scene
if (window()) {
connect(window(), &QQuickWindow::frameSwapped, this, [this] {
if (this->isVisible())
this->update();
});
}
}