Results 1 to 4 of 4

Thread: an Unchekcable push Button is checked and stays checked when used with qfiledialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,233
    Thanks
    303
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: an Unchekcable push Button is checked and stays checked when used with qfiledial

    The clicked signal worked as i always use pressed signal i'll try to understand the difference.
    The difference is that the pressed() signal is emitted as soon as the mouse goes down on the button. The clicked() signal is emitted only when the mouse goes down and then comes back up while on the button. This difference has at least three consequences:

    - If you connect to pressed(), then there is no way for the user to cancel the action - whatever is in the slot gets executed as soon as the mouse goes down.
    - If the slot connected to pressed() causes the button to lose focus, then the button will never see a mouse release so it stays depressed. This is what happened for you.
    - If you connect to clicked() and the user presses the mouse on the button but then moves off the button to release the mouse, there is no signal. This lets the user "cancel" the click before anything happens. The clicked() signal is emitted only if the mouse down and up happen while the mouse is on the button. (The mouse can move off the button while it is pressed, but if it moves back on when it is released, the signal will be emitted).

    In general, you should always connect to the clicked() signal for a good user experience.
    Last edited by d_stranz; 22nd February 2019 at 16:22.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 2
    Last Post: 28th July 2012, 16:09
  2. How to checked if button is clicked
    By stbb24 in forum Newbie
    Replies: 3
    Last Post: 5th June 2012, 06:04
  3. Replies: 1
    Last Post: 26th April 2012, 10:36
  4. Replies: 2
    Last Post: 6th June 2011, 09:40
  5. Replies: 3
    Last Post: 26th July 2010, 02:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.