[Qt4-preview-feedback] Vertical Text performance

Philippe philwave at gmail.com
Sat Feb 14 07:59:26 CET 2009


1) Under Windows, drawing a string horizontally or vertically, takes the  
same amount of time.
But antialiasing is better done horizontally, Vertically it does not look  
as good.

2) Under OSX, drawing a string horizontally or vertically, takes the same  
amount of time,
using the native graphic engine. Antialiasing is equally well horizontally  
and vertically.

But using the raster engine, drawing vertically is 15 times slower than  
using the native graphic engine.
Antialiasing is equally well horizontally and vertically.

Using the raster engine (on the Mac), is a global startup option.
Is there the possibility to switch back to the native engine for a  
particular window or paint device?

Thanks

void TMainWindow::paintEvent(QPaintEvent*)
{
	QTime time;
	time.start();
	QRect r = rect();

	QPainter painter(this);

	painter.fillRect(r, QBrush(Qt::white));
	QFont font = QApplication::font("QMenu");
	painter.setFont(QFont(font.family(), 20));
	painter.setBackgroundMode(Qt::OpaqueMode);

  	painter.rotate(90);
  	painter.translate(0, -r.width());

	for (int i = 0; i < 1; i++)
	{
		painter.drawText(100, 100, "EXAMPLE");
	}

	QString s = QString::number(time.elapsed());
	s += " ms";
	painter.drawText(20, 60, s);
}



More information about the Qt4-feedback mailing list