title: Text scrolling (Marquee) in QLabel
body: <p>I'm studying <a href="https://www.linux-apps.com/p/1132075/" rel="nofollow noreferrer">WidgetMarqueeLabel</a> class:</p>
  
  <pre><code>#include "WidgetMarqueeLabel.h"
  #include &lt;QPainter&gt;
  #include &lt;QWidget&gt;
  
  WidgetMarqueeLabel::WidgetMarqueeLabel(QWidget *parent)//*parent)
  {   
          px = 0;
          py = 10;
          speed = 1;
          direction = RightToLeft;
          connect(&amp;timer3, SIGNAL(timeout()), this, SLOT(refreshLabel()));
          timer3.start(10);
  }
  
  void WidgetMarqueeLabel::refreshLabel()
  {
      repaint();  
  }
  
  WidgetMarqueeLabel::~WidgetMarqueeLabel()
  {}
  
  void WidgetMarqueeLabel::show()
  {   
      QLabel::show();
  }
  
  void WidgetMarqueeLabel::setAlignment(Qt::Alignment al)
  {
      m_align = al;
      updateCoordinates();
      QLabel::setAlignment(al);
  }
  
  void WidgetMarqueeLabel::paintEvent(QPaintEvent *evt)
  {
      QPainter p(this);
      if(direction==RightToLeft)
      {
          px -= speed;
          if(px &lt;= (-textLength))
              px = width();
      }
      else
      {
          px += speed;
          if(px &gt;= width())
              px = - textLength;
      }
          p.drawText(px, py+fontPointSize, text());
      p.translate(px,0);
  }
  
  void WidgetMarqueeLabel::resizeEvent(QResizeEvent *evt)
  {   
      updateCoordinates();
      QLabel::resizeEvent(evt);
  }
  
  void WidgetMarqueeLabel::updateCoordinates()
  {
      switch(m_align)
      {
          case Qt::AlignTop:
              py = 10;
              break;
          case Qt::AlignBottom:
                          py = height()-10;
              break;
          case Qt::AlignVCenter:
              py = height()/2;
              break;
      }
      fontPointSize = font().pointSize()/2;
      textLength = fontMetrics().width(text());
  }
  
  void WidgetMarqueeLabel::setSpeed(int s)
  {
      speed = s;
  }
  
  int WidgetMarqueeLabel::getSpeed()
  {
      return speed;
  }
  
  void WidgetMarqueeLabel::setDirection(int d)
  {
      direction = d;
      if (direction==RightToLeft)
          px = width() - textLength;
      else
          px = 0;
      refreshLabel();
  }
  
  void WidgetMarqueeLabel::close()
  {
          QLabel::close();
  }
  </code></pre>
  
  <p>I was wondering if it was possible to make the text reappear before the text that reaches the end of the last letter on the right. I want something like this: for example (white space are 25):</p>
  
  <pre class="lang-none prettyprint-override"><code>WidgetMarqueeLabel
  tMarqueeLabel                         Widge
  eLabel                         WidgetMarque
  el                          WidgetMarqueeLa
                        WidgetMarqueeLabel
                 WidgetMarqueeLabel
         WidgetMarqueeLabel
  WidgetMarqueeLabel
  </code></pre>
  
  <p>Is this possible?</p>