PDA

View Full Version : Resolution independant UI with QGraphicsScene



brendan0powers
11th February 2010, 18:05
I'm trying to create a resolution independent UI for my QGraphicsScene base application. The main window consists of a QGraphicsView that is full screen, with no window border. I'm doing this by using a local coordinates system where the long dimension of the screen is always one. For example, resolutions such as 640x480, 102x768, etc would have a graphics scene size of 1.0x0.75. Resolutions such as 1280x768 would have a scene size of 1.0x0.56. The problem is that it usually scales very badly. Text and image look very grainy. I would have though that keeping the same aspect ratio would ensure a good looking scaled up image. Is this correct?

Is there a technique i can use to have a resolution independent coordinate system that looks good when scaled? I'm using a mixture of QWidgets, pixmaps, and painted items. I plan to use a QGLWidget as the view port for my graphics view, and enable anti aliasing. I haven't tried that yet though.

pitonyak
11th February 2010, 21:14
Much depends on your intent and how the internal items scale. For example, if I display a picture of your head full screen, then move from a normal monitor to a wide screen monitor, your head will likely be stretched. For this reason, I always try to scale graphics so that the graphic maintains its aspect ration. Assume a 4x6 photo, which has an aspect ration of 2:3. If my monitor is 1024x768, the ratio is 4:3, a resolution of 1920x1200 is 8:5.

brendan0powers
12th February 2010, 15:25
Aspect ratio is not the problem. I set the scene rect at the same ratio of the screen. Also, I'm not expecting low resolution bitmaps to look good when scaled up.

pitonyak
12th February 2010, 16:02
It is my understanding that all supported devices use square pixels. As long as you do not change the aspect ratio, then I would expect things to look fine. Most people use twips when they desire device independence.