// Description:
//
//
-// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2011
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008-2016
//
// Copyright: See README/COPYING.GPL files that come with this distribution
//
mr=set.value("marginRight").toDouble();
mb=set.value("marginBottom").toDouble();
mt=set.value("marginTop").toDouble();
- prn.setPageMargins(ml,mr,mb,mt,QPrinter::Millimeter);
+ prn.setPageMargins(QMarginsF(ml,mr,mb,mt),QPrinter::Millimeter);
prn.setDuplex(QPrinter::DuplexMode(set.value("duplex",QPrinter::DuplexAuto).toInt()));
prn.setOrientation((set.value("orientation","portrait").toString()=="portrait")?QPrinter::Portrait:QPrinter::Landscape);
if(set.contains("resolution"))
#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
set.setValue("soption",prn.printerSelectionOption());
#endif
- qreal ml,mr,mt,mb;
- prn.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
- set.setValue("marginLeft",ml);
- set.setValue("marginRight",mr);
- set.setValue("marginBottom",mb);
- set.setValue("marginTop",mt);
+ //qreal ml,mr,mt,mb;
+ //prn.getPageMargins(&ml,&mr,&mb,&mt,QPrinter::Millimeter);
+ QMarginsF marg=prn.pageLayout().margins(QPrinter::Millimeter);
+ set.setValue("marginLeft",marg.left());
+ set.setValue("marginRight",marg.right());
+ set.setValue("marginBottom",marg.bottom());
+ set.setValue("marginTop",marg.top());
set.setValue("duplex",(int)prn.duplex());
set.setValue("orientation",prn.orientation()==QPrinter::Portrait?"portrait":"landscape");
set.setValue("paper",(int)prn.paperSize());
hl->addWidget(new QLabel(tr("high","paper size: height")));
QGridLayout*gl;
fl->addRow(tr("Margins:"),gl=new QGridLayout);
- qreal ml,mr,mt,mb;
- mprinter->getPageMargins(&ml,&mt,&mr,&mb,QPrinter::Millimeter);
+ //qreal ml,mr,mt,mb;
+ QMarginsF marg=mprinter->pageLayout().margins(QPrinter::Millimeter);
+ //mprinter->getPageMargins(&ml,&mt,&mr,&mb,QPrinter::Millimeter);
gl->addWidget(mmargtop=new QDoubleSpinBox,0,1);
- mmargtop->setValue(mt/moldunit);
+ mmargtop->setValue(marg.top()/moldunit);
gl->addWidget(mmargleft=new QDoubleSpinBox,1,0);
- mmargleft->setValue(ml/moldunit);
+ mmargleft->setValue(marg.left()/moldunit);
gl->addWidget(mmargright=new QDoubleSpinBox,1,2);
- mmargright->setValue(mr/moldunit);
+ mmargright->setValue(marg.right()/moldunit);
gl->addWidget(mmargbottom=new QDoubleSpinBox,2,1);
- mmargbottom->setValue(mb/moldunit);
+ mmargbottom->setValue(marg.bottom()/moldunit);
fl->addRow(tr("Resolution:"),mresolution=new QComboBox);
fl->addRow(new QLabel(" "));
fl->addRow(hl=new QHBoxLayout);
mprinter->setPrinterName(mprnselect->itemText(mprnselect->currentIndex()));
mprinter->setPaperSize(QPrinter::PaperSize(mpaper->itemData(mpaper->currentIndex()).toInt()));
mprinter->setPageSizeMM(QSizeF(msizex->value()*moldunit,msizey->value()*moldunit));
- mprinter->setPageMargins(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit, QPrinter::Millimeter);
+ //mprinter->setPageMargins(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit, QPrinter::Millimeter);
+ mprinter->setPageMargins(QMarginsF(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit), QPrinter::Millimeter);
mprinter->setResolution(mresolution->itemData(mresolution->currentIndex()).toInt());
//close the dialog