Qt - A login dialog

Posted by Narek on Stack Overflow See other posts from Stack Overflow or by Narek
Published on 2010-06-10T10:55:47Z Indexed on 2010/06/10 11:12 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

I want to create a login dialog by inheriting QDialog. I put in subclass named LoginDialog 2 QLineEdits:

  1. for login
  2. for password.

I want to be able to warn the user with a message if the caps lock is ON while he will start to fill passwordLineEdit. Suppose I have a function that tells the current state of CapsLock button. So I want to do eventFiltering in LoginDialog class in order to understand that user starts to fill the password field (i.e. user just stepped into the password field)

So for that purpose I wrote the following in the LoginDialog class constructor:

m_passwordLineEdit->installEventFilter(this);

So the only thing is to do is to implement a function which can understand that user is going to fill the password. Seems is should be done with the following function(??):

bool LoginDialog::eventFilter(QObject *target, QEvent *event)
{
    if (target == m_passwordLineEdit)
    {


    }
    return QDialog::eventFilter(target, event);
}

How to implement this function???

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt