Lazy Initialize QPrinter

it was taking 3 - 4 secs here to open the print dialog,
first I tought it was a bug in our side, but it looks like
it's a Qt bug, and by lazy initializing it we don't actually
solve this, since it will still take 3 - 4 secs for the printer
to start, but the dialog will appear much quicker.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-01-07 19:33:58 -02:00 committed by Dirk Hohndel
parent 25aa80846b
commit 19dee335e4
2 changed files with 28 additions and 8 deletions

View file

@ -18,12 +18,13 @@ class PrintDialog : public QDialog {
public:
explicit PrintDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~PrintDialog();
private:
PrintOptions *optionsWidget;
QProgressBar *progressBar;
Printer *printer;
QPrinter qprinter;
QPrinter *qprinter;
struct print_options printOptions;
struct template_options templateOptions;
@ -33,6 +34,7 @@ slots:
void previewClicked();
void printClicked();
void onPaintRequested(QPrinter *);
void createPrinterObj();
};
#endif
#endif // PRINTDIALOG_H