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. Class's value not changing / keeps reseting | Simple Qt Application

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 217 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
    vander_13
    wrote on last edited by vander_13
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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
      1
      • V Offline
        V Offline
        vander_13
        wrote on last edited by vander_13
        #3

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

        SGaistS 1 Reply Last reply
        0
        • V vander_13

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

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          1

          • Login

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