hi,
as i m new to qt.I have to show 1 window with menu items,whenever one of the menu item triggered than hav to hide main window & show another widget with small functionality.
I m able to open another widget n hiding main window, but unable to show back the main window after exiting widget.
i m using 2 classes one for main window & another for widget class.
m attaching the code.
ParentChild1.cpp
ParentChild1:

arentChild1(QWidget *parent) :
QMainWindow(parent)
{
setupUi(this);
QPixmap logo(":/Touch/onity_logo.png");
label_2->setPixmap(logo);
//SecondWindow *newWind = new SecondWindow;
//newWind->show();
connect(actionTS_Test,SIGNAL(triggered()),this,SLOT(hide()));
connect(actionTS_Test,SIGNAL(triggered()),this,SLOT(tsTest()));
}
void ParentChild1::tsTest()
{
SecondWindow *newWind = new SecondWindow;
newWind->show();
}
ParentChild1.h
class ParentChild1 : public QMainWindow,Ui::Man_test {
Q_OBJECT
public:
ParentChild1(QWidget *parent = 0);
~ParentChild1();
protected:
//void mousePressEvent(QMouseEvent *event);
void changeEvent(QEvent *e);
public slots:
void tsTest();
void back2Main();
private:
//Ui::Man_test *ui;
};
SecondWindow.cpp
SecondWindow:

econdWindow()
{
setupUi(this);
setGeometry(0, 0,480,272);
//ParentChild1 *parChild = new ParentChld1;
//connect(pushButton, SIGNAL(clicked()), parChild,SLOT(show()));
//connect(this,SIGNAL(destroyed),ParentChild1,SLOT(show()));
}
SecondWindow.h
class SecondWindow : public QWidget,Ui::Form
{
public:
SecondWindow();
public slots:
//void back2Main();
protected:
void mousePressEvent(QMouseEvent *event);
private slots:
void on_pushButton_clicked();
};
Main.cpp
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ParentChild1 w;
w.show();
a.setActiveWindow(&w);
//a.setMainWidget(&a);
//a.connect(&w,SIGNAL())
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(show()));
//a.connect(&a, SIGNAL(lastWindowClosed()),&a,SLOT(quit()));
return a.exec();
}
i m using 2 ui form from designer I think that is not required.
Thanx in advance,