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. Weird behavior for Qt Creator when removing events for objects.
Forum Updated to NodeBB v4.3 + New Features

Weird behavior for Qt Creator when removing events for objects.

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 631 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.
  • V Offline
    V Offline
    voncloft
    wrote on 28 Sept 2020, 11:48 last edited by
    #1

    Over the course of debugging parts of my project I will occasionally remove functions for an object-say QListview and I no longer need the itemChanged event. So I will delete it from the MainWindow.cpp.

    Everything seems "fine" for the moment, however maybe 10 minutes go by and I update part of my code and sure enough I get a reference to a piece of code that I deleted. I don't have the error off the top of my head I am currently at work,, but for some reason the deletion of events for objects never stay deleted for long. It is quite annoying and I am curious if there is a fix for this.

    Also if anyone can have the "Tree" view not rely on dark theme colors while in project mode?

    Thanks.

    J 1 Reply Last reply 28 Sept 2020, 11:54
    0
    • V voncloft
      28 Sept 2020, 11:48

      Over the course of debugging parts of my project I will occasionally remove functions for an object-say QListview and I no longer need the itemChanged event. So I will delete it from the MainWindow.cpp.

      Everything seems "fine" for the moment, however maybe 10 minutes go by and I update part of my code and sure enough I get a reference to a piece of code that I deleted. I don't have the error off the top of my head I am currently at work,, but for some reason the deletion of events for objects never stay deleted for long. It is quite annoying and I am curious if there is a fix for this.

      Also if anyone can have the "Tree" view not rely on dark theme colors while in project mode?

      Thanks.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 28 Sept 2020, 11:54 last edited by
      #2

      @voncloft said in Weird behavior for Qt Creator when removing events for objects.:

      remove functions for an object-say QListview and I no longer need the itemChanged event

      I don't quite understand what you mean.
      Can you please show some code - before and after the change you mean?

      Also, sometimes it helps to do a complete rebuild: delete build folder, run qmake and build.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        voncloft
        wrote on 28 Sept 2020, 12:07 last edited by
        #3

        @jsulm said in Weird behavior for Qt Creator when removing events for objects.:

        @voncloft said in Weird behavior for Qt Creator when removing events for objects.:

        remove functions for an object-say QListview and I no longer need the itemChanged event

        I don't quite understand what you mean.
        Can you please show some code - before and after the change you mean?

        Also, sometimes it helps to do a complete rebuild: delete build folder, run qmake and build.

        Say for example I have QListview and I am using the itemChanged to debug something.....then I find out I don't need itemChanged but instead need itemSelected so I delete itemChanged, its pointless no longer needed.

        So I keep pushing along and critiquing my app just doing whatever, then I hit the green arrow to run.....and then I get a reference to itemChanged for Qlistview saying referenced to non existing function.

        I will get an error to add to the moc file Yes to All, something about the project being changed outside the directory and I get an Elf error in the program. If I go to form_ui.h and remove the functioin of itemChanged it works....but I have to keep deleting the declarative statment, its as if Qt won't let me delete the declaration.

        I don't have the information off the top of my head, but its the best I can describe at the moment....I am currently at work so I am unable to debug at the moment, once I am home I will gladly enter the information.

        M 1 Reply Last reply 28 Sept 2020, 12:15
        0
        • V voncloft
          28 Sept 2020, 12:07

          @jsulm said in Weird behavior for Qt Creator when removing events for objects.:

          @voncloft said in Weird behavior for Qt Creator when removing events for objects.:

          remove functions for an object-say QListview and I no longer need the itemChanged event

          I don't quite understand what you mean.
          Can you please show some code - before and after the change you mean?

          Also, sometimes it helps to do a complete rebuild: delete build folder, run qmake and build.

          Say for example I have QListview and I am using the itemChanged to debug something.....then I find out I don't need itemChanged but instead need itemSelected so I delete itemChanged, its pointless no longer needed.

          So I keep pushing along and critiquing my app just doing whatever, then I hit the green arrow to run.....and then I get a reference to itemChanged for Qlistview saying referenced to non existing function.

          I will get an error to add to the moc file Yes to All, something about the project being changed outside the directory and I get an Elf error in the program. If I go to form_ui.h and remove the functioin of itemChanged it works....but I have to keep deleting the declarative statment, its as if Qt won't let me delete the declaration.

          I don't have the information off the top of my head, but its the best I can describe at the moment....I am currently at work so I am unable to debug at the moment, once I am home I will gladly enter the information.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 28 Sept 2020, 12:15 last edited by
          #4

          @voncloft

          Hi
          you must also delete them from mainwindow.h

          Slots are just like normal functions with a definition and a body so
          it must be removed from both .cpp and .h

          V 1 Reply Last reply 28 Sept 2020, 12:35
          1
          • M mrjj
            28 Sept 2020, 12:15

            @voncloft

            Hi
            you must also delete them from mainwindow.h

            Slots are just like normal functions with a definition and a body so
            it must be removed from both .cpp and .h

            V Offline
            V Offline
            voncloft
            wrote on 28 Sept 2020, 12:35 last edited by
            #5

            @mrjj said in Weird behavior for Qt Creator when removing events for objects.:

            @voncloft

            Hi
            you must also delete them from mainwindow.h

            Slots are just like normal functions with a definition and a body so
            it must be removed from both .cpp and .h

            I have done that as well and still the event is readded for some reason.

            M 1 Reply Last reply 28 Sept 2020, 12:58
            0
            • V voncloft
              28 Sept 2020, 12:35

              @mrjj said in Weird behavior for Qt Creator when removing events for objects.:

              @voncloft

              Hi
              you must also delete them from mainwindow.h

              Slots are just like normal functions with a definition and a body so
              it must be removed from both .cpp and .h

              I have done that as well and still the event is readded for some reason.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 28 Sept 2020, 12:58 last edited by
              #6

              @voncloft

              Hi
              That can be some of the xx_ui files somehow ended up in project folder.
              Or the usual case where one must to a clean all, rebuild or even delete the build folder.

              In any case, if you delete the slot function, its normally gone.

              V 1 Reply Last reply 28 Sept 2020, 13:41
              0
              • M mrjj
                28 Sept 2020, 12:58

                @voncloft

                Hi
                That can be some of the xx_ui files somehow ended up in project folder.
                Or the usual case where one must to a clean all, rebuild or even delete the build folder.

                In any case, if you delete the slot function, its normally gone.

                V Offline
                V Offline
                voncloft
                wrote on 28 Sept 2020, 13:41 last edited by
                #7

                @mrjj said in Weird behavior for Qt Creator when removing events for objects.:

                @voncloft

                Hi
                That can be some of the xx_ui files somehow ended up in project folder.
                Or the usual case where one must to a clean all, rebuild or even delete the build folder.

                In any case, if you delete the slot function, its normally gone.

                How do any of those things even happen?

                M 1 Reply Last reply 29 Sept 2020, 05:05
                0
                • V voncloft
                  28 Sept 2020, 13:41

                  @mrjj said in Weird behavior for Qt Creator when removing events for objects.:

                  @voncloft

                  Hi
                  That can be some of the xx_ui files somehow ended up in project folder.
                  Or the usual case where one must to a clean all, rebuild or even delete the build folder.

                  In any case, if you delete the slot function, its normally gone.

                  How do any of those things even happen?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 29 Sept 2020, 05:05 last edited by
                  #8

                  @voncloft
                  Hi
                  Hard to say. often with shadow building setting turning it on/of or change path.
                  The reason for deleting the build folder is that sometimes make cachces things.

                  1 Reply Last reply
                  0

                  1/8

                  28 Sept 2020, 11:48

                  • Login

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