Hey! I have a mainwindow and 2 dialogs(namely dialog2 and dialog3). I need to go to dialog2 from mainwindow while hiding mainwindow and i need to goto dialog3 from dialog2 while hiding dialog2.
Here is my code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dialog2.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
hide();
Dialog2 ptr;
ptr.setModal(true);
ptr.exec();
show();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dialog2.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
hide();
Dialog2 ptr;
ptr.setModal(true);
ptr.exec();
show();
}
To copy to clipboard, switch view to plain text mode
#include "dialog2.h"
#include "ui_dialog2.h"
#include "dialog3.h"
#include <QDebug>
Dialog2
::Dialog2(QWidget *parent
) : ui(new Ui::Dialog2)
{
ui->setupUi(this);
}
Dialog2::~Dialog2()
{
delete ui;
}
void Dialog2::on_pushButton_clicked()
{
hide();
Dialog3 ptr;
ptr.setModal(true);
ptr.exec();
show();
}
#include "dialog2.h"
#include "ui_dialog2.h"
#include "dialog3.h"
#include <QDebug>
Dialog2::Dialog2(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog2)
{
ui->setupUi(this);
}
Dialog2::~Dialog2()
{
delete ui;
}
void Dialog2::on_pushButton_clicked()
{
hide();
Dialog3 ptr;
ptr.setModal(true);
ptr.exec();
show();
}
To copy to clipboard, switch view to plain text mode
#include "dialog3.h"
#include "ui_dialog3.h"
Dialog3
::Dialog3(QWidget *parent
) : ui(new Ui::Dialog3)
{
ui->setupUi(this);
}
Dialog3::~Dialog3()
{
delete ui;
}
#include "dialog3.h"
#include "ui_dialog3.h"
Dialog3::Dialog3(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog3)
{
ui->setupUi(this);
}
Dialog3::~Dialog3()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
PROBLEM:
When I close dialog3 , dialog2 is not showing up(it's destructor is being called) and mainwindow shows up. Help me out.
Bookmarks