adjust for modern Qt
authorKonrad Rosenbaum <konrad@silmor.de>
Sun, 27 Nov 2016 20:19:26 +0000 (21:19 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Sun, 27 Nov 2016 21:09:17 +0000 (22:09 +0100)
Change-Id: I3ded4299d9f5020ec7c3e4b18ae388dd31f71911

commonlib/templates/labeldlg.cpp
commonlib/templates/labeldlg.h
iface/misc/misc.cpp
iface/misc/misc.h

index 324acef..d4aab61 100644 (file)
@@ -4,7 +4,7 @@
 // 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
 //
@@ -557,7 +557,7 @@ bool MLabelConfig::configurePrinter(QPrinter&prn ) const
        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"))
@@ -576,12 +576,13 @@ void MLabelConfig::storePrinter(QPrinter& prn)
 #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());
@@ -734,16 +735,17 @@ MLabelPrintDialog::MLabelPrintDialog(QPrinter* prn, QWidget* parent, Qt::WindowF
         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);
@@ -855,7 +857,8 @@ void MLabelPrintDialog::okBtnPressed()
         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
index e3c18f5..6b8abac 100644 (file)
@@ -4,7 +4,7 @@
 // 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
 //
index 572385c..a9de63c 100644 (file)
@@ -164,6 +164,8 @@ MLocalFormat::MLocalFormat(const MOServerFormat& s)
        setDateTimeFormat(s.dateformat(),s.timeformat(),s.datetimeformat());
 }
 
+MLocalFormat::~MLocalFormat(){}
+
 QStringList MLocalFormat::weekDayNames()const{return d->m_day;}
 QStringList MLocalFormat::shortWeekDayNames()const{return d->m_sday;}
 QStringList MLocalFormat:: monthNames()const{return d->m_month;}
index 685456a..ef0d06d 100644 (file)
@@ -110,7 +110,7 @@ class MSIFACE_EXPORT MLocalFormat
                /**initializes the formatter object from a server format object*/
                MLocalFormat(const MOServerFormat&);
                /**deletes the formatter object*/
-               virtual ~MLocalFormat(){}
+               virtual ~MLocalFormat();
                
                /**sets a new default format*/
                static void setDefaultFormat(const MLocalFormat&);