tags:

views:

252

answers:

1

Hello all ,

  i develop a mobile application ,where i want to auto scroll some text as my advertisement.I read from some forum where they mention its a ticker,but i try it but but i failed ,so please help me to solve my problem,

with regards,

shakti.

A: 

Assuming you have access to the QScrollBar you want to move, you can do it like this: Use a single-shot QTimer to define how often you move the scroll. Connect the timeout() signal of the timer to a slot written by you which calls the QScrollBar setSliderPosition method. If you need to scroll further, restart the QTimer. The slot you connect the timer's signal to would look like:

void scroll()
{
    new_scroll_offset = ...; // compute scroll offset here (possibly from old scroll offset)
    scroll_bar->setSliderPosition(new_scroll_offset);

    if (/* can scroll further */)
    { 
        timer->start();
    }
}

It can also be done with a multiple shot timer in a similar fashion

laura