Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtextDocument no document
Qt 6.11 is out! See what's new in the release blog

QtextDocument no document

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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);
    browser->show();
    }@
    @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;
    }@

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

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved