Mercurial > projects > qtd
comparison qt/d2/qt/core/QPoint.d @ 252:37eed70de029
More things broken than fixed. Rolling back to 263
author | maxter |
---|---|
date | Sat, 22 Aug 2009 12:50:58 +0000 |
parents | 7664de4a55e5 |
children | 34a37904ff77 |
comparison
equal
deleted
inserted
replaced
251:739d0ee5bd91 | 252:37eed70de029 |
---|---|
58 QPoint opSubAssign(ref QPoint p) | 58 QPoint opSubAssign(ref QPoint p) |
59 { xp-=p.xp; yp-=p.yp; return this; } | 59 { xp-=p.xp; yp-=p.yp; return this; } |
60 | 60 |
61 QPoint opMulAssign(qreal c) | 61 QPoint opMulAssign(qreal c) |
62 { xp = qRound(xp*c); yp = qRound(yp*c); return this; } | 62 { xp = qRound(xp*c); yp = qRound(yp*c); return this; } |
63 | 63 |
64 bool opEquals(ref QPoint p) | 64 bool opEquals(ref QPoint p) |
65 { return xp == p.xp && yp == p.yp; } | 65 { return xp == p.xp && yp == p.yp; } |
66 | 66 |
67 QPoint opAdd(ref QPoint p) | 67 QPoint opAdd(ref QPoint p) |
68 { return QPoint(this.xp+p.xp, this.yp+p.yp); } | 68 { return QPoint(this.xp+p.xp, this.yp+p.yp); } |
69 | 69 |
70 QPoint opSub(ref QPoint p) | 70 QPoint opSub(ref QPoint p) |
71 { return QPoint(this.xp-p.xp, this.yp-p.yp); } | 71 { return QPoint(this.xp-p.xp, this.yp-p.yp); } |
72 | 72 |
73 QPoint opMul(qreal c) | 73 QPoint opMul(qreal c) |
74 { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } | 74 { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } |
75 | 75 |
76 QPoint opDivAssign(qreal c) | 76 QPoint opDivAssign(qreal c) |
77 { | 77 { |
84 { | 84 { |
85 return QPoint(qRound(this.xp/c), qRound(this.yp/c)); | 85 return QPoint(qRound(this.xp/c), qRound(this.yp/c)); |
86 } | 86 } |
87 | 87 |
88 public final void writeTo(QDataStream arg__1) { | 88 public final void writeTo(QDataStream arg__1) { |
89 qtd_QPoint_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); | 89 qtd_QPoint_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); |
90 } | 90 } |
91 | 91 |
92 public final void readFrom(QDataStream arg__1) { | 92 public final void readFrom(QDataStream arg__1) { |
93 qtd_QPoint_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); | 93 qtd_QPoint_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 // ### Qt 5; remove the ifdef and just have the same order on all platforms. | 97 // ### Qt 5; remove the ifdef and just have the same order on all platforms. |
98 version(OSX) | 98 version(OSX) |
113 public static QPointF opCall() { | 113 public static QPointF opCall() { |
114 QPointF pt; | 114 QPointF pt; |
115 pt.xp = pt.yp = 0; | 115 pt.xp = pt.yp = 0; |
116 return pt; | 116 return pt; |
117 } | 117 } |
118 | 118 |
119 public this(qreal xpos, qreal ypos) { | 119 public this(qreal xpos, qreal ypos) { |
120 xp = xpos; | 120 xp = xpos; |
121 yp = ypos; | 121 yp = ypos; |
122 } | 122 } |
123 | 123 |
124 public this(QPoint p) { | 124 public this(QPoint p) { |
125 xp = p.x(); | 125 xp = p.x(); |
126 yp = p.y(); | 126 yp = p.y(); |
127 } | 127 } |
128 | 128 |
129 bool isNull() //const | 129 bool isNull() //const |
130 { | 130 { |
131 return qIsNull(xp) && qIsNull(yp); | 131 return qIsNull(xp) && qIsNull(yp); |
132 } | 132 } |
133 | 133 |
134 qreal x() //const | 134 qreal x() //const |
135 { | 135 { |
136 return xp; | 136 return xp; |
137 } | 137 } |
138 | 138 |
139 qreal y() //const | 139 qreal y() //const |
140 { | 140 { |
141 return yp; | 141 return yp; |
142 } | 142 } |
143 | 143 |
144 void x(qreal xpos) | 144 void x(qreal xpos) |
145 { | 145 { |
146 xp = xpos; | 146 xp = xpos; |
147 } | 147 } |
148 | 148 |
149 void y(qreal ypos) | 149 void y(qreal ypos) |
150 { | 150 { |
151 yp = ypos; | 151 yp = ypos; |
152 } | 152 } |
153 /* | 153 /* |
154 inline qreal &QPointF::rx() | 154 inline qreal &QPointF::rx() |
155 { | 155 { |
156 return xp; | 156 return xp; |
157 } | 157 } |
158 | 158 |
159 inline qreal &QPointF::ry() | 159 inline qreal &QPointF::ry() |
160 { | 160 { |
161 return yp; | 161 return yp; |
162 } | 162 } |
163 */ | 163 */ |
164 | 164 |
165 QPointF opAddAssign(ref QPointF p) | 165 QPointF opAddAssign(ref QPointF p) |
166 { xp+=p.xp; yp+=p.yp; return this; } | 166 { xp+=p.xp; yp+=p.yp; return this; } |
167 | 167 |
168 QPointF opSubAssign(ref QPointF p) | 168 QPointF opSubAssign(ref QPointF p) |
169 { xp-=p.xp; yp-=p.yp; return this; } | 169 { xp-=p.xp; yp-=p.yp; return this; } |
170 | 170 |
171 QPointF opMulAssign(qreal c) | 171 QPointF opMulAssign(qreal c) |
172 { xp*=c; yp*=c; return this; } | 172 { xp*=c; yp*=c; return this; } |
173 | 173 |
174 bool opEquals(ref QPointF p) | 174 bool opEquals(ref QPointF p) |
175 { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } | 175 { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } |
176 | 176 |
177 QPointF opAdd(ref QPointF p) | 177 QPointF opAdd(ref QPointF p) |
178 { return QPointF(this.xp+p.xp, this.yp+p.yp); } | 178 { return QPointF(this.xp+p.xp, this.yp+p.yp); } |
179 | 179 |
180 QPointF opSub(ref QPointF p) | 180 QPointF opSub(ref QPointF p) |
181 { return QPointF(this.xp-p.xp, this.yp-p.yp); } | 181 { return QPointF(this.xp-p.xp, this.yp-p.yp); } |
182 | 182 |
183 QPointF opMul(qreal c) | 183 QPointF opMul(qreal c) |
184 { return QPointF(this.xp*c, this.yp*c); } | 184 { return QPointF(this.xp*c, this.yp*c); } |
185 | 185 |
186 QPointF opDivAssign(qreal c) | 186 QPointF opDivAssign(qreal c) |
187 { | 187 { |
188 xp/=c; | 188 xp/=c; |
189 yp/=c; | 189 yp/=c; |
190 return this; | 190 return this; |
191 } | 191 } |
192 | 192 |
193 QPointF opDiv(qreal c) | 193 QPointF opDiv(qreal c) |
194 { | 194 { |
195 return QPointF(xp/c, yp/c); | 195 return QPointF(xp/c, yp/c); |
196 } | 196 } |
197 | 197 |
198 QPoint toPoint() //const | 198 QPoint toPoint() //const |
199 { | 199 { |
200 return QPoint(qRound(xp), qRound(yp)); | 200 return QPoint(qRound(xp), qRound(yp)); |
201 } | 201 } |
202 | 202 |
203 public final void writeTo(QDataStream arg__1) { | 203 public final void writeTo(QDataStream arg__1) { |
204 qtd_QPointF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); | 204 qtd_QPointF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); |
205 } | 205 } |
206 | 206 |
207 public final void readFrom(QDataStream arg__1) { | 207 public final void readFrom(QDataStream arg__1) { |
208 qtd_QPointF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); | 208 qtd_QPointF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); |
209 } | 209 } |
210 | 210 |
211 private: | 211 private: |
212 qreal xp; | 212 qreal xp; |
213 qreal yp; | 213 qreal yp; |
214 } | 214 } |
215 | 215 |