Using QTimeline to bink textedit box instead (Solved)
-
wrote on 25 Sept 2014, 15:39 last edited by
Below is my code using Qtimer, i like to get a sample code for using Qtimeline, please kindly assist.
-
wrote on 25 Sept 2014, 15:41 last edited by
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(1000);
textlabel=color1;void blinkme()
{
if(textlabel = color1)
textlabel->clear
else textlabel->color1
update();
} -
wrote on 25 Sept 2014, 15:52 last edited by
how to delete post
-
wrote on 25 Sept 2014, 15:55 last edited by
QColor red;
QColor green;
int mybuttonState;
connect(timer, SIGNAL(timeout),this, SLOT(Changecolor));
mybuttonState=1;Changecolor()
{
mybuttonState= ++mybuttonState;
if(++mybuttonState%2 ==0)
txtlabel->red
else txtlabel->green;
}mybuttonState is initially set as 1, when slot activates, mybuttonState adds 1 and if division remainder result in 0 txtlabel is red else green.
Thus label blinks 1sec red, green. Using Qtimeline? -
wrote on 30 Sept 2014, 02:07 last edited by
I successfully implemented one basic timer. Below is workable code.
My problem is when i implemented three basic timer. do i need 3 timerEvent??? The document in the net is not comprehensive enough. Does 3 timer use 3 timer handler or just one time handler?#include <QBasicTimer>
MainWindow::MainWindow
{ ui->setupui(this);
step1=3;
timer1.start(600, this);
}MainWindow::timerEvent1( QTimerEvent *event )
{ if( event->timerid() == timer1.timerid() )
{ update();
} else
{ MainWindow::timerEvent1(event);
}
}MainWindow::Update()
{ if(set1%2)
{ ui->label->setText("hello");
step1--;
} else
{ ui->label->setText("GoodBye");
step1++;
}
} -
wrote on 30 Sept 2014, 02:08 last edited by
I successfully implemented one basic timer. Below is workable code.
My problem is when i implemented three basic timer. do i need 3 timerEvent??? The document in the net is not comprehensive enough. Does 3 timer use 3 timer handler or just one time handler?#include <QBasicTimer>
MainWindow::MainWindow
{ ui->setupui(this);
step1=3;
timer1.start(600, this);
}MainWindow::timerEvent1( QTimerEvent *event )
{ if( event->timerid() == timer1.timerid() )
{ update();
} else
{ MainWindow::timerEvent1(event);
}
}MainWindow::Update()
{ if(set1%2)
{ ui->label->setText("hello");
step1--;
} else
{ ui->label->setText("GoodBye");
step1++;
}
} -
wrote on 30 Sept 2014, 04:30 last edited by
good. Do you have any idea by changing image using keypress.
-
wrote on 1 Nov 2014, 15:32 last edited by
how to make pushbutton blink instead. I fail to do it after my vacation.
I forget everything.Timer3update()
{
ui->PBleftdoorOpen->setvisible(1);
timer3step - -;
}
else
{
ui->PBrightdoorOpen->setvisible(0);
timer3step++;
}