Results 1 to 6 of 6

Thread: Painting problem

  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

  2. #2
    Join Date
    Nov 2006
    Location
    Russian Federation, Novosibirsk
    Posts
    7
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Painting problem

    Maybe better draw to QPixmap all scene?

  3. #3
    Join Date
    Nov 2006
    Posts
    15

    Default Re: Painting problem

    well, I've tried it before and nothing changed !!!

  4. #4
    Join Date
    Nov 2006
    Posts
    15

    Default Re: Painting problem

    still no body has any proposal !!!!

  5. #5
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Painting problem

    Excuse me, but could you explain your rendering issue more precisely ?
    By watching the video, I can't see what's wrong...

  6. #6
    Join Date
    Nov 2006
    Posts
    15

    Default Re: Painting problem

    well, text animation is not smooth. if u looked at the text for a while ur eye's will hurt. besides if the animation was at higher speed u won't be able to read the text @ all !!

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.