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. Modification to form are not reflected when running the application.
Forum Updated to NodeBB v4.3 + New Features

Modification to form are not reflected when running the application.

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 6 Posters 2.4k Views 4 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.
  • D Offline
    D Offline
    Daniel Williams
    wrote on 16 Jan 2019, 21:33 last edited by Daniel Williams
    #1

    I am using Qt Creator 4.8 on debian.

    I created a very simple application with a main window with buttons, labels, etc. It has been working fine for some time. Today, I started changing the main window form. I deleted the buttons and labels and added a layout following the examples in Mastering Qt book.

    When I try to reference the new layout from within the code to add a widget, the cpp code says the layout doesn't exist in the ui object. Yet, all of the objects that I deleted are reflected on the ui object.

    I have deleted every reference I could find in the files to the objects. I have cleaned the solution, run qmake and re-compiled. When I run the application, the old form displays as if I hadn't made any changes.

    Any ideas what might be happening? What am I doing wrong?

    J 1 Reply Last reply 17 Jan 2019, 03:27
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Jan 2019, 21:39 last edited by
      #2

      Hi,

      How did you change that exactly ? Manually or using Designer ?
      Did you check that the code generated from your UI file ?

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

      D 1 Reply Last reply 16 Jan 2019, 21:50
      0
      • S SGaist
        16 Jan 2019, 21:39

        Hi,

        How did you change that exactly ? Manually or using Designer ?
        Did you check that the code generated from your UI file ?

        D Offline
        D Offline
        Daniel Williams
        wrote on 16 Jan 2019, 21:50 last edited by Daniel Williams
        #3

        @SGaist I opened the form in the designer, clicked on the objects and pressed the delete button for each of the controls on the form that I wanted to delete. I re-compiled and ran it. The old controls were still there.

        After it wasn't working and I had tried everything else, I looked at the ui_mainwindow.h file and found the references. So, I deleted that file and then ran, "touch ui_mainwindow.h" to create a blank file and hoping it would re-create it when I re-compiled. No luck. I still get the old controls when I run the application from within Qt.

        I could trash it completely and start over. And so, I tried that. I right clicked on mainwindow.ui file and removed it permanently. I then re-created it with the designer with a different set of controls. No luck. Whenever I run the application, it get the old form.

        J 1 Reply Last reply 17 Jan 2019, 06:16
        0
        • D Daniel Williams
          16 Jan 2019, 21:33

          I am using Qt Creator 4.8 on debian.

          I created a very simple application with a main window with buttons, labels, etc. It has been working fine for some time. Today, I started changing the main window form. I deleted the buttons and labels and added a layout following the examples in Mastering Qt book.

          When I try to reference the new layout from within the code to add a widget, the cpp code says the layout doesn't exist in the ui object. Yet, all of the objects that I deleted are reflected on the ui object.

          I have deleted every reference I could find in the files to the objects. I have cleaned the solution, run qmake and re-compiled. When I run the application, the old form displays as if I hadn't made any changes.

          Any ideas what might be happening? What am I doing wrong?

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 17 Jan 2019, 03:27 last edited by
          #4

          @Daniel-Williams said in Modification to form are not reflected when running the application.:

          Any ideas what might be happening?

          My first guess is that there's more than 1 copy of your project on disk, and somewhere along the line the paths got mixed up so you're editing 1 copy but building another.

          1. Have a look inside the Makefile. Do the paths look correct?
          2. Close Qt Creator and delete your *.pro.user file. Re-launch the project. Does that fix things?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          D 1 Reply Last reply 17 Jan 2019, 14:40
          3
          • D Offline
            D Offline
            dheerendra
            Qt Champions 2022
            wrote on 17 Jan 2019, 05:30 last edited by
            #5

            In addition to what @JKSH said, search for ui_mainwindow.h. Some where you have copied this file and Qt creator is finding this file while compiling.

            Dheerendra
            @Community Service
            Certified Qt Specialist
            http://www.pthinks.com

            D 1 Reply Last reply 17 Jan 2019, 14:52
            2
            • D Daniel Williams
              16 Jan 2019, 21:50

              @SGaist I opened the form in the designer, clicked on the objects and pressed the delete button for each of the controls on the form that I wanted to delete. I re-compiled and ran it. The old controls were still there.

              After it wasn't working and I had tried everything else, I looked at the ui_mainwindow.h file and found the references. So, I deleted that file and then ran, "touch ui_mainwindow.h" to create a blank file and hoping it would re-create it when I re-compiled. No luck. I still get the old controls when I run the application from within Qt.

              I could trash it completely and start over. And so, I tried that. I right clicked on mainwindow.ui file and removed it permanently. I then re-created it with the designer with a different set of controls. No luck. Whenever I run the application, it get the old form.

              J Online
              J Online
              J.Hilk
              Moderators
              wrote on 17 Jan 2019, 06:16 last edited by
              #6

              @Daniel-Williams did you actually rerun qmake after changing the ui?
              qmake or cmake is needed to create cpp code out of your ui file that than is used to create binary code, if you do not delete/clean your build folder than changes you made in the ui will only be noticebale when you manualy select a qmake rerun.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              3
              • J JKSH
                17 Jan 2019, 03:27

                @Daniel-Williams said in Modification to form are not reflected when running the application.:

                Any ideas what might be happening?

                My first guess is that there's more than 1 copy of your project on disk, and somewhere along the line the paths got mixed up so you're editing 1 copy but building another.

                1. Have a look inside the Makefile. Do the paths look correct?
                2. Close Qt Creator and delete your *.pro.user file. Re-launch the project. Does that fix things?
                D Offline
                D Offline
                Daniel Williams
                wrote on 17 Jan 2019, 14:40 last edited by
                #7

                @JKSH Thanks for the suggestions. The Makefile looks good and I deleted the *.pro.user file. FYI, this is a subdirs project with several libraries and a gui project. Qt also installed the most recent 4.8.1 update. I get the same results.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on 17 Jan 2019, 14:46 last edited by
                  #8

                  @Daniel-Williams you must be having ui_mainwindow.h somewhere. Just check by mistake this file is checked in somewhere. Also just go mainwindow.cpp file, on the top of the file you will see entry ui_mainwindow.h. When you click which files does it resolve to ?

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MrShawn
                    wrote on 17 Jan 2019, 14:47 last edited by
                    #9

                    Clean or delete your build directory, run QMake, then try building again. I have had this happen a few times to me as well.

                    1 Reply Last reply
                    0
                    • D dheerendra
                      17 Jan 2019, 05:30

                      In addition to what @JKSH said, search for ui_mainwindow.h. Some where you have copied this file and Qt creator is finding this file while compiling.

                      D Offline
                      D Offline
                      Daniel Williams
                      wrote on 17 Jan 2019, 14:52 last edited by
                      #10

                      @dheerendra I went to the root of my repo and issues: find . -iname 'ui_mainwindow.h' I found an older gui project I had created as training with the file and I deleted that folder. Other than that, I only have 1 other file with that name.

                      Trying to be thorough, I found the name of a control that shouldn't be on the ui object but is (lblRBG1). I did: grep -iR 'lblRBG1' * It returned 0 files which was a surprising to me.

                      With all this digging, I'm feeling much more comfortable with how the projects run. I plan on creating a new window with the the layout I want. I'll just switch to using the new window and delete all references to ui_mainwindow. Once I stop looking, I'll probably find the cause next week some time ;) And it's likely operator error :D

                      Thanks again for the suggestions.

                      1 Reply Last reply
                      0

                      1/10

                      16 Jan 2019, 21:33

                      • Login

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