1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qspritesheetitem.h" |
5 | #include "qspritesheetitem_p.h" |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | using namespace Qt3DCore; |
10 | |
11 | namespace Qt3DExtras { |
12 | |
13 | QSpriteSheetItemPrivate::QSpriteSheetItemPrivate() |
14 | : QNodePrivate() |
15 | , m_x(0) |
16 | , m_y(0) |
17 | , m_width(0) |
18 | , m_height(0) |
19 | { |
20 | |
21 | } |
22 | |
23 | QSpriteSheetItem::QSpriteSheetItem(QNode *parent) |
24 | : Qt3DCore::QNode(* new QSpriteSheetItemPrivate(), parent) |
25 | { |
26 | |
27 | } |
28 | |
29 | int QSpriteSheetItem::x() const |
30 | { |
31 | Q_D(const QSpriteSheetItem); |
32 | return d->m_x; |
33 | } |
34 | |
35 | void QSpriteSheetItem::setX(int x) |
36 | { |
37 | Q_D(QSpriteSheetItem); |
38 | if (x != d->m_x) { |
39 | d->m_x = x; |
40 | emit xChanged(x); |
41 | } |
42 | } |
43 | |
44 | int QSpriteSheetItem::y() const |
45 | { |
46 | Q_D(const QSpriteSheetItem); |
47 | return d->m_y; |
48 | } |
49 | |
50 | void QSpriteSheetItem::setY(int y) |
51 | { |
52 | Q_D(QSpriteSheetItem); |
53 | if (y != d->m_y) { |
54 | d->m_y = y; |
55 | emit yChanged(y); |
56 | } |
57 | } |
58 | |
59 | int QSpriteSheetItem::width() const |
60 | { |
61 | Q_D(const QSpriteSheetItem); |
62 | return d->m_width; |
63 | } |
64 | |
65 | void QSpriteSheetItem::setWidth(int width) |
66 | { |
67 | Q_D(QSpriteSheetItem); |
68 | if (width != d->m_width) { |
69 | d->m_width = width; |
70 | emit widthChanged(width); |
71 | } |
72 | } |
73 | |
74 | int QSpriteSheetItem::height() const |
75 | { |
76 | Q_D(const QSpriteSheetItem); |
77 | return d->m_height; |
78 | } |
79 | |
80 | void QSpriteSheetItem::setHeight(int height) |
81 | { |
82 | Q_D(QSpriteSheetItem); |
83 | if (height != d->m_height) { |
84 | d->m_height = height; |
85 | emit heightChanged(height); |
86 | } |
87 | } |
88 | |
89 | } // namespace Qt3DExtras |
90 | |
91 | QT_END_NAMESPACE |
92 | |
93 | #include "moc_qspritesheetitem.cpp" |
94 |