Important: Please read the Qt Code of Conduct -

My Text Scolling class

  • Hi all I have a class for text scrolling. At the time the text reaches the end of his long and starts from the beginning. But I am unable to restart the text before the end of the text:
    xt te
    t tex
    Can anyone view the class?


  • I think that i must modified this function:

    @void WidgetMarqueeLabel::paintEvent(QPaintEvent *evt) //fai ogni volta che c'è l'evento repaint
    QPainter p(this);
    QPainter p2(this);
    px -= speed;
    px2 -= speed;

            if (px <= (-textLength)){
                px = width();
            if (px2 <= (-textLength)){
                px2 = width();

    px += speed;
    if(px >= width())
    px = - textLength;
    p.drawText(px, py+fontPointSize, text()); // disegna il testo alle coordinate px, py+fontPointSize
    p2.drawText(px2,py+fontPointSize, text());

    but not work :(

Log in to reply