Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Class's value not changing / keeps reseting | Simple Qt Application

    General and Desktop
    3
    4
    79
    Loading More Posts
    • 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
      vander_13 last edited by vander_13

      Hey, this is my first time using qt. I had this issue while making a simple windows app, I don't know how I’m going to explain this but please bear with me.
      I have added in the app's main window a single button, that based on a class object's boolean variable ("availability"), you can be able to press the button or not. Let's say that the variable is true, the button is now clickable and pressing it will 'supposedly' set the “availability” to false. The problem here is somehow the variable doesn't get set to false when I press the button, I can just keep pressing and it never changes to false.
      After some debugging, I’ve found that somehow whenever I click on the button, what will happen is the “availability” will be set to false but when I click on the button again its value gets reset to true, so whether clicking on it or not wouldn’t change anything.
      This seems like nonsense and a lot for you to read, but I can't think of any other way to explain this, as I myself have no idea what's causing this issue. Also, english is not my first language, so I’ll be thankful for any good explanation!

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        Don't worry, the description is clear, but what we're missing is your code :-) It's hard to guess what's wrong with it without seeing it.

        Just from the description I'd say either signal-slot connection is not working, or slot code is wrong.

        (Z(:^

        1 Reply Last reply Reply Quote 1
        • V
          vander_13 last edited by vander_13

          Hey, thanks for your reply!
          Where can i share the code with you?

          SGaist 1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion @vander_13 last edited by

            Hi,

            @vander_13 said in Class's value not changing / keeps reseting | Simple Qt Application:

            Hey, thanks for your reply!
            Where can i share the code with you?

            You can post the relevant code here.

            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 Reply Quote 1
            • First post
              Last post