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. QT TextBrowser unable to open html page from within an HTML page
Forum Updated to NodeBB v4.3 + New Features

QT TextBrowser unable to open html page from within an HTML page

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 535 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.
  • A Offline
    A Offline
    Athem
    wrote on last edited by Athem
    #1

    Hi everyone,

    I am stuck on a problem for which I can't really seem to find a solution. So I have an HTML file (a.html) with a link to another HTML file (using a href="b.html"). I am launching a.html using textBrowser and that works. But on clicking on the link which should ideally launch page b.html, it gives me an error in the log: " Go to window eWindow::ContextHelp
    Unable to detect a web browser to launch 'learn_ok.html'
    ". (screenshots below)

    The weird thing here is, the same page is working fine in QT 4.8 but has an issue in Qt 5.15 (the development platform is for a company I work for).

    *Edit: For those looking for a solution, the way QT TextBrowser works is once you launch a page, any links inside of that page is heard by anchorClicked Signal. So define a connect property with signal listening to anchorClicked(QUrl) and on SLOT define a property to take the URL and launch it just the way first page was launched. So something like : connect(mp_Ui->textBrowser, SIGNAL(anchorClicked(QUrl)), this, SLOT(onAnchorClicked(QUrl))); and then define onAnchorClicked(QUrl) as:

    void CContextHelpForm::onAnchorClicked(const QUrl& link)
    {
    ShowPage(link);
    }

    1 Reply Last reply
    0
    • A Athem

      @Christian-Ehrlicher NEw link is mentioned in the ahref tag of the html page.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @Athem said in QT TextBrowser unable to open html page from within an HTML page:

      NEw link is mentioned in the ahref tag of the html page.

      That's not the point...
      You should connect anchorClicked(QUrl) to a slot and show the given url in your QTextBrowser.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Make sure you did not enable 'openExternalLinks' and anchorClicked() to open the link by yourself if the normal way does not work.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        A 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          Make sure you did not enable 'openExternalLinks' and anchorClicked() to open the link by yourself if the normal way does not work.

          A Offline
          A Offline
          Athem
          wrote on last edited by
          #3

          @Christian-Ehrlicher Thanks for the response. The 'openExternalLinks' is set to false as well as I removed anchorClicked(QUrl) but it still does not work.

          Christian EhrlicherC 1 Reply Last reply
          0
          • A Athem

            @Christian-Ehrlicher Thanks for the response. The 'openExternalLinks' is set to false as well as I removed anchorClicked(QUrl) but it still does not work.

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Athem said in QT TextBrowser unable to open html page from within an HTML page:

            as well as I removed anchorClicked(QUrl) but it still does not work.

            I don't understand this. I said you should use this signal so you can open the html page by yourself.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            A 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @Athem said in QT TextBrowser unable to open html page from within an HTML page:

              as well as I removed anchorClicked(QUrl) but it still does not work.

              I don't understand this. I said you should use this signal so you can open the html page by yourself.

              A Offline
              A Offline
              Athem
              wrote on last edited by Athem
              #5

              @Christian-Ehrlicher My bad. I meant, I am using it already but it does not open the link still. 5f8d28cb-fc77-4c98-85f5-03967bfe300f-image.png

              Christian EhrlicherC 1 Reply Last reply
              0
              • A Athem

                @Christian-Ehrlicher My bad. I meant, I am using it already but it does not open the link still. 5f8d28cb-fc77-4c98-85f5-03967bfe300f-image.png

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Athem said in QT TextBrowser unable to open html page from within an HTML page:

                but it does not open the link still.

                Since your slot does not take a url - how should it open the new link?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                A 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  @Athem said in QT TextBrowser unable to open html page from within an HTML page:

                  but it does not open the link still.

                  Since your slot does not take a url - how should it open the new link?

                  A Offline
                  A Offline
                  Athem
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher NEw link is mentioned in the ahref tag of the html page.

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • A Athem

                    @Christian-Ehrlicher NEw link is mentioned in the ahref tag of the html page.

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    @Athem said in QT TextBrowser unable to open html page from within an HTML page:

                    NEw link is mentioned in the ahref tag of the html page.

                    That's not the point...
                    You should connect anchorClicked(QUrl) to a slot and show the given url in your QTextBrowser.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    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