×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Question how to call fun after fixed time interval?

    Hi,

    I have 1 function and am calling that function after clicking in pushbutton, but i want to call that fun repeatively 20 times in a time interval of 1sec. can u plz help me for this.

    Thanks,
    mdm21

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to call fun after fixed time interval?


  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Re: how to call fun after fixed time interval?

    Thanks danil but sorry i have to asked my Question clearly.

    Actually i have 50 PushButton and i want to change the color of 20 random pushbutton one by one after every 1 sec. I have tried with timer class but it change the color of all 20 button at a time

    Hope my Question is clear to u now.

    Thanks,
    mdm21

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to call fun after fixed time interval?

    Quote Originally Posted by mdm21 View Post
    Actually i have 50 PushButton and i want to change the color of 20 random pushbutton one by one after every 1 sec. I have tried with timer class but it change the color of all 20 button at a time
    QTimer does not do anything with buttons, it's only emitting timeout() signal, then it's up to you what you do in the corresponding slot.

  5. #5
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Re: how to call fun after fixed time interval?

    thanks..can u plz guide me what to u do in that case

    I have taken random num in a list and taken num 1 by 1 from list and changed the color.now i want to set timer in list ..is it possible??

    i have the following code:

    QList<QList<QPushButton*> >field;
    for (int i = 0; i<20; ++i)
    {
    if (green_list.at(i) % 10 == 0) //in green_list i have random no list
    {
    ro = (green_list.at(i)/10) - 1;
    col = 9;
    }
    else
    {
    ro = green_list.at(i)/10;
    col = (green_list.at(i) % 10) - 1;
    }
    field[ro][col]->setStyleSheet("background-color: rgb(0, 255, 0); color: rgb(255, 255, 255)"); //green
    }

    Please help me.

    Thanks
    mdm21
    Last edited by mdm21; 2010-06-11 at 11:20.

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to call fun after fixed time interval?

    You can try to share your code.

    I don't see neither QTimer in your code, not a random generator used.
    Last edited by divanov; 2010-06-11 at 12:19. Reason: udpate

  7. #7
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Re: how to call fun after fixed time interval?

    my random list fun is as follows::

    void randomlist()
    {

    int flag = 0;
    do{

    int rdm = (qrand() % 80)+ 1;

    green_list<<green.toInt();
    if(green_list.contains(rdm) == true)
    continue;
    else
    green_list[flag++] = rdm;

    } while (flag < 20);
    }

    i dont know where and how to use timer.

  8. #8
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Re: how to call fun after fixed time interval?

    Thanks danil for ur kind help

    i have resolved my issue

  9. #9
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to call fun after fixed time interval?

    Not exactly what you are doing, but very close:
    http://wiki.forum.nokia.com/index.php/QTimer_example

Similar Threads

  1. Draw at Regular interval of Time
    By neeraj17sep.ims@gmail.com in forum Symbian
    Replies: 3
    Last Post: 2010-04-23, 10:44
  2. How to create Async timer and update time interval dynamic?
    By yazoox in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2010-03-22, 07:54
  3. Session expity after time interval?
    By kusumat in forum Symbian
    Replies: 6
    Last Post: 2009-10-14, 09:48
  4. Replies: 27
    Last Post: 2009-09-24, 10:36
  5. Exchange - Sync mode time interval 5mins
    By raduuuz@gmail.com in forum General Messaging
    Replies: 1
    Last Post: 2009-07-24, 16:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×