some corrections for print labels config
authorKonrad Rosenbaum <konrad@silmor.de>
Fri, 10 Feb 2017 22:27:59 +0000 (23:27 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Fri, 10 Feb 2017 22:27:59 +0000 (23:27 +0100)
Change-Id: Ib84b570f2131fe82d909c5c709d18d084f69dac6

commonlib/templates/labeldlg.cpp
commonlib/templates/labeldlg.h

index 24a192f..b0a83fb 100644 (file)
@@ -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());
         
index 6b8abac..6870b0a 100644 (file)
@@ -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