HI
The below code must show a button in a scene ,but the scene shows a widget in a scene with no button ,it seems as if only a widget is created but widget remains empty...any IDEA !!
{
public:
QGraphicsProxyWidget *proxy;
Navigation *navigate;
MainScene();
void displayNavigationStatus();
virtual ~MainScene();
};
MainScene::MainScene()
{
navigate = new Navigation;
displayNavigationStatus();
}
void MainScene::displayNavigationStatus()
{
proxy = addWidget(navigate);
}
MainScene::~MainScene()
{
}
{
public:
Navigation();
~Navigation();
private:
void setBackButton();
};
#include "Navigation.h"
Navigation::Navigation()
{
setBackButton();
}
void Navigation::setBackButton()
{
backButton
->setIcon
(QIcon(BACKBUTTON_DIR_LOCATION
));
backButton->setIconSize(buttonIconSize);
backButton->setGeometry(BACK_BUTTON_X,BACK_BUTTON_Y,BUTTON_PARAM,BUTTON_PARAM);
}
class MainScene:public QGraphicsScene
{
public:
QGraphicsProxyWidget *proxy;
Navigation *navigate;
MainScene();
void displayNavigationStatus();
virtual ~MainScene();
};
MainScene::MainScene()
{
navigate = new Navigation;
displayNavigationStatus();
}
void MainScene::displayNavigationStatus()
{
proxy = addWidget(navigate);
}
MainScene::~MainScene()
{
}
class Navigation:public QWidget
{
public:
Navigation();
~Navigation();
private:
QSize buttonIconSize;
QPushButton *backButton ;
void setBackButton();
};
#include "Navigation.h"
Navigation::Navigation()
{
backButton = new QPushButton();
setBackButton();
}
void Navigation::setBackButton()
{
backButton->setIcon(QIcon(BACKBUTTON_DIR_LOCATION));
backButton->setIconSize(buttonIconSize);
backButton->setGeometry(BACK_BUTTON_X,BACK_BUTTON_Y,BUTTON_PARAM,BUTTON_PARAM);
}
To copy to clipboard, switch view to plain text mode
Bookmarks