Password entered not able to retrieve

  • i am displaying a splash screen in my application. I am showing application initialization using progress bar. Once progress reaches some level: I am asking user to enter password.Displaying password control using LineEdit control. Trying to get entered password in editingFinished() signal. But after entering password: control not at all coming to slot related to editingFinished() signal.Waiting for help.

  • Do you have an event loop running? Are there any input masks or validators set?

  • I have set echo mode as QLineEdit::Password for lineedit control used for password entry.

  • Fine. Do you have an event loop running?

  • I added a.processEvents(); where a is QApplication a.
    I have QSplashScreen derived class where I create progressbar & password & update progress of progress bar based on initialization of classes. When progress reaches some % level: I display the password control to user. He will enter password & on authentication: next window gets displayed.In splashscreen derived class I create: connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(PasswordEntered()));[ signal & slot for password control]. Here: QLineEdit* lineEdit.

    If you need any further info: pls let me know.

  • processEvents() processes events once, not continuously. In order to have signals and slots working you will have to either

    • call processEvents() continuously or
    • enter an event loop using exec()

  • Have a look at [[Doc:QInputDialog]] - looks more sufficient for your use case. As long as your application event loop is not running, I would not bet on any signals/slots working.

  • i am calling processEvents() in my main() like
    a.processEvents(); where a is QApplication object. In my QSPlashScreen derived class I am implementing progressbar & password controls dynamically.when progressbar progress level reaches some level say 70% I am showing password control.[Using QLineEdit] User enters password and then on authentication: control takes him to main window.My query is: where will I have to call processEvents() continuously. Is it in main() or is it in Splashscreen derived class? Please let me know. If you need any further inputs please let me know.

  • I am trying to use following code for password.

    QString stPassword = QInputDialog::getText(this, tr("QInputDialog::getText()"),
    tr("Password:"), QLineEdit::Password ,
    0, &ok,Qt::FramelessWindowHint);

    After password is verified: how to close input dialog on click of OK button here.

    [EDIT: code formatting, please use @-tags, Volker]

  • A QInputDialog is closed automatically after pressing enter or clicking on the ok or cancel button, there shouldn't be a problem here.

    Splash screens in general are not suitable for asking the user for input. A splash screen usually is dismissed when someone clicks on it. If you need something more sophisticated, I would suggest to implement your own startup widget.

  • Yes, instead of splash screen a widget can be customized to behave the way a splash screen works and still achieve the same functionality.after all, its just that QSplash remains always on the top, you can achieve it in your custom widget

  • I want to display image in a widget. Can you give me some sample code to do this.

Log in to reply