Using QTimeline to bink textedit box instead (Solved)



  • Below is my code using Qtimer, i like to get a sample code for using Qtimeline, please kindly assist.



  • 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();
    }



  • how to delete post



  • 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?



  • 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++;
    }
    }



  • 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++;
    }
    }



  • good. Do you have any idea by changing image using keypress.



  • 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++;
    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.