[Qt-interest] Xorg performance

Matthew Fincham matthewf at cat.co.za
Tue May 25 16:04:03 CEST 2010


Hi

I am having performance trouble with the Qt4/Xorg combination.
I have reduced it to a simple widget with a 40ms timer and an empty 
paint event. An update is called whenever the timer activates.
This results in Xorg using 50-100% CPU, with the CPU usage varying 
depending on the size of the widget (See the test program listed below).

OS: NetBSD 4
Qt: 4.6.2
Xorg: 1.3.0 (using XAA)

Clearly there is a problem with this configuration. Does anyone know 
what it could be?

Many thanks
Matthew Fincham



------------------------------------------------------------------------

//----------------------------------------------------------------------//
class MyWidget : public QWidget
{
public:
	MyWidget(QWidget* parent);
	virtual ~MyWidget();
	
	virtual void paintEvent(QPaintEvent*);
	virtual void timerEvent(QTimerEvent*);
};


	//----------------------------------------------------------------------//
MyWidget::MyWidget(QWidget* parent)
	: QWidget(parent)
{
	setBackgroundMode(Qt::NoBackground);

	setAttribute(Qt::WA_OpaquePaintEvent,true);
	setAttribute(Qt::WA_NativeWindow,true);
	//setAttribute(Qt::WA_PaintOnScreen,true);

	startTimer(40);
}


//----------------------------------------------------------------------//
MyWidget::~MyWidget()
{
}


//----------------------------------------------------------------------//	
void MyWidget::paintEvent(QPaintEvent* e)
{
	printf("."); fflush(stdout);
}

void MyWidget::timerEvent(QTimerEvent*)
{
	repaint(0,0,width(),height());
}



//----------------------------------------------------------------------//
int main(int argc,char** argv)
{
	QApplication q(argc,argv);
	
	QWidget* w=new MyWidget(NULL);
	w->show();

	q.exec();
	delete w;
	return 0;
}




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100525/cfbf5c1e/attachment.html 


More information about the Qt-interest-old mailing list