Hello, all;
Does anyone know the best way to pass an integer to a slot? I'm currently having trouble doing so and am receiving a “no such slot†message when I run my program.
It compiles and runs fine if I don't try to pass anything to it (i.e. declare it “voidâ€), and even compiles when I do; it's only upon execution that I get the error message. Here are the relevant code snippets I'm using for the signal connection and slot in the .cpp file:
int currentFreq1 = frequency_ch1_SB->value();
qDebug() << currentFreq1 << " Frequency value to pass to Start IO #1\n";
connect( taStartPB, SIGNAL( clicked() ), this, SLOT( startIO(currentFreq1) ));
int currentFreq1 = frequency_ch1_SB->value();
qDebug() << currentFreq1 << " Frequency value to pass to Start IO #1\n";
connect( taStartPB, SIGNAL( clicked() ), this, SLOT( startIO(currentFreq1) ));
To copy to clipboard, switch view to plain text mode
void ConfigurationPage::startIO(int currentFreq1)
{
...
}
void ConfigurationPage::startIO(int currentFreq1)
{
...
}
To copy to clipboard, switch view to plain text mode
...and in the .h file, the slot is defined this way:
class ConfigurationPage
: public QWidget{
Q_OBJECT
public:
ConfigurationPage
(QWidget *parent
= 0);
private slots:
void startIO(int);
};
class ConfigurationPage : public QWidget
{
Q_OBJECT
public:
ConfigurationPage(QWidget *parent = 0);
private slots:
void startIO(int);
};
To copy to clipboard, switch view to plain text mode
The specific error message I'm getting is: “No such slot ConfigurationPage::startIO(currentFreq1) in toneaud_pages.cpp:348
â€. If anyone has any suggestions, I'd certainly appreciate it.
Thanks,
Allan
Bookmarks