Results 1 to 4 of 4

Thread: Extending QTimer()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    27
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Extending QTimer()

    Hi,

    I am trying to figure out how to extend the QTimer class so I can pass some variables through the timeout signal. Is that even possible? I was think I could like "catch" the normal timeout() emit and then just emit my own signal with some variables I need.

    Or is there some other way I am do not know of to pass arguments or at least get the QTimer object from the signal() that comes through?

    I have never done this before and pretty confused. Is what below anything similar to what it should be?

    Thanks

    Qt Code:
    1. #include <QTimer>
    2. #include "common.h"
    3.  
    4.  
    5. class FileTimer: public QTimer{
    6.  
    7. public:
    8. FileTimer(QObject * parent, uint16 dest, QString fileName):
    9. QTimer ( parent )
    10. {
    11. dest = dest;
    12. fileName = fileName;
    13. }
    14.  
    15. uint16 dest;
    16. QString fileName;
    17.  
    18. signals:
    19. void sendTimeout(uint16 dest, QString fileName);
    20.  
    21. void timeout()
    22. {
    23. emit QTimer::timeout();
    24. emit sendTimeout(dest, fileName);
    25. }
    26. };
    To copy to clipboard, switch view to plain text mode 
    Last edited by rishid; 26th March 2008 at 17:01.

Similar Threads

  1. Simple QTimer help
    By philips in forum Qt Programming
    Replies: 14
    Last Post: 6th July 2015, 08:39
  2. QThread/QObject and QTimer
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 08:37
  3. QTimer problem
    By vv in forum Qt Programming
    Replies: 9
    Last Post: 3rd July 2007, 08:13
  4. Replies: 5
    Last Post: 6th March 2007, 05:34
  5. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54

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
  •  
Qt is a trademark of The Qt Company.