How to set background inactive and grey while i put a password to a QInputDialog in QT? I have an qmainwindow app and i would like to do this. Thanks your help! :)
bool ok;
QString sPassword = QInputDialog::getText(this, "Enter Password", "Password: ", QLineEdit::Password, "",&ok);
if(ok && QString::compare(sPassword,"goodpassword",Qt::CaseInsensitive)==0)
QApplication::quit();
Your background should be inactive. The
QInputDialog::getText
is modal by default, see the doc: https://doc.qt.io/qt-5/qinputdialog.html#getTextTo grey out your application when the dialog is opened I'd say either play with the stylesheet or create your custom dialog that paints a grey rectangle on top of the application.