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. QPrinter problem QT 5.9.2 and 5.8
Forum Updated to NodeBB v4.3 + New Features

QPrinter problem QT 5.9.2 and 5.8

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 5 Posters 10.1k Views 2 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.
  • K Offline
    K Offline
    Krasnoiark
    wrote on last edited by
    #1

    Hi everyone,

    I am a beginner in QT, And I have been stuck for weeks searching and searching everywhere but I can't resolve it.
    I am only trying to use QPrinter in order to print a QTextDocument. I am working on QT 5.8 (I have switch to 5.9.2 still same problem)

    I have added to my .pro file QT += printsupport
    And included where I want to use QPrinter : #include <QtPrintSupport/QtPrintSupport>
    (I have tryed including all of the classes).
    The result is that I get undefined reference to `_imp___ZN8QPrinterD1Ev'.
    When I manualy add #define QT_NO_PRINTER I get 'Orientation' in 'class QPrinter' does not name a type QPrinter::Orientation orientation() const;

    I have tryed everything. Please can someone help me, I need PDF extraction and landscape oriantation for my QTextDocument.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What OS are you running on ?
      What compiler are you using ?
      Did you re-run qmake after modifying the QT variable content ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Krasnoiark
        wrote on last edited by
        #3

        Hi, I am running on Windows 10 and Ubuntu 17 LTS.
        I am using Mingw32 compiler.
        I have run qmake after adding my QT variable, I have also deleted the build file, re-run the qmake and re built and same errors.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Krasnoiark
          wrote on last edited by
          #4

          3_1508163614268_Capture d’écran (34).png 2_1508163614267_Capture d’écran (33).png 1_1508163614267_Capture d’écran (32).png 0_1508163614267_Capture d’écran (31).png

          This is my code and the .pro file

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            QT += printsupport

            and
            #include <QPrinter>

            does it for me on Qt 5.9/win 10.

            1 Reply Last reply
            1
            • K Offline
              K Offline
              Krasnoiark
              wrote on last edited by
              #6

              Hi
              Thanks for the response but it tells me that QPrinter is no such file or directory. Won't let me compile.

              jsulmJ 1 Reply Last reply
              0
              • K Krasnoiark

                Hi
                Thanks for the response but it tells me that QPrinter is no such file or directory. Won't let me compile.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Krasnoiark How did you install Qt?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • K Offline
                  K Offline
                  Krasnoiark
                  wrote on last edited by
                  #8

                  I went on the QT website, downloaded the open source installer.
                  Downloaded and Installed QT 5.9.2 MinGW 5.3.0 32 bit. And I checked all the tools.

                  mrjjM jsulmJ 2 Replies Last reply
                  0
                  • K Krasnoiark

                    I went on the QT website, downloaded the open source installer.
                    Downloaded and Installed QT 5.9.2 MinGW 5.3.0 32 bit. And I checked all the tools.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #9

                    @Krasnoiark
                    That sounds pretty ok.

                    Can you try this default project and tell if it also gives errors?
                    https://www.dropbox.com/s/wxcdigflnwbeq4d/myprinter.zip?dl=0

                    Also, you are targeting Desktop, correct ?
                    Its not bare metal project or something like that?

                    1 Reply Last reply
                    0
                    • K Krasnoiark

                      I went on the QT website, downloaded the open source installer.
                      Downloaded and Installed QT 5.9.2 MinGW 5.3.0 32 bit. And I checked all the tools.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Krasnoiark Most probably not the reason for the problem, but why do you add core and gui twice to QT?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • K Offline
                        K Offline
                        Krasnoiark
                        wrote on last edited by
                        #11

                        It compiles and there is no errors

                        mrjjM 1 Reply Last reply
                        0
                        • K Krasnoiark

                          It compiles and there is no errors

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by mrjj
                          #12

                          @Krasnoiark
                          So i think your .pro or kit selection might be messed up.

                          This is a desktop app, correct?

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            Krasnoiark
                            wrote on last edited by
                            #13

                            0_1508167382383_Capture d’écran (35).png

                            Yes, this is a Desktop project and the project is a QTWidget project insite 2 other QT Sub-projects.

                            1 Reply Last reply
                            0
                            • mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              Hmm
                              It does look fine with the kit.

                              It must be something with the pro file then

                              Since the test project worked and I assume you compiled that
                              exactly like this.

                              O 1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                Krasnoiark
                                wrote on last edited by
                                #15

                                https://drive.google.com/file/d/0B3foRMnUz_jLM1FPTVZZb1U2LUE/view?usp=sharing

                                This is my .pro file

                                jsulmJ 1 Reply Last reply
                                0
                                • mrjjM mrjj

                                  Hmm
                                  It does look fine with the kit.

                                  It must be something with the pro file then

                                  Since the test project worked and I assume you compiled that
                                  exactly like this.

                                  O Offline
                                  O Offline
                                  ofmrew
                                  wrote on last edited by
                                  #16

                                  @mrjj I believe that once in the past you told me to try deleting the build folder. It has solved many of my problems, is it worth a try?

                                  mrjjM 1 Reply Last reply
                                  1
                                  • K Krasnoiark

                                    https://drive.google.com/file/d/0B3foRMnUz_jLM1FPTVZZb1U2LUE/view?usp=sharing

                                    This is my .pro file

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #17

                                    @Krasnoiark You still add gui twice.
                                    Do you have other Qt installations on your machine?

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    K 1 Reply Last reply
                                    2
                                    • O ofmrew

                                      @mrjj I believe that once in the past you told me to try deleting the build folder. It has solved many of my problems, is it worth a try?

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @ofmrew
                                      its always worth a try :) Especially when stuff are strange. Good call.

                                      1 Reply Last reply
                                      0
                                      • jsulmJ jsulm

                                        @Krasnoiark You still add gui twice.
                                        Do you have other Qt installations on your machine?

                                        K Offline
                                        K Offline
                                        Krasnoiark
                                        wrote on last edited by
                                        #19

                                        @ofmrew No I don't. All I have is QT 5.9.2 MinGW and the tools
                                        .0_1508168815473_Capture d’écran (36).png

                                        I have tryed recompiling from scratch, it did not work.

                                        1 Reply Last reply
                                        0
                                        • mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #20

                                          It seems not to be the pro file as
                                          it is pretty basic and it could compile my project too.

                                          And QPrinter is included in the installation as a default project works.

                                          My best bet is that the
                                          $$files(.cpp)
                                          $$files(classes/
                                          .cpp)
                                          $$files(gui/*.cpp) \

                                          find something we dont expect and include.

                                          K 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