[Interest] Qt Quick main window contents are all rendered at an offset position

Rob Allan rob_allan at trimble.com
Fri Aug 4 05:25:42 CEST 2017


We have a Qt Quick application which, for most members of our team, works
just fine. But for one team member, there is a strange bug in the way it is
rendered. This user has a Microsoft Surface tablet, and the app runs OK on
the tablet itself. But when he runs the app on an external monitor, the
strange rendering occurs.

What he is seeing is that the contents of the main window are shifted,
maybe 4 pixels to the right and about 20 pixels down. The extra space at
the top and left is filled with white, or sometimes black. Items in the
bottom right get clipped as they are pushed beyond the bounds of the main
window.

The really weird thing is that there are are a number of MouseAreas in the
scene, and they all behave as if they were positioned at the right location
- even though the items they are associated with are rendered at the wrong
location! That means you have to click a little higher than the visible
position of the items in order for them to handle clicks as expected. If it
weren't for this fact, I would suspect this was a bug in our code, and that
we were somehow setting a non-zero (x, y) coordinate for something near the
top of our QML scene. But because the MouseAreas behave as if they were at
the correct location, that seems a lot less likely, and I wonder if it is a
Qt Quick rendering bug.

The outermost QML items in our app are very simple. We have a Main.qml
containing a Window item, which contains a MainWindow (our own QML type).
Inside MainWindow we have a Rectangle that is supposed to represent the
outermost frame within which all other content is drawn. MainWindow has
anchors.fill within the Window, and the framing Rectangle has anchors.fill
within MainWindow. So there is no reason why this outermost frame shouldn't
fill the parent Window - yet on this one device, it appears a few pixels
down and to the right.

Is this a known bug with QML rendering? Or can anyone think of any other
reason for why this might be happening?

Thanks,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170804/8b6a3b56/attachment.html>


More information about the Interest mailing list