I am trying to pass a QLabel as a parameter to another function that is supposed to change the style of the label:
main
{
...
setSeatColor(ui->lblPan2Seat5B, 2);
}
void setSeatColor(QLabel& lbl, int i)
{
if(i == 1)
{
lbl.setStyleSheet("QLabel { background-color : blue; color : white; }");
}
else if(i == 2)
{
lbl.setStyleSheet("QLabel { background-color : red; color : white; }");
}
else if(i == 3)
{
lbl.setStyleSheet("QLabel { background-color : green; color : white; }");
}
else
{
lbl.setStyleSheet("QLabel { background-color : rgb(240,240,240); color : back; }");
}
}
The error in the function:
"No matching function for call to setSeatColor(QLabel*&,int)"
Your help is much appreciated!