Results 1 to 7 of 7

Thread: disabling the signal event

  1. #1
    Join Date
    Sep 2008
    Posts
    84
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default disabling the signal event

    hello.....
    can we disable the SIGNAL for some specific time & then enable it in real time ?

    For Eg:
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(clicked()));

    I want to disable the clickced SIGNAL for specific time & then re-eanble it;
    When the SIGNAL is disabled, if the user clicks on the button no SIGNAL should be called.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: disabling the signal event

    take a look at QObject::disconnect()

  3. #3
    Join Date
    Sep 2008
    Posts
    84
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: disabling the signal event

    i want to disable SIGNAL((valueChanged (int))) of QSpinbox,

    but when i tried to use the code:

    Qt Code:
    1. ui->spinBox->disable()
    To copy to clipboard, switch view to plain text mode 

    it is not showing option for (valueChanged (int)), it is applicable for tthis SIGNAL

  4. #4
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: disabling the signal event

    As MrD. suggested, you have to do this:
    disconnect(ui->spinBox, SIGNAL(valueChanged (int)), 0, 0);

    You may read the QObject Class Reference for more info about this.

  5. #5
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: disabling the signal event

    If you want to block all signals of particular control use
    Qt Code:
    1. blockSignals()
    To copy to clipboard, switch view to plain text mode 
    function.

  6. The following user says thank you to navi1084 for this useful post:

    basslo (13th July 2012)

  7. #6
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    1

    Default Re: disabling the signal event

    Quote Originally Posted by navi1084 View Post
    If you want to block all signals of particular control use
    Qt Code:
    1. blockSignals()
    To copy to clipboard, switch view to plain text mode 
    function.
    thanks navi, it s exactly what i wanted.

  8. #7
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: disabling the signal event

    But you can also perform your task through disconnect also.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

Similar Threads

  1. disabling mouse event
    By elessaar in forum Qt Programming
    Replies: 7
    Last Post: 17th September 2008, 09:03
  2. event loop isStarted() signal?
    By Xerion in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2008, 21:45
  3. TableView navigate signal/event
    By skuda in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 15:52
  4. QTreeWidgetItem signal or event
    By db in forum Newbie
    Replies: 1
    Last Post: 20th October 2007, 14:18
  5. What's the relationship between signal/slot and event?
    By twosnowman in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 17:13

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.