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

Andrew Ialacci andrew at dkai.dk
Fri Aug 4 11:07:26 CEST 2017


You mention you have a Window QML item as the root in your main.qml file. And then inside the Window you have MainWindow custom component. 

Is the top level / root item inside MainWindow.qml also a Window? So, nested windows?

I've been building an MDI interface with QML for a while now and have definitely noticed some funny things when it comes to multiple windows with QML. Wondering if what you have going on is similar though unintentional. 




Sent from my iPad

> On Aug 4, 2017, at 5:26 AM, Rob Allan <rob_allan at trimble.com> wrote:
> 
> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list