Hi all,

I have a Keyboard that shall be opened, when I tap a QLineEdit on a touch screen.

This works fine, but the problem is that the Keyboard is some kind of not Focussed, when I open it a second and/or a third time. So I have to tap on the Keyboard first and then it handles my inputs.

My Code:

Qt Code:
  1. main.cpp:
  2.  
  3. screenLogin::screenLogin(QWidget *parent) :
  4. QWidget(parent),
  5. ui(new Ui::screenLogin)
  6. {
  7. ui->setupUi(this);
  8. keyboardlogin = new Keyboard(this); // Keyboard is set to private in .h-file
  9. keyboardlogin->close(); // have to close it here, because it opens automatically
  10.  
  11. QObject::connect(ui->editFieldPassword,SIGNAL(selectionChanged()), keyboardlogin,SLOT(runKeyboard()));
To copy to clipboard, switch view to plain text mode 

Keyboard.cpp:

Qt Code:
  1. void Keyboard::runKeyboard()
  2. {
  3. qDebug() << "KeyboardVisible?" << isVisible() << isActiveWindow();
  4. if(!ALREADY_OPEN){
  5. ALREADY_OPEN = true;
  6. QLineEdit *line = (QLineEdit *)sender();
  7. line->deselect();
  8. setLineEdit(line);
  9. this->keyboardCaller = line->objectName();
  10. this->keyboard_ui->lineEdit->setText(line->text());
  11.  
  12. outputText = "";
  13. currentCursorPos = line->text().length();
  14. outputText = line->text();
  15. this->keyboard_ui->lblMinMax->setVisible(false);
  16. this->setWindowModality(Qt::ApplicationModal);
  17. this->setWindowFlags(Qt::SplashScreen);
  18. this->show();
  19. // this->setFocus();
  20. qDebug() << "KeyboardVisible2?" << isVisible() << QApplication::activeWindow();
  21. }
  22. }
To copy to clipboard, switch view to plain text mode 

Does anyone know what I am doing wrong?

Thanks.