Results 1 to 3 of 3

Thread: Some Signal Ignore

  1. #1
    Join Date
    Jun 2008
    Posts
    35
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Some Signal Ignore

    Hello,

    I need to block some signals (QPushButton pressed) for some time.

    For example, dialog button was pressed, some routine started but from time to time event queue is being processed, so it is possible to press some other button. And its effect will be not good.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Some Signal Ignore

    the first variant
    Qt Code:
    1. ....
    2. bool isBlocked = myButton->blockSignals(this);
    3. //routines
    4. myButton->blockSignals(isBlocked);
    5. ....
    To copy to clipboard, switch view to plain text mode 
    the second variant
    Qt Code:
    1. ...
    2. myObject->disconnect(myReceiver);
    3. ...
    To copy to clipboard, switch view to plain text mode 
    see more information disconnect
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Some Signal Ignore

    I'd suggest simply disabling the buttons you don't wish pressed with QWidget::enabled property. This is the only (proper) visible way to tell the user - "you can't push this button now but it will be available later on". If you block or disconnect the signal, the user will be able to push the button - it will simply do nothing which doesn't seem very correct.

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  3. Possible signal mapper problem
    By MarkoSan in forum Qt Programming
    Replies: 13
    Last Post: 25th January 2008, 13:11
  4. Replies: 2
    Last Post: 17th May 2006, 21:01

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.