void QcNumberBox::keyPressEvent ( QKeyEvent * event ) { if( !isReadOnly() ) return QLineEdit::keyPressEvent( event ); int key = event->key(); if( key == Qt::Key_Up ){ stepBy( 1, step ); Q_EMIT( action() ); return; } else if( key == Qt::Key_Down ) { stepBy( -1, step ); Q_EMIT( action() ); return; } else { // unlock typing if valid char is entered QString t = event->text(); int i = 0; if( !t.isEmpty() && ( _validator->validate( t, i ) != QValidator::Invalid ) ) { blockSignals(true); clear(); blockSignals( false ); setLocked( false ); } } QLineEdit::keyPressEvent( event ); }
void CodeSpinBox::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = codeLineEdit()->createStandardContextMenu(); menu->addSeparator(); const uint se = stepEnabled(); QAction *up = menu->addAction(tr("&Step up")); up->setShortcut(QKeySequence(Qt::Key_Up)); up->setEnabled(se & StepUpEnabled); QAction *down = menu->addAction(tr("Step &down")); down->setShortcut(QKeySequence(Qt::Key_Down)); down->setEnabled(se & StepDownEnabled); menu->addSeparator(); codeLineEdit()->addShortcuts(menu); const QAction *action = menu->exec(event->globalPos()); if(action == up) stepBy(1); else if(action == down) stepBy(-1); delete menu; event->accept(); }
void SpinBox::keyPressEvent(QKeyEvent *event) { int steps = 1; if ((event->key() >= Qt::Key_0) && (event->key() <= Qt::Key_9)) return; if ((event->key() >= Qt::Key_A) && (event->key() <= Qt::Key_Z)) return; switch (event->key()) { case Qt::Key_Left: focusPreviousChild(); break; case Qt::Key_Right: focusNextChild(); break; case Qt::Key_F2: case Qt::Key_F4: { event->accept(); const bool up = (event->key() == Qt::Key_F2); if (!(stepEnabled() & (up ? StepUpEnabled : StepDownEnabled))) return; if (!up) steps *= -1; stepBy(steps); return; } default: QSpinBox::keyPressEvent(event); } }
void QDateEdit_QtDShell::__override_stepBy(int steps0, bool static_call) { if (static_call) { QDateTimeEdit::stepBy((int )steps0); } else { stepBy((int )steps0); } }
void QcNumberBox::wheelEvent ( QWheelEvent * event ) { if( scroll && isReadOnly() && _valueType == Number && event->orientation() == Qt::Vertical ) { stepBy( event->delta() > 0 ? 1 : -1, scrollStep ); Q_EMIT( action() ); } }
void DurationSpinBox::keyPressEvent( QKeyEvent * event ) { //kDebug(planDbg())<<lineEdit()->cursorPosition()<<","<<(text().size() - Duration::unitToString( m_unit, true ).size())<<""<<event->text().isEmpty(); if ( isOnUnit() ) { // we are in unit switch (event->key()) { case Qt::Key_Up: event->accept(); stepBy( 1 ); return; case Qt::Key_Down: event->accept(); stepBy( -1 ); return; default: break; } } QDoubleSpinBox::keyPressEvent(event); }
void QcNumberBox::mouseMoveEvent ( QMouseEvent * event ) { if( scroll && isReadOnly() && _valueType == Number && ( event->buttons() & Qt::LeftButton ) ) { int steps = (event->globalY() - lastPos) / dragDist; if( steps != 0 ) { lastPos = lastPos + (steps * dragDist); stepBy( -steps, scrollStep ); Q_EMIT( action() ); } } else QLineEdit::mouseMoveEvent( event ); }
void DhQAbstractSpinBox::DvhstepBy(int x1) { return stepBy(x1); }
void NumberBoxWidget::scrollBy( int steps ) { stepBy( steps, scrollStep ); }
void NumberBoxWidget::stepBy( int steps ) { stepBy( steps, singleStep() ); }
void gsCamera::back() { stepBy(1.0f); }
void gsCamera::foward() { stepBy(-1.0f); }