I have the following function that is a SIMPLE password input dialog.
It works except that I cannot capture and process the CANCEL button click.
When CANCEL is clicked I want the dialog box to close without doing anything.
I have the cancel variable for the button click return but cannot get it done.
Here's the function
int class::display_password_dialog()
{
bool cancel;
do
{
retarg
= QInputDialot
::gettext(0,
"Password Entry",
"Type Password, Press Ok: ",
QLineEdit::Normal,
"***",
&cancel
);
std::cout <<"user entered"<< retarg.toStdString()<<std::endl;
if(cancel)
{
std::cout<<"Cancel pressed"<<std::endl;
return EXIT_FAILURE;
}
} while (retarg != "'");
return EXIT_SUCCESS;
}
int class::display_password_dialog()
{
QString retarg;
bool cancel;
do
{
retarg = QInputDialot::gettext(0,"Password Entry", "Type Password, Press Ok: ",QLineEdit::Normal, "***", &cancel);
std::cout <<"user entered"<< retarg.toStdString()<<std::endl;
if(cancel)
{
std::cout<<"Cancel pressed"<<std::endl;
return EXIT_FAILURE;
}
} while (retarg != "'");
return EXIT_SUCCESS;
}
To copy to clipboard, switch view to plain text mode
Bookmarks