Dear High_flyer,
Here i am putting the Header and source file code.
file:dynscrn.h
{
Q_OBJECT
public:
~dsynsrn();
QGraphicsProxyWidget *proxy;
}
class dynscrn : public QWidget
{
Q_OBJECT
public:
dynscrn(QStringList str, int msgid, QWidget *parent=0);
~dsynsrn();
QWidget *dynwid;
QGraphicsScene *scene;
QGraphicsProxyWidget *proxy;
QGraphicsView *view;
QLabel *info1;
QLabel *info2;
}
To copy to clipboard, switch view to plain text mode
//////////////////////////////////////////////////////////////////////////////////////////
File: dynscrn.CPP
{
dynwid
= new QWidget();
//Widget on which i paste my text or Image dynwid -> setGeoMetry(0,0,460,570);
dynwid -> setWindowOpacity(0.75);
info1 -> setText(str.at(0));
info2 -> setText(str.at(1));
//rotate above dynwid
proxy = scene -> addWidget(dynwid );
view -> setParent( parent, Qt::FrameLessWindowHint);
view ->setFixedSize(570+4, 460+4);
view -> setGeoMetry(0,0,570,460); //change the width and height
view -> rotate(-90); //rotate at -90
view -> show(); //display dynwid
}
dsynsrn ::~dsynsrn() //deletes whole dynwid and its children
{
delete info1;
delete info2;
delete dynwid;
delete scene;
delete view;
}
dynscrn :: dynscrn(QStringList str, int msgid, QWidget *parent=0):QWidget(parent)
{
dynwid = new QWidget(); //Widget on which i paste my text or Image
dynwid -> setGeoMetry(0,0,460,570);
dynwid -> setWindowOpacity(0.75);
info1 = new QLabel(dynwid );
info2 = new QLabel(dynwid );
info1 -> setText(str.at(0));
info2 -> setText(str.at(1));
//rotate above dynwid
scene =new QGraphicsScene();
proxy = scene -> addWidget(dynwid );
view = new QGraphicsView(scene);
view -> setParent( parent, Qt::FrameLessWindowHint);
view ->setFixedSize(570+4, 460+4);
view -> setGeoMetry(0,0,570,460); //change the width and height
view -> rotate(-90); //rotate at -90
view -> show(); //display dynwid
}
dsynsrn ::~dsynsrn() //deletes whole dynwid and its children
{
delete info1;
delete info2;
delete dynwid;
delete scene;
delete view;
}
To copy to clipboard, switch view to plain text mode
/////////////////////////////////////////////////////////////////////////
Now in Another Class File I used this as below:
In this Both dynamic and static screen object will be used as per requirement.
void Widget:: RxMessageAtQt(messgeid, stringlist)
{
if(static Screen is visible)
{
hide static screen;
}
if(dynscrn is object ! = NULL) //means dynamic widget is currently exist
{
delete dynamic widget;
dynamic widget = NULL;
}
if(messageid == 500) //show dynamic scrn
{
create a dynamic widget from dynscrn and will be displayed by its constructor;
}
else //show static screen
{
if(static screen is not visible)
{
show static screen;
// Static screen is a statcked of widgets.Its basically a Menu, and we can
// navigate by the button on that screen.
//User can enter some valued like ethernet parameters and save ,delete and
// cancel it. or move to the next or previous menu widget.
//Thede are not editable when i come second time over this page.
}
}
}
void Widget:: RxMessageAtQt(messgeid, stringlist)
{
if(static Screen is visible)
{
hide static screen;
}
if(dynscrn is object ! = NULL) //means dynamic widget is currently exist
{
delete dynamic widget;
dynamic widget = NULL;
}
if(messageid == 500) //show dynamic scrn
{
create a dynamic widget from dynscrn and will be displayed by its constructor;
}
else //show static screen
{
if(static screen is not visible)
{
show static screen;
// Static screen is a statcked of widgets.Its basically a Menu, and we can
// navigate by the button on that screen.
//User can enter some valued like ethernet parameters and save ,delete and
// cancel it. or move to the next or previous menu widget.
//Thede are not editable when i come second time over this page.
}
}
}
To copy to clipboard, switch view to plain text mode
/*************end *******************
I cant find any bug in the above code.
If some one knows let know.
THANKING YOU ALL.
Bookmarks