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();
}
connect(Layer_spinBox, SIGNAL(valueChanged(int)),this, SLOT(setLayer(int)));
void
JDFWindow::setLayer(int lyr)
{
active_layer_number = lyr;
redraw();
}
To copy to clipboard, switch view to plain text mode
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:
myQGraphicsScene *scene;
JOB *Job;
int active_layer_number;
};
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;
};
To copy to clipboard, switch view to plain text mode
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?
Bookmarks