View Full Version : slots with params problem
brantyou
15th September 2010, 01:35
I want to send a signal which with params to a slot. And the params is necessary to the slot.For example,mysignal(int , QString); myslot(int , QString). If I used the slot like that,whether it is right or not. My mind is to inform a slot function, and pass the param to it.
Thanks very much.
tbscope
15th September 2010, 05:36
I don't understand your question.
But here's an example of a signal and slot connection with parameters:
Class A : public QObject
{
Q_OBJECT
signals:
void signalWithParameters(const QString &text, int number);
};
Class B: public QObject
{
Q_OBJECT
public slots:
void slotWithParameters(const QString &text, int number);
};
...
A aObject;
B bObject;
connect(&aObject, SIGNAL(signalWithParameters(const QString&, int)), &bObject, SLOT(slotWithParameters(const QString&, int)));
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.