printOptions::printOptions(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); connect(_printerGroup, SIGNAL(toggled(bool)), this, SLOT(sHandleCheckbox())); QPrinterInfo pinfo; QList<QPrinterInfo> plist = pinfo.availablePrinters(); for (int i = 0; i < plist.size(); ++i) _printers->addItem(plist.at(i).printerName()); }
/* prepareGeneralSettings() * Called : By selectFunction() * Performs : Sets up the General Settings Tab */ void Settings::prepareGeneralSettings() { flag[5]=true; //once flag is set we need not have the signals as //the settings are saved only at ok disconnect(printersCombo,SIGNAL(currentIndexChanged( const QString &)),this, SLOT(setPrinterFlag( const QString&))); databaseRB->setChecked(settings->value("general/mode",true).toBool()); manualRB->setChecked(!settings->value("general/mode",false).toBool()); QList<QPrinterInfo> plist; QPrinterInfo pinfo; plist=pinfo.availablePrinters(); QStringList printers; for(int i=0;i<plist.size();i++) printers<<plist[i].printerName(); int index=printers.indexOf( settings->value("general/printer","Unavailable").toString()); QString temp,dprinter=pinfo.defaultPrinter().printerName(); temp=dprinter; //highlighting default printer temp+="(Default)"; printers.replace(printers.indexOf(dprinter),temp); //inserting all the printers printersCombo->insertItems(0,printers); //checking whether the current printer is there in the list newly generated //if not there show a msg saying "No printer assigned" if(index==-1) { printersCombo->insertItem(0,"No Printer Assigned"); QMessageBox::information(this,"DocmaQ Settings","No Printer Assingned.Select a printer from the Available Printers "); } else printersCombo->setCurrentIndex(index); connect(printersCombo,SIGNAL(currentIndexChanged( const QString &)),this,SLOT(setPrinterFlag( const QString&)),Qt::UniqueConnection); }
+ QObject::tr("找零: ") + "<font size=\"+2\">" + QString::number(m_totalget-m_totalcost, 'g', 6) + "</font></div>"; m_html += "<p align=\"center\">" + QObject::tr("*淘米欢迎您再次光临*") + "</p>"; m_html += "<div align=\"center\">" + QObject::tr("服务热线: 88888888") + "</div>"; //debug: to get the html content qDebug(m_html.toUtf8()); //debug: to get available printer in local area QString m_printers = Printer::printerList(); qDebug(m_printers.toUtf8()); //find the wanted network printer to print QPrinterInfo printerInfo = QPrinterInfo(); QPrinterInfo targetPrinterInfo = QPrinterInfo(); foreach(QPrinterInfo item, printerInfo.availablePrinters()){ if(item.printerName() == QString::fromStdString("HP_LaserJet_P4014.P4015_PCL6:3")){ //m_printer = new QPrinter(item, QPrinter::HighResolution); targetPrinterInfo = item; qDebug(targetPrinterInfo.printerName().toUtf8()); break; }else{ qDebug("nothing!!!"); } } //QPrinter m_printer(targetPrinterInfo, QPrinter::HighResolution); QPrinter m_printer(QPrinter::HighResolution); //m_printer.setOutputFormat(QPrinter::NativeFormat); m_printer.setOutputFileName("/home/ljl/menu.pdf");