Hello,
in my app I have a custom class for networking that uses a QNetworkAccessManager object inside it.
From the QNetworkAccessManager's requestFinished(..) slot I emit some custom signal that carries some data
and which I want to handle in other classes.
My problem is following. Imagine in some class B, I tie a slot to the signal I mentioned above.
Then I tie another slot to this signal. In the end we may have that to my signal (customSignal) there are
10 slots connected in some other class B. I don't want that once the signal is emitted all these
10 slots get called simultaneously. Rather at some point in time, I want the signal to call
only one slot, at another point in time, only another slot and etc.
How can I achieve this?
I know I could for example use different my custom network objects (but I was told it is not recommended??).
e.g., like this:
MyNetworkClass *network1 = new MyNetworkClass();
MyNetworkClass *network2 = new MyNetworkClass();
MyNetworkClass *network3 = new MyNetworkClass();
MyNetworkClass *network1 = new MyNetworkClass();
bool res = QObject::connect(network1, SIGNAL(signalSuccess(QVariant)), this, SLOT(CustomSLot1(QVariant)));
MyNetworkClass *network2 = new MyNetworkClass();
bool res = QObject::connect(network2, SIGNAL(signalSuccess(QVariant)), this, SLOT(CustomSLot2(QVariant)));
MyNetworkClass *network3 = new MyNetworkClass();
bool res = QObject::connect(network3, SIGNAL(signalSuccess(QVariant)), this, SLOT(CustomSLot3(QVariant)));
To copy to clipboard, switch view to plain text mode
I think it would work this way also??? Thanks.
Bookmarks