jaca
20th May 2008, 19:18
Hello!
In my program this function below is called once when I opened.
It read the file and updates the QLabel "title" with setText().
void Mpl::updateFiles()
{
QFile file("mpl.dat");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file);
QApplication::setOverrideCursor(Qt::WaitCursor);
while (!in.atEnd()) {
QString line = in.readLine();
uplist << line;
}
QApplication::restoreOverrideCursor();
file.close();
if (uplist.count() == 3){
title->setText(uplist.at(0));
path = uplist.at(1);
path2 = uplist.at(2);
}else{
QMessageBox::warning(this, "Error reading File",
"The file should contain: name of the project and paths.");
}
}
In the programme it is possible to change the file "mpl.dat". Then the user can click a QPushButton and call updateFiles () again. But the upgrade of QLabel "title" does not occur.
Someone help me, please?
Thanks
In my program this function below is called once when I opened.
It read the file and updates the QLabel "title" with setText().
void Mpl::updateFiles()
{
QFile file("mpl.dat");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file);
QApplication::setOverrideCursor(Qt::WaitCursor);
while (!in.atEnd()) {
QString line = in.readLine();
uplist << line;
}
QApplication::restoreOverrideCursor();
file.close();
if (uplist.count() == 3){
title->setText(uplist.at(0));
path = uplist.at(1);
path2 = uplist.at(2);
}else{
QMessageBox::warning(this, "Error reading File",
"The file should contain: name of the project and paths.");
}
}
In the programme it is possible to change the file "mpl.dat". Then the user can click a QPushButton and call updateFiles () again. But the upgrade of QLabel "title" does not occur.
Someone help me, please?
Thanks