QDesktopServices::open - kf.windowsystem: Could not find any platform plugin
Solved
General and Desktop
-
Hello.
I've faced the trouble, I can't run any local file within QDesktopServices::open or QProcess::startDetached.Text of the exception:
kf.windowsystem: Could not find any platform plugin This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are: xcb. Reinstalling the application may fix this problem.
I've tried:
#include <QApplication> #include <QUrl> #include <QDesktopServices> int main(int argc, char *argv[]) { QApplication app(argc, argv); // just this line QDesktopServices::openUrl(QUrl::fromLocalFile("/home/user/myfile.pdf")); return app.exec(); }
or
QProcess::startDetached("xdg-open", QStringList() << "/home/user/myfile.pdf");
in all cases I have the same exception.
I have already installed all needed packages:
sudo apt-get install libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev
Tested on Ubuntu (KDE) 20.04, Qt 5.15.2
What is wrong?
Thanks!