Hello, everybody!
Please help with qprinter()
I'm sending 10 pages to printer, and I want to clear pending events to printer.
But printer.abort() doesn't work and its result is false;
what's problem?
maybe I need to connect additional libs or make some changes in .pro

there is a piece of my code:

Qt Code:
  1. void AbortPrinter::on_pushButton_clicked()
  2. {
  3. //to print
  4. if(dialog->exec() == QDialog::Accepted)
  5. {
  6. progressDialog->show();
  7. painter->begin(&printer);
  8. painter->setPen(Qt::white);
  9. for(int i=0;i<10;i++)
  10. {
  11. painter->drawText(50,50,tr("HELLO DUDE! X))"));
  12. if(i>0)
  13. printer.newPage();
  14. qDebug()<<"pending Events: "<<qApp->hasPendingEvents();
  15. qApp->processEvents(QEventLoop::AllEvents);
  16. //if(qApp->hasPendingEvents()) - this version is also doesn't work correct
  17. if(b) //b is global bool to check aborted printers
  18. {
  19. painter->end();
  20. qDebug()<<"aborted: "<<b;
  21. break;
  22. }
  23. }
  24. painter->end();
  25. }
  26. }
  27.  
  28. void AbortPrinter::on_pushButton_2_clicked()
  29. {//to abort
  30. b = printer.abort();
  31. }
To copy to clipboard, switch view to plain text mode