File indexing completed on 2024-05-12 16:23:32
0001 0002 /*************************************************************************** 0003 * Copyright (C) 2005-2008 by Bjoern Erik Nilsen & Fredrik Berg Kjoelstad* 0004 * bjoern.nilsen@bjoernen.com & fredrikbk@hotmail.com * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0020 ***************************************************************************/ 0021 #ifndef FLEXIBLESPINBOX_H 0022 #define FLEXIBLESPINBOX_H 0023 0024 #include <QSpinBox> 0025 0026 class QKeyEvent; 0027 0028 /** 0029 * An extended spin box class. 0030 * @author Bjoern Erik Nilsen & Fredrik Berg Kjoelstad 0031 */ 0032 class FlexibleSpinBox : public QSpinBox 0033 { 0034 Q_OBJECT 0035 public: 0036 0037 /** 0038 * Constructs and initializes the object. 0039 * @param parent the parent widget 0040 */ 0041 FlexibleSpinBox(QWidget *parent = 0); 0042 0043 /** 0044 * Checks what kind of key event the user has requested and 0045 * does actions based on this. 0046 * @param k the key event 0047 */ 0048 void keyPressEvent( QKeyEvent * k ); 0049 0050 public slots: 0051 /** 0052 * Sets a limit for the maximum value. This is based on the 0053 * the thumbnails displayed in the framebar. 0054 * @param maxValue maximum value (index of the last frame in framebar) 0055 */ 0056 void setMaximumValue(int maxValue); 0057 0058 /** 0059 * Sets the value to one more than @a index. 0060 */ 0061 void setIndexSecond(int, int index); 0062 0063 signals: 0064 /** 0065 * Emits this signal when pressing enter. 0066 * @param frameNumber the chosen frame number in this spinbox 0067 */ 0068 void spinBoxTriggered(int frameNumber); 0069 0070 /** 0071 * Emits this signal when getting an escape event (Key_Escape). 0072 */ 0073 void spinBoxCanceled(); 0074 0075 protected: 0076 void showEvent(QShowEvent * event); 0077 }; 0078 0079 #endif