From: Konrad Rosenbaum Date: Sun, 27 Nov 2016 20:19:26 +0000 (+0100) Subject: adjust for modern Qt X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=3defe6e89d106c9dfee9e98f499cc0e30b2cf3ae;p=web%2Fkonrad%2Fsmoke.git adjust for modern Qt Change-Id: I3ded4299d9f5020ec7c3e4b18ae388dd31f71911 --- diff --git a/commonlib/templates/labeldlg.cpp b/commonlib/templates/labeldlg.cpp index 324acef..d4aab61 100644 --- a/commonlib/templates/labeldlg.cpp +++ b/commonlib/templates/labeldlg.cpp @@ -4,7 +4,7 @@ // Description: // // -// Author: Konrad Rosenbaum , (C) 2008-2011 +// Author: Konrad Rosenbaum , (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 diff --git a/commonlib/templates/labeldlg.h b/commonlib/templates/labeldlg.h index e3c18f5..6b8abac 100644 --- a/commonlib/templates/labeldlg.h +++ b/commonlib/templates/labeldlg.h @@ -4,7 +4,7 @@ // Description: // // -// Author: Konrad Rosenbaum , (C) 2008-2011 +// Author: Konrad Rosenbaum , (C) 2008-2016 // // Copyright: See README/COPYING.GPL files that come with this distribution // diff --git a/iface/misc/misc.cpp b/iface/misc/misc.cpp index 572385c..a9de63c 100644 --- a/iface/misc/misc.cpp +++ b/iface/misc/misc.cpp @@ -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;} diff --git a/iface/misc/misc.h b/iface/misc/misc.h index 685456a..ef0d06d 100644 --- a/iface/misc/misc.h +++ b/iface/misc/misc.h @@ -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&);