[Interest] Problem with zoomed-out qgraphicsview/scene

william.crocker at analog.com william.crocker at analog.com
Tue Mar 29 16:58:04 CEST 2016


On 03/29/2016 10:47 AM, David Heremans wrote:
> Hello,
>
> I seem to have a 'visibility problem' with my application.
> I have a QGraphicsscene that represents a piece of A4 paper at 300DPI
> (approx. 3300 by 2500 scene coordinates). On this scene I have a simple
> street map and some symbols. I draw the lines in black with thickness
> ranging between 1 to 10 and when printed on paper this all looks fine.
> However when I draw these in a much smaller qgraphicsview  I have to
> zoom out quite a lot. As this happens the thin lines start to get
> lighter and lighter up until the point that you can not see them any more.
> Is there a way to avoid this from happening?
>
> I know that if I draw them with size 0 then the lines will always be one
> pixel wide on screen but then the printed version is not as nice. And
> then they also will always be the same thickness even when zoomed in to
> 100%.
>
> It really is a problem because some of the symbols become invisible this
> way when you are editing the map.
>
> Any body here has any hints on how to handle this situation?
>

I Use a global variable to track the current operation
For example, am I drawing to drawing to the screen or printing.

Then I override the graphics item paint() function and just
do what needs to be done for the current context. You could
suppress painting all together. You could change the pen/brush.
Set a minimum line width based on zoom factor (I have not actually
done that, but I assume it is possible.)

> regards,
>
> David H
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list