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. QLabel added in Designer, no corresponding object in ui*.h
QtWS25 Last Chance

QLabel added in Designer, no corresponding object in ui*.h

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 604 Views
  • 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
    Dave Colter
    wrote on last edited by
    #1

    Hi, I'm enhancing a program I wrote in Qt last year.

    It is a touch screen-based app with a very simple UI hierarchy like this:

    MainApp (QMainWindow)
        centralWidget (QWidget)
            label1 (QLabel)
            label2 (QLabel)
            label3 (QLabel)
    

    In ui_mainapp.h, the following was generated:

    class Ui_MainApp
    {
    public:
        QWidget *centralWidget;
        QLabel *label1;
        QLabel *label2;
        QLabel *label3;
    // etc.
    }
    

    Now, I'd like to add a fourth QLabel. So I drag and drop the label in Qt Designer. It appears in the edit window, I can set its properties and it is shown in the object list with the other three. However, no object is created in the ui_mainapp.h file. Consequently, I have nothing to reference in my code

    Is there something I'm missing?

    Thanks in advance.

    Dave

    Pl45m4P 1 Reply Last reply
    0
    • D Dave Colter

      @Pl45m4

      Thanks for the reply. Tried that to no avail. I get the message

      make: Nothing to be done for 'qmake_all'.
      

      Now you say "clean up your project". I did a Clean All from the build menu; is there anything else I can do? I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt. I got the compile errors you might expect, so the file is not being regenerated, even on a Clean All/Rebuild All. Can the file be safely deleted to force regeneration?

      Pl45m4P Online
      Pl45m4P Online
      Pl45m4
      wrote on last edited by
      #4

      @Dave-Colter said in QLabel added in Designer, no corresponding object in ui*.h:

      I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt

      You dont have to edit the ui_xxxx.h at all. It's generated by qmake from your Qt Designer file (*.ui).
      So yes, you can delete it.

      Try:
      Close your project and Qt Creator / Designer and re-open it again. Sometimes there are cached or autosaved files, so qmake doesnt see any changes.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      D 1 Reply Last reply
      2
      • D Dave Colter

        Hi, I'm enhancing a program I wrote in Qt last year.

        It is a touch screen-based app with a very simple UI hierarchy like this:

        MainApp (QMainWindow)
            centralWidget (QWidget)
                label1 (QLabel)
                label2 (QLabel)
                label3 (QLabel)
        

        In ui_mainapp.h, the following was generated:

        class Ui_MainApp
        {
        public:
            QWidget *centralWidget;
            QLabel *label1;
            QLabel *label2;
            QLabel *label3;
        // etc.
        }
        

        Now, I'd like to add a fourth QLabel. So I drag and drop the label in Qt Designer. It appears in the edit window, I can set its properties and it is shown in the object list with the other three. However, no object is created in the ui_mainapp.h file. Consequently, I have nothing to reference in my code

        Is there something I'm missing?

        Thanks in advance.

        Dave

        Pl45m4P Online
        Pl45m4P Online
        Pl45m4
        wrote on last edited by Pl45m4
        #2

        @Dave-Colter

        Clean up your project, then run qmake / build and compile again.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        D 1 Reply Last reply
        1
        • Pl45m4P Pl45m4

          @Dave-Colter

          Clean up your project, then run qmake / build and compile again.

          D Offline
          D Offline
          Dave Colter
          wrote on last edited by
          #3

          @Pl45m4

          Thanks for the reply. Tried that to no avail. I get the message

          make: Nothing to be done for 'qmake_all'.
          

          Now you say "clean up your project". I did a Clean All from the build menu; is there anything else I can do? I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt. I got the compile errors you might expect, so the file is not being regenerated, even on a Clean All/Rebuild All. Can the file be safely deleted to force regeneration?

          Pl45m4P CP71C 2 Replies Last reply
          0
          • D Dave Colter

            @Pl45m4

            Thanks for the reply. Tried that to no avail. I get the message

            make: Nothing to be done for 'qmake_all'.
            

            Now you say "clean up your project". I did a Clean All from the build menu; is there anything else I can do? I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt. I got the compile errors you might expect, so the file is not being regenerated, even on a Clean All/Rebuild All. Can the file be safely deleted to force regeneration?

            Pl45m4P Online
            Pl45m4P Online
            Pl45m4
            wrote on last edited by
            #4

            @Dave-Colter said in QLabel added in Designer, no corresponding object in ui*.h:

            I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt

            You dont have to edit the ui_xxxx.h at all. It's generated by qmake from your Qt Designer file (*.ui).
            So yes, you can delete it.

            Try:
            Close your project and Qt Creator / Designer and re-open it again. Sometimes there are cached or autosaved files, so qmake doesnt see any changes.


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            D 1 Reply Last reply
            2
            • D Dave Colter

              @Pl45m4

              Thanks for the reply. Tried that to no avail. I get the message

              make: Nothing to be done for 'qmake_all'.
              

              Now you say "clean up your project". I did a Clean All from the build menu; is there anything else I can do? I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt. I got the compile errors you might expect, so the file is not being regenerated, even on a Clean All/Rebuild All. Can the file be safely deleted to force regeneration?

              CP71C Offline
              CP71C Offline
              CP71
              wrote on last edited by
              #5

              @Dave-Colter
              Hi,
              Try to remove build directory from file manager, sometimes I saw that clear all isn't useful to remove this issue,

              D 1 Reply Last reply
              1
              • Pl45m4P Pl45m4

                @Dave-Colter said in QLabel added in Designer, no corresponding object in ui*.h:

                I tried commenting one of the QLabel declarations in ui_mainapp.h and rebuilt

                You dont have to edit the ui_xxxx.h at all. It's generated by qmake from your Qt Designer file (*.ui).
                So yes, you can delete it.

                Try:
                Close your project and Qt Creator / Designer and re-open it again. Sometimes there are cached or autosaved files, so qmake doesnt see any changes.

                D Offline
                D Offline
                Dave Colter
                wrote on last edited by
                #6

                @Pl45m4

                OK -- I deleted all the ui_.h files, all the moc_.cpp files and the debug folder. Then I did a Clean All/qmake/Rebuild All.

                It works!! Thank you!!

                The only odd thing is that now the generated files are saved only in my debug folder. I used to have copies in my main project folder. However, when I initially created this app last year, I was learning Qt from scratch. I guess it was something I did back then that left the copies in my main folder.

                Thanks again!

                Dave

                1 Reply Last reply
                1
                • CP71C CP71

                  @Dave-Colter
                  Hi,
                  Try to remove build directory from file manager, sometimes I saw that clear all isn't useful to remove this issue,

                  D Offline
                  D Offline
                  Dave Colter
                  wrote on last edited by
                  #7

                  @CP71

                  Hi, just seeing your reply now as I've been banging away on my project. Deleting the build (debug) folder was indeed part of the solution. Thanks for your reply.

                  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