简体   繁体   中英

QLineEdit Subclassing

I have Subclassed QlineEdit . Since I needed a specific operation on mousePress Event.
Now, as soon as I click the mouse on the subclassed QlineEdit (I call it CustomLineEdit). I am trying to pop up a virtual keyboard. A new Window panel shows up, but the virtual keyboard is not showing up. I have checked for the correctness of the virtual keyboard by using it on other classes.

This is my code:

void CustomLineEdit::mousePressEvent(QMouseEvent *s)
{
    qDebug() << " Custom Line EDit is kicking";
    myKeyBoard->show(this); // once created keyboard object, use this method to switch between windows
    myKeyBoard->move(0, 0 + myKeyBoard->height() + 175); // to move keyboard
}

Btw, the virtual keyboard was downloaded from this link .

Any suggestions will highly be appreciated.

myKeyBoard->show(this);

This show method needs a parent to drawing into this widget. If a widget is into another one, it cannot paint out of parent's work area. Maybe, if you change the line in this way, virtual keyboard will show:

myKeyBoard->show( parent( ) );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM