I'm new to Qt and I'm working on a search application which search and list all videos in a folder. I want to generates clickable file paths which can run the video file when cilcked. here is the code I'm trying to do:
void MainWindow::on_pushButton_7_clicked()
{
QString key = ui->key->toPlainText(); //get the search keyword
QString text = ui->DIR->toPlainText(); //get the directory
string cmd = "./search_by_keyword.sh "+text.toStdString()+" "+key.toStdString();
//command to run a shell script with 2 arguments
system("chmod +x search_by_keyword.sh");
system(cmd.c_str()); //run the script which produce a txt file containing the search results
ifstream fin { "search_result.txt" }; //read result and print out
string s;
QStringList all;
while(!fin.eof()){
getline(fin,s);
string convert = s; //I want each "s" produced to be clickable, and it run the video in the path when clicked
QString str = convert.c_str();
all << str;
}
fin.close();
ui->searchResult->setText(all.join("\n")); //searchResult is currently a textBrowser
}
here is an scrshot of the UI, just in case:
thank you!