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. What's wrong?

What's wrong?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 607 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.
  • P Offline
    P Offline
    Poshtarelka
    wrote on last edited by
    #1

    In the constructor of the main class

    connect(ui.Button_Update, SIGNAL(clicked()), this, SLOT(GetIp()) );
    connect(manager, &QNetworkAccessManager::finished,this, &Chat::replyFinished);
    

    Now the description of the functions

    void Chat::GetIp() {
    	response = manager->get(QNetworkRequest(QUrl("https://yandex.ru/internet")));
    	ui.plainTextEdit->appendPlainText("Connecting");
    }
    
    void Chat::replyFinished() {
    	ui.plainTextEdit->appendPlainText("Data recieved");
    	ui.plainTextEdit->appendPlainText(response->readAll());
    	ui.plainTextEdit->appendPlainText("Data couted");
    }
    
    

    When you press the button after launching, this is what (Look on the text in a large area)
    0_1562183578805_e3e75f63-399f-47e3-87a9-92f1bd447f84-изображение.png
    If you wait for a while and click again, the picture will repeat, and if you press with a small interval, only Connecting will be displayed.
    I apologize if somewhere was wrong with the markup. I am new here.

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

      Your request is redirected and you don't listen to QNetworkReply::redirected - you can test it with the download example - you will get a 'Request was redirected.' output.

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

      P 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Your request is redirected and you don't listen to QNetworkReply::redirected - you can test it with the download example - you will get a 'Request was redirected.' output.

        P Offline
        P Offline
        Poshtarelka
        wrote on last edited by
        #3

        @Christian-Ehrlicher I had done, like you said, but it looks, that request wasnt redirected.
        Every day I think more and more about the fact that it would be nice to learn an assembler. I would understand how everything works, but not cram a manual for a manual.

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

          @Poshtarelka said in What's wrong?:

          but it looks, that request wasnt redirected.

          I do get a redeirected output with the download example...

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

          P 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @Poshtarelka said in What's wrong?:

            but it looks, that request wasnt redirected.

            I do get a redeirected output with the download example...

            P Offline
            P Offline
            Poshtarelka
            wrote on last edited by
            #5

            @Christian-Ehrlicher i found mistake, and wanted to delete my previous post. Thanks

            Christian EhrlicherC 1 Reply Last reply
            0
            • P Poshtarelka

              @Christian-Ehrlicher i found mistake, and wanted to delete my previous post. Thanks

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

              @Poshtarelka Then please mark this topic as solved, thx :)

              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