PDA

View Full Version : Closing a independent widget and returning to its previous widget.



ashukla
16th October 2007, 06:45
Dear Everyone!

I am creating a dialog having a push button pbPlay. on pbPlay_clicked() event I am opening a independent widget indWidget having three child widget.

When I click over the indWidget close button the indWidget is not being closed. If I close the widget which is containing the pbPlay push button; this widget has been closed; but still now the indWidget is appeared. And now I click over the indWidget close button, It close the indWidget.

firstly I want to close the indWidget and then I wnat to return on a dialog which contains the pbPlay push button.

What can I do to solve my problem?

I don't want to create the indWidget as a child of dialog that contains the pbPlay push button like this;

QWidget *indWidget=new dlgMainPlayer(this,0);

b/z when I do this and close the indWidget the parent dlgMainPlayer is also closed. I still want to return on dlgMain Player Widget.

with regards!

marcel
16th October 2007, 08:37
Can you just post an archive with the code so someone can test it?
I can test it myself, but when I get the time.

ashukla
16th October 2007, 09:14
void dlgCreateplaylist::pbPlay_clicked()
{
//

indexNo=Table2->numRows();

qDebug()<<"indexNo"<<indexNo;
QMessageBox::information( this, "Createplaylist","Add Media item to Preview playlist.");
for(int i=0;i<indexNo;i++)
{
int k=0;

if (Table2->text(i,2)=="Frame1")
k=0;
else if(Table2->text(i,2)=="Frame2")
k=1;
else
k=2;


frameData[k].SeqData[i] = Table2->text(i,1);
qDebug()<<frameData[k].SeqData[i];
frameData[k].mfileData[i] = Table2->text(i,3);
qDebug()<<frameData[k].mfileData[i];
QString data(frameData[k].mfileData[i]);
frameData[k].filetypeData[i] = data.section(".",1,1);
qDebug()<<frameData[k].filetypeData[i];
frameData[k].EndTimeData[i] = Table2->text(i,4);
qDebug()<<frameData[k].EndTimeData[i];
frameData[k].filepathData[i] = Table2->text(i,5);
qDebug()<<frameData[k].filepathData[i];
frameData[k].framenameData = Table2->text(i,2);
qDebug()<<frameData[k].framenameData;
}
//this->setVisible(FALSE);
loadFrameData();
playPreview();

}


void dlgCreateplaylist::playPreview()
{

F.screen=QApplication::desktop()->screenGeometry();
w = new QWidget(0,0);

w->resize(F.screen.width(),F.screen.height());
//checkPoint=1;


QPalette palette;
QBrush brush(Qt::black,Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Window, brush);
w->setPalette(palette);

layout=new QHBoxLayout;
layout->addWidget(&f1);
layout->addWidget(&f2);

vLayout=new QVBoxLayout;
vLayout->addLayout(layout);
vLayout->addWidget(&f3);

QHBoxLayout *mainLayout=new QHBoxLayout;
mainLayout->addLayout(vLayout);

w->setLayout(mainLayout);
mainLayout->setSpacing (0);


f1.reSize(&f2,&f3);
f2.reSize(&f1,&f3);
f3.reSize(&f1,&f2);
w->show();

f1.setGeometry(f1.locx,f1.locy,f1.w,f1.h);
f2.setGeometry(f2.locx,f2.locy,f2.w,f2.h);
f3.setGeometry(f3.locx,f3.locy,f3.w,f3.h);
qDebug()<<"locationXof F1"<<f1.locx;
qDebug()<<"locationYof F1"<<f1.locy;
qDebug()<<"WIDTH of F1"<<f1.w;
qDebug()<<"HIGHT of F1"<<f1.h;

qDebug()<<"locationX of F2"<<f2.locx;
qDebug()<<"locationY of F2"<<f2.locy;
qDebug()<<"WIDTH of F2"<<f2.w;
qDebug()<<"HIGHT of F2"<<f2.h;

qDebug()<<"locationX of F3"<<f3.locx;
qDebug()<<"locationY of F3"<<f3.locy;
qDebug()<<"WIDTH of F3"<<f3.w;
qDebug()<<"HIGHT of F3"<<f3.h;

f3.play();
f1.play();
f2.play();

}

mchara
17th October 2007, 12:52
Did you tried to make independentWidget dialog but exec() it instead of show() [exec() waits for widget's close before going forwards with code execution]

You can also connect close signal of child dialog with reopening slot of parent.