Results 1 to 5 of 5

Thread: Can we connect QTimer::SingleShot with a slot taking arguments?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can we connect QTimer::SingleShot with a slot taking arguments?

    Hi,

    I suppose we have a small misunderstanding.
    We have this code:

    myClass.h
    Qt Code:
    1. ....
    2. private slots:
    3. void mySlot(int);
    4. ...
    To copy to clipboard, switch view to plain text mode 
    myClass.cpp
    Qt Code:
    1. ..
    2. void MyClass::mySlot(int _value){
    3. qDebug()<<_value;
    4. }
    5. ....
    To copy to clipboard, switch view to plain text mode 
    ..... and somewhere in the code.....
    Qt Code:
    1. int x = 3;
    2. QTimer::singleShot(2000,this,SLOT(mySlot(x)));
    3. ...
    To copy to clipboard, switch view to plain text mode 
    What I am trying to explain is this:
    In my app a QTimer::singleShot(...) do not work with slots taking arguments.

    And I would like to ask:
    Can a QTimer::singleShot() work with a slot taking arguments? yes, not? Why no?

    Kacper
    Last edited by jpn; 17th September 2008 at 18:06. Reason: missing [code] tags
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

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.