mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
Default system printer will selected in "printer select dialog" by default
This commit is contained in:
parent
b963428f4c
commit
d250015839
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
|
#include <QPrinterInfo>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
@ -157,7 +158,13 @@ void PreviewReportWidget::lastPage()
|
|||||||
|
|
||||||
void PreviewReportWidget::print()
|
void PreviewReportWidget::print()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QPrinterInfo pi;
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
|
||||||
|
if (!pi.defaultPrinter().isNull())
|
||||||
|
printer.setPrinterName(pi.defaultPrinterName());
|
||||||
|
|
||||||
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
||||||
if (dialog.exec()==QDialog::Accepted){
|
if (dialog.exec()==QDialog::Accepted){
|
||||||
if (!d_ptr->m_reportPages.isEmpty())
|
if (!d_ptr->m_reportPages.isEmpty())
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
|
#include <QPrinterInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
@ -271,6 +272,9 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons
|
|||||||
bool ReportEnginePrivate::printReport(QPrinter* printer)
|
bool ReportEnginePrivate::printReport(QPrinter* printer)
|
||||||
{
|
{
|
||||||
if (!printer&&!m_printerSelected){
|
if (!printer&&!m_printerSelected){
|
||||||
|
QPrinterInfo pi;
|
||||||
|
if (!pi.defaultPrinter().isNull())
|
||||||
|
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
||||||
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
||||||
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
||||||
}
|
}
|
||||||
@ -294,8 +298,10 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
|
|||||||
|
|
||||||
bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange)
|
bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!printer&&!m_printerSelected){
|
if (!printer&&!m_printerSelected){
|
||||||
|
QPrinterInfo pi;
|
||||||
|
if (!pi.defaultPrinter().isNull())
|
||||||
|
m_printer.data()->setPrinterName(pi.defaultPrinterName());
|
||||||
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
||||||
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
||||||
if (m_printerSelected){
|
if (m_printerSelected){
|
||||||
|
Loading…
Reference in New Issue
Block a user