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. Button display problem
Forum Updated to NodeBB v4.3 + New Features

Button display problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 241 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.
  • B Offline
    B Offline
    Baptiste
    wrote on last edited by
    #1

    Hello,

    I'm building an application with PyQt5 on Windows and I have a problem with button display. When I click on a button, I disabled it with the method : setEnabled(False)

    The desired result is : button.gif

    However, sometimes, the display does not work and the button remains blue, as if the animation was interrupted : error_button.gif

    Do you know what the problem is and how I can fix it?

    1 Reply Last reply
    0
    • gde23G Offline
      gde23G Offline
      gde23
      wrote on last edited by
      #2

      Could be a timing problem since the disabling is happening during the press.
      try to not call setEnabled directly from the slot that is called on click, but with delay

      QTimer::singleShot(0, this, SLOT(disableButton());
      

      where disableButton() is a slot that calls setEnabled(false) on the button.

      B 1 Reply Last reply
      1
      • gde23G gde23

        Could be a timing problem since the disabling is happening during the press.
        try to not call setEnabled directly from the slot that is called on click, but with delay

        QTimer::singleShot(0, this, SLOT(disableButton());
        

        where disableButton() is a slot that calls setEnabled(false) on the button.

        B Offline
        B Offline
        Baptiste
        wrote on last edited by
        #3

        @gde23

        I chose a time of 300ms and it's working well.
        Thanks for your help.

        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