Important: Please read the Qt Code of Conduct -

QFileDialog - stopping it updating (i.e. enabling) its own button

  • I've got a QFileDialog, embedded in a QDialog with some other controls.

    I want the QFileDialog selected button (i.e. the one that they push when they've selected the right directory) to only be enabled when some conditions are met, based on the state of the other controls.

    So I've connected a checking function up to the QFileDialog's signal, like this:

    connect(fileDialog, SIGNAL(currentChanged(QString)), this, SLOT(updateButtonState(QString)));

    and each time the user selects a directory, the updateButtonState slot is called and I can see the button being enabled or disabled correctly.

    However, right after that, the button is enabled. Something else (inside the QFileDialog, I suspect) is being run after my slot, and setting the button enabled.

    Does anyone know what that might be, and is there a way I can turn it off?

Log in to reply