PDA

View Full Version : RunTime Execution



hasnatzaidi
5th October 2009, 06:27
hey to all, i create the ui Files more than one. At the execution one Ui file call successfully opened by the Pushbutton Clicked. But When I want to open Another Ui file From Previous opened Ui file it can't open. The Code are same, and i include also its header file But it can not work.
Its .cpp file is

#include "sessiondetail.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QWidget>
#include <QDebug>
#include "ui_2x.h"
#include "ui_mainwindow2.h"

sessiondetail::sessiondetail()
{
connect(ui->btn_s_2x,SIGNAL(clicked()),this,SLOT(on_btn_s_2x_c licked()));
}
// that window open successfully
void MainWindow::on_btn_screate_clicked()
{
Ui::sessiondetail ui;
QMainWindow *sessiondetail = new QMainWindow;
ui.setupUi(sessiondetail);
sessiondetail->show();
}
// this MainWindow2X not be open
void sessiondetail::on_btn_s_2x_clicked()
{
Ui::MainWindow2X ui;
QMainWindow *MainWindow2X = new QMainWindow;
ui.setupUi(MainWindow2X);
MainWindow2X->show();
}

the header file is


#ifndef SESSIONDETAIL_H
#define SESSIONDETAIL_H
#include <QMainWindow>
#include <QWidget>
namespace Ui
{
class MainWindow;
class sessiondetail;
}
class sessiondetail : public QMainWindow
{

public:

private:
Ui::sessiondetail *ui;
private slots:
void on_btn_s_ica_clicked();

void on_btn_s_2x_clicked();

};

#endif // SESSIONDETAIL_H


sorry for poor english.:)
Thanks in ADvance

yogeshgokul
5th October 2009, 06:46
You forgot to put Q_OBJECT macro in class declaration.

hasnatzaidi
5th October 2009, 07:43
Its Not a MainWindow header file .Its a another header file under MainWindow.
I Also put Q_OBECT Errors occured.
thanks

hasnatzaidi
5th October 2009, 07:45
Any Other Solution PLz