Solved Why Run QT Widget Application on Raspberry Pi close/minimize button doesn't show and can't adjust window size
-
I run the QT Widget with the kits of the desktop and there is a close / minimize / button and the window size can be adjusted.
But when it run on the raspberry pi (i cross compile qt for raspberry pi) close / minimize button doesn't show and cover the entire screen.why this happens? and how can fix this? -
Hi,
What backend are you using on the Pi ? Eglfs ? If so then it’s normal, there’s no windowing system with that one. If you need one either use wayland or Xorg.
-
I use raspberrypi2eglfs to cross compile QT for pi
For use wayland or xorg I should cross compile again?how can use wayland or xrog -
@isan said in Why Run QT Widget Application on Raspberry Pi close/minimize button doesn't show and can't adjust window size:
For use wayland or xorg I should cross compile again?how can use wayland or xrog
Check if you have the plugins in QTDIR/plugins/platforms. If yes, then there is no need to (re)compile.
All you need to do to run it under X11, for example, is to boot into X11 GUI (like the default Raspbian system) and run your app like this:
./yourApp -platform xcb
-
@sierdzio I have libqxcb.so on my Ubuntu on QTDIR / qt5pi / plugins / platforms.
And in Raspi I do not have it
So I copied it to raspi
And the permision is rw-r-r--
I run the program with ./program -platform xcb
And I'm getting this error: what should I do?This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb. Reinstalling the application may fix this problem. Aborted
-
Hm, platform plugin is available but Qt cannot load it. Try setting QT_PLUGIN_PATH on your Pi. Also, maybe setting LD_LIBRARY_PATH would help but I doubt it.
Lastly, run
ldd
on libqxcb.so on your raspberry to see which dependencies are missing.Also, make sure the libqxcb.so is really compiled for your Pi, and not for your host PC.
readelf
could probably help here. -
@sierdzio I re-rsync /raspi/qt5pi/plugins/platforms to raspi/qt5pi/plugins/
and now when run with this command./yourApp -platform xcb
I get this error:
QXcbConnection: Could not connect to display Aborted
what should I do now?
-
Do you have an active X11 session (are you logged into GUI on your raspberry pi) when you run that command?
-
@sierdzioI plugged the raspberry into a lcd and run it with ./yourApp -platform Xcb
The program runs but does not make a difference(close / minimize button doesn't show and widget cover the entire screen)I set the pushButton to close with this->close();
can set pushButton to minimize the widget? -
@isan
Hi- the program runs but does not make a difference(close / minimize button doesn't show and widget cover the entire screen)
Sounds like you are running with no windows manager.
Qt do not draw the close button etc. Its the Os/windows manager.Yes, you can also make button minimize the window. just like close there is a call for that.
http://doc.qt.io/qt-5/qwidget.html#showMinimized -
@mrjj I set pushButton and do this
connect(ui->pushButton,SIGNAL(clicked(bool)),this,SLOT(showMinimized()));
but not work
-
@isan
hi
try without the bool
connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(showMinimized()));
and check return value of connect. -
@isan said in Why Run QT Widget Application on Raspberry Pi close/minimize button doesn't show and can't adjust window size:
showMinimized()
I'm not sure this will work without window manager. Do you use any window manager on your device?
-
@jsulm I don’t know ,how can I found?
-
Hi,
Are you running an Xorg server ?
What plugin is your application loading ? -
@isan When you aren't running the app, what does the system look like? Is it a normal GUi desktop with icons and windows? Or is it just a text mode command line interface?
Step 1: Run a normal desktop with windows.
Step 2: Make your app run nicely in that desktop.
-
@wrosecrans this is gui on forms QT
this is when run on ubuntu desktop
this is when run on raspberry
now what?
-
@isan What did you install on your Raspberry?
From the picture I would say you don't have any window manager.
Raspbian usually installs Pixel desktop. -
@jsulm I did no install any window manager
What is the way to find the window manager that is used?
If raspi has pixel desktop can it be changed?
What is the good window manager ? -
@isan said in Why Run QT Widget Application on Raspberry Pi close/minimize button doesn't show and can't adjust window size:
@jsulm I don't know
How to find out which window manager is being used?Just answer the questions @wrosecrans that will be enough to know if you're on X11 or without a windowing system.
As @jsulm pointed out, most probably you do not have any window manager running, so the window bezel will just not be there (and no way to minimize/maximize because without window manager such methods do not make sense).
To see if you have X11 installed, log into your raspberry pi and run this command:
startx
If as a result you get a nice OS GUI, then you have X11 installed and ready. To turn it on permanently, you can then run:
sudo raspi-config
And set it up to boot to GUI instead of command line.