Hi,
I would like to pass an additional boolean parameter with the following slot:
Qt Code:
To copy to clipboard, switch view to plain text mode
I saw QSignalMapper might be the the way to go...can you show an example?
Thanks,
Surf
Hi,
I would like to pass an additional boolean parameter with the following slot:
Qt Code:
To copy to clipboard, switch view to plain text mode
I saw QSignalMapper might be the the way to go...can you show an example?
Thanks,
Surf
From the documentation of QSignalMapper, line 2 of the detailed description (emphasis is mine):
This will not do for your fileChanged(QString) signal.This class collects a set of parameterless signals, and re-emits them with integer, string or widget parameters corresponding to the object that sent the signal.
You have to implement the solution yourself. Connect fileChanged(QString) to a slot (in some "proxy" QObject) with a QString parameter only, which then emits another signal adding the boolean value you want.
No, signal mapper does not do this at all.
It is used for connecting multiple signal sources to the mapper and then the mapper to a slot and have it pass an identifier or data associated with the original sender.
What is it that you want to achieve?
Cheers,
_
i would like to pass a bool as shown here (written as pseudo like code, since it will not compile):
Qt Code:
void MainWindow::onReadStdOut() { bool info = true; // info will be set by another function }To copy to clipboard, switch view to plain text mode
my current solution (which works fine):
Qt Code:
void MainWindow::onReadStdOut() { info = true; // info will be set by another function } // here i can read info, bc its a member variable }To copy to clipboard, switch view to plain text mode
I cannot see what is wrong with your current solution. As far as I know, 'info' seems to be a part of the state of MainWindow, just like the background color of the window, for instance. Why should any of them be passed to readInfo() as a parameter?
Do you want to associate a boolean with the "fs" object?
And the boolean is changed by some other code during runtime?
Cheers,
_
the bool is changed by information from ReadStdOut...
If the data is not associated with the "fs" object, then a member variable is definitely the way to go.
Btw, onReadStdOut() sounds like a slot, be sure you really want to do the connect() in there, i.e. every time the slot is invoked.
Cheers,
_
Bookmarks