2016-05-27 22:45:58 +02:00
|
|
|
#ifndef MARGINS_H
|
|
|
|
#define MARGINS_H
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
class MarginsF
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MarginsF() {_left = 0; _top = 0; _right = 0; _bottom = 0;}
|
|
|
|
MarginsF(qreal left, qreal top, qreal right, qreal bottom)
|
|
|
|
{_left = left, _top = top; _right = right; _bottom = bottom;}
|
|
|
|
|
|
|
|
qreal left() const {return _left;}
|
|
|
|
qreal top() const {return _top;}
|
|
|
|
qreal right() const {return _right;}
|
|
|
|
qreal bottom() const {return _bottom;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
qreal _left, _top, _right, _bottom;
|
|
|
|
};
|
|
|
|
|
2020-10-06 22:02:26 +02:00
|
|
|
inline MarginsF operator*(const MarginsF &margins, qreal factor)
|
2020-09-27 00:34:38 +02:00
|
|
|
{
|
2020-10-06 21:41:23 +02:00
|
|
|
return MarginsF(margins.left() * factor, margins.top() * factor,
|
|
|
|
margins.right() * factor, margins.bottom() * factor);
|
2020-09-27 00:34:38 +02:00
|
|
|
}
|
|
|
|
|
2020-10-06 22:02:26 +02:00
|
|
|
inline MarginsF operator/(const MarginsF &margins, qreal factor)
|
2020-10-06 21:41:23 +02:00
|
|
|
{
|
|
|
|
return MarginsF(margins.left() / factor, margins.top() / factor,
|
|
|
|
margins.right() / factor, margins.bottom() / factor);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG
|
2018-01-21 11:19:46 +01:00
|
|
|
inline QDebug operator<<(QDebug dbg, const MarginsF &margins)
|
|
|
|
{
|
|
|
|
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
|
|
|
|
<< ", " << margins.right() << margins.bottom() << ")";
|
|
|
|
return dbg.space();
|
|
|
|
}
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2016-05-27 22:45:58 +02:00
|
|
|
|
|
|
|
#endif // MARGINS_H
|