QTextBrowser set link , can't make it clickble



  • Im using QTextBrowser , and setting it with link like this :

    @QString url = "http://developer.qt.nokia.com/doc/qt-4.8/qtextbrowser.html#source-prop";

    textBrowser->setOpenExternalLinks(true);
    textBrowser->setHTML(url);
    or with 
    textBrowser->setSource(QUrl(url));
    

    or even :
    QString u = "<a >"+url+"</a>";
    textBrowser->setHTML(u);@

    but nothing happens , if i add the setSource i dont even see the fonts



  • http://pastebin.com/serh7RRh

    PS: I can't paste it as a code...



  • QTextBrowser does not load content from the interwebs automatically.

    "QTextBrowser openExternalLinks property":/doc/qt-4.8/qtextbrowser.html#openExternalLinks-prop

    bq. Specifies whether QTextBrowser should automatically open links to external sources using QDesktopServices::openUrl() instead of emitting the anchorClicked signal. Links are considered external if their scheme is neither file or qrc.

    "QTextBrowser source property":/doc/qt-4.8/qtextbrowser.html#source-prop

    bq. 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 you want to load web content, use a [[Doc:QWebView]] instead.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.