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. syntax signal/slots QT - question
Forum Updated to NodeBB v4.3 + New Features

syntax signal/slots QT - question

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 1.8k 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.
  • J Offline
    J Offline
    Jeronimo
    wrote on last edited by Jeronimo
    #1

    I have some questions about signal and slots. First thing the syntax look like this:

    connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
    

    If i am not wrong:

    1. const QObject *sender-> is the button that start the signal?
    2. const char *signal, -> the signal
    3. const char *method->element receive the signal
    4. Qt::ConnectionType type-> slot

    Other question i have, i can call the signal using emit or other way without buttons? thx again!

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

      Hi,

      A signal should be emitted from within the class that declares it. What do you have in mind ?

      Also, you should move to Qt 5's new syntax. It does compile time check rather than run time.

      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
      • J Offline
        J Offline
        Jeronimo
        wrote on last edited by
        #3

        ok solved this is the button that you press but if for example i want to emit the signal without buttons normally in this i put ui->button

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

          If you don't have a sender then you can't emit a signal.

          What is exactly your use case ?

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

          J 1 Reply Last reply
          0
          • SGaistS SGaist

            If you don't have a sender then you can't emit a signal.

            What is exactly your use case ?

            J Offline
            J Offline
            Jeronimo
            wrote on last edited by
            #5

            @SGaist i need other sender because my program is only console program, But i dont know other way to activate sender without buttons or using main window.

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

              How is exactly your application supposed to work ?

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

              J 1 Reply Last reply
              0
              • SGaistS SGaist

                How is exactly your application supposed to work ?

                J Offline
                J Offline
                Jeronimo
                wrote on last edited by Jeronimo
                #7

                @SGaist my program will be console so i can't use buttons like with mainwindow. So i dont know other way to activate sender or emit signal.
                How is exactly your application supposed to work ?
                Activate some sender to activate signal i was trying include in this code something to activate sender without using buttons.
                Signal/slot connection:
                connect(this, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
                I need some sender to activate this signal.
                If i am doing one console program i can activate sender???

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

                  That I understood, my question is: what is your application supposed to do ? i.e How should it be used ? Why do you need that signal ?

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

                  J 2 Replies Last reply
                  0
                  • SGaistS SGaist

                    That I understood, my question is: what is your application supposed to do ? i.e How should it be used ? Why do you need that signal ?

                    J Offline
                    J Offline
                    Jeronimo
                    wrote on last edited by
                    #9

                    @SGaist i need because i'm doing one little console program to download files of my page. It will be used i put in the code the url of my page and download my the file. And maybe more advance i will try to do one http client.

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      That I understood, my question is: what is your application supposed to do ? i.e How should it be used ? Why do you need that signal ?

                      J Offline
                      J Offline
                      Jeronimo
                      wrote on last edited by
                      #10

                      @SGaist thx a lot i solved my problem i was trying to update one http client with qt console to download some files of my webpage. At last i asked in other forum and i clear this. So thx again!

                      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