Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Open link in default browser?
Qt 6.11 is out! See what's new in the release blog

Open link in default browser?

Scheduled Pinned Locked Moved QML and Qt Quick
16 Posts 7 Posters 17.5k 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.
  • J Offline
    J Offline
    jkosonen
    wrote on last edited by
    #1

    Hey, is it possible to open link in users default browser ( example Opera?) ?
    If, how?

    Cheers,
    Juuso

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      [[Doc:QDesktopServices]] is what you are looking for.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jkosonen
        wrote on last edited by
        #3

        Does that work in symbian too?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          I don't know, sorry. I did not see that this was posted in the Quick forum. Apologies.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #5

            It will work on symbian, but it is not qml-way, if you need it (if you asked about standard non-qml way then thread should be moved)

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jkosonen
              wrote on last edited by
              #6

              [quote author="Denis Kormalev" date="1310021884"]It will work on symbian, but it is not qml-way, if you need it (if you asked about standard non-qml way then thread should be moved)[/quote]

              Well I can use signals, but if there is a straight way from QML, that would always be better :)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                situ117
                wrote on last edited by
                #7

                May be this would help;

                http://doc.qt.nokia.com/latest/qml-qt.html#openUrlExternally-method

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jkosonen
                  wrote on last edited by
                  #8

                  [quote author="situ117" date="1310029012"]May be this would help;

                  http://doc.qt.nokia.com/latest/qml-qt.html#openUrlExternally-method[/quote]

                  That doesn't open in default browser

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    q8phantom
                    wrote on last edited by
                    #9

                    I don't know if this is old, but I always use this in my apps, I have the textBrowser widget in my .ui file,

                    then I'll put this code in my constructor

                    // set up the pages on textbrowser to open in external browser
                    ui->textBrowser->setOpenLinks(1);
                    ui->textBrowser->setOpenExternalLinks(1);
                    

                    and don't forget also to put a check on link accessible by mouse and open external links and open links and also link accessible by keyboard, to set this things select the textBrowser in your .ui file and you'll find the settings on the right side find these three things.

                    This works for me best. :) Hope it helps.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DenisKormalev
                      wrote on last edited by
                      #10

                      [quote author="jkosonen" date="1310031715"]
                      That doesn't open in default browser[/quote]

                      Are you sure? Docs are saying that it should

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jkosonen
                        wrote on last edited by
                        #11

                        [quote author="Denis Kormalev" date="1310679893"]
                        [quote author="jkosonen" date="1310031715"]
                        That doesn't open in default browser[/quote]

                        Are you sure? Docs are saying that it should

                        [/quote]

                        Well, not in my app anyway...
                        QDesktopServices::openUrl() didn't work either

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          Tslv
                          wrote on last edited by
                          #12

                          Hi,
                          I have managed to start Nokia's built in web browser on Nokia C7 using QDesktopServices::openUrl()
                          I guess that is the default browser on Nokia mobile phone.

                          I was wondering how to close the Qt app afterwards?
                          I have tried using
                          QAplication::quit();
                          or
                          QAplication::exit();

                          but it didn't work.

                          Qt Video Tutorials
                          http://www.youtube.com/user/MobileDevVT/videos
                          More learning materials
                          http://mobiledevvt.blogspot.com/

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            Tslv
                            wrote on last edited by
                            #13

                            Hi,
                            I have found a solution to my question from above. It seems you cannot call QApplication::exit() from the constructor, and I was doing that :/ Since I needed the Qt app only to launch external WebBrowser on the Symbian phone and then wished to quit the app I have put the app.quit(); into the main.cpp. I had to comment out return app.exec();

                            Qt Video Tutorials
                            http://www.youtube.com/user/MobileDevVT/videos
                            More learning materials
                            http://mobiledevvt.blogspot.com/

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              Tslv
                              wrote on last edited by
                              #14

                              QDesktopServices::openUrl() doesn't work if the web browser that comes with Symbian^3 is already opened. If the browser is opened, nothing happens. The browser stays in background and it stays on the same URL ot was before openUrl call.

                              Qt Video Tutorials
                              http://www.youtube.com/user/MobileDevVT/videos
                              More learning materials
                              http://mobiledevvt.blogspot.com/

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                loladiro
                                wrote on last edited by
                                #15

                                Sounds like a bug to me, please report it at http://bugreports.qt.nokia.com .

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  Tslv
                                  wrote on last edited by
                                  #16

                                  I think it is already known bug. I have googled this out
                                  https://bugreports.qt.nokia.com//browse/QTBUG-8336

                                  It says here it is solved in version 4.7.0. I have just downloaded QT SDK 1.1.3. from http://www.developer.nokia.com/Develop/Qt/Tools/
                                  It is released 01 September 2011
                                  Why the hell don't they just say what version of QT is in there?

                                  Anyways I have written the same code using this QT SDK 1.1.3 and my problem is still present. I Guess it is not solved then?

                                  Qt Video Tutorials
                                  http://www.youtube.com/user/MobileDevVT/videos
                                  More learning materials
                                  http://mobiledevvt.blogspot.com/

                                  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