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

how to feed data to Qt creator ( plugin development )



  • hello , i am trying to create a plugin for Qt creator. I have followed the docs example and have a working hello world plugin now . I have modified it to call meson via Qtcprocess and get back results .

    I am currently storing the results as QVariantMap . kind of like this

    const QString args = "introspect --targets /home/user/project/meson/builddir/";
       QObject *parent = nullptr;
        Utils::QtcProcess process(parent);
    
        process.setCommand(getMesonPath(), args);
        process.start();
    
        int res = process.waitForFinished();
    
        if( !res ) {
            qDebug() << process.errorString();
        }
    
        process.waitForFinished();
    
        QByteArray output = process.readAllStandardOutput();
        qDebug() << output;
    
        const QJsonDocument doc = QJsonDocument::fromJson(output);
        foreach ( auto value, doc.array()) {
            introspectResults["name"] = value.toObject().value("name").toString();
            introspectResults["filename"] = value.toObject().value("filename").toString();
            introspectResults["id"] = value.toObject().value("id").toString();
            introspectResults["type"] = value.toObject().value("type").toString();
        }
    

    now how to proceed ? . My initital goal is to be able to open meson projects in Qt creator. Also show the project in sidebar ( projectExplorer i what it is called guess) .


  • Lifetime Qt Champion

    Hi
    I have not seen may doing Creator plugins here.
    I think best chance is to use
    https://code.woboq.org/qt5/qt-creator/
    and look around in source. All is hot linked so its very
    good to discover with. (IMHO)


  • Lifetime Qt Champion

    Hi @Qjay,

    I'd take the Generic Project Manager as template. It's very easy to understand and should get you forward a bit.

    process.waitForFinished();

    No, please don't do this. Use signals & slots instead.

    Regards



  • thanks !! . I will look into both of them