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.

Weird behavior for Qt Creator when removing events for objects.

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 564 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.
  • V Offline
    V Offline
    voncloft
    wrote on 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.

    jsulmJ 1 Reply Last reply
    0
    • V voncloft

      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.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on 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 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.

        mrjjM 1 Reply Last reply
        0
        • V voncloft

          @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.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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
          1
          • mrjjM mrjj

            @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 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.

            mrjjM 1 Reply Last reply
            0
            • V voncloft

              @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.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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
              0
              • mrjjM mrjj

                @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 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?

                mrjjM 1 Reply Last reply
                0
                • V voncloft

                  @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?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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

                  • Login

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