diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-09-15 12:14:55 +0000 |
commit | b0546e5e7f7044019892543c6c82029db8d564a7 (patch) | |
tree | 1b96a6260900f3fbf3513fb48a5a72aa89052dc8 /attic/muse2-oom/muse2/muse/widgets/spinbox.cpp | |
parent | 583c73d1a07154d3d2672d65d8cce6495f490454 (diff) |
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse2-oom/muse2/muse/widgets/spinbox.cpp')
-rw-r--r-- | attic/muse2-oom/muse2/muse/widgets/spinbox.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/attic/muse2-oom/muse2/muse/widgets/spinbox.cpp b/attic/muse2-oom/muse2/muse/widgets/spinbox.cpp deleted file mode 100644 index ee585da7..00000000 --- a/attic/muse2-oom/muse2/muse/widgets/spinbox.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: spinbox.cpp,v 1.1.2.3 2009/07/09 18:27:11 terminator356 Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#include <QKeyEvent> -#include <QEvent> -#include "spinbox.h" - -//--------------------------------------------------------- -// SpinBox -//--------------------------------------------------------- - -SpinBox::SpinBox(QWidget* parent) - : QSpinBox(parent) -{ - _clearFocus = true; -} - -SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent) - : QSpinBox(parent) -{ - setRange(minValue, maxValue); - setSingleStep(step); - _clearFocus = true; -} - -bool SpinBox::eventFilter(QObject* o, QEvent* ev) -{ - // if (o != (QObject*)editor()) ddskrjo can't find editor() - // return QSpinBox::eventFilter(o,ev); - - bool retval = FALSE; - if(ev->type() == QEvent::KeyPress) - { - QKeyEvent* k = (QKeyEvent*)ev; - if(k->key() == Qt::Key_Up || k->key() == Qt::Key_Down) - { - // stepUp/stepDown will be called. Set this now. - _clearFocus = false; - } - else if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return) - { - // With this line, two enter presses after an edit will clear focus. - // Without, just one enter press clears the focus. - //if(!editor()->isModified()) - { - clearFocus(); - return TRUE; - } - } - } - else - if(ev->type() == QEvent::MouseButtonDblClick) - { - emit doubleClicked(); - return TRUE; - } - - retval = QSpinBox::eventFilter(o, ev); - - return retval; -} - -void SpinBox::stepUp() -{ - QSpinBox::stepUp(); - if(_clearFocus) - clearFocus(); - else - _clearFocus = true; -} - -void SpinBox::stepDown() -{ - QSpinBox::stepDown(); - if(_clearFocus) - clearFocus(); - else - _clearFocus = true; -} - |