mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 11:10:44 +00:00
Can now print from Help Browser too
This commit is contained in:
parent
cd637c4356
commit
f2de65aa33
@ -1217,7 +1217,17 @@ void MainWindow::on_actionPrint_Report_triggered()
|
|||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
printer.setPrinterName("Print to File (PDF)");
|
printer.setPrinterName("Print to File (PDF)");
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
QString filename=PREF.Get("{home}/Summary_"+PROFILE.user->userName()+"_"+QDate::currentDate().toString(Qt::ISODate)+".pdf");
|
QString name;
|
||||||
|
QString datestr;
|
||||||
|
if (ui->tabWidget->currentWidget()==ui->summaryTab) {
|
||||||
|
name="Summary";
|
||||||
|
datestr=QDate::currentDate().toString(Qt::ISODate);
|
||||||
|
} else if (ui->tabWidget->currentWidget()==ui->helpTab) {
|
||||||
|
name="Help";
|
||||||
|
datestr=QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||||
|
} else name="Unknown";
|
||||||
|
|
||||||
|
QString filename=PREF.Get("{home}/"+name+"_"+PROFILE.user->userName()+"_"+datestr+".pdf");
|
||||||
|
|
||||||
printer.setOutputFileName(filename);
|
printer.setOutputFileName(filename);
|
||||||
#endif
|
#endif
|
||||||
@ -1229,7 +1239,13 @@ void MainWindow::on_actionPrint_Report_triggered()
|
|||||||
|
|
||||||
QPrintDialog pdlg(&printer,this);
|
QPrintDialog pdlg(&printer,this);
|
||||||
if (pdlg.exec()==QPrintDialog::Accepted) {
|
if (pdlg.exec()==QPrintDialog::Accepted) {
|
||||||
ui->summaryView->print(&printer);
|
|
||||||
|
if (ui->tabWidget->currentWidget()==ui->summaryTab) {
|
||||||
|
ui->summaryView->print(&printer);
|
||||||
|
} else if (ui->tabWidget->currentWidget()==ui->helpTab) {
|
||||||
|
ui->webView->print(&printer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//QMessageBox::information(this,tr("Not supported Yet"),tr("Sorry, printing from this page is not supported yet"),QMessageBox::Ok);
|
//QMessageBox::information(this,tr("Not supported Yet"),tr("Sorry, printing from this page is not supported yet"),QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user