Page 2 of 2 FirstFirst 12
Results 21 to 21 of 21

Thread: QTextBroxser : home() problem

  1. #21
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextBroxser : home() problem

    Yes !

    I solved the problem like this :
    Qt Code:
    1. QStringList chemins;
    2. chemins << "../../aide/";
    3.  
    4. QString acces_app = "accueil.html";
    5. QUrl url_source(acces_app);
    6.  
    7. my_help_window->TB_message->setSearchPaths (chemins);
    8. my_help_window->TB_message->setSource(url_source);
    To copy to clipboard, switch view to plain text mode 

    source : QUrl

    This property holds the name of the displayed document.
    This is a an invalid url if no document is displayed or if the source is unknown.
    When setting this property QTextBrowser tries to find a document with the specified name in the paths of the searchPaths property and directory of the current source, unless the value is an absolute file path. It also checks for optional anchors and scrolls the document accordingly

    If the first tag in the document is <qt type=detail>, the document is displayed as a popup rather than as new document in the browser window itself. Otherwise, the document is displayed normally in the text browser with the text set to the contents of the named document with setHtml().

    Access functions:

    QUrl source () const
    virtual void setSource ( const QUrl & name )
    At the beginning, in my aide.ui file, I had set the setSource property.
    I let the setSearchPaths wide, with no path specified (I understood that this property should facilitate access to linked files or displayed images...).
    So, it should have displayed my HTML file when calling the implementation class object in my application, without setting other setSource property... But the document was cleared, the content of the HTML source file wasn't displayed. Perhaps it's a bug, perhaps I am the bug (certainly... ), but I'll never know.

    After that, I tried to set the HTML source directly from my application.
    My error was to set (another time...) the setSource property in the application, cause the relative path was specified from the searchPath definied originally in my aide.ui file : none !

    So the final solution is :
    - not to set the setSource property in my aide.ui file
    - set the setSearchPaths list property in my aide.ui file ("../../aide/")
    - set the setSource property in my application ("accueil.html")



    One more time, let me thank you a lot for your help and participation




    PS : Arrrghhh....
    Now my links (<a href...>) are no more resolved...
    Nothing happens when I click a link, the source stay the same, the content displayed isn't changed. If I open it with Firefox, links a well resolved.

    If I want them to work, I must specify the setSource property in my aide.ui file.
    So I specify the setSource and the setSearchPaths list properties in my aide.ui file.
    Last edited by Nyphel; 25th May 2007 at 13:25.

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.