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. Problem on SIGNALS and SLOTS
Forum Updated to NodeBB v4.3 + New Features

Problem on SIGNALS and SLOTS

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 6 Posters 1.6k Views 2 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.
  • R Offline
    R Offline
    rezaMSLM
    wrote on last edited by rezaMSLM
    #1

    I designed a GUI to upload and download files from my FTP server
    when i click on upload button, uploads my file on the server successfully.
    in order to see upload progress added a progress bar to the GUI.
    I know that when uploading and downloading dataTransferProgress() signal is emited.
    I tried to connect this signal to my progress bar:

    connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this ,SLOT(ui->progressBar_Upload));
    

    I receive no error but it doesnt work!

    J.HilkJ 1 Reply Last reply
    0
    • R rezaMSLM

      I designed a GUI to upload and download files from my FTP server
      when i click on upload button, uploads my file on the server successfully.
      in order to see upload progress added a progress bar to the GUI.
      I know that when uploading and downloading dataTransferProgress() signal is emited.
      I tried to connect this signal to my progress bar:

      connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this ,SLOT(ui->progressBar_Upload));
      

      I receive no error but it doesnt work!

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @rezaMSLM said in Problem on SIGNALS and SLOTS:

      connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this ,SLOT(ui->progressBar_Upload));

      there's defenitly an error, but the old Signal/Slot syntax does not show it during compile time.

      try the following:

       connect(ftp, QFTP::dataTransferProgress, ui->progressBar_Upload ,[=](qint64 current, qint64 max){
           ui->progressBar_Upload->setValue(current);
           ui->progressBar_Upload->setMaximum(max);
      });
      

      this should work.
      If you're bound to qt4 or something, you'll need a slot in your Class(Mainwindow?)

      connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this ,SLOT(newProgressValues(qint64, qint64));
      
      void Mainwindow::newProgressValues(qint64 current, qint64 max){
           ui->progressBar_Upload->setValue(current);
           ui->progressBar_Upload->setMaximum(max);
      }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      4
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3
        • check if connection worked (connect() returns a bool)
        • use new connection syntax - it will give you compilation errors when something is wrong in connection statement
        • you are not specifying any actual slot in your SLOT() macro call, so I'm 99% sure it fails there. You should rather do it like:
        connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)), ui->progressBar_Upload ,SLOT(nameOfYourSlot(qint64, qint64)));
        

        (Z(:^

        1 Reply Last reply
        3
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Oh, what timing :)

          (Z(:^

          J.HilkJ 1 Reply Last reply
          0
          • sierdzioS sierdzio

            Oh, what timing :)

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @sierdzio for the "easy questions" people tend to answer within the same minute. I had it once, where 5 people answred within 1 minute x)


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            JKSHJ 1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Haha, nice :-)

              (Z(:^

              JonBJ 1 Reply Last reply
              0
              • sierdzioS sierdzio

                Haha, nice :-)

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                There are easier questions than this one... :)

                1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @sierdzio for the "easy questions" people tend to answer within the same minute. I had it once, where 5 people answred within 1 minute x)

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  @J.Hilk said in Problem on SIGNALS and SLOTS:

                  @sierdzio for the "easy questions" people tend to answer within the same minute. I had it once, where 5 people answred within 1 minute x)

                  I'm starting to think we should have Sticky threads for those... :P

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  J.HilkJ 1 Reply Last reply
                  0
                  • JKSHJ JKSH

                    @J.Hilk said in Problem on SIGNALS and SLOTS:

                    @sierdzio for the "easy questions" people tend to answer within the same minute. I had it once, where 5 people answred within 1 minute x)

                    I'm starting to think we should have Sticky threads for those... :P

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @JKSH You mean, like an FAQ->Readonly sub-categorie ? Sounds like a plan :)


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rezaMSLM
                      wrote on last edited by rezaMSLM
                      #10

                      when using QFtp::put() command I want to be noticed whether the command successfully finished or not; so I want to use "void QFtp::commandFinished ( int id, bool error )" SIGNAL.
                      from Qt help:
                      "This signal is emitted when processing the command identified by id has finished"
                      now my question is that what is QFtp::put() command id?
                      in other words:
                      when commandfinished() signal is emitted how I understand which command is finished?

                      jsulmJ 1 Reply Last reply
                      0
                      • R rezaMSLM

                        when using QFtp::put() command I want to be noticed whether the command successfully finished or not; so I want to use "void QFtp::commandFinished ( int id, bool error )" SIGNAL.
                        from Qt help:
                        "This signal is emitted when processing the command identified by id has finished"
                        now my question is that what is QFtp::put() command id?
                        in other words:
                        when commandfinished() signal is emitted how I understand which command is finished?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @rezaMSLM said in Problem on SIGNALS and SLOTS:

                        now my question is that what is QFtp::put() command id?

                        Please read the documentation: http://doc.qt.io/archives/qt-4.8/qftp.html#put-2
                        The id is what QFtp::put() returns...

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

                        1 Reply Last reply
                        2

                        • Login

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