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. [SOLVED] Why QPrinter need QtGUI
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Why QPrinter need QtGUI

Scheduled Pinned Locked Moved General and Desktop
18 Posts 4 Posters 11.1k 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.
  • A Offline
    A Offline
    AcerExtensa
    wrote on last edited by
    #9

    Tell us what do you use and how do you do it! Maybe you have something what peoples with PostScript printers all other the world are looking for...

    God is Real unless explicitly declared as Integer.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Pitchou
      wrote on last edited by
      #10

      So, if I undestand what you said... Before Qt4.4, it was possible to use QPrinter to generate a PDF file but now, with Qt I can't print a PDF file with QPrinter if my Linux doesn't have a GUI ? ...

      Do you know another way to print a QImage in a PDF file, without using GUI ?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #11

        QImage and QPrinter inherits QPaintDevice, and QPaintDevice is an GUI Class. So you need QtGUI library if you would like to use this two classes.

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Pitchou
          wrote on last edited by
          #12

          I have QtGUI library installed on the OS which is OpenSuse 11. But it's a server OS and it doesn't have server X connexion ...

          So, I'm happy :/ My app can't work on the server.

          Thanks for your answer.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AcerExtensa
            wrote on last edited by
            #13

            you can still use virtual framebuffer like Xvfb

            God is Real unless explicitly declared as Integer.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Pitchou
              wrote on last edited by
              #14

              Thanks AcerExtensa ! XVFB was a good idea and now, the app works well ! :D
              This thread can be closed

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AcerExtensa
                wrote on last edited by
                #15

                Please add prefix "[SOLVED]" to the left of the topic subject. Thanks!

                God is Real unless explicitly declared as Integer.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fernando.lopes
                  wrote on last edited by
                  #16

                  Hi Pitchou.
                  How did you use XVFB to create the QPrinter?

                  I need to make a PDF printer in a console application and I get the same error you got.

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Pitchou
                    wrote on last edited by
                    #17

                    Hi Fernando, I changed my way. I do not use XVFB anymore because I found a solution to use QPriner without serverX.

                    My error was to use QApplication, which require a serverX. I found a trick !

                    When you use QApplication, I think you use it like this :
                    @QApplication a(argc, argv,);@

                    Change it to have something like this : @QApplication a(argc, argv, false);@

                    The false attribute will force the program to work without a serverX and you can use QPrinter without any problem

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fernando.lopes
                      wrote on last edited by
                      #18

                      Thank you Pitchou!
                      It is working now! :D

                      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