actually that problem has been solved but in the same regard i faced a new problem so instead of starting a new thread ,i will post the problem here
this following is my implementation but it only shows an empty window
int main(int argc, char *argv[])
{
TrainingUI w;
w.show();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
TrainingUI w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
#include "MainScene.h"
#include <QGraphicsView>
{
Q_OBJECT
public:
TrainingUI();
~TrainingUI();
private:
..
MainScene *mainScn;
..
};
TrainingUI::TrainingUI()
{
mainScn= new MainScene;
..
}
#include "MainScene.h"
#include <QGraphicsView>
class TrainingUI : public QGraphicsView
{
Q_OBJECT
public:
TrainingUI();
~TrainingUI();
private:
..
MainScene *mainScn;
..
};
TrainingUI::TrainingUI()
{
mainScn= new MainScene;
..
}
To copy to clipboard, switch view to plain text mode
#include "MainWidget.h"
#include <QGraphicsScene>
{
Q_OBJECT
public:
MainWidget *mainWidg;
MainScene();
virtual ~MainScene();
};
MainScene::MainScene()
{
mainWidg = new MainWidget;
addWidget(mainWidg);
}
#include "MainWidget.h"
#include <QGraphicsScene>
class MainScene:public QGraphicsScene
{
Q_OBJECT
public:
MainWidget *mainWidg;
MainScene();
virtual ~MainScene();
};
MainScene::MainScene()
{
mainWidg = new MainWidget;
addWidget(mainWidg);
}
To copy to clipboard, switch view to plain text mode
#include "Navigation.h"
{
Q_OBJECT
public:
Navigation *navigate;
MainWidget();
virtual ~MainWidget();
};
MainWidget::MainWidget()
{
navigate = new Navigation(this);
navigate->setGeometry(30,20,350,200);
// naviagte->show(); // if i put this line here then it shows my navigate widget which means navigate which is a widget is doing its works
}
#include "Navigation.h"
class MainWidget:public QWidget
{
Q_OBJECT
public:
Navigation *navigate;
MainWidget();
virtual ~MainWidget();
};
MainWidget::MainWidget()
{
navigate = new Navigation(this);
navigate->setGeometry(30,20,350,200);
// naviagte->show(); // if i put this line here then it shows my navigate widget which means navigate which is a widget is doing its works
}
To copy to clipboard, switch view to plain text mode
i think there is some problem in between MainScene and MainWidget..
before introducing MainWidget all the class heirarchy was same and the code inside MainWidget was in MainScene and my program ran successfully...
Bookmarks