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. Update function with timer
Forum Updated to NodeBB v4.3 + New Features

Update function with timer

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 2 Posters 5.6k 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.
  • T Offline
    T Offline
    takoo
    wrote on last edited by
    #5

    no no . I am making console app

    I just write code ------- (-_-) ----------

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #6

      Your code snippet shows a QMainWindow based class using a designer based UI with a slot connected to a QPushButton named pushButton.

      That doesn't look like a console application code.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        takoo
        wrote on last edited by
        #7

        @SGaist but this app for console

        I just write code ------- (-_-) ----------

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          Then why are you using GUI classes ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • T Offline
            T Offline
            takoo
            wrote on last edited by
            #9

            just sample above codes

            I just write code ------- (-_-) ----------

            1 Reply Last reply
            0
            • T Offline
              T Offline
              takoo
              wrote on last edited by
              #10
              #include "networkprocess.h"
              
              NetworkProcess::NetworkProcess(QObject *parent) : QObject(parent)
              {
                  nam = new QNetworkAccessManager();
                  timer=new QTimer(this);
                  url2.setUrl("ftp://myserver");
                  url2.setPassword("xxx");
                  url2.setUserName("xxx");
                  url2.setPort(21);
                  req.setUrl(url2);
              
              
                  reply = nam->get(req);
              
                  connect(reply, SIGNAL(readyRead()),this, SLOT(downloadReadyRead()));
              
                  connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
              
                  timer->setInterval(500);
              
                  timer->start();
                  connect(timer,SIGNAL(timeout()),this,SLOT(updatet()));
              
              }
              
              
              
              
              void NetworkProcess::updatet()
              {
              
                     updatereply=reply;
              
              
              
              
              }
              
              
              
              void NetworkProcess::downloadReadyRead()
              {
              
                  if(updatereply->error() == QNetworkReply::NoError){
                          buf = updatereply->readAll();
                          if(buf=="Kapat")
                          {
                            qDebug()<<"tako";
                          }
              
              
                          if(buf=="Ac")
                          {
                              qDebug()<<"vural";
                          }
              
                      }
              }
              
              void NetworkProcess::requestFinished()
              {
              
              }
              
              
              

              this is

              I just write code ------- (-_-) ----------

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #11

                That update function doesn't really make sense. The reply is automatically updated while the request is being processed.

                Why not use the downloadProgress signal if you want information about the downloading state of your query ?

                On a side note there's the QtFTP module that you can use to access a FTP server.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                  I used QT5.5 . There is no qtftp.

                  I just write code ------- (-_-) ----------

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    Please, take the time to do a bit of search: http://code.qt.io/cgit/qt/qtftp.git/

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                      @SGaist how to I install this ?

                      I just write code ------- (-_-) ----------

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #15
                        git clone https://code.qt.io/qt/qtftp.git
                        cd qtftp
                        qmake
                        make
                        make install
                        

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        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