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. QPrintSupport - print dialog not showing in windows
QtWS25 Last Chance

QPrintSupport - print dialog not showing in windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
printprintsupportqtprintsupport
6 Posts 3 Posters 1.5k Views
  • 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.
  • K Offline
    K Offline
    Kosmic
    wrote on 13 Sept 2021, 09:20 last edited by
    #1

    Greetings,
    I have recently ran into a problem with QT5 and QTPrintSupport. I am using Qt version 5.15.0 with C++ on Windows 10, developing with Visual Studio 2019. I have QTPrintSupport set up in my project. When I build app in Debug or Release directly from Visual Studio, print dialog is called correctly and I can print whatever I want. If I then open the build folder and run the .exe file directly, print dialog window is not shown. We usually install the app using ClickOnce technology. When I run the app directly from windows (using the installed ClickOnce), that does not work either.

    std::ofstream printDebug("print.txt");
    printDebug << "creating print dialog" << std::endl;
    
    QPrintDialog printDialog(&printer, this);
    if (printDialog.exec() != QDialog::Accepted) return;
    

    the print out is called every time so the code correctly reaches the lines with QPrintDialog. Do you have any clue what could be wrong here?

    Thanks in advance,
    Kosmic

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 13 Sept 2021, 09:30 last edited by
      #2

      Hi
      It could be missing windowsprintersupport.dll or it sees the wrong version.
      also could be the deployment folder that is not having the right layout.
      I think the windeployqt also makes a folder called printsupport but not 100% sure.

      A 1 Reply Last reply 13 Sept 2021, 09:36
      0
      • M mrjj
        13 Sept 2021, 09:30

        Hi
        It could be missing windowsprintersupport.dll or it sees the wrong version.
        also could be the deployment folder that is not having the right layout.
        I think the windeployqt also makes a folder called printsupport but not 100% sure.

        A Offline
        A Offline
        artwaw
        wrote on 13 Sept 2021, 09:36 last edited by
        #3

        @mrjj it does create the folder since the print support is deployed as a plugin. So it might be the exe is missing the dll.

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kosmic
          wrote on 13 Sept 2021, 09:37 last edited by Kosmic
          #4

          I have checked to folder layout on the deployment folder.

          application.exe
          printsupport
          |-------windowsprintersupport.dll

          I am not sure if this folder layout is correct.
          Nor am I sure how to check version of windowsprintersupport.dll.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kosmic
            wrote on 13 Sept 2021, 10:03 last edited by
            #5

            Recently, I have discovered that from Visual Studio, when printing:

            printDebug << QPrinterInfo::availablePrinters().size() << std::endl;
            

            It has discovered 7 printers available. When I print this from the deployment folder, it will print 0. Can this be connected to the dll not registered by the application?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kosmic
              wrote on 13 Sept 2021, 10:32 last edited by
              #6

              Finally discovered the error here. Inspired here:
              https://forum.qt.io/topic/39319/solved-qprinterinfo-availableprinters-don-t-list-available-printers/2
              the .dll file was from the previous version before upgrade and somehow didnt get upgraded along. So copying the file manually to the location instead of the previous dll version made it.
              Thanks for help,
              Kosmic

              1 Reply Last reply
              2

              1/6

              13 Sept 2021, 09:20

              • Login

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