jmqt
22nd July 2009, 14:37
OK. Quick question: When I click on my button it goes from red to green, however, when I want to turn the button off, it does not turn back to red. Does anyone have any suggestions.
button->setChecked(true);
button->setStyleSheet(QString("QPushButton {background-color: red;}"));
connect(button,SIGNAL(pressed()),this,SLOT(onoff() ));
void Dialog::onoff()
{
button->setChecked(false);
button->setStyleSheet(QString("QPushButton {background-color: green;}"));
*
*
button->setChecked(true);
button->setStyleSheet(QString("QPushButton {background-color: red;}"));
connect(button,SIGNAL(pressed()),this,SLOT(onoff() ));
void Dialog::onoff()
{
button->setChecked(false);
button->setStyleSheet(QString("QPushButton {background-color: green;}"));
*
*