How to blink a pushbutton(Solved)
-
Hi
Anyone can comment why the code below cannot blink a pushbutton
while(5<6)
connect(&timer1,SIGNAL(timeout()),this,SLOT(setvisible));
connect(&timer2,SIGNAL(timeout()),this,SLOT(setinvisible));
}
void setvisible()
{
ui->pb->setvisible(true);
}voi setinvisible()
{
ui->pb2->setvisible(false);
} -
[quote author="houmingc" date="1414875115"]
@
while(5<6) < infinite loop ?
connect(&timer1,SIGNAL(),this,SLOT (setvisible()); <- why two timers ?
connect(&timer2,SIGNAL(),this,SLOT (setinvisible()); <- are the timers class variables ?
}
void setvisible()
{
ui->pb->setvisible(true);
}voi setinvisible()
{
ui->pb2->setvisible(false);
}@
[/quote]Simpler version
@
connect(timer,SIGNAL(),this,SLOT (toggleVisibility());
}
void toggleVisibility()
{
ui->pb->setVisible(!ui-->pb->isVisible());
}
@