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. I need to get title of webpage
Forum Update on Monday, May 27th 2025

I need to get title of webpage

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 3 Posters 7.6k Views
  • 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
    Armin
    wrote on 23 Jan 2017, 11:22 last edited by
    #1

    Hi
    I need to get title of webpage , for example : https://forum.qt.io/category/10/general-and-desktop , title : General and Desktop | Qt Forum .
    How can i do?
    Thanks

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 23 Jan 2017, 11:53 last edited by
      #2

      @Armin using what ? use title to get it using QWebEnginePage.

      157

      A 1 Reply Last reply 23 Jan 2017, 12:01
      2
      • P p3c0
        23 Jan 2017, 11:53

        @Armin using what ? use title to get it using QWebEnginePage.

        A Offline
        A Offline
        Armin
        wrote on 23 Jan 2017, 12:01 last edited by
        #3

        @p3c0 Thanks
        I used QWebEngineView before i send this topic.
        I using QWebEnginePage and i get thie error :
        :-1: error: Unknown module(s) in QT: webenginewidgets

        J 1 Reply Last reply 23 Jan 2017, 12:14
        0
        • A Armin
          23 Jan 2017, 12:01

          @p3c0 Thanks
          I used QWebEngineView before i send this topic.
          I using QWebEnginePage and i get thie error :
          :-1: error: Unknown module(s) in QT: webenginewidgets

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 23 Jan 2017, 12:14 last edited by
          #4

          @Armin What is Qt version you're using? webenginewidgets is available since Qt 5.4

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply 23 Jan 2017, 12:24
          1
          • J jsulm
            23 Jan 2017, 12:14

            @Armin What is Qt version you're using? webenginewidgets is available since Qt 5.4

            A Offline
            A Offline
            Armin
            wrote on 23 Jan 2017, 12:24 last edited by
            #5

            @jsulm
            I using Qt Creator 4.0.2
            Update ? or no ?

            J 1 Reply Last reply 23 Jan 2017, 12:27
            0
            • A Armin
              23 Jan 2017, 12:24

              @jsulm
              I using Qt Creator 4.0.2
              Update ? or no ?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 23 Jan 2017, 12:27 last edited by
              #6

              @Armin I wanted to know the Qt version, not QtCreator version.
              Which Qt version did you install?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply 23 Jan 2017, 12:45
              1
              • J jsulm
                23 Jan 2017, 12:27

                @Armin I wanted to know the Qt version, not QtCreator version.
                Which Qt version did you install?

                A Offline
                A Offline
                Armin
                wrote on 23 Jan 2017, 12:45 last edited by
                #7

                @jsulm Thanks
                Sorry
                I downlaoded 5.7.0

                J 1 Reply Last reply 23 Jan 2017, 12:48
                0
                • A Armin
                  23 Jan 2017, 12:45

                  @jsulm Thanks
                  Sorry
                  I downlaoded 5.7.0

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 23 Jan 2017, 12:48 last edited by
                  #8

                  @Armin Did you install Qt WebEngine as well? It is not part of default installation. You can use Qt Maintenance Tool to install Qt WebEngine.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply 23 Jan 2017, 12:55
                  1
                  • J jsulm
                    23 Jan 2017, 12:48

                    @Armin Did you install Qt WebEngine as well? It is not part of default installation. You can use Qt Maintenance Tool to install Qt WebEngine.

                    A Offline
                    A Offline
                    Armin
                    wrote on 23 Jan 2017, 12:55 last edited by
                    #9

                    @jsulm
                    How can i install that ?

                    J 1 Reply Last reply 23 Jan 2017, 12:56
                    0
                    • A Armin
                      23 Jan 2017, 12:55

                      @jsulm
                      How can i install that ?

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 23 Jan 2017, 12:56 last edited by
                      #10

                      @Armin If you used Qt Online INstaller then you already have the Qt Maintenance Tool - see in Qt installation directory.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • A Offline
                        A Offline
                        Armin
                        wrote on 5 Feb 2017, 11:36 last edited by
                        #11

                        My maintance tool problem solved.
                        but i dont know how i must get title of a html page.

                        J 1 Reply Last reply 6 Feb 2017, 05:59
                        0
                        • A Armin
                          5 Feb 2017, 11:36

                          My maintance tool problem solved.
                          but i dont know how i must get title of a html page.

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 6 Feb 2017, 05:59 last edited by
                          #12

                          @Armin You mean you want to extract title from:

                          <head>
                          	<title>General and Desktop | Qt Forum</title>
                          

                          right?
                          Then you can just sent a GET request using http://doc.qt.io/qt-5/qnetworkaccessmanager.html and then parse the response (you can use a regular expression to extract the title from <title>...</title>).
                          From the link above:

                          QNetworkRequest request;
                          request.setUrl(QUrl("http://qt-project.org"));
                          request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
                          
                          QNetworkReply *reply = manager->get(request);
                          connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
                          connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
                                  this, SLOT(slotError(QNetworkReply::NetworkError)));
                          connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
                                  this, SLOT(slotSslErrors(QList<QSslError>)));
                          

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          A 1 Reply Last reply 6 Feb 2017, 09:29
                          2
                          • J jsulm
                            6 Feb 2017, 05:59

                            @Armin You mean you want to extract title from:

                            <head>
                            	<title>General and Desktop | Qt Forum</title>
                            

                            right?
                            Then you can just sent a GET request using http://doc.qt.io/qt-5/qnetworkaccessmanager.html and then parse the response (you can use a regular expression to extract the title from <title>...</title>).
                            From the link above:

                            QNetworkRequest request;
                            request.setUrl(QUrl("http://qt-project.org"));
                            request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
                            
                            QNetworkReply *reply = manager->get(request);
                            connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
                            connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
                                    this, SLOT(slotError(QNetworkReply::NetworkError)));
                            connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
                                    this, SLOT(slotSslErrors(QList<QSslError>)));
                            
                            A Offline
                            A Offline
                            Armin
                            wrote on 6 Feb 2017, 09:29 last edited by
                            #13

                            @jsulm Thanks
                            But i want to get title and i don't need to set. i need get and no set

                            J 1 Reply Last reply 6 Feb 2017, 09:30
                            0
                            • A Armin
                              6 Feb 2017, 09:29

                              @jsulm Thanks
                              But i want to get title and i don't need to set. i need get and no set

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 6 Feb 2017, 09:30 last edited by
                              #14

                              @Armin Where did I say anything about set?

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              A 1 Reply Last reply 6 Feb 2017, 10:19
                              0
                              • J jsulm
                                6 Feb 2017, 09:30

                                @Armin Where did I say anything about set?

                                A Offline
                                A Offline
                                Armin
                                wrote on 6 Feb 2017, 10:19 last edited by Armin 2 Jun 2017, 10:19
                                #15

                                @jsulm Thanks
                                In this line if i am not mistaken you set the title
                                request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
                                But i want to store the title in a QString

                                J 1 Reply Last reply 6 Feb 2017, 10:19
                                0
                                • A Armin
                                  6 Feb 2017, 10:19

                                  @jsulm Thanks
                                  In this line if i am not mistaken you set the title
                                  request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
                                  But i want to store the title in a QString

                                  J Offline
                                  J Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 6 Feb 2017, 10:19 last edited by jsulm 2 Jun 2017, 10:22
                                  #16

                                  @Armin No this line does not set any titles, why do you think so? Did you read the documentation? You can remove this line. It is not needed for your use-case.

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  A 1 Reply Last reply 7 Feb 2017, 11:40
                                  3
                                  • J jsulm
                                    6 Feb 2017, 10:19

                                    @Armin No this line does not set any titles, why do you think so? Did you read the documentation? You can remove this line. It is not needed for your use-case.

                                    A Offline
                                    A Offline
                                    Armin
                                    wrote on 7 Feb 2017, 11:40 last edited by
                                    #17

                                    @jsulm Thanks

                                    now , all i want is to get url in title ( <title> ... </title> ) and put it on QString.

                                    J 1 Reply Last reply 7 Feb 2017, 11:51
                                    0
                                    • A Armin
                                      7 Feb 2017, 11:40

                                      @jsulm Thanks

                                      now , all i want is to get url in title ( <title> ... </title> ) and put it on QString.

                                      J Offline
                                      J Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on 7 Feb 2017, 11:51 last edited by
                                      #18

                                      @Armin You can use a regular expression after you got the response from the server to extract the title.

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      A 1 Reply Last reply 11 Feb 2017, 12:41
                                      1
                                      • J jsulm
                                        7 Feb 2017, 11:51

                                        @Armin You can use a regular expression after you got the response from the server to extract the title.

                                        A Offline
                                        A Offline
                                        Armin
                                        wrote on 11 Feb 2017, 12:41 last edited by
                                        #19

                                        @jsulm Thanks
                                        If that file isn't html , and be mp4 or pdf
                                        So what do i do ?

                                        J 1 Reply Last reply 13 Feb 2017, 05:19
                                        0
                                        • A Armin
                                          11 Feb 2017, 12:41

                                          @jsulm Thanks
                                          If that file isn't html , and be mp4 or pdf
                                          So what do i do ?

                                          J Offline
                                          J Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on 13 Feb 2017, 05:19 last edited by
                                          #20

                                          @Armin Sorry, but you asked how to get the title of a web page, right?
                                          What do you want to do with mp4 or pdf?

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          A 1 Reply Last reply 13 Feb 2017, 10:17
                                          1

                                          • Login

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