mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed margins operators + print margins now in cm
This commit is contained in:
parent
789f314ae8
commit
378da395fb
@ -20,13 +20,13 @@ private:
|
||||
qreal _left, _top, _right, _bottom;
|
||||
};
|
||||
|
||||
inline MarginsF operator*(const MarginsF &margins, int factor)
|
||||
inline MarginsF operator*(const MarginsF &margins, qreal factor)
|
||||
{
|
||||
return MarginsF(margins.left() * factor, margins.top() * factor,
|
||||
margins.right() * factor, margins.bottom() * factor);
|
||||
}
|
||||
|
||||
inline MarginsF operator/(const MarginsF &margins, int factor)
|
||||
inline MarginsF operator/(const MarginsF &margins, qreal factor)
|
||||
{
|
||||
return MarginsF(margins.left() / factor, margins.top() / factor,
|
||||
margins.right() / factor, margins.bottom() / factor);
|
||||
|
@ -59,10 +59,10 @@ PDFExportDialog::PDFExportDialog(PDFExport &exp, Units units, QWidget *parent)
|
||||
_landscape->setChecked(true);
|
||||
|
||||
_margins = new MarginsFWidget();
|
||||
_margins->setUnits((units == Metric) ? tr("mm") : tr("in"));
|
||||
_margins->setUnits((units == Metric) ? tr("cm") : tr("in"));
|
||||
_margins->setSingleStep(0.1);
|
||||
_margins->setValue((units == Metric)
|
||||
? _export.margins : _export.margins * MM2IN);
|
||||
? _export.margins * MM2CM : _export.margins * MM2IN);
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
QGroupBox *pageSetupBox = new QGroupBox(tr("Page Setup"));
|
||||
@ -129,7 +129,7 @@ void PDFExportDialog::accept()
|
||||
_export.resolution = resolution;
|
||||
_export.orientation = orientation;
|
||||
_export.margins = (_units == Imperial)
|
||||
? _margins->value() / MM2IN : _margins->value();
|
||||
? _margins->value() / MM2IN : _margins->value() / MM2CM;
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ enum Units {
|
||||
#define MS2KN 1.943844490000 // m/s -> kn
|
||||
#define FT2MI 0.000189393939 // ft -> mi
|
||||
#define MM2IN 0.039370100000 // mm -> in
|
||||
#define MM2CM 0.100000000000 // mm -> cm
|
||||
#define H2S 0.000277777778 // h -> s
|
||||
#define MIN2S 0.016666666667 // min -> s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user