summaryrefslogtreecommitdiffstats
path: root/PaintedItemSlide.qml
blob: 2d18071310ab30e29f7d9c54a7d2f7e1da1b0e6e (plain)
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
33
34
35
36
37
38
39
40
41
42
import QtQuick 2.0
import Qt.labs.presentation 1.0

Slide {
    id: slide

    title: "Integration with QPainter"
    contentWidth: codeSection.x
    content: [
        "class QSGPaintedItem",
        "Renders with QPainter",
        " QImage based",
        " FBO based",
        "Equivalent API to QDeclarativeItem"
    ]

    CodeSection {
        id: codeSection
        text:
"
class Painter : public QSGPaintedItem
{
    Q_OBJECT
public:

    void paint(QPainter *p) {
        ...
        p->drawStuff();
    }

};


// Somewhere during setup...
qmlRegisterType<Painter>(\"QtQuick\",
                         2, 0,
                         \"Painter\");

"
    }

}