0

I want to show osk.exe(onscreenkeyboard) when click on the QLineEdit and when focus out osk.exe hide or minimized? how can i do?

thanks

Sarkhan
  • 1,281
  • 1
  • 11
  • 33

1 Answers1

0

You need to use a QProcess and reimplement the methods QLineEdit::focusInEvent and QLineEdit::focusOutEvent. Try implement a class inheriting from QLineEdit like this:

#include <QLineEdit>
#include <QProcess>

class MyLineEdit: public QLineEdit
{
public:
    MyLineEdit(QWidget * parent = 0): QLineEdit(parent) 
    {
        process_ = new QProcess();
    }

protected:
    void focusInEvent(QFocusEvent * e)
    {
        QLineEdit::focusInEvent(e);
        process_->start("start C:\\osk.exe"); 
    }
    void focusOutEvent(QFocusEvent * e)
    {
        QLineEdit::focusOutEvent(e);
        process_->kill(); 
    }

private:
    QProcess * process_;
}

(Of course replace C:\\osk.exe by the exact address of this osk.exe).

Then just use a MyLineEdit instead of a QLineEdit, it should work. I do not know how to hide or minimize the process, so I decided to kill it and restart it if necessary instead ;-)

Boris Dalstein
  • 7,015
  • 4
  • 30
  • 59