Important: Please read the Qt Code of Conduct -

QtextDocument no document

  • 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) //slot for showing the page
    QString path= directoryOf("manual").absolutePath();
    qDebug()<<"path"<<path; //when this runs it shows the correct path
    qDebug()<<"page"<<page; //when this runs it shows the correct file
    DlgHelpBrowser *browser = new DlgHelpBrowser (path, page);
    browser->resize(1000, 800);
    @QDir DlgHelpBrowser::directoryOf(const QString &subdir)
    QDir dir(QApplication::applicationDirPath());
    if (dir.dirName().toLower()== "debug" || dir.dirName().toLower()=="release")
    return dir;

    I have looked over the code and the settings in the Creator and can't find any issues.
    Any ideas??

  • If you set "Shadow Build" property in Projects build settings then your application will looking for the file at the path "projectname-build-desktop" instead of your project folder.

    You can disable this property or add your file to the application resources.

  • Shadow build is not selected. It was the first time I ran the program then I changed it. Would that have changed a setting that I need to set back? Just before the QText document is called the I see that the correct path is set. Is there a setting to see what QTextDocument is looking for?

Log in to reply