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. Please a solution of this problem in Qt?
Forum Updated to NodeBB v4.3 + New Features

Please a solution of this problem in Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 202 Views 2 Watching
  • 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.
  • K Offline
    K Offline
    Khalil Mahdi
    wrote on last edited by Khalil Mahdi
    #1

    2021-08-26_225547.png

    QString MainWindow::cmd(const QString &command)
    {
    QProcess Proces;
    Proces.start(command);
    Proces.waitForFinished(-1);
    Proces.setReadChannel(QProcess::StandardOutput);
    QTextStream reade2(&Proces);
    reade2.setCodec("UTF-8");
    QString line2,line,Out;
    while (reade2.readLineInto(&line2))
    {
    Out.append(line2 +'\n');
    }
    Proces.setReadChannel(QProcess::StandardError);
    QTextStream reader(&Proces);
    while (reader.readLineInto(&line))
    {
    Out.append(line +'\n');
    }
    Proces.close();
    return Out.trimmed();
    }

    extern QString MainWindow::Exec(const QString &command)
    {
    QFuture<QString> maeit = QtConcurrent::run(this ,cmd,command);
    while (!maeit.isFinished()) {QApplication::processEvents();}
    return maeit.result();
    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      https://doc.qt.io/qt-5/qtconcurrentrun.html#using-member-functions

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi and welcome to devnet,

        https://doc.qt.io/qt-5/qtconcurrentrun.html#using-member-functions

        K Offline
        K Offline
        Khalil Mahdi
        wrote on last edited by
        #3

        @SGaist thank you.

        1 Reply Last reply
        0

        • Login

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