Output is there..but code doesnt look to be Perfect..!
Hi..
I had tried to show a layout of buttons on View..it worked fine,but the return function ( retWidg() ) which i have specified in the main doesnt seems to be necessary..i mean to say is there any other solution by which i can avoid these statement and with it be more cleared in approach...
Code:
#include "exclass.h"
#include <QApplication>
#include <QGraphicsScene>
int main(int argc, char *argv[])
{
exclass *w = new exclass;
mainW = w->retWidg();
scene.addWidget(mainW);
scene.addItem(w);
view.setScene(&scene);
view.show();
return a.exec();
}
#ifndef EXCLASS_H
#define EXCLASS_H
#include <QtGui/QWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QPainter>
#include <QImage>
#include <QPushButton>
#include <QHBoxLayout>
//#include <QString>
//#include "ui_exclass.h"
{
Q_OBJECT
public:
};
#endif // EXCLASS_H
#include "exclass.h"
{
hboxLay->addWidget(playButton);
hboxLay->addWidget(stopButton);
widg->setLayout(hboxLay);
}
{
return widg;
}
QRectF exclass
::boundingRect() const {
}
{
}
Re: Output is there..but code doesnt look to be Perfect..!
You could simply add Widget in the scene.
Code:
main()
{
// set the layout on widget;
// add play styop buttons to widget;
QScene scene;
scene.addWidget(widget);
view.show();
}
Re: Output is there..but code doesnt look to be Perfect..!
so what i understand ,you are saying that i should implement everything in the main function,i started the things the same way but then to use drawBackGround() function which is protected i had to develop a class which look like this...i hope you understand..!!:)