demos/embedded/desktopservices/contenttab.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the demonstration applications of the Qt Toolkit.
     7 ** This file is part of the demonstration applications of the Qt Toolkit.
     8 **
     8 **
   112 }
   112 }
   113 
   113 
   114 void ContentTab::keyPressEvent(QKeyEvent *event)
   114 void ContentTab::keyPressEvent(QKeyEvent *event)
   115 {
   115 {
   116     switch (event->key()) {
   116     switch (event->key()) {
   117     case Qt::Key_Up:
       
   118         if (currentRow() == 0) {
       
   119             setCurrentRow(count() - 1);
       
   120         } else {
       
   121             setCurrentRow(currentRow() - 1);
       
   122         }
       
   123         break;
       
   124     case Qt::Key_Down:
       
   125         if (currentRow() == (count() - 1)) {
       
   126             setCurrentRow(0);
       
   127         } else {
       
   128             setCurrentRow(currentRow() + 1);
       
   129         }
       
   130         break;
       
   131     case Qt::Key_Select:
   117     case Qt::Key_Select:
   132         openItem(currentItem());
   118         openItem(currentItem());
   133     default:
   119     default:
   134         QListWidget::keyPressEvent(event);
   120         QListWidget::keyPressEvent(event);
   135         break;
   121         break;