QT5 App Random Window Position - SAMA5D27-SOM1-EK

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

kengineer
Posts: 15
Joined: Tue Oct 31, 2017 3:08 pm

QT5 App Random Window Position - SAMA5D27-SOM1-EK

Thu Feb 22, 2018 6:43 pm

I am attempting to build my own QT5 application for the SAMA5D27-SOM1-EK board using the QT Yocto build provided from Microchip.

When I build my own application in QT5, I find that each time I launch it the QT window seems to have a random position. I understand that the BSP is using the wayland compositor and weston in order to actually draw to the screen and QT is using this protocol. Maybe it's something involving this but looking at the Microchip example app source code (for the application launcher) I see that the apps are setting fullscreen instead of a fixed size or position. Maybe it has something to do with this. In my app however I am explicitly setting the window size and position (and need to) within QT. This works fine when running on my desktop (defined position and size). When I load it on the board however, it looks like the size is correct but the position varies with each launch.
blue_z
Location: USA
Posts: 1691
Joined: Thu Apr 19, 2007 10:15 pm

Re: QT5 App Random Window Position - SAMA5D27-SOM1-EK

Tue Feb 27, 2018 3:23 am

kengineer wrote:In my app however I am explicitly setting the window size and position (and need to) within QT.
You're vague as to which plugins are in use and how you're specifying this.
Have you studied the Qt5 documentation?

Regards
kengineer
Posts: 15
Joined: Tue Oct 31, 2017 3:08 pm

Re: QT5 App Random Window Position - SAMA5D27-SOM1-EK

Tue Feb 27, 2018 3:55 pm

Yes, and it works when building for a desktop deployment.

It will depend on the app type, but if we consider creating a new QT widgets application with main window (File -> New File or Project -> Application -> Qt Widgets Application), the following statements could be added in main to set a fixed size window at a fixed position:

Code: Select all

    MainWindow w;
    
    // Set main window to a fixed side of 100x100 and move it to position 0, 0
    w.setFixedSize(100, 100);
    w.move(0,0);

When launching the app on the board, this does not work. The window will be a fixed size, however it will take a random position each time. If I make a QML based application (which will involve different statements), same problem.

I've seen some similar related discussion here:
https://lists.freedesktop.org/archives/ ... 24410.html
However, I'm not familiar enough with the underlying architecture of Wayland and Weston on this board so thought I would look for some help here.


The major difference I see between my app and the Microchip demo applications is that those are all set to full screen mode. If I set my app to full screen, it will lock to full screen. However, I don't want to do this in my case - I want to be able to position a smaller fixed size window at a fixed position.

This is using the QT5 demo image Yocto build for the SAMA5D27-SOM1-EK with QT5 community addition configured using the build environment also created by Yocto.
nimarc
Posts: 1
Joined: Sat Jun 02, 2018 4:24 pm

Re: QT5 App Random Window Position - SAMA5D27-SOM1-EK

Sat Jun 02, 2018 4:28 pm

I think with linuxfb this will be slight a difficult. You can enable X11 and use -platfor xcb with -geometry 80x50+494+51 options. This will simplify things for you.

Return to “LINUX”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests