Esempio n. 1
0
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 );
}
Esempio n. 2
0
	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();
	}
Esempio n. 3
0
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);
    }
}
Esempio n. 4
0
void QDateEdit_QtDShell::__override_stepBy(int  steps0, bool static_call)
{
    if (static_call) {
        QDateTimeEdit::stepBy((int )steps0);
    } else {
        stepBy((int )steps0);
    }
}
Esempio n. 5
0
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);
}
Esempio n. 7
0
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 );
}
Esempio n. 8
0
void DhQAbstractSpinBox::DvhstepBy(int x1) {
  return stepBy(x1);
}
Esempio n. 9
0
void NumberBoxWidget::scrollBy( int steps )
{
  stepBy( steps, scrollStep );
}
Esempio n. 10
0
void NumberBoxWidget::stepBy( int steps )
{
  stepBy( steps, singleStep() );
}
Esempio n. 11
0
void gsCamera::back()
{
	stepBy(1.0f);
}
Esempio n. 12
0
void gsCamera::foward()
{
	stepBy(-1.0f);
}