1

How can I pass the argument from the bash script in Qt? For example with the script

echo "Enter keywords: "
read test1
result1=$(find . -name "*$test1*" -print0)
echo $result1

I want to let the user type keyword to lineEdit in Qt and when they press button the result of find . -name "*$test1*" -print0 will be shown

1
  • You could use QProcess for executing and reading back the results of the find command. Better would be to just search within QDir and omit the bash totally if you want to use Qt. Commented Jun 21, 2016 at 5:17

1 Answer 1

1

The QProcess class is designed to start other processes and allows you to interact with the result.

To start it, see the documentation

Be aware that this is asynchronous, so you will either need to play with the signal/slot or block, using QProcess::waitForFinished.

The result, you can then get from QProcess::readAllStandardOutput() or QProcess::readAllStandardError() and export to a widget for showing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.