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. Code changes don't take effect?
Forum Updated to NodeBB v4.3 + New Features

Code changes don't take effect?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 435 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.
  • P Offline
    P Offline
    PsylumDan
    wrote on last edited by
    #1

    I had the strangest issue last night. To make it simple I'll break it down.

    I have two classes. Class A and class B. Class B has a signal that has a hard coded string as a parameter. Class A connects this signal to a slot. Lets say that this signal is emitted when a button is pushed in class A (MainWindow). In Class A's slot there's a qDebug() that prints the string parameter.

    Class B::emit sig("This is a test");
    Class A prints this to the debug console. So far so good.

    Class B::emit sig("This is the second test");
    Class A prints "This is a test" to the console.

    Ok. just need to rebuild the project.
    Rebuild, execute: same thing.
    Class B emits "This is the second test"
    Class A prints "This is a test"

    Now I delete the class B compiled files (.o and moc file)
    This forces a recompile of class B.
    Rebuild, execute: same thing.
    Class B emits "This is the second test"
    Class A prints "This is a test"

    Step through it with the debugger
    I set a breakpoint on the emit line and the slot in class A.
    The emit line is correct "emit sig("This is the second test");
    The slot parameter, however, equals "This is a test"

    So I shutdown Qt Creator, restart it, load the project, build, execute
    Same damn thing.

    It finally runs correctly after I restart the computer.

    Has anyone encountered this before?

    1 Reply Last reply
    1
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      I have tried some thing like that by having a moc_xxx file in the project folder
      so it would link that and not the new fresh on in build folder.

      However, that would not be resolved by rebooting so not sure its same issue.

      But check the project folder for any build artifacts. ( moc_xx, qmake.cache etc)

      1 Reply Last reply
      2
      • P Offline
        P Offline
        PsylumDan
        wrote on last edited by
        #3

        I looked for any leftover build files. There was nothing. It's crazy that it printed the wrong text even stepping though it in the debugger.

        mrjjM 1 Reply Last reply
        0
        • P PsylumDan

          I looked for any leftover build files. There was nothing. It's crazy that it printed the wrong text even stepping though it in the debugger.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @PsylumDan
          Yes it really sounded like it ran other code that it was displaying.

          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