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. class Ui::MainWindow has no member named 'lineEdit'
Forum Updated to NodeBB v4.3 + New Features

class Ui::MainWindow has no member named 'lineEdit'

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 2.8k 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.
  • B Offline
    B Offline
    BITniki
    wrote on 9 Apr 2022, 10:05 last edited by
    #1

    i added some objects in mainwindow.ui
    alt text
    And got this error
    alt text

    This problem is only with new objects
    There are no such problems with other projects, only with this one

    tried:
    Rebuild
    Reopening the project
    Re-entry to QT
    Deleting *.pro.user

    It didn't help.

    J 2 Replies Last reply 9 Apr 2022, 10:12
    0
    • B BITniki
      9 Apr 2022, 10:05

      i added some objects in mainwindow.ui
      alt text
      And got this error
      alt text

      This problem is only with new objects
      There are no such problems with other projects, only with this one

      tried:
      Rebuild
      Reopening the project
      Re-entry to QT
      Deleting *.pro.user

      It didn't help.

      J Offline
      J Offline
      JonB
      wrote on 9 Apr 2022, 12:09 last edited by
      #6

      @BITniki said in class Ui::MainWindow has no member named 'lineEdit':

      This problem is only with new objects
      There are no such problems with other projects, only with this one

      I do not know why this is the case.

      You presumably have verified that your mainwindow.cpp has #include "ui_mainwindow.h" at the start?

      Make sure there is not some other ui_mainwindow.h lying around somewhere. You have discovered that lives in the build output directory. Make sure there isn't one in, say, the same source directory as your mainwindow.cpp.

      Delete all files in the build output directory (not your sources directory!). That should force a full rebuild.

      Other than that I don't know.

      1 Reply Last reply
      3
      • B BITniki
        9 Apr 2022, 10:05

        i added some objects in mainwindow.ui
        alt text
        And got this error
        alt text

        This problem is only with new objects
        There are no such problems with other projects, only with this one

        tried:
        Rebuild
        Reopening the project
        Re-entry to QT
        Deleting *.pro.user

        It didn't help.

        J Offline
        J Offline
        JonB
        wrote on 9 Apr 2022, 10:12 last edited by JonB 4 Sept 2022, 10:13
        #2

        @BITniki
        I can't tell from your screenshot, I assume you have verified that QLineEdit's name is spelled lE_Port (first char lowercase L) and not IE_Port (first char uppercase I)?

        Make sure your designer changes are being saved to the .ui file, and the build is re-running the uic to process the .ui file. That generates a file named ui_mainwindow.h in the build output directory (for Debug or Release, where the .obj files are generated when compiling). Read that in and look at it. You should see it change/be regenerated any time you build after altering anything in the designer. Is that happening? What does it have in its content relating to lE_Port?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BITniki
          wrote on 9 Apr 2022, 10:53 last edited by BITniki 4 Sept 2022, 10:54
          #3

          @JonB
          it's lowercase L in lE_Port

          Sorry, I didn't quite understand you, but there my mainwindow.ui file
          alt text

          and my ui_mainwindow.h file
          alt text

          Alse, there my build settings
          Untitled.png
          Hope thats help

          J 1 Reply Last reply 9 Apr 2022, 11:11
          0
          • B BITniki
            9 Apr 2022, 10:53

            @JonB
            it's lowercase L in lE_Port

            Sorry, I didn't quite understand you, but there my mainwindow.ui file
            alt text

            and my ui_mainwindow.h file
            alt text

            Alse, there my build settings
            Untitled.png
            Hope thats help

            J Offline
            J Offline
            JonB
            wrote on 9 Apr 2022, 11:11 last edited by JonB 4 Sept 2022, 11:11
            #4

            @BITniki
            The generated files seem to look good.

            This problem is only with new objects

            What you show is a warning in the editor. This will happen when you add a new object in the designer but not yet rebuilt. Ignore it for now. If you actually build your project, does it compile successfully? If not show the compiler error output.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              BITniki
              wrote on 9 Apr 2022, 11:52 last edited by
              #5

              @JonB
              There my compiler output
              Untitled.png

              1 Reply Last reply
              0
              • B BITniki
                9 Apr 2022, 10:05

                i added some objects in mainwindow.ui
                alt text
                And got this error
                alt text

                This problem is only with new objects
                There are no such problems with other projects, only with this one

                tried:
                Rebuild
                Reopening the project
                Re-entry to QT
                Deleting *.pro.user

                It didn't help.

                J Offline
                J Offline
                JonB
                wrote on 9 Apr 2022, 12:09 last edited by
                #6

                @BITniki said in class Ui::MainWindow has no member named 'lineEdit':

                This problem is only with new objects
                There are no such problems with other projects, only with this one

                I do not know why this is the case.

                You presumably have verified that your mainwindow.cpp has #include "ui_mainwindow.h" at the start?

                Make sure there is not some other ui_mainwindow.h lying around somewhere. You have discovered that lives in the build output directory. Make sure there isn't one in, say, the same source directory as your mainwindow.cpp.

                Delete all files in the build output directory (not your sources directory!). That should force a full rebuild.

                Other than that I don't know.

                1 Reply Last reply
                3
                • B Offline
                  B Offline
                  BITniki
                  wrote on 9 Apr 2022, 17:51 last edited by
                  #7

                  @JonB
                  Thanks.
                  I fixed the problem.
                  In the folder with the project, there was another ui_mainwindow.h
                  I don't understand how it got there, but thank you

                  T 1 Reply Last reply 11 Apr 2024, 11:39
                  0
                  • B BITniki
                    9 Apr 2022, 17:51

                    @JonB
                    Thanks.
                    I fixed the problem.
                    In the folder with the project, there was another ui_mainwindow.h
                    I don't understand how it got there, but thank you

                    T Offline
                    T Offline
                    tsvigo2
                    wrote on 11 Apr 2024, 11:39 last edited by tsvigo2 4 Nov 2024, 11:42
                    #8

                    @BITniki , we need to rename a name_of_project.pro.user to name_of_project.pro.user.backup

                    J 1 Reply Last reply 11 Apr 2024, 11:50
                    0
                    • T tsvigo2
                      11 Apr 2024, 11:39

                      @BITniki , we need to rename a name_of_project.pro.user to name_of_project.pro.user.backup

                      J Offline
                      J Offline
                      JonB
                      wrote on 11 Apr 2024, 11:50 last edited by JonB 4 Nov 2024, 11:50
                      #9

                      @tsvigo2 No, @BITniki's solution weas correct. ui_....h must not be in source directory.

                      1 Reply Last reply
                      0

                      • Login

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