[Interest] Qt 5.8 and QPainter based rendering

Kristoffersen, Even (NO14) Even.Kristoffersen at Honeywell.com
Mon Apr 24 13:56:42 CEST 2017


The trick I use with SVGs is to scale the "sourceSize" of the image.

SvgImage.qml
-----
Image {
    sourceSize.width: width *scale
    sourceSize.height: height *scale
}

Main.qml
------
scale: 3.0

SvgImage {
	height: 40
	width: 40
               source: "someImage.svg"
}

This way it'll use the correctly rendered image as texture directly.
It works pretty well as long as you don't change the scaling in real-time.
If you do scaling in real-time you could Math.ceil(scale) for sourceSize calculation so that it only re-creates the texture at certain intervals.

-Even

-----Original Message-----
From: Interest [mailto:interest-bounces+even.kristoffersen=honeywell.com at qt-project.org] On Behalf Of bunjee at omega.gg
Sent: 21. april 2017 13:28
To: interest at qt-project.org
Subject: [Interest] Qt 5.8 and QPainter based rendering

Greetings Qt community,

I'm currently working on a feasability using embedded hardware (Xilinx Zynq).
It has no dedicated GPU so I'm experimenting with:
- Qt 4.8.7 (QtQuick 1.0)
- Qt 5.8 with OpenGL (QtQuick 2.0).
- Qt 5.8 with QtQuick 2D (QtQuick 2.0).

I'm building a multitouch interface with extensive use of scaling (for transitions inside Row(s) or ListView(s)).
To make it clean I'm using a custom QML component that renders SVG with the QPainter (based on QQuickPaintedItem for Qt 5).

This is what I get with a 3.0 scale: 
https://image.ibb.co/ctYRkk/scale.png.

- Qt 4 does a good job at scaling SVG(s) or anything QPainter based.

- I suspect that Qt 5 just caches a static texture for a given QQuickPaintedItem and simply scales it.
This gives a blurry output on both Qt 5 OpenGL and Software (QtQuick 2D).

Is there a way to force Qt 5 and QQuickPaintedItem to scale without using its blurry texture cache ?

Note: I'm a little bit surprised about the transition to QtQuick 2.0. 
The performance are there but they come with a significant graphical tradeof. Having a scenegraph, shaders and particles is cool but it shouldn't come at the expense of basic 2d rendering.

Let me know If I'm missing something,

Thanks !
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list