Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Code changes in Qt 4 and Qt 5
Qt 6.12 LTS is out! See what's new in the release blog

Code changes in Qt 4 and Qt 5

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 3.3k 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.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by
    #1

    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:

    MainWindow::MainWindow()
    {
        spreadsheet = new Spreadsheet;
        setCentralWidget(spreadsheet);
    
        createActions();
        createMenus();
        createContextMenu();
        createToolBars();
        createStatusBar();
      ...
    }
    

    Right, please?

    JonBJ 1 Reply Last reply
    0
    • tomyT tomy

      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:

      MainWindow::MainWindow()
      {
          spreadsheet = new Spreadsheet;
          setCentralWidget(spreadsheet);
      
          createActions();
          createMenus();
          createContextMenu();
          createToolBars();
          createStatusBar();
        ...
      }
      

      Right, please?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

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

      tomyT 1 Reply Last reply
      0
      • JonBJ JonB

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

        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #3

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

        JonBJ 1 Reply Last reply
        0
        • tomyT tomy

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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @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.

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

            Hi,

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

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

            tomyT 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

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

              tomyT Offline
              tomyT Offline
              tomy
              wrote on last edited by
              #6

              @SGaist
              Thank you.

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

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

                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.

                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
                2

                • Login

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