QPainter is not active error.works fine on desktop but gives error in embedded device.



  • So I implemented this test code to print some text using ubuntu based desktop. It worked fine in there. But same code when Implemented in the machine , it gives an error that QPainter is not active. Pls help.

    QPrinter printer;
    
    //            printer.setOutputFormat(QPrinter::PdfFormat);
    //            printer.setOutputFileName("writable.pdf");
              QPainter painter;
               if (! painter.begin(&printer)) { // failed to open file
                   qWarning("failed to open file, is it writable?");
                   return 0;
               }
              painter.drawText(00, 80, "Testing the automaization of this printer");
    
               painter.drawText(00, 100, "Test 2");
               QString str="Pdf is ready============== to print";
    
               painter.drawText(40,80,str);
    
    
               painter.end();
    

  • Lifetime Qt Champion

    Hi,

    Please give more details about your desktop and embedded device.


Log in to reply