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. What am I doing wrong?

What am I doing wrong?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 575 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.
  • U Offline
    U Offline
    Uberlinc
    wrote on last edited by
    #1

    So, coding is an on-and-off thing for me.
    I've had to reimage my laptop several times over the last year.

    I'm running Qt Creator 4.9.0 based on Qt 5.12.2
    The book I am working from is Blanchett and Summerfield "C++ GUI Programming with Qt 4."

    I realise that the code in the book will not work correctly with the latest Qt without some changes.
    So, I have a copy of the code that some gentleman (whose name escapes me) has written to account for Qt 5 changes.
    The last time I was coding, this all worked well, and I was coding away fine with the updated code.

    That was a few months ago.
    Now, here's the rub - I was getting back to working through the book and opened some basic, easy stuff from the updated code samples, and Qt has it lit up like a Christmas tree with warning and errors.

    So, has something changed in the newest version that I've installed (when I've reimaged my laptop, I downloaded the latest version of Qt Creator) or is the a setting that has bumped to "Compile using something-or-other mode" etc (as packages like this often tend to have?

    A hint, anyone?

    Regards,

    Uberlinc.

    1 Reply Last reply
    0
    • U Offline
      U Offline
      Uberlinc
      wrote on last edited by
      #2

      Okay, so edit: I scrubbed all versions and simply re-copied the plain, original code from the Qt5 files and it did not light up all the errors as it did (possibly a typo somewhere critical which upset the whole thing) but it is still giving a warning:

      "zero as null-pointer constant" after line stating:

      FindDialog(QWidget *parent = 0);

      Is this valid and why would there be a warning?

      Many thanks,

      Uberlinc.

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        C++11 introduced a nullptr keyword that should be used for, well, null pointers. 0 will still work but the warning is there to suggest you modernize. The example is simply pre C++11 code so it will give you that warning with newer compiler. You can ignore it or change it to

        FindDialog(QWidget *parent = nullptr);
        

        It will work the same either way.

        1 Reply Last reply
        3
        • U Offline
          U Offline
          Uberlinc
          wrote on last edited by
          #4

          That's as comprehensive an answer as I could have expected!
          Many thanks!

          1 Reply Last reply
          1

          • Login

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