Copy pixels from ofImage to qImage (Qt)

I spend some time solving this one. So here i leave it for future reference:
It seems that Qt adds 4 bytes per line if image width is not multiple of four.

some more info here and here.

// copy from oF to Qt
qImage = QImage(w, h, QImage::Format_RGB888);
for (int y = 0; y < qImage.height(); y++)
{
	memcpy(
		&qImage.bits()					[y*qImage.bytesPerLine()], 
		&ofImage.getPixels().getData()	[y*ofImage.getPixels().getBytesStride()],
		qImage.bytesPerLine()
	);
}

If anyone has a better fix please let me know.