if(pid<=0 || !d->domCache.contains(pid))return;
//invalidate children
int csize=d->domCache[nid].children.size()-1;
+ if(csize<0)csize=0;
beginRemoveRows(index,0,csize);
for(int n:d->domCache[nid].children)d->removeNode(n);
d->domCache[nid].children.clear();
qDebug()<<" new nodes type is"<<nnode.nodeType()<<"value"<<nnode.nodeValue();
//add the new child-nodes
QDomNodeList nl=nnode.childNodes();
- beginInsertRows(index,0,nl.size()-1);
+ beginInsertRows(index,0,nl.size()?nl.size()-1:0);
for(int i=0;i<nl.size();i++)
d->domCache[nid].children.append(d->buildCache(nl.at(i),nid));
endInsertRows();
operator=(defaultformat);
//overwrite with new settings
QStringList sl;
- sl=s.weekdays();if(sl.size())setWeekDays(sl);
- sl=s.shortweekdays();if(sl.size())setShortWeekDays(sl);
- sl=s.months();if(sl.size())setMonths(sl);
- sl=s.shortmonths();if(sl.size())setShortMonths(sl);
+ sl=s.weekdays();if(sl.size()==7)setWeekDays(sl);else setWeekDays();
+ sl=s.shortweekdays();if(sl.size()==7)setShortWeekDays(sl);else setShortWeekDays();
+ sl=s.months();if(sl.size()==12)setMonths(sl);else setMonths();
+ sl=s.shortmonths();if(sl.size()==12)setShortMonths(sl);else setShortMonths();
setMoneyFormat(s.currencysymbol(),s.moneydecimals(),s.currencysymbolpos());
setMoneySign(s.moneynegative(),s.moneypositive(),s.moneynegativepos(),s.moneypositivepos());
setNumberFormat(s.decimaldot().value().at(0), s.thousandseparator().value().at(0), s.thousanddigits().value());
out+=m;
break;
}
- case 'n':out+=d->m_smonth[time.month()-1];break;
- case 'N':out+=d->m_month[time.month()-1];break;
+ case 'n':out+=d->m_smonth.value(time.month()-1);break;
+ case 'N':out+=d->m_month.value(time.month()-1);break;
case 'd':out+=QString::number(time.day());break;
case 'D':{
QString m=QString::number(time.day());
out+=m;
break;
}
- case 'w':out+=d->m_sday[time.weekDay()];break;
- case 'W':out+=d->m_day[time.weekDay()];break;
+ case 'w':out+=d->m_sday.value(time.weekDay());break;
+ case 'W':out+=d->m_day.value(time.weekDay());break;
//time formats
case 'h':out+=QString::number(time.hour());break;
case 'H':{
p->setText("...");
auto settprn=[&]{
QPrintDialog pd(&t_printer,&d);
+ pd.setOptions(QAbstractPrintDialog::PrintShowPageSize);
if(pd.exec()!=QDialog::Accepted)return;
t_prn->setText(t_printer.printerName());
};
p->setText("...");
auto setvprn=[&]{
QPrintDialog pd(&v_printer,&d);
+ pd.setOptions(QAbstractPrintDialog::PrintShowPageSize);
if(pd.exec()!=QDialog::Accepted)return;
v_prn->setText(pd.printer()->printerName());
};
if(!set.contains("name"))return false;
QString pname=set.value("name").toString();
bool found=false;
- for(QPrinterInfo &info : QPrinterInfo::availablePrinters()){
+ for(const QPrinterInfo &info : QPrinterInfo::availablePrinters()){
if(info.printerName()==pname){
found=true;
break;
}
}
- if(!found)return false;
+ if(!found){
+ qDebug()<<"MLabelConfig::configurePrinter could not find printer"<<pname<<"falling back to system default printer";
+ return false;
+ }
prn.setPrinterName(pname);
+ qDebug()<<"config prn"<<prn.isValid();
#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
prn.setPrinterSelectionOption(set.value("soption","").toString());
#endif
set.setValue("paper",(int)prn.paperSize());
set.setValue("papersize",prn.paperSize(QPrinter::Point));
set.setValue("resolution",prn.resolution());
+ qDebug()<<"storing printer settings"<<cgroup()<<prn.printerName()<<prn.paperSize();
}
-Subproject commit f37aaa3c8e4d867b97c98c33e3fb80fe020209b1
+Subproject commit 31ca5bda9b24c3ae42d6b907ffadeb82c3436998