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. Retrieve weather forecast
Forum Updated to NodeBB v4.3 + New Features

Retrieve weather forecast

Scheduled Pinned Locked Moved General and Desktop
19 Posts 4 Posters 7.0k 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.
  • D Offline
    D Offline
    deepnguyen
    wrote on last edited by
    #9

    When I tried to run the file in my debug folder with all the needed dll i got

    Entry Point Not Found

    The procedure entry point _Z15qIsEffectiveTLDRK7QString could not be located in the dynamic link library QtCored4.dll.

    and if I try to debug it it raised

    The program has unexpectedly finished.
    C:\Users\DeepBlue\Documents\Qt\Clock-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug\debug\Clock.exe exited with code -1073741511

    I just know that -1073741511 = 0xc0000139.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #10

      I don't see possible error here. It is somewhere else... Set some breakpoints and debug your app step-by-step

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        deepnguyen
        wrote on last edited by
        #11

        Well I managed to clean up the Build Environment and it works now, turn out I was using the wrong environment variables.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deepnguyen
          wrote on last edited by
          #12

          now when I tried to debug i get 2 errors
          Object::connect: No such slot MainWindow::slotFinished(QNetworkReply*) in ..\Clock\mainwindow.cpp:755
          Object::connect: (receiver name: 'MainWindow')
          Object::connect: No such slot MainWindow::slotError( QNetworkReply::NetworkError) in ..\Clock\mainwindow.cpp:757
          Object::connect: (receiver name: 'MainWindow')

          1 Reply Last reply
          0
          • D Offline
            D Offline
            deepnguyen
            wrote on last edited by
            #13

            Ok I know what to do now, thanks a lot AcerExtensa

            1 Reply Last reply
            0
            • D Offline
              D Offline
              deepnguyen
              wrote on last edited by
              #14

              My code after I clean up a bit is

              @void MainWindow::on_pushButton_3_clicked()
              {

              QNetworkAccessManager * manager = new QNetworkAccessManager(this);
              connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotFinished(QNetworkReply*)));
              QUrl url("http://rss.weatherzone.com.au/?u=12994-1285&lt=aploc&lc=9388&obs=1&fc=1&warn=1");
              
              manager->get(QNetworkRequest(url));
              

              }

              void MainWindow::slotFinished(QNetworkReply* reply)
              {
              if(reply->error() != QNetworkReply::NoError)
              {
              qCritical() << reply->errorString();
              return;
              }
              QXmlStreamReader reader( reply );
              reader.readNext();
              while (!reader.atEnd()) {
              if (reader.isStartElement()) {
              if (reader.name() == "title") {
              reader.readNext();
              if (reader.text() == "Brisbane weather forecast") {
              //blah blah blah
              qDebug()<< reader.text();
              }
              }
              }
              }

              }@

              When I debug, whenever I click the button the program freeze up. Where is the problem--?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                deepnguyen
                wrote on last edited by
                #15

                lol silly me, I didn't put

                @reader.readNext();@

                in the while loop, and I keep checking my slot connections

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  AcerExtensa
                  wrote on last edited by
                  #16

                  -Hm, it can be only because of while loop. but it should not take more then some seconds...-

                  God is Real unless explicitly declared as Integer.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    deepnguyen
                    wrote on last edited by
                    #17

                    "
                    Tuesday

                    Mostly sunny
                    14°C - 25°C
                    Wednesday

                    Mostly sunny
                    14°C - 26°C
                    Thursday

                    Mostly sunny
                    13°C - 28°C
                    Friday

                    Mostly sunny
                    15°C - 32°C
                    "

                    I'm almost there but I need a way to split this string and my head is going dumb now. How can i get only the Days and the weather status?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      AcerExtensa
                      wrote on last edited by
                      #18

                      the problem is, your choosen service returns RSS feed with forecast as simple html text in [CDATA]... So, you need to parse it yourself... For example with "QRegExp":http://qt-project.org/doc/qt-4.8/qregexp.html parse days first(there is only 7 days), after that parse temperature, it may always have format like:
                      +/- <min 1 digit - max 2digits>°<ignore symbols> - <ignore symbols> +/- <min 1 digit - max 2 digit>°

                      God is Real unless explicitly declared as Integer.

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        johndev
                        Banned
                        wrote on last edited by
                        #19
                        This post is deleted!
                        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