jesse_mark
21st November 2012, 16:24
Hello Guys,
Im trying to Connect multiple QlineEdit::textChanged(QString) SIGNAL with one SLOT , but in this slot i need it to change the Label color of the particular LineEdit that trigger the Slot.
so how can i connect a textchanged signal correctly to the slot ??
the problem the slot signature is not the same the as signal signature, which i know that u can not connect them this way.
but can i change the signal signature ?? because i need to know the lable for that particular lineEdit.
i'll try to illustrate more by this exmple:
connect(ui->LEdit1, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(..,.,))); // change lable1 color
connect(ui->LEdit2, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable2 color
connect(ui->LEdit3, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable3 color
connect(ui->LEdit4, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable4 color
connect(ui->LEdit5, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable5 color
void setLableColor(QLabel *lable, QString txt , QString color)
{
//change the lable color ;
}
before i used to have a textchange slot for each lineEdit and then call the setLableColor from there. but i though maybe is should be a way to just have one slot and connect all the LineEdit to this as im doing the same thing its just a different label.
so, is there a way to connect with this slot ?? or how should i do it ??
Thank you so much in advnace for any help and suggestions.
Im trying to Connect multiple QlineEdit::textChanged(QString) SIGNAL with one SLOT , but in this slot i need it to change the Label color of the particular LineEdit that trigger the Slot.
so how can i connect a textchanged signal correctly to the slot ??
the problem the slot signature is not the same the as signal signature, which i know that u can not connect them this way.
but can i change the signal signature ?? because i need to know the lable for that particular lineEdit.
i'll try to illustrate more by this exmple:
connect(ui->LEdit1, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(..,.,))); // change lable1 color
connect(ui->LEdit2, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable2 color
connect(ui->LEdit3, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable3 color
connect(ui->LEdit4, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable4 color
connect(ui->LEdit5, SIGNAL(textChanged(QString)), this, SLOT(setLableColor(.,.,.))); //change lable5 color
void setLableColor(QLabel *lable, QString txt , QString color)
{
//change the lable color ;
}
before i used to have a textchange slot for each lineEdit and then call the setLableColor from there. but i though maybe is should be a way to just have one slot and connect all the LineEdit to this as im doing the same thing its just a different label.
so, is there a way to connect with this slot ?? or how should i do it ??
Thank you so much in advnace for any help and suggestions.