Results 1 to 4 of 4

Thread: Sending signals from QPushButton

  1. #1
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Sending signals from QPushButton

    Hi,

    Is it possible to send a lot of signals from a QPushButton if we still pressing the button all the time?

    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending signals from QPushButton

    Woudn't it be easier to fire a QTimer on the press and release of the button and let the timer fire the events are your expected intervals?

  3. #3
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending signals from QPushButton

    How can I do this?

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Sending signals from QPushButton

    check this out
    Qt Code:
    1. QPushButton * button = QPushButton("Press Me Long", this);
    2. QTimer * timer = new QTimer(this); //0 ms timer, the fastest possible QTimer
    3. connect(timer, SIGNAL(timeout()), this, SIGNAL(MySignal()); //Note: signal connected to signal
    4. connect(button, SIGNAL(pressed()), timer, SLOT(start()));
    5. connect(button, SIGNAL(released()), timer, SLOT(stop()));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 4
    Last Post: 8th June 2011, 03:18
  2. sending signals to underlying qt code and vice versa
    By technoViking in forum Qt Quick
    Replies: 2
    Last Post: 9th November 2010, 12:10
  3. Sending OS I/O interrupt signals!
    By nofortee in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2010, 15:42
  4. Sending signals from one module to another
    By Dubbie in forum Newbie
    Replies: 5
    Last Post: 6th July 2010, 02:52
  5. sending signals to ancestors
    By magland in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2007, 11:51

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.