Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Restart a dialog
Forum Updated to NodeBB v4.3 + New Features

[Solved]Restart a dialog

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nikitto
    wrote on last edited by
    #1

    Hi everyone,
    I want to restart a dialog (reopen). The dialog is attached to a mainwindow as modal application. Some Ideas?
    Thanks

    @#include "dialog.h"
    #include "ui_dialog.h"

    Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
    {
    ui->setupUi(this);
    }

    Dialog::~Dialog()
    {
    delete ui;
    }

    void Dialog::on_Restart_button_clicked()
    {
    //close and restart the QDialog, this Dialog is attached to another mainwindow
    }@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      One of the possible ways:
      Create a slot in MainWindow, let say restartDialog()
      Connect it with a restartDialog() signal from the Dialog.
      In a closeEvent() of the Dialog emit a signal to restart a dialog.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #3

        Another possible solution:
        If Dialog is modal dialog then you can use return code from
        "int QDialog::exec()":http://qt-project.org/doc/qt-5/qdialog.html#exec and and restart if return code is not one of "QDialog::DialogCode":http://qt-project.org/doc/qt-5/qdialog.html#DialogCode-enum

        1 Reply Last reply
        0
        • N Offline
          N Offline
          Nikitto
          wrote on last edited by
          #4

          Hey,
          thanks andreyc I made it with closeEvent()!!!

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved