PDA

View Full Version : Signal from variable



waynew
17th November 2009, 23:31
I'm trying to set up a signal/slot for a change in variable value.
The variable is global, ::gOper
In the class it is declared in, is the following code:



connect(gOper, SIGNAL(valueChanged()), this, SLOT(updateStats()));


But, it doesn't compile.
error: no matching function for call to `MainWindow::connect(QString&, const char*, MainWindow* const, const char*)'

So how do you refer to the variable? Or what am I doing wrong?

squidge
17th November 2009, 23:52
The variable must be a QObject-derived class, not a QString.

So create a class, give it a setter, getter and signal, and then use connect()

waynew
18th November 2009, 01:18
Tnx Fatjuicymole, I got it now. :)