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. Problem with "C++ GUI Programming with Qt4, 2nd Edition"
Forum Updated to NodeBB v4.3 + New Features

Problem with "C++ GUI Programming with Qt4, 2nd Edition"

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 4.4k 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #5

    Hi
    Incomplete type often means you forgot the include. ( like #include <QLabel> )
    But in this case please check you have
    QT += widgets
    in the .pro file

    also go to
    https://github.com/mutse/qt5-book-code
    and see if he fixed sample for Qt5

    L 1 Reply Last reply
    3
    • mrjjM mrjj

      Hi
      Incomplete type often means you forgot the include. ( like #include <QLabel> )
      But in this case please check you have
      QT += widgets
      in the .pro file

      also go to
      https://github.com/mutse/qt5-book-code
      and see if he fixed sample for Qt5

      L Offline
      L Offline
      LonelyZero
      wrote on last edited by LonelyZero
      #6

      @mrjj

      The thing is it's not my files. It's book example. Literally took it from the site to compare with my code. So i don't think it's about me forgetting something.

      Yep, it's there.

      0_1526713549991_stupid_2.jpg

      Ok, i'll check it now.

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

        Hi
        What chapter is it ?

        Ag Chap02, find.pro

        L 1 Reply Last reply
        0
        • L LonelyZero

          @aha_1980

          Thanks for reply and words of welcome. I thought linked files may say much more than my noobie analysis. You can find the whole project there and try to run it yourself. I don't think there is a way to copy error log and i'm kinda too stupid to feel the difference between linker errors and runtime errors.

          Here's example screen of some errors:

          0_1526713248532_stupid.jpg

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @LonelyZero said in Problem with "C++ GUI Programming with Qt4, 2nd Edition":

          I thought linked files may say much more than my noobie analysis.

          I did not say you should analyze the problem, but you need to give us facts for our analysis. Compiler errors often differ from compiler to compiler and from platform to platform, so it is needed to see what's going wrong on your side.

          I don't think there is a way to copy error log

          Just go to the compile output pane and you can select the whole compiler log.

          and i'm kinda too stupid to feel the difference between linker errors and runtime errors.

          Oh. How is your C++ knowledge level? You will need C++ to work with Qt.

          Qt has to stay free or it will die.

          L 1 Reply Last reply
          3
          • mrjjM mrjj

            Hi
            What chapter is it ?

            Ag Chap02, find.pro

            L Offline
            L Offline
            LonelyZero
            wrote on last edited by
            #9

            @mrjj

            Version from github works. Now just need to find the difference. Probably can do it myself.

            mrjjM 1 Reply Last reply
            1
            • L LonelyZero

              @mrjj

              Version from github works. Now just need to find the difference. Probably can do it myself.

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

              @LonelyZero
              I like to use
              http://winmerge.org/
              for such tasks.

              update:
              for learning
              I had to change forwards to includes

              class QCheckBox;
              class QLabel;
              class QLineEdit;
              class QPushButton;

              #include <QDialog>
              #include <QLabel>
              #include <QLineEdit>
              #include <QPushButton>
              #include <qcheckbox.h>

              and add
              #include <QHBoxLayout> to .cpp
              it seems that #include <QtGui>
              used to pull in more.

              and QT +=widgets
              to .pro

              so basically you can fix it with replace
              #include <QtGui> with
              #include <QtWidgets>
              but NOTE , this is not good style for real projects as it pulls in far more than you need :)

              L 1 Reply Last reply
              2
              • aha_1980A aha_1980

                @LonelyZero said in Problem with "C++ GUI Programming with Qt4, 2nd Edition":

                I thought linked files may say much more than my noobie analysis.

                I did not say you should analyze the problem, but you need to give us facts for our analysis. Compiler errors often differ from compiler to compiler and from platform to platform, so it is needed to see what's going wrong on your side.

                I don't think there is a way to copy error log

                Just go to the compile output pane and you can select the whole compiler log.

                and i'm kinda too stupid to feel the difference between linker errors and runtime errors.

                Oh. How is your C++ knowledge level? You will need C++ to work with Qt.

                L Offline
                L Offline
                LonelyZero
                wrote on last edited by
                #11

                @aha_1980

                I know basic C++ stuff. Functions, variables, classes. I don't feel like i don't understand the code i've seen so far. It's just all i knew is from couple books i read in free time and i have zero expirience with real software and, erm, error fixing. That's kinda stuff i'm used to. It's for university so don't worry i'm not gonna crash any planes.

                0_1526714274741_0175fe2d-bf2c-4070-9e0c-d65d8970dcbf-image.png

                aha_1980A 1 Reply Last reply
                0
                • mrjjM mrjj

                  @LonelyZero
                  I like to use
                  http://winmerge.org/
                  for such tasks.

                  update:
                  for learning
                  I had to change forwards to includes

                  class QCheckBox;
                  class QLabel;
                  class QLineEdit;
                  class QPushButton;

                  #include <QDialog>
                  #include <QLabel>
                  #include <QLineEdit>
                  #include <QPushButton>
                  #include <qcheckbox.h>

                  and add
                  #include <QHBoxLayout> to .cpp
                  it seems that #include <QtGui>
                  used to pull in more.

                  and QT +=widgets
                  to .pro

                  so basically you can fix it with replace
                  #include <QtGui> with
                  #include <QtWidgets>
                  but NOTE , this is not good style for real projects as it pulls in far more than you need :)

                  L Offline
                  L Offline
                  LonelyZero
                  wrote on last edited by
                  #12

                  @mrjj

                  Thank you! I'll try that one in couple hours.

                  1 Reply Last reply
                  0
                  • L LonelyZero

                    @aha_1980

                    I know basic C++ stuff. Functions, variables, classes. I don't feel like i don't understand the code i've seen so far. It's just all i knew is from couple books i read in free time and i have zero expirience with real software and, erm, error fixing. That's kinda stuff i'm used to. It's for university so don't worry i'm not gonna crash any planes.

                    0_1526714274741_0175fe2d-bf2c-4070-9e0c-d65d8970dcbf-image.png

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    @LonelyZero said in Problem with "C++ GUI Programming with Qt4, 2nd Edition":

                    I know basic C++ stuff. Functions, variables, classes. I don't feel like i don't understand the code i've seen so far. It's just all i knew is from couple books i read in free time and i have zero expirience with real software and, erm, error fixing.

                    Then just start coding :) You will get used to error fixing if you do errors, and you will learn a lot. When I started coding, I typed listings from books and so you had to fix lots of errors before the program was running the first time. But you also got a better understanding of the code you're having.

                    That's kinda stuff i'm used to. It's for university so don't worry i'm not gonna crash any planes.

                    :) But if you need help building your first plane, just ask here.

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    3
                    • L Offline
                      L Offline
                      LonelyZero
                      wrote on last edited by
                      #14

                      Yep, changed forwards into includes and added layout to .cpp. Works perfectly. Thank you, guys.

                      1 Reply Last reply
                      2

                      • Login

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