bnilsson
2nd April 2008, 20:58
I am trying to connect a QSpinBox to a slot:
connect(Layer_spinBox, SIGNAL(valueChanged(int)),this, SLOT(setLayer(int)));
void
JDFWindow::setLayer(int lyr)
{
active_layer_number = lyr;
redraw();
}
and
class JDFWindow : public QWidget, public Ui::JDFView
{
Q_OBJECT
public:
JDFWindow( QWidget * parent = 0, Qt::WFlags f = 0 );
~JDFWindow();
void redraw();
signals:
void valueChanged(int);
private slots:
void setLayer(int);
private:
protected:
QRectF screct;
myQGraphicsScene *scene;
JOB *Job;
int active_layer_number;
};
I get this strange message from the console:
Object::connect: Parentheses expected, slot JDFWindow::
Object::connect: (sender name: 'Layer_spinBox')
Object::connect: (receiver name: 'JDFView')
The slot works, I get the correct value form the QSpinBox, but the context of the JDFWindow object is lost when setLayer() is entered , the content of my object "Job" is garbage when enter the slot, while it was ok before I triggered the QSpinBox..
The console message tells me soething is wrong with my syntax, but I cannot figure out what.
Can someone enlighten me?
connect(Layer_spinBox, SIGNAL(valueChanged(int)),this, SLOT(setLayer(int)));
void
JDFWindow::setLayer(int lyr)
{
active_layer_number = lyr;
redraw();
}
and
class JDFWindow : public QWidget, public Ui::JDFView
{
Q_OBJECT
public:
JDFWindow( QWidget * parent = 0, Qt::WFlags f = 0 );
~JDFWindow();
void redraw();
signals:
void valueChanged(int);
private slots:
void setLayer(int);
private:
protected:
QRectF screct;
myQGraphicsScene *scene;
JOB *Job;
int active_layer_number;
};
I get this strange message from the console:
Object::connect: Parentheses expected, slot JDFWindow::
Object::connect: (sender name: 'Layer_spinBox')
Object::connect: (receiver name: 'JDFView')
The slot works, I get the correct value form the QSpinBox, but the context of the JDFWindow object is lost when setLayer() is entered , the content of my object "Job" is garbage when enter the slot, while it was ok before I triggered the QSpinBox..
The console message tells me soething is wrong with my syntax, but I cannot figure out what.
Can someone enlighten me?