Mercurial > projects > qtd
comparison qt/d1/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 |
---|---|
59 QPoint opSubAssign(in QPoint p) | 59 QPoint opSubAssign(in QPoint p) |
60 { xp-=p.xp; yp-=p.yp; return *this; } | 60 { xp-=p.xp; yp-=p.yp; return *this; } |
61 | 61 |
62 QPoint opMulAssign(qreal c) | 62 QPoint opMulAssign(qreal c) |
63 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; } | 63 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; } |
64 | 64 |
65 bool opEquals(in QPoint p) | 65 bool opEquals(in QPoint p) |
66 { return xp == p.xp && yp == p.yp; } | 66 { return xp == p.xp && yp == p.yp; } |
67 | 67 |
68 QPoint opAdd(in QPoint p) | 68 QPoint opAdd(in QPoint p) |
69 { return QPoint(this.xp+p.xp, this.yp+p.yp); } | 69 { return QPoint(this.xp+p.xp, this.yp+p.yp); } |
70 | 70 |
71 QPoint opSub(in QPoint p) | 71 QPoint opSub(in QPoint p) |
72 { return QPoint(this.xp-p.xp, this.yp-p.yp); } | 72 { return QPoint(this.xp-p.xp, this.yp-p.yp); } |
73 | 73 |
74 QPoint opMul(qreal c) | 74 QPoint opMul(qreal c) |
75 { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } | 75 { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } |
76 | 76 |
77 QPoint opDivAssign(qreal c) | 77 QPoint opDivAssign(qreal c) |
78 { | 78 { |
85 { | 85 { |
86 return QPoint(qRound(this.xp/c), qRound(this.yp/c)); | 86 return QPoint(qRound(this.xp/c), qRound(this.yp/c)); |
87 } | 87 } |
88 | 88 |
89 public final void writeTo(QDataStream arg__1) { | 89 public final void writeTo(QDataStream arg__1) { |
90 qtd_QPoint_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); | 90 qtd_QPoint_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
91 } | 91 } |
92 | 92 |
93 public final void readFrom(QDataStream arg__1) { | 93 public final void readFrom(QDataStream arg__1) { |
94 qtd_QPoint_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); | 94 qtd_QPoint_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
95 } | 95 } |
96 | 96 |
97 private: | 97 private: |
98 // ### Qt 5; remove the ifdef and just have the same order on all platforms. | 98 // ### Qt 5; remove the ifdef and just have the same order on all platforms. |
99 version(OSX) | 99 version(OSX) |
114 public static QPointF opCall() { | 114 public static QPointF opCall() { |
115 QPointF pt; | 115 QPointF pt; |
116 pt.xp = pt.yp = 0; | 116 pt.xp = pt.yp = 0; |
117 return pt; | 117 return pt; |
118 } | 118 } |
119 | 119 |
120 public static QPointF opCall(qreal xpos, qreal ypos) { | 120 public static QPointF opCall(qreal xpos, qreal ypos) { |
121 QPointF pt; | 121 QPointF pt; |
122 pt.xp = xpos; | 122 pt.xp = xpos; |
123 pt.yp = ypos; | 123 pt.yp = ypos; |
124 return pt; | 124 return pt; |
125 } | 125 } |
126 | 126 |
127 public static QPointF opCall(in QPoint p) { | 127 public static QPointF opCall(in QPoint p) { |
128 QPointF pt; | 128 QPointF pt; |
129 pt.xp = p.x(); | 129 pt.xp = p.x(); |
130 pt.yp = p.y(); | 130 pt.yp = p.y(); |
131 return pt; | 131 return pt; |
132 } | 132 } |
133 | 133 |
134 bool isNull() //const | 134 bool isNull() //const |
135 { | 135 { |
136 return qIsNull(xp) && qIsNull(yp); | 136 return qIsNull(xp) && qIsNull(yp); |
137 } | 137 } |
138 | 138 |
139 qreal x() //const | 139 qreal x() //const |
140 { | 140 { |
141 return xp; | 141 return xp; |
142 } | 142 } |
143 | 143 |
144 qreal y() //const | 144 qreal y() //const |
145 { | 145 { |
146 return yp; | 146 return yp; |
147 } | 147 } |
148 | 148 |
149 void x(qreal xpos) | 149 void x(qreal xpos) |
150 { | 150 { |
151 xp = xpos; | 151 xp = xpos; |
152 } | 152 } |
153 | 153 |
154 void y(qreal ypos) | 154 void y(qreal ypos) |
155 { | 155 { |
156 yp = ypos; | 156 yp = ypos; |
157 } | 157 } |
158 /* | 158 /* |
159 inline qreal &QPointF::rx() | 159 inline qreal &QPointF::rx() |
160 { | 160 { |
161 return xp; | 161 return xp; |
162 } | 162 } |
163 | 163 |
164 inline qreal &QPointF::ry() | 164 inline qreal &QPointF::ry() |
165 { | 165 { |
166 return yp; | 166 return yp; |
167 } | 167 } |
168 */ | 168 */ |
169 | 169 |
170 QPointF opAddAssign(in QPointF p) | 170 QPointF opAddAssign(in QPointF p) |
171 { xp+=p.xp; yp+=p.yp; return *this; } | 171 { xp+=p.xp; yp+=p.yp; return *this; } |
172 | 172 |
173 QPointF opSubAssign(in QPointF p) | 173 QPointF opSubAssign(in QPointF p) |
174 { xp-=p.xp; yp-=p.yp; return *this; } | 174 { xp-=p.xp; yp-=p.yp; return *this; } |
175 | 175 |
176 QPointF opMulAssign(qreal c) | 176 QPointF opMulAssign(qreal c) |
177 { xp*=c; yp*=c; return *this; } | 177 { xp*=c; yp*=c; return *this; } |
178 | 178 |
179 bool opEquals(in QPointF p) | 179 bool opEquals(in QPointF p) |
180 { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } | 180 { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } |
181 | 181 |
182 QPointF opAdd(in QPointF p) | 182 QPointF opAdd(in QPointF p) |
183 { return QPointF(this.xp+p.xp, this.yp+p.yp); } | 183 { return QPointF(this.xp+p.xp, this.yp+p.yp); } |
184 | 184 |
185 QPointF opSub(in QPointF p) | 185 QPointF opSub(in QPointF p) |
186 { return QPointF(this.xp-p.xp, this.yp-p.yp); } | 186 { return QPointF(this.xp-p.xp, this.yp-p.yp); } |
187 | 187 |
188 QPointF opMul(qreal c) | 188 QPointF opMul(qreal c) |
189 { return QPointF(this.xp*c, this.yp*c); } | 189 { return QPointF(this.xp*c, this.yp*c); } |
190 | 190 |
191 QPointF opDivAssign(qreal c) | 191 QPointF opDivAssign(qreal c) |
192 { | 192 { |
193 xp/=c; | 193 xp/=c; |
194 yp/=c; | 194 yp/=c; |
195 return *this; | 195 return *this; |
196 } | 196 } |
197 | 197 |
198 QPointF opDiv(qreal c) | 198 QPointF opDiv(qreal c) |
199 { | 199 { |
200 return QPointF(xp/c, yp/c); | 200 return QPointF(xp/c, yp/c); |
201 } | 201 } |
202 | 202 |
203 QPoint toPoint() //const | 203 QPoint toPoint() //const |
204 { | 204 { |
205 return QPoint(qRound(xp), qRound(yp)); | 205 return QPoint(qRound(xp), qRound(yp)); |
206 } | 206 } |
207 | 207 |
208 public final void writeTo(QDataStream arg__1) { | 208 public final void writeTo(QDataStream arg__1) { |
209 qtd_QPointF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); | 209 qtd_QPointF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
210 } | 210 } |
211 | 211 |
212 public final void readFrom(QDataStream arg__1) { | 212 public final void readFrom(QDataStream arg__1) { |
213 qtd_QPointF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); | 213 qtd_QPointF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
214 } | 214 } |
215 | 215 |
216 private: | 216 private: |
217 qreal xp; | 217 qreal xp; |
218 qreal yp; | 218 qreal yp; |
219 } | 219 } |
220 | 220 |