Important: Please read the Qt Code of Conduct -

Blinking a line in qt Painter

  • Managed to draw an arrow with paintEvent.
    Now i need to make it blink. Like to get some pointer.

    void MainWindow:: paintEvent(QPaintEvent *event)

          QPen framepen(Qt::blue);
        if (state_){
         } else
       {                //how to make the line disappear?


    class MainWindow :public QMainWindow
    bool state_;
    QTimer* timer;


  • Lifetime Qt Champion


    One technique would be to clear your widget before doing any painting so you would only paint the arrow when you want it, otherwise you could repaint with the same color as the background.

    Hope it helps

Log in to reply