I have a project that was originally developed in Creator 2.0.1 and when I try to run it on a new computer running Creator 2.4.1 it doesn’t work properly. I have a button that when pressed displays a manual. The code works fine on the other computer and when I copy the project to the new computer, clean the project, and rebuild the project, it displays a blank QTextDocument and in the appplication output window it shows “QTextBrowser: No document for UserManual.html†Here is the code I use:
void DlgHelpBrowser
::showPage(const QString &page
) {
QString path
= directoryOf
("manual").
absolutePath();
qDebug()<<"path"<<path;//when run, this shows the correct path
qDebug()<<"page"<<page;//and this shows the correct file
DlgHelpBrowser *browser = new DlgHelpBrowser (path, page);
browser->resize(1000, 800);
browser->show();
}
void DlgHelpBrowser::showPage(const QString &page)
{
QString path= directoryOf("manual").absolutePath();
qDebug()<<"path"<<path;//when run, this shows the correct path
qDebug()<<"page"<<page;//and this shows the correct file
DlgHelpBrowser *browser = new DlgHelpBrowser (path, page);
browser->resize(1000, 800);
browser->show();
}
To copy to clipboard, switch view to plain text mode
QDir DlgHelpBrowser
::directoryOf(const QString &subdir
) {
if (dir.dirName().toLower()== "debug" || dir.dirName().toLower()=="release")
dir.cdUp();
dir.cd(subdir);
return dir;
}
QDir DlgHelpBrowser::directoryOf(const QString &subdir)
{
QDir dir(QApplication::applicationDirPath());
if (dir.dirName().toLower()== "debug" || dir.dirName().toLower()=="release")
dir.cdUp();
dir.cd(subdir);
return dir;
}
To copy to clipboard, switch view to plain text mode
I use the exact same code on both machines, a direct copy, and it works on one but not on the other. Any ideas?
Bookmarks