Add missing operators QMargins -=,+= (int).
Task-number: QTBUG-34079 Change-Id: If61cc01ba70345b01f13072769d3a38f23e8cefc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a3a1bd755f
commit
8178a6cab1
@ -242,6 +242,24 @@ inline QMargins &QMargins::operator-=(const QMargins &margins)
|
||||
return *this = *this - margins;
|
||||
}
|
||||
|
||||
inline QMargins &QMargins::operator+=(int margin)
|
||||
{
|
||||
m_left += margin;
|
||||
m_top += margin;
|
||||
m_right += margin;
|
||||
m_bottom += margin;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline QMargins &QMargins::operator-=(int margin)
|
||||
{
|
||||
m_left -= margin;
|
||||
m_top -= margin;
|
||||
m_right -= margin;
|
||||
m_bottom -= margin;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline QMargins &QMargins::operator*=(int factor)
|
||||
{
|
||||
return *this = *this * factor;
|
||||
|
@ -93,6 +93,12 @@ void tst_QMargins::operators()
|
||||
a -= m2;
|
||||
QCOMPARE(a, subtracted);
|
||||
|
||||
QMargins h = m1;
|
||||
h += 2;
|
||||
QCOMPARE(h, QMargins(14, 16, 18, 20));
|
||||
h -= 2;
|
||||
QCOMPARE(h, m1);
|
||||
|
||||
const QMargins doubled = m1 * 2;
|
||||
QCOMPARE(doubled, QMargins(24, 28, 32, 36));
|
||||
QCOMPARE(2 * m1, doubled);
|
||||
|
Loading…
Reference in New Issue
Block a user