diff options
Diffstat (limited to 'kalarm/lib/spinbox.cpp')
-rw-r--r-- | kalarm/lib/spinbox.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/kalarm/lib/spinbox.cpp b/kalarm/lib/spinbox.cpp index bb9ef2441..6145114a3 100644 --- a/kalarm/lib/spinbox.cpp +++ b/kalarm/lib/spinbox.cpp @@ -19,21 +19,21 @@ */ #include <kdeversion.h> -#include <qlineedit.h> -#include <qobjectlist.h> +#include <tqlineedit.h> +#include <tqobjectlist.h> #include "spinbox.moc" -SpinBox::SpinBox(QWidget* parent, const char* name) - : QSpinBox(0, 99999, 1, parent, name), - mMinValue(QSpinBox::minValue()), - mMaxValue(QSpinBox::maxValue()) +SpinBox::SpinBox(TQWidget* parent, const char* name) + : TQSpinBox(0, 99999, 1, parent, name), + mMinValue(TQSpinBox::minValue()), + mMaxValue(TQSpinBox::maxValue()) { init(); } -SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent, const char* name) - : QSpinBox(minValue, maxValue, step, parent, name), +SpinBox::SpinBox(int minValue, int maxValue, int step, TQWidget* parent, const char* name) + : TQSpinBox(minValue, maxValue, step, parent, name), mMinValue(minValue), mMaxValue(maxValue) { @@ -42,7 +42,7 @@ SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent, const ch void SpinBox::init() { - int step = QSpinBox::lineStep(); + int step = TQSpinBox::lineStep(); mLineStep = step; mLineShiftStep = step; mCurrentButton = NO_BUTTON; @@ -56,8 +56,8 @@ void SpinBox::init() // Find the spin widgets which are part of the spin boxes, in order to // handle their shift-button presses. - QObjectList* spinwidgets = queryList("QSpinWidget", 0, false, true); - QSpinWidget* spin = (QSpinWidget*)spinwidgets->getFirst(); + TQObjectList* spinwidgets = queryList("TQSpinWidget", 0, false, true); + TQSpinWidget* spin = (TQSpinWidget*)spinwidgets->getFirst(); if (spin) spin->installEventFilter(this); // handle shift-button presses delete spinwidgets; @@ -65,7 +65,7 @@ void SpinBox::init() #if KDE_IS_VERSION(3,1,90) // Detect when the text field is edited - connect(editor(), SIGNAL(textChanged(const QString&)), SLOT(textEdited())); + connect(editor(), TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(textEdited())); #endif } @@ -88,14 +88,14 @@ int SpinBox::bound(int val) const void SpinBox::setMinValue(int val) { mMinValue = val; - QSpinBox::setMinValue(val); + TQSpinBox::setMinValue(val); mShiftMinBound = false; } void SpinBox::setMaxValue(int val) { mMaxValue = val; - QSpinBox::setMaxValue(val); + TQSpinBox::setMaxValue(val); mShiftMaxBound = false; } @@ -103,26 +103,26 @@ void SpinBox::setLineStep(int step) { mLineStep = step; if (!mShiftMouse) - QSpinBox::setLineStep(step); + TQSpinBox::setLineStep(step); } void SpinBox::setLineShiftStep(int step) { mLineShiftStep = step; if (mShiftMouse) - QSpinBox::setLineStep(step); + TQSpinBox::setLineStep(step); } void SpinBox::stepUp() { - int step = QSpinBox::lineStep(); + int step = TQSpinBox::lineStep(); addValue(step); emit stepped(step); } void SpinBox::stepDown() { - int step = -QSpinBox::lineStep(); + int step = -TQSpinBox::lineStep(); addValue(step); emit stepped(step); } @@ -135,8 +135,8 @@ void SpinBox::stepDown() void SpinBox::addValue(int change, bool current) { int newval = value() + change; - int maxval = current ? QSpinBox::maxValue() : mMaxValue; - int minval = current ? QSpinBox::minValue() : mMinValue; + int maxval = current ? TQSpinBox::maxValue() : mMaxValue; + int minval = current ? TQSpinBox::minValue() : mMinValue; if (wrapping()) { int range = maxval - minval + 1; @@ -163,20 +163,20 @@ void SpinBox::valueChange() if (mShiftMinBound && val >= mMinValue) { // Reinstate the minimum bound now that the value has returned to the normal range. - QSpinBox::setMinValue(mMinValue); + TQSpinBox::setMinValue(mMinValue); mShiftMinBound = false; } if (mShiftMaxBound && val <= mMaxValue) { // Reinstate the maximum bound now that the value has returned to the normal range. - QSpinBox::setMaxValue(mMaxValue); + TQSpinBox::setMaxValue(mMaxValue); mShiftMaxBound = false; } bool focus = !mSelectOnStep && hasFocus(); if (focus) clearFocus(); // prevent selection of the spin box text - QSpinBox::valueChange(); + TQSpinBox::valueChange(); if (focus) setFocus(); } @@ -193,13 +193,13 @@ void SpinBox::textEdited() void SpinBox::updateDisplay() { mEdited = false; - QSpinBox::updateDisplay(); + TQSpinBox::updateDisplay(); } /****************************************************************************** * Receives events destined for the spin widget or for the edit field. */ -bool SpinBox::eventFilter(QObject* obj, QEvent* e) +bool SpinBox::eventFilter(TQObject* obj, TQEvent* e) { if (obj == editor()) { @@ -207,10 +207,10 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) bool shift = false; switch (e->type()) { - case QEvent::KeyPress: + case TQEvent::KeyPress: { // Up and down arrow keys step the value - QKeyEvent* ke = (QKeyEvent*)e; + TQKeyEvent* ke = (TQKeyEvent*)e; int key = ke->key(); if (key == Qt::Key_Up) step = 1; @@ -219,15 +219,15 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) shift = ((ke->state() & (Qt::ShiftButton | Qt::AltButton)) == Qt::ShiftButton); break; } - case QEvent::Wheel: + case TQEvent::Wheel: { - QWheelEvent* we = (QWheelEvent*)e; + TQWheelEvent* we = (TQWheelEvent*)e; step = (we->delta() > 0) ? 1 : -1; shift = ((we->state() & (Qt::ShiftButton | Qt::AltButton)) == Qt::ShiftButton); break; } #if KDE_IS_VERSION(3,1,90) - case QEvent::Leave: + case TQEvent::Leave: if (mEdited) interpretText(); break; @@ -259,10 +259,10 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) int etype = e->type(); // avoid switch compile warnings switch (etype) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonDblClick: { - QMouseEvent* me = (QMouseEvent*)e; + TQMouseEvent* me = (TQMouseEvent*)e; if (me->button() == Qt::LeftButton) { // It's a left button press. Set normal or shift stepping as appropriate. @@ -278,9 +278,9 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) } break; } - case QEvent::MouseButtonRelease: + case TQEvent::MouseButtonRelease: { - QMouseEvent* me = (QMouseEvent*)e; + TQMouseEvent* me = (TQMouseEvent*)e; if (me->button() == Qt::LeftButton && mShiftMouse) { setShiftStepping(false, mCurrentButton); // cancel shift stepping @@ -288,9 +288,9 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) } break; } - case QEvent::MouseMove: + case TQEvent::MouseMove: { - QMouseEvent* me = (QMouseEvent*)e; + TQMouseEvent* me = (TQMouseEvent*)e; if (me->state() & Qt::LeftButton) { // The left button is down. Track which spin button it's in. @@ -310,19 +310,19 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) } break; } - case QEvent::Wheel: + case TQEvent::Wheel: { - QWheelEvent* we = (QWheelEvent*)e; + TQWheelEvent* we = (TQWheelEvent*)e; bool shift = (we->state() & (Qt::ShiftButton | Qt::AltButton)) == Qt::ShiftButton; if (setShiftStepping(shift, (we->delta() > 0 ? UP : DOWN))) return true; // hide the event from the spin widget return false; // forward event to the destination widget } - case QEvent::KeyPress: - case QEvent::KeyRelease: - case QEvent::AccelOverride: // this is needed to receive Shift presses! + case TQEvent::KeyPress: + case TQEvent::KeyRelease: + case TQEvent::AccelOverride: // this is needed to receive Shift presses! { - QKeyEvent* ke = (QKeyEvent*)e; + TQKeyEvent* ke = (TQKeyEvent*)e; int key = ke->key(); int state = ke->state(); if ((state & Qt::LeftButton) @@ -345,7 +345,7 @@ bool SpinBox::eventFilter(QObject* obj, QEvent* e) } } } - return QSpinBox::eventFilter(obj, e); + return TQSpinBox::eventFilter(obj, e); } /****************************************************************************** @@ -389,7 +389,7 @@ bool SpinBox::setShiftStepping(bool shift, int currentButton) newval = mMinValue; else newval = (newval <= minval) ? minval : mMaxValue; - QSpinBox::setValue(newval); + TQSpinBox::setValue(newval); emit stepped(step); return true; } @@ -399,12 +399,12 @@ bool SpinBox::setShiftStepping(bool shift, int currentButton) int tempval = val + adjust; if (tempval < mMinValue) { - QSpinBox::setMinValue(tempval); + TQSpinBox::setMinValue(tempval); mShiftMinBound = true; } else if (tempval > mMaxValue) { - QSpinBox::setMaxValue(tempval); + TQSpinBox::setMaxValue(tempval); mShiftMaxBound = true; } } @@ -417,14 +417,14 @@ bool SpinBox::setShiftStepping(bool shift, int currentButton) blockSignals(blocked); mSuppressSignals = false; } - QSpinBox::setLineStep(mLineShiftStep); + TQSpinBox::setLineStep(mLineShiftStep); } else if (!shift && mShiftMouse) { // Reinstate to normal (non-shift) stepping - QSpinBox::setLineStep(mLineStep); - QSpinBox::setMinValue(mMinValue); - QSpinBox::setMaxValue(mMaxValue); + TQSpinBox::setLineStep(mLineStep); + TQSpinBox::setMinValue(mMinValue); + TQSpinBox::setMaxValue(mMaxValue); mShiftMinBound = mShiftMaxBound = false; mShiftMouse = false; } @@ -466,7 +466,7 @@ int SpinBox::shiftStepAdjustment(int oldValue, int shiftStep) /****************************************************************************** * Find which spin widget button a mouse event is in. */ -int SpinBox::whichButton(const QPoint& pos) +int SpinBox::whichButton(const TQPoint& pos) { if (upRect().contains(pos)) return UP; |