Results 1 to 6 of 6

Thread: Painting problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2006
    Posts
    15

    Wink Painting problem

    Hay Fellows,

    I'm trying to make some thing like stock ticker here, but i have problem with the rendering behavior. I've attached a sample video of the run. Any wayz, i'm having a timer that fires each 30 msecs, on the fire it calls animate() - connected with a direct connection - which updates the translation variable and calls update().

    In the PaintEvent(), i starts the translations and rendering the ticker items. If any one please could help me here.

    Qt Code:
    1. void CSymbolsTicker::animate()
    2. {
    3. qreal last = m_rTranslationStep * m_itime * 0.0001;
    4. m_itime = (m_itime + qobject_cast<QTimer*>(sender())->interval()) % 1000;
    5. qreal current = m_rTranslationStep * m_itime * 0.0001;
    6. current -= last;
    7. if(current * m_iDirection < 0)
    8. current = m_rDiff;
    9. else
    10. m_rDiff = current;
    11. m_rTranslationX += m_rDiff;
    12. .....
    13. update();
    14. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void CSymbolsTicker::paintEvent(QPaintEvent *event)
    2. {
    3. CTicker::paintEvent(event);
    4. m_pPainter->begin(this);
    5. m_pPainter->setRenderHint(QPainter::TextAntialiasing/*QPainter::Antialiasing*/);
    6.  
    7. m_pPainter->setFont(m_Font);
    8.  
    9. m_pPainter->translate(m_rTranslationX,0);
    10. for (int i=0;i<m_vSymbols.count();++i)
    11. {
    12. m_rCurrentTranslationStep = m_vSymbols[i]->GetWidth() * -1;
    13. if(InViewPort())
    14. {
    15. SetPen(m_vSymbols[i]->GetStatus());
    16. m_vSymbols[i]->paint(m_pPainter,event,height());
    17. m_pPainter->translate(m_rCurrentTranslationStep,0);
    18. }
    19. }
    20. m_pPainter->end();
    21. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

Similar Threads

  1. Painting Problem
    By shyam prasad in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2007, 14:07
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.