/****************************************************************************** * Receives events destined for the spin widget or for the edit field. */ bool SpinBox::eventFilter(QObject* obj, QEvent* e) { if (obj == lineEdit()) { int step = 0; switch (e->type()) { case QEvent::KeyPress: { // Up and down arrow keys step the value QKeyEvent* ke = (QKeyEvent*)e; int key = ke->key(); if (key == Qt::Key_Up) step = 1; else if (key == Qt::Key_Down) step = -1; break; } case QEvent::Wheel: { QWheelEvent* we = (QWheelEvent*)e; step = (we->delta() > 0) ? 1 : -1; break; } default: break; } if (step) { if (mReadOnly) return true; // discard up/down arrow keys QInputEvent* ie = (QInputEvent*)e; if ((ie->modifiers() & (Qt::ShiftModifier | Qt::AltModifier)) == Qt::ShiftModifier) { // Shift stepping int val = value(); if (step > 0) step = mLineShiftStep - val % mLineShiftStep; else step = - ((val + mLineShiftStep - 1) % mLineShiftStep + 1); } else step = (step > 0) ? mLineStep : -mLineStep; addValue(step, false); return true; } } return QSpinBox::eventFilter(obj, e); }
static PyObject *meth_QInputEvent_modifiers(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QInputEvent *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QInputEvent, &sipCpp)) { Qt::KeyboardModifiers *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = new Qt::KeyboardModifiers(sipCpp->modifiers()); Py_END_ALLOW_THREADS return sipConvertFromNewType(sipRes,sipType_Qt_KeyboardModifiers,NULL); } }
static PyObject *meth_QInputEvent_setTimestamp(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { ulong a0; QInputEvent *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "Bm", &sipSelf, sipType_QInputEvent, &sipCpp, &a0)) { sipCpp->setTimestamp(a0); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QInputEvent, sipName_setTimestamp, doc_QInputEvent_setTimestamp); return NULL; }