[Solved] How to redirect the QT Application display to /dev/fb0
I have a very simple QT GUI application like shown below:
int main(int argc, char** argv)
QApplication app(argc, argv); QLabel *label = new QLabel("Hello World!"); label->show(); return app.exec();
Now when i run the above command like this:
./myApp -qws -display "linuxfb:/dev/fb0"
I get following error:
This application failed to start because it could not find or load the Qt platform plugin "xcb".
Available platform plugins are: linuxfb (from :/home/GUI).
Reinstalling the application may fix this problem.
Aborted (core dumped)
Kindly help me out. I compiled QT from source code and there was no XCB support. Only Support that is available is LinuxFB.
i assume you use Qt5? The QWS system does not exist anymore and is replaced by the QPA system which by now is not documented very well.
However you should be fine with the linuxfb plugin. What you need to change is:
- change your application to be a QGuiApplication
@QGuiApplication theApp(argc, argv);@
- remove @-qws -display “linuxfb:/dev/fb0”@
command line parameters
- copy or move the platforms directory created by qt install to the directory containing your application (maybe it is also ok to just install the platforms directory's contents to /lib or /usr/lib?)
Oh, and dont't forget to pass
as an argument to configure when you build Qt5 to assure that the linuxfb plugin is used as default.
Thanks for your quick reply.
Actually while building QT from source i got following Config summary:
DirectFB ............. no
EGLFS ................ no
KMS .................. no
LinuxFB .............. yes
XCB .................. no
so i think there is no need of doing QT Configure with -qpa linuxfb.
So i want to pass the command line argument. So to run the application what arguments i should use so that it is redirected to LinuxFb.
Looking forward for your help.
Forgot to mention that i am using QT 5.2.1.
my application starts nicely without any additional parameters.
This is possible because with the configure flag i say that i want to use "offscreen" (i.e. in my case: -qpa offscreen, you would use -qpa linuxfb) as default QPA platform plugin.
from ./configure --help
@-qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).@
If you don't want to use linuxfb as default you can still pass the platform parameter to your programme:
BTW i'm using Qt 5.1.1 but the instructions should do for your version as well
Thanks for your quick reply.
I will work on your inputs and will update you about the progress :)
Good luck :)
The doc for QGuiApplication gives some clues which arguments can be passed to a QGuiApplication:
very interesting is:
@-platform platformName[:options], specifies the Qt Platform Abstraction (QPA) plugin.
Overridden by the QT_QPA_PLATFORM environment variable.
Thanks for the help. I regenerated all the libraries by passing
@-qpa LinuxFB @
during the configure.
Now i am able to see the output on LinuxFB by giving the following command:
./gui_qt -platform linuxfb@
Marking it as solved.