Re: Many signals one slot
Have a look at QObject::sender().
Code:
MyClass::mySlot(){
if (sender() == myButton1)
{...}
}
Re: Many signals one slot
Have a look at QSignalMapper.
Re: Many signals one slot
Thanks again. I used the mapping and I did it.
But this success led me to another different problem. I will continue to this thread.
Part of configdilog.h
Code:
private:
QLineEdit *ebmFloodImage,
*ebmFloodImage20,
*ebmCrystalEnergies,
*ebmIMat,
*ebmJMat;
QPushButton *psbFloodImage,
*psbFloodImage20,
*psbCrystalEnergies,
*psbIMat,
*psbJMat;
private slots:
And at the constructor I implement everything you see here. I connect the pushbuttons with the slot selectFile. But when I go to the slot and select a new file, I cannot "print" the new name to the lineEdits (from the slot routine, at the constructor I can set the Text). The following runtime error appears.
Code:
Program received signal SIGSEGV, Segmentation fault.
0x00007f7a0331b6f0 in
QLineEdit::setText () from
/usr
/lib
/libQtGui.
so.4
Do have any idea where this comes from??
Re: Many signals one slot
Probably you have a local variable in the constructor, instead of assigning to the member variable:
Code:
Type* var = new Something;
// vs.
var = new Something; // <-- should be like this
Re: Many signals one slot
Thanx, a lot! That was the problem. The statement that I had meant that I redeclare a new LineEdit and I don't use the global one?
Re: Many signals one slot
One assigns to a new local variable, another assigns to the member variable. Member variables are not global variables. :)
Re: Many signals one slot
Yes... sorry.. idiot mistake...