Qt5 Project on Raspberry Pi 5 Bookworm
-
wrote on 22 Sept 2024, 16:26 last edited by
Hi,
I’m developing a Qt based project for raspberry pi5 Bookworm using VisualGDB (VS Community 2022) running on a Win11 PC and deploying the executable on the Raspi5.
It all works perfect, however, I get different results when I remotely running the application as a debug session from VS and when I directly run the executable on the Raspi5.
The major differences are:
Coloring of some widgets are the same and as required, but other may slightly differ, or are completely different, such as the QPushButton background color, that may individually be set for each button when running as VS debug session, but when executing the application directly on the Raspi5, all buttons background color is White.
Coloring is done by setting each widget styleSheet property using the Qt Designer application.
As part of the application, the in-focus widget may be programably selected, bringing each widget at atime to focus on top. The last in-focus location of each widget is also maintained.
This all works fine when running as a VS remote debug session, however, when running the executable on the Raspi5, the in focus selection works, however, the widget locations always goes back to the original widget location at creation.Can anyone provide an explanation to the above and if are there any ways to get it work the same in both scenarios?
Thanks,
Nahum Budin.
-
Hi,
I’m developing a Qt based project for raspberry pi5 Bookworm using VisualGDB (VS Community 2022) running on a Win11 PC and deploying the executable on the Raspi5.
It all works perfect, however, I get different results when I remotely running the application as a debug session from VS and when I directly run the executable on the Raspi5.
The major differences are:
Coloring of some widgets are the same and as required, but other may slightly differ, or are completely different, such as the QPushButton background color, that may individually be set for each button when running as VS debug session, but when executing the application directly on the Raspi5, all buttons background color is White.
Coloring is done by setting each widget styleSheet property using the Qt Designer application.
As part of the application, the in-focus widget may be programably selected, bringing each widget at atime to focus on top. The last in-focus location of each widget is also maintained.
This all works fine when running as a VS remote debug session, however, when running the executable on the Raspi5, the in focus selection works, however, the widget locations always goes back to the original widget location at creation.Can anyone provide an explanation to the above and if are there any ways to get it work the same in both scenarios?
Thanks,
Nahum Budin.
@nahumb
It’s a bit hard to guess that without seeing your creator kits and CMake/qmake configuration. In principle both should look the same.One reason for different look may be that Creator sets environment variables for styling. Maybe you want to add some code to log the application’s style.
-
wrote on 23 Sept 2024, 08:16 last edited by nahumb
Hi Axel,
Thanks for your prompt reply.
After further searching I have found a solution on a stackoverflow post for the buttons color.
The solution is adding a "boarder:none" to the stylesheet, for example: background-color: rgba(46, 204, 113, 0.4); border: none;
This keeps the pushbuttons background colors in both running scenarios.I'm still looking for a workaround for the keeping the widgets screen locations issue.
Thanks,
Nahum.
-
wrote on 23 Sept 2024, 20:14 last edited by nahumb
@Axel-Spoerl
After further exploring the position issue, I have identify that there is an issue with the moveEvent being fired when dragging
a QDilaog when the application runs from the VS debug session, but generated only once when the Dialog is created and opened
when running directly from the Raspi5.void Dialog_MyDialog::moveEvent(QMoveEvent *event) { QWidget::moveEvent(event); last_position = event->pos(); printf("Dialog position %i:%i\n", last_position.x(), last_position.y()); }
-
wrote on 25 Sept 2024, 19:30 last edited by
Looks like Qt and Wayland do not work well together.
I've switch RasPi OS Bookworm GUI to use X11 instead of Wayland and it all works fine now (thank to the support of Paul Hutch on the Raspi Forum).
-
-
Which Qt version do you use?
-
wrote on 26 Sept 2024, 07:26 last edited by
The c++ application is based on Qt5.
1/7