Example #1
0
QtItem::QtItem(QGraphicsItem *parent)
  : QGraphicsObject(parent),
    m_clicked_signal{},
    m_n_flashes{0},
    m_pixmap{new QPixmap(":/images/PicR.png")},
    m_timer{new QTimer(this)}
{
  assert(!m_pixmap->isNull()
    && "Assume pixmap is loaded successfully");

  this->setFlags(
      QGraphicsItem::ItemIsMovable
    | QGraphicsItem::ItemIsSelectable
  );


  //Without this line, hoverMoveEvent will not be called
  this->setAcceptHoverEvents(true);

  ///Set the interval between the flickers
  m_timer->setInterval(100); //100 ms

  QObject::connect(m_timer,SIGNAL(timeout()),
    this,SLOT(FlashEvent()));
}
Example #2
0
void CSelfTestMenu::OnButton2(int iEvent, unsigned char * pEventData, int iDataLen)
{
	FlashEvent(1);
	this->ReFresh();
}