mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-16 03:44:24 +02:00
Margins widget refactoring
This commit is contained in:
@ -4,27 +4,6 @@
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
|
||||
class Margins
|
||||
{
|
||||
public:
|
||||
Margins() {_left = 0; _top = 0; _right = 0; _bottom = 0;}
|
||||
Margins(int left, int top, int right, int bottom)
|
||||
{_left = left, _top = top; _right = right; _bottom = bottom;}
|
||||
|
||||
int left() const {return _left;}
|
||||
int top() const {return _top;}
|
||||
int right() const {return _right;}
|
||||
int bottom() const {return _bottom;}
|
||||
|
||||
int &rleft() {return _left;}
|
||||
int &rtop() {return _top;}
|
||||
int &rright() {return _right;}
|
||||
int &rbottom() {return _bottom;}
|
||||
|
||||
private:
|
||||
int _left, _top, _right, _bottom;
|
||||
};
|
||||
|
||||
class MarginsF
|
||||
{
|
||||
public:
|
||||
@ -37,23 +16,23 @@ public:
|
||||
qreal right() const {return _right;}
|
||||
qreal bottom() const {return _bottom;}
|
||||
|
||||
qreal &rleft() {return _left;}
|
||||
qreal &rtop() {return _top;}
|
||||
qreal &rright() {return _right;}
|
||||
qreal &rbottom() {return _bottom;}
|
||||
|
||||
private:
|
||||
qreal _left, _top, _right, _bottom;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const Margins &margins)
|
||||
inline MarginsF operator*(const MarginsF &margins, int factor)
|
||||
{
|
||||
dbg.nospace() << "Margins(" << margins.left() << ", " << margins.top()
|
||||
<< ", " << margins.right() << margins.bottom() << ")";
|
||||
return dbg.space();
|
||||
return MarginsF(margins.left() * factor, margins.top() * factor,
|
||||
margins.right() * factor, margins.bottom() * factor);
|
||||
}
|
||||
|
||||
inline MarginsF operator/(const MarginsF &margins, int factor)
|
||||
{
|
||||
return MarginsF(margins.left() / factor, margins.top() / factor,
|
||||
margins.right() / factor, margins.bottom() / factor);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const MarginsF &margins)
|
||||
{
|
||||
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
|
||||
|
Reference in New Issue
Block a user