PDA

View Full Version : Object::connect: Parentheses expected, slot...



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?

bnilsson
2nd April 2008, 22:20
Apparently, I had a duplicate slot/signal defined in the Designer UI file that interfered with the written code.
The error message is eliminated, but the object context corruption remains. I have not a clue. Anyone?

jpn
3rd April 2008, 06:26
It must be some other connect statement because the receiver is JDFView. There is no ')' character in method name inside SLOT() macro.

bnilsson
3rd April 2008, 06:35
It must be some other connect statement because the receiver is JDFView. There is no ')' character in method name inside SLOT() macro.
Exactly.
This is now eliminated, so now my problem is the data loss.
Maybe I should put this question in a new thread?

jpn
3rd April 2008, 06:47
so now my problem is the data loss.
I'm not exactly sure if I understand the problem. Perhaps you used a local Job pointer variable by accident so when you later access the member variable, it's uninitialized? Where do you allocate the job and how?

bnilsson
5th April 2008, 15:02
Well, it is solved.
The "Job" data structure was accidentally deleted outside the Display method.
Case closed, thanks for the attention.