Congratulations to our 2022 Qt Champions!

how to pass a value from QDialog to another QDialog

  • how to pass a value from Dialog to another Dialog?

  • @davidlabib create a setter in the receiving Dialog class, quick pseudocode example:

    class DialogSender : public QDialog {
    DialogSender::on_button_X_clicked() {
       DialogReceiver receiverDlg();
       receiverDlg.setValueX(the value to set from DialogSender)
    class DialogReceiver : public QDialog {
        void setValueX(WhateverType value);
    void AnotherClass::doWork() {
        dialogSender = new DialogSender();

    Or you can have the dialogs connected via signals and slots

    PS: please update/fix the title of your post so other people can find it meaningful

  • is editing the contractor of the receiving dialog a good idea ?

  • Lifetime Qt Champion

    contractor = constructor ?
    Yes, its very fine to change it to give dialog any data it needs.

Log in to reply