Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Blinking a line in qt Painter
Forum Updated to NodeBB v4.3 + New Features

Blinking a line in qt Painter

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    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);
          framepen.setWidth(15);
          painter.setPen(framepen);
        if (state_){
          painter.drawLine(1400,160,1450,210);
          painter.drawLine(1400,260,1450,210);
         } else
       {                //how to make the line disappear?
        }
    

    }

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

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved