tpf80
20th June 2007, 21:25
I have the following code to change the background of a line edit when it is edited by the user:
ProgramMain::ProgramMain() {
connect( ui.vendorname, SIGNAL( textEdited() ), this, SLOT( colorbackground() ) );
}
ProgramMain::colorbackground() {
ui.vendorname->setStyleSheet( QString( "background-color: yellow"));
}
This works, however I have many line edits in the UI file and I would like to have them all change color if the user edits them.
is there any way I can make a single slot that can handle any line edit? Or will I need to make a slot for each line edit that I want to change the color for?
ProgramMain::ProgramMain() {
connect( ui.vendorname, SIGNAL( textEdited() ), this, SLOT( colorbackground() ) );
}
ProgramMain::colorbackground() {
ui.vendorname->setStyleSheet( QString( "background-color: yellow"));
}
This works, however I have many line edits in the UI file and I would like to have them all change color if the user edits them.
is there any way I can make a single slot that can handle any line edit? Or will I need to make a slot for each line edit that I want to change the color for?