Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void PictureFlow::keyPressEvent ( QKeyEvent event  )  [protected, virtual]

This event handler, for event event, can be reimplemented in a subclass to receive key press events for the widget.

A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.

If you reimplement this handler, it is very important that you call the base class implementation if you do not act upon the key.

The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored, so that the widget's parent can interpret it.

Note that QKeyEvent starts with isAccepted() == true, so you do not need to call QKeyEvent::accept() - just do not call the base class implementation if you act upon the key.

See also:
keyReleaseEvent(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent, {Tetrix Example}

Reimplemented from QWidget.

Definition at line 1215 of file pictureflow.cpp.

References currentSlide(), QKeyEvent::key(), QKeyEvent::modifiers(), showNext(), showPrevious(), and showSlide().

{
  if(event->key() == Qt::Key_Left)
  {
    if(event->modifiers() == Qt::ControlModifier)
      showSlide(currentSlide()-10);
    else  
      showPrevious();
    event->accept();
    return;
  }

  if(event->key() == Qt::Key_Right)
  {
    if(event->modifiers() == Qt::ControlModifier)
      showSlide(currentSlide()+10);
    else
      showNext();
    event->accept();
    return;
  }

  event->ignore();
}


Generated by  Doxygen 1.6.0   Back to index