Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved how to feed data to Qt creator ( plugin development )

    General and Desktop
    plugin qtcreator c++11 qprocess
    3
    4
    815
    Loading More Posts
    • 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.
    • Qjay
      Qjay last edited by

      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_1980 1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        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 Reply Quote 1
        • aha_1980
          aha_1980 Lifetime Qt Champion @Qjay last edited by aha_1980

          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 Reply Quote 3
          • Qjay
            Qjay last edited by

            thanks !! . I will look into both of them

            1 Reply Last reply Reply Quote 1
            • First post
              Last post