Solved syntax signal/slots QT - question
-
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:
- const QObject *sender-> is the button that start the signal?
- const char *signal, -> the signal
- const char *method->element receive the signal
- Qt::ConnectionType type-> slot
Other question i have, i can call the signal using emit or other way without buttons? thx again!
-
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.
-
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
-
If you don't have a sender then you can't emit a signal.
What is exactly your use case ?
-
@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.
-
How is exactly your application supposed to work ?
-
@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??? -
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 ?
-
@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.
-
@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!