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. [SOLVED] Removing .ui form leads to segmentation fault

[SOLVED] Removing .ui form leads to segmentation fault

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 1.9k Views 1 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.
  • N Offline
    N Offline
    nanthiran_2005
    wrote on last edited by
    #1

    HI all,

    I' trying to remove the .ui form and all its associates pointer from the .h and .cpp file. After removing them, I ran qmake and rebuild the project. However, when I Run the project, the program end unexpectedly. I tried debugging by putting breakpoints, but it did not even enter the main function.

    Am I missing any step in removing the ui file? Thanks in advance.

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

      Hi,

      You should rather delete your build directory when doing that.

      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
      0
      • Pradeep P NP Offline
        Pradeep P NP Offline
        Pradeep P N
        wrote on last edited by
        #3

        Hi,

        Remove the .ui name from the * .pro* file.

        Ex: FORMS +=
        topmenu.ui
        welcomescreen.ui
        inputrecordrange.ui
        inputtabularrange.ui
        about.ui

        in above case if you have deleted about.ui & inputrecordrange.ui, you just remove the names from FORMS

        FORMS +=
        topmenu.ui
        welcomescreen.ui
        inputtabularrange.ui

        Pradeep Nimbalkar.
        Upvote the answer(s) that helped you to solve the issue...
        Keep code clean.

        1 Reply Last reply
        2
        • N Offline
          N Offline
          nanthiran_2005
          wrote on last edited by
          #4

          Hi,

          Thanks SGaist. Deleting the whole build directory helped me to solve that problem. And yes Pradeep, I did removed the .ui file before too. But that alone didn't help.

          One thing to note though; after deleting the build directory, I still had segmentation fault which is caused by the code below:

          @QHBoxLayout *layout = new QHBoxLayout;
          this->centralWidget()->setLayout(layout);
          @

          So I changed it to this:

          @QHBoxLayout layout = new QHBoxLayout;
          QWidget
          w = new QWidget;
          w->setLayout(layout);
          this->setCentralWidget(w);
          @

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

            You're welcome !

            By default there's no central widget, hence the crash.

            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
            1
            • N Offline
              N Offline
              nanthiran_2005
              wrote on last edited by
              #6

              So I believe the code didn't crash when I was initially using the form as the form provides a default central widget.

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

                You're right

                Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                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
                1

                • Login

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