Original one : QFile file("/home/casper/QuickRecorder/about_content.txt");
(Work)
I have tried :
"about_content.txt"
"/about_content.txt"
"~/about_content.txt"
"./about_content.txt"
"QuickRecorder/about_content.txt"
"/QuickRecorder/about_content.txt"
"~/QuickRecorder/about_content.txt"
"~/QuickRecorder/about_content.txt"
No one works.=[
My Questions
- What path can I use?
- If I register the file "about_content.txt" into Resource, how can I read it into text browser?
The following is the entire code :
About::About(QWidget *parent) :
QDialog(parent),
ui(new Ui::About)
{
ui->setupUi(this);
this->setFixedSize(this->width(),this->height());
QFile file("/home/casper/QuickRecorder/about_content.txt");
if ( !file.open(QIODevice::ReadOnly) )
QMessageBox::information(0, "Error", file.errorString());
QTextStream content(&file);
ui->aboutContentBrowser->setText(content.readAll());
}
Reference : QT C++ GUI Tutorial 27- How to read text file and display file to a textbrowser or textEdit
Thank you for your help.