Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to feed data to Qt creator ( plugin development )

how to feed data to Qt creator ( plugin development )

Scheduled Pinned Locked Moved Unsolved General and Desktop
pluginqtcreatorc++11qprocess
4 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • QjayQ Offline
    QjayQ Offline
    Qjay
    wrote on last edited by
    #1

    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) .

    aha_1980A 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      1
      • QjayQ Qjay

        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) .

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by aha_1980
        #3

        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

        Qt has to stay free or it will die.

        1 Reply Last reply
        3
        • QjayQ Offline
          QjayQ Offline
          Qjay
          wrote on last edited by
          #4

          thanks !! . I will look into both of them

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved