Important: Please read the Qt Code of Conduct -

Code changes in Qt 4 and Qt 5

  • Hi all,

    Here is the program from the book "C++-GUI-Programming-with-Qt-4-2nd Edition".
    The book is of Qt 4 and I used it on Qt Creator 4.3.0. I started
    learning Qt using that book.
    Anyway, would you please take a look at the code to see what part can be updated using Qt 5?

    The second case: What I've learnt by reading the first 4 chapters has been laying the widgets out and putting them on the screen for output by the setLayout statement. But here and don't see any layout! I think it's done by:

        spreadsheet = new Spreadsheet;

    Right, please?

  • @tomy
    Your link is to a RAR file on Dropbox?

  • @JNBarchan
    Yes, it's the source code. You can download it.

  • @tomy
    No thank you. Perhaps it's just me, but I wasn't expecting to be taken to a Dropbox download when I clicked on a link in a post here, and it doesn't seem to me to be a suitable thing to post, especially without warning.

  • Lifetime Qt Champion


    QMainWindow already has a layout which handles QMenuBar, QToolBars, QDockWidgets etc. The call to setCentralWidget is what puts spreadsheet inside the QMainWindow layout.

  • @SGaist
    Thank you.

    How to recognise where in the code can be updated to Qt 5?

  • Lifetime Qt Champion

    The Qt 5 documentation has a porting guide. You can check it and you'll see there's not much that needs to be done.

    What can be of interest is learning at least C++11 features since it's now a requirement to build Qt. And nothing forbids you to go on with C++14/17.

Log in to reply