From 7f8df924eb12d28e447d8e731c5cc6dc665f8039 Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Fri, 10 Feb 2017 23:27:59 +0100 Subject: [PATCH] some corrections for print labels config Change-Id: Ib84b570f2131fe82d909c5c709d18d084f69dac6 --- commonlib/templates/labeldlg.cpp | 16 ++++++++++------ commonlib/templates/labeldlg.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/commonlib/templates/labeldlg.cpp b/commonlib/templates/labeldlg.cpp index 24a192f..b0a83fb 100644 --- a/commonlib/templates/labeldlg.cpp +++ b/commonlib/templates/labeldlg.cpp @@ -557,8 +557,8 @@ bool MLabelConfig::configurePrinter(QPrinter&prn ) const mr=set.value("marginRight").toDouble(); mb=set.value("marginBottom").toDouble(); mt=set.value("marginTop").toDouble(); - prn.setFullPage(true); - prn.setPageMargins(QMarginsF(ml,mr,mb,mt),QPageLayout::Millimeter); + prn.setFullPage(set.value("fullPage",true).toBool()); + prn.setPageMargins(QMarginsF(ml,mt,mr,mb),QPageLayout::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")) @@ -584,6 +584,7 @@ void MLabelConfig::storePrinter(QPrinter& prn) set.setValue("marginRight",marg.right()); set.setValue("marginBottom",marg.bottom()); set.setValue("marginTop",marg.top()); + set.setValue("fullPage",prn.fullPage()); set.setValue("duplex",(int)prn.duplex()); set.setValue("orientation",prn.orientation()==QPrinter::Portrait?"portrait":"landscape"); set.setValue("paper",(int)prn.paperSize()); @@ -739,13 +740,15 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF //qreal ml,mr,mt,mb; QMarginsF marg=mprinter->pageLayout().margins(QPageLayout::Millimeter); //mprinter->getPageMargins(&ml,&mt,&mr,&mb,QPrinter::Millimeter); - gl->addWidget(mmargtop=new QDoubleSpinBox,0,1); + gl->addWidget(mfullpage=new QCheckBox(tr("Use Full Page")),0,0,1,3); + mfullpage->setChecked(mprinter->fullPage()); + gl->addWidget(mmargtop=new QDoubleSpinBox,1,1); mmargtop->setValue(marg.top()/moldunit); - gl->addWidget(mmargleft=new QDoubleSpinBox,1,0); + gl->addWidget(mmargleft=new QDoubleSpinBox,2,0); mmargleft->setValue(marg.left()/moldunit); - gl->addWidget(mmargright=new QDoubleSpinBox,1,2); + gl->addWidget(mmargright=new QDoubleSpinBox,2,2); mmargright->setValue(marg.right()/moldunit); - gl->addWidget(mmargbottom=new QDoubleSpinBox,2,1); + gl->addWidget(mmargbottom=new QDoubleSpinBox,3,1); mmargbottom->setValue(marg.bottom()/moldunit); fl->addRow(tr("Resolution:"),mresolution=new QComboBox); fl->addRow(new QLabel(" ")); @@ -859,6 +862,7 @@ void MLabelPrintDialog::okBtnPressed() 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->setFullPage(mfullpage->isChecked()); mprinter->setPageMargins(QMarginsF(mmargleft->value()*moldunit, mmargtop->value()*moldunit, mmargright->value()*moldunit, mmargbottom->value()*moldunit), QPageLayout::Millimeter); mprinter->setResolution(mresolution->itemData(mresolution->currentIndex()).toInt()); diff --git a/commonlib/templates/labeldlg.h b/commonlib/templates/labeldlg.h index 6b8abac..6870b0a 100644 --- a/commonlib/templates/labeldlg.h +++ b/commonlib/templates/labeldlg.h @@ -221,6 +221,7 @@ class MAGICSMOKE_COMMON_EXPORT MLabelPrintDialog:public QDialog QDoubleSpinBox*msizex,*msizey; QLabel*mdescript,*mlocation,*mmakemodel; QPushButton*mokbtn; + QCheckBox*mfullpage; double moldunit=1.; //internal: initialize paper types -- 1.7.2.5