void Dentry::wheelEvent(QWheelEvent* event) { // Avoid unwanted wheel events from outside the control. // Tested: No go, can't seem to determine where event came from. /* const QPoint gp = mapToGlobal(event->pos()); const QRect gr = QRect(mapToGlobal(rect().topLeft()), mapToGlobal(rect().bottomRight())); if(!gr.contains(gp)) */ //if(sender() != this) //{ // event->ignore(); // return; //} event->accept(); int delta = event->delta(); if (delta < 0) { if (_slider) _slider->stepPages(-1); else decValue(-1.0); } else if (delta > 0) { if (_slider) _slider->stepPages(1); else incValue(1.0); } }
void FloatEntry::repeat() { if (timecount == 1) { ++timecount; timer->stop(); timer->start(TIMER2); return; } ++timecount; if (timecount == TIMEC) { timer->stop(); timer->start(TIMER3); } if (timecount == TIMEC2) { timer->stop(); timer->start(TIMER4); } switch (button) { case Qt::LeftButton: return; case Qt::MidButton: decValue(evx); break; case Qt::RightButton: incValue(evx); break; default: break; } }
/** * @brief change the value of the spinner of one step * @param[in] node Spinner to change * @param[in] down Direction of the step (if down is true, decrease the value) */ bool uiSpinnerNode::step (uiNode_t *node, bool down) { if (!down) { return incValue(node); } else { return decValue(node); } }
void FloatEntry::wheelEvent(QWheelEvent* event) { int delta = event->delta(); if (delta < 0) decValue(-1.0); else if (delta > 0) incValue(1.0); }
void Nentry::wheel(QWheelEvent* event) { int n = event->delta(); if (n > 0) incValue(n); else decValue(-n); event->accept(); }
void Dentry::repeat() { if (timecount == 1) { ++timecount; timer->stop(); timer->start(TIMER2); return; } ++timecount; if (timecount == TIMEC) { timer->stop(); timer->start(TIMER3); } if (timecount == TIMEC2) { timer->stop(); timer->start(TIMER4); } switch (button) { case Qt::LeftButton: return; case Qt::MidButton: if (_slider) _slider->stepPages(-1); else decValue(evx); break; case Qt::RightButton: if (_slider) _slider->stepPages(1); else incValue(evx); break; default: break; } }
/**************************************************************************//*** * @brief Executes the step-down of the resistance. * * @return None. *******************************************************************************/ void DoDecrement(double* param, char paramNo) // "decrement=" command { unsigned char stepNo = 0; unsigned char counter = 0; if(paramNo >= 1) { paramLimit(¶m[0], 0, MAX_POS); stepNo = (unsigned char)param[0]; for (counter = 0; counter < stepNo; counter++) { decValue(); } CONSOLE_Print("Resistor value was decreased with %d steps.\r\n", stepNo); } else { /* Display error messages */ DisplayError(2); } }
void Nentry::repeat() { if (timecount == 1) { ++timecount; timer->stop(); timer->start(TIMER2); return; } ++timecount; if (timecount == TIMEC) { timer->stop(); timer->start(TIMER3); } if (timecount == TIMEC2) { timer->stop(); timer->start(TIMER4); } switch (button) { case Qt::LeftButton: return; case Qt::MidButton: decValue(evx); break; case Qt::RightButton: incValue(evx); break; default: break; } if (focusW) focusW->setFocus(); edit->clearFocus(); }
bool Nentry::keyPress(QKeyEvent* event) { bool shift = event->modifiers() & Qt::ShiftModifier; bool ctrl = event->modifiers() & Qt::ControlModifier; int key = event->key(); if (shift) { switch (key) { case Qt::Key_Left: case Qt::Key_Right: return false; default: return true; } return true; } if (ctrl) { switch (key) { case Qt::Key_A: case Qt::Key_B: case Qt::Key_C: case Qt::Key_D: case Qt::Key_E: case Qt::Key_F: case Qt::Key_H: case Qt::Key_V: case Qt::Key_X: case Qt::Key_Z: case Qt::Key_Y: return false; default: return true; } return true; } if (event->modifiers()) return true; switch (key) { case Qt::Key_Up: incValue(0); return true; case Qt::Key_Down: decValue(0); return true; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case Qt::Key_Minus: case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Backspace: case Qt::Key_Home: case Qt::Key_End: case Qt::Key_Delete: case Qt::Key_Return: return false; default: break; } return true; }