Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make cells blinking in a QTableView
Forum Updated to NodeBB v4.3 + New Features

How to make cells blinking in a QTableView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.4k Views 1 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.
  • Q Offline
    Q Offline
    quadbyte
    wrote on last edited by
    #1

    Hi,

    I am trying to 'blink' a cell in a QTableView each time the content changes. By blinking I means the background color is set to a particular color then after a short time, returns to the original color.

    I thinking about a way by QItemDelegate, but do no figure out how to 'resent' an event to the delegate object to set the background back to original color without 'stimulation' of the model. May be by a timer ?!

    Thanks for all your comments, I am stuck...

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      You could do it in the model you have.
      Yust create a timer (singleSAhot would be enough) and emit the dataChanged() signal from the model. By switching a value that indicates the color you've got it.

      The delegate does not work here, as it is used for painting but does not trigger it.

      so, in pseudo code, it would be:

      @
      MyModel::setData()
      {
      m_blinkCell = XXX;
      QTimer::singleShot(..., resetBlink);
      emit dataChanged(changedCell);
      }

      MyModel::data()
      {
      if(index.cell == m_blinkCell && role==background)
      return Qt::red;
      return defaultImpl;
      }

      MyModel::resetBlink()
      {
      m_blinkCell = none;
      emit dataChanged(changedCell);
      }
      @

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        quadbyte
        wrote on last edited by
        #3

        Impressive Gerolf... I am trying your idea now
        thanks :)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          If you have any further questions, just ask. It was a short shot, but it will work :-)

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          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