Results 1 to 2 of 2

Thread: Qt - Simple code QPrinter doesn't work on others pc

  1. #1
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Qt - Simple code QPrinter doesn't work on others pc

    Hi all, i have a little problem with this simple code:

    Qt Code:
    1. void MainWindow::on_Stampa_clicked()
    2.  
    3. {
    4.  
    5. QPrinter printer(QPrinter::HighResolution);
    6.  
    7. printer.setPageSize(QPrinter::A4);
    8. printer.setOrientation(QPrinter::Portrait);
    9. printer.setPageMargins (15,15,15,15,QPrinter::Millimeter);
    10. printer.setFullPage(false);
    11. printer.setOutputFormat(QPrinter::NativeFormat);
    12.  
    13.  
    14. QPainter painter(&printer);
    15.  
    16. painter.setFont(QFont("Tahoma",8));
    17. painter.drawText(200,200,"Test prova prova");
    18. painter.end();
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 

    "Stampa" is a normal button.

    In the PC with QT the print works right, but in the others pc (one with win 8.1 and one with win 7) default print doesn't start, the print queue stay empty. I don't understand why and i don't get any error.

    I use:

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3. #include <QPrinter>
    4. #include <QPainter>
    To copy to clipboard, switch view to plain text mode 

    and in the .pro:

    Qt Code:
    1. QT += printsupport
    2. QTPLUGIN += windowsprintersupport
    To copy to clipboard, switch view to plain text mode 

    The dll "Qt5PrintSupport" is present inside the folder of course.

    Sorry for the noob question but I don't understand what I am doing wrong..

  2. #2
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qt - Simple code QPrinter doesn't work on others pc

    Solved with add
    Qt Code:
    1. {myAppPath}\printsupport\windowsprintersupport.dll
    To copy to clipboard, switch view to plain text mode 

    http://stackoverflow.com/questions/2...80565#29980565

Similar Threads

  1. A simple Plot doesn't work in Qt5
    By 8Observer8 in forum Qwt
    Replies: 3
    Last Post: 16th January 2014, 06:45
  2. Replies: 0
    Last Post: 23rd October 2013, 06:23
  3. Replies: 12
    Last Post: 5th July 2009, 16:03
  4. Why this code doesn't work?
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 11th February 2009, 19:08
  5. QHttp simple program doesn't work
    By johncharlesb in forum Qt Programming
    Replies: 0
    Last Post: 4th April 2008, 04:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.