Hello,

I am writing a real time plotting widget.
I need to trace 12 signals as fast as possible.The height space of the widget is subdivided in 12 pieces each of them hosts a signal.

At the moment It seems like the performances with qt3 are much better than thoose with Qt4. In Qt3 code I trace on a Pixmap and then I bitBlt to the visible area.

Some pieces of the Qt4 code follows:

Inside constructor i use a timer to call the method processSomeThing "as fast as possible":

Qt Code:
  1. QTimer *timer = new QTimer(this);
  2. connect(timer, SIGNAL(timeout()), this, SLOT(processSomeThing()));
  3. timer->start(0);
To copy to clipboard, switch view to plain text mode 

I use a bidimensional array to store data:

Qt Code:
  1. int points[12][640];
To copy to clipboard, switch view to plain text mode 

Inside processSomeThing for each call I add 12 points and update current_x position (it wraps after the 640th point). After adding 12 points I call

Qt Code:
  1. repaint(current_x-1,0,1,400);
To copy to clipboard, switch view to plain text mode 

This calls paintEvent to retrace a 1x400 rectangle.

Inside paintEvent I trace 12 lines each of them starts from the previous value to the current values

Qt Code:
  1. for (i=0; i<ngraphs; i++)
  2. {
  3. prev_y = ((i+1)*y_space)-ampliAndClipValue(points[i][current_x-1]);
  4. new_y = ((i+1)*y_space)-ampliAndClipValue(points[i][current_x]);
  5.  
  6. painter.drawLine(current_x-1,prev_y,current_x,new_y);
  7. }
To copy to clipboard, switch view to plain text mode 

More in general I am asking what are the best optimisations for realtime plotting widgets (For examples polylines or so on) and why Qt3 code is faster then Qt4 one.

Thanks in advance