Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QDesktopServices::open - kf.windowsystem: Could not find any platform plugin



  • 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!



  • the touble is in option

    Project -> Run -> [x] Add build library search path to LD_LIBRARY_PATH
    

    if uncheck it, all works fine under QtCreator,
    and problem is gone



  • The problem rises only when try to launch application from QtCreator (Run/Debug). If try to launch compiled binary file, so it works fine.



  • the touble is in option

    Project -> Run -> [x] Add build library search path to LD_LIBRARY_PATH
    

    if uncheck it, all works fine under QtCreator,
    and problem is gone


Log in to reply