Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I abort a print job?
Forum Updated to NodeBB v4.3 + New Features

How can I abort a print job?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fredrossperry
    wrote on last edited by
    #1

    I am printing using QPrinter, in a thread. The main UI thread has a progress dialog with a cancel button.
    If the user cancels before the printing is complete, I want to abort the job. Is there hope? Thank you.

    1 Reply Last reply
    0
    • siropS Offline
      siropS Offline
      sirop
      wrote on last edited by
      #2

      Try http://qt-project.org/doc/qt-5/qprinter.html#abort

      To be, or not to be: that is the question:
      Whether ’tis nobler in the mind to suffer
      The slings and arrows of outrageous fortune,
      Or to take arms against a sea of troubles,
      And by opposing end them?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fredrossperry
        wrote on last edited by
        #3

        I am calling this, but it's not helping. My pseudo-code is like this:

        get a QPrinter
        make a QPainter, begin
        for each page
        {
        if user canceled
        call QPrinter abort
        break
        render page to printer
        }

        It does stop rendering new pages (break), but the
        abor seems to have no effect.

        1 Reply Last reply
        0
        • siropS Offline
          siropS Offline
          sirop
          wrote on last edited by
          #4

          Well, the docs say:
          It is not always possible to abort a print job. For example, all the data has gone to the printer but the printer cannot or will not cancel the job when asked to.

          To be, or not to be: that is the question:
          Whether ’tis nobler in the mind to suffer
          The slings and arrows of outrageous fortune,
          Or to take arms against a sea of troubles,
          And by opposing end them?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved