Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to transpose from a QDialog to another QDialog



  • Like in two steps, I want to close the first QDialog by clicking on a button, and open another QDialog.

    As long as both QDialog's have the same parent, it is possible?

    1° QDialog: confirm
    2° QDialog: edit

    Parent of his QDialog's:

    
    void Header::editClicked() {
    
    	if (!confirm)
    		confirm = new UserConfirmation(this);
    		
    	confirm->show();
    	if (confirm->result() == 1) {
    		if (!edit) {
    			edit = new EditCredentials(this);
    		}
    		edit->show();
    	}
    }
    

    First QDialog:

    void Confirm::on_pb_next_clicked() {
    	QString password = ui->le_password->text();
    
    	if (password == "123") {
    		// here is the condition where i want to transpose de QDialog
    		this->setResult(1);
    	}
    }
    


  • sample the return values from each modal dialog to determine the appropriate action for the parent to take.


  • Lifetime Qt Champion

    Hi
    Just as a note.
    For any design featuring a go to next page concept, please be aware of this class
    https://doc.qt.io/qt-5/qwizard.html#details
    Its made for a sequence of pages with build-in support for next / prev etc for the navigation.


Log in to reply