comparison qt/core/QSize.d @ 3:323efbe5c2f7

native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
author eldar
date Wed, 13 May 2009 17:34:40 +0000
parents e78566595089
children
comparison
equal deleted inserted replaced
2:ee8e70aca95e 3:323efbe5c2f7
45 final void width(int w) 45 final void width(int w)
46 { wd = w; } 46 { wd = w; }
47 47
48 final void height(int h) 48 final void height(int h)
49 { ht = h; } 49 { ht = h; }
50 50
51 final void setWidth(int w) 51 final void setWidth(int w) // for convenience
52 { wd = w; } 52 { wd = w; }
53 53
54 void setHeight(int h) 54 final void setHeight(int h) // for convenience
55 { ht = h; } 55 { ht = h; }
56 56
57 void transpose() { 57 void transpose() {
58 int tmp = wd; 58 int tmp = wd;
59 wd = ht; 59 wd = ht;
91 { wd-=s.wd; ht-=s.ht; return *this; } 91 { wd-=s.wd; ht-=s.ht; return *this; }
92 92
93 QSize opMulAssign(qreal c) 93 QSize opMulAssign(qreal c)
94 { wd = qRound(wd*c); ht = qRound(ht*c); return *this; } 94 { wd = qRound(wd*c); ht = qRound(ht*c); return *this; }
95 95
96 bool opEquals(ref QSize s1, ref QSize s2) 96 bool opEquals(ref QSize s)
97 { return s1.wd == s2.wd && s1.ht == s2.ht; } 97 { return wd == s.wd && ht == s.ht; }
98 98
99 QSize opAdd(ref QSize s) 99 QSize opAdd(ref QSize s)
100 { return QSize(this.wd+s.wd, this.ht+s.ht); } 100 { return QSize(this.wd+s.wd, this.ht+s.ht); }
101 101
102 QSize opSub(ref QSize s) 102 QSize opSub(ref QSize s)
214 { wd -= s.wd; ht -= s.ht; return *this; } 214 { wd -= s.wd; ht -= s.ht; return *this; }
215 215
216 QSizeF opMulAssign(qreal c) 216 QSizeF opMulAssign(qreal c)
217 { wd *= c; ht *= c; return *this; } 217 { wd *= c; ht *= c; return *this; }
218 218
219 bool opEquals(ref QSizeF s1, ref QSizeF s2) 219 bool opEquals(ref QSizeF s)
220 { return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); } 220 { return qFuzzyCompare(wd, s.wd) && qFuzzyCompare(ht, s.ht); }
221 221
222 QSizeF opAdd(ref QSizeF s) 222 QSizeF opAdd(ref QSizeF s)
223 { return QSizeF(this.wd+s.wd, this.ht+s.ht); } 223 { return QSizeF(this.wd+s.wd, this.ht+s.ht); }
224 224
225 QSizeF opSub(ref QSizeF s) 225 QSizeF opSub(ref QSizeF s)