To display the image in a QLabel (not upside down):
ui->imageLabel->setPixmap(QPixmap::fromImage(img.mirrored(false, true)));
The problem here is that you are having the image in the GL/Windows format that Qt does not expect. Qt expects the X11 format, being a 180° rotated GL image.
But you could as well go ahead and use a QGLWidget where you draw a square and map the image as texture on it.
How it would work for OpenGL in a QGLWidget:
GLuint texture;
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image_buffer);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glColor3f(1.0, 1.0, 1.0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(1, 0);
glVertex2f(1, -1);
glTexCoord2f(0, 1);
glVertex2f(-1, 1);
glTexCoord2f(1, 1);
glVertex2f(1, 1);
glEnd();
glPopMatrix();