PDA

View Full Version : Painting problem



ScoOteR
13th February 2007, 10:47
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.



void CSymbolsTicker::animate()
{
qreal last = m_rTranslationStep * m_itime * 0.0001;
m_itime = (m_itime + qobject_cast<QTimer*>(sender())->interval()) % 1000;
qreal current = m_rTranslationStep * m_itime * 0.0001;
current -= last;
if(current * m_iDirection < 0)
current = m_rDiff;
else
m_rDiff = current;
m_rTranslationX += m_rDiff;
.....
update();
}




void CSymbolsTicker::paintEvent(QPaintEvent *event)
{
CTicker::paintEvent(event);
m_pPainter->begin(this);
m_pPainter->setRenderHint(QPainter::TextAntialiasing/*QPainter::Antialiasing*/);

m_pPainter->setFont(m_Font);

m_pPainter->translate(m_rTranslationX,0);
for (int i=0;i<m_vSymbols.count();++i)
{
m_rCurrentTranslationStep = m_vSymbols[i]->GetWidth() * -1;
if(InViewPort())
{
SetPen(m_vSymbols[i]->GetStatus());
m_vSymbols[i]->paint(m_pPainter,event,height());
m_pPainter->translate(m_rCurrentTranslationStep,0);
}
}
m_pPainter->end();
}

Tonal
14th February 2007, 11:49
Maybe better draw to QPixmap all scene?

ScoOteR
15th February 2007, 11:56
well, I've tried it before and nothing changed !!!

ScoOteR
5th March 2007, 12:18
still no body has any proposal !!!!

guilugi
5th March 2007, 13:35
Excuse me, but could you explain your rendering issue more precisely ?
By watching the video, I can't see what's wrong...

ScoOteR
11th March 2007, 11:03
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 !!