0

I've created a QWidget, which contains three QLineEdits. Then I added a overwrote the keyPressEvent so that this lineEdit_3 reacts on key press. Working good.

void MySuperWidget::keyPressEvent(QKeyEvent* keyEv)
{
  switch (keyEv->key()) {
    case Qt::Key_Up: 
       //.. stuff
       break;

    case Qt::Key_Down: {
        //.. stuff
        }
        break;
      default:
        break;
    }
}

BUT the first and second QLineEdit also react on keypress :(

I need somethng like this:

  if (sender() != ui->lineEdit_3 ) {
    keyEv->ignore();
  }
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103

0 Answers0