Skip to content

_print_document method #8

@DevinLand

Description

@DevinLand

I don't know if it's my version of Qt (5.13) python (3.7.5) or the example in chapter 11 invoice_maker_printable.py is just wrong but I had an issue that as soon as I clicked the print dialog on the print tab my printer would print the document before I had selected anything in the dialog. So I think the code:

 self.preview.document().print(self.printer)

does start printing immediately.

I fixed the issue by changing it to this:

def _print_document(self):
    
    self.preview.document().print(self.printer)

def print_dialog(self):

    #self._print_document()
    dialog = qtps.QPrintDialog(self.printer, self)
    dialog.accepted.connect(self._print_document) '''Added this line'''
    dialog.exec()
    self._update_preview_size()

Just in case someone else has the same problem. Or maybe something in my system is making it behave this way.

Any thoughts?

Thanks,
Devin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions