You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, June 18th 2012, 9:44pm

Forward signals & sender

Hi all.

I need to forward one signal, and also replace sender, how can I do this?

Example:

I reimplement "QNetworkAccessManager::createRequest" for forward "QNetworkReply::readyRead()" signal

So sheme like this "QNetworkAccessManager::createRequest() -> QNetworkReply::readyRead() -> QNetworkAccessManager::readyReadForwardSlot() -> QNetworkAccessManager::replyReadyRead() -> myCustomMethod()"
How can I get QNetworkReply from "sender()" in "myCustomMethod()"?

Also i try to connect signal with signal (without slot) it also doesn't works

Thanks.

2

Monday, June 18th 2012, 11:01pm

You can connect signals to signals. It does work.

If you need to know QNetworkReply in mycustommethod then you've probably done something wrong. mycustommethod is so far away from QNetworkReply that it should not need anything at all from it.

ofcourse, you can/could access sender from readyReadForwardSlot and just pass it on...
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Pipeliner

Beginner

Posts: 24

Location: Los Angeles

Occupation: Tools Developer

  • Send private message

3

Monday, June 18th 2012, 11:12pm

If you can do as Amleto suggests and avoid connecting chaining multiple SIGNALs together you should save computation time when the signals are emitted, or sent. This is especially important if you're working with a QTableWidget or need to emit this signal more than 20-30 times in a second. The SIGNAL->SLOT/SIGNAL->SLOT connection chain can drastically slow down your code without technically coding any errors.

4

Tuesday, June 19th 2012, 8:36pm

Thanks. I understand.