Results 1 to 4 of 4

Thread: Closing a independent widget and returning to its previous widget.

  1. #1
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Closing a independent widget and returning to its previous widget.

    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!
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Closing a independent widget and returning to its previous widget.

    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.

  3. #3
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Exclamation Re: Closing a independent widget and returning to its previous widget.

    Qt Code:
    1. void dlgCreateplaylist::pbPlay_clicked()
    2. {
    3. //
    4.  
    5. indexNo=Table2->numRows();
    6.  
    7. qDebug()<<"indexNo"<<indexNo;
    8. QMessageBox::information( this, "Createplaylist","Add Media item to Preview playlist.");
    9. for(int i=0;i<indexNo;i++)
    10. {
    11. int k=0;
    12.  
    13. if (Table2->text(i,2)=="Frame1")
    14. k=0;
    15. else if(Table2->text(i,2)=="Frame2")
    16. k=1;
    17. else
    18. k=2;
    19.  
    20.  
    21. frameData[k].SeqData[i] = Table2->text(i,1);
    22. qDebug()<<frameData[k].SeqData[i];
    23. frameData[k].mfileData[i] = Table2->text(i,3);
    24. qDebug()<<frameData[k].mfileData[i];
    25. QString data(frameData[k].mfileData[i]);
    26. frameData[k].filetypeData[i] = data.section(".",1,1);
    27. qDebug()<<frameData[k].filetypeData[i];
    28. frameData[k].EndTimeData[i] = Table2->text(i,4);
    29. qDebug()<<frameData[k].EndTimeData[i];
    30. frameData[k].filepathData[i] = Table2->text(i,5);
    31. qDebug()<<frameData[k].filepathData[i];
    32. frameData[k].framenameData = Table2->text(i,2);
    33. qDebug()<<frameData[k].framenameData;
    34. }
    35. //this->setVisible(FALSE);
    36. loadFrameData();
    37. playPreview();
    38.  
    39. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void dlgCreateplaylist::playPreview()
    2. {
    3.  
    4. F.screen=QApplication::desktop()->screenGeometry();
    5. w = new QWidget(0,0);
    6.  
    7. w->resize(F.screen.width(),F.screen.height());
    8. //checkPoint=1;
    9.  
    10.  
    11. QPalette palette;
    12. QBrush brush(Qt::black,Qt::SolidPattern);
    13. palette.setBrush(QPalette::Active, QPalette::Window, brush);
    14. w->setPalette(palette);
    15.  
    16. layout=new QHBoxLayout;
    17. layout->addWidget(&f1);
    18. layout->addWidget(&f2);
    19.  
    20. vLayout=new QVBoxLayout;
    21. vLayout->addLayout(layout);
    22. vLayout->addWidget(&f3);
    23.  
    24. QHBoxLayout *mainLayout=new QHBoxLayout;
    25. mainLayout->addLayout(vLayout);
    26.  
    27. w->setLayout(mainLayout);
    28. mainLayout->setSpacing (0);
    29.  
    30.  
    31. f1.reSize(&f2,&f3);
    32. f2.reSize(&f1,&f3);
    33. f3.reSize(&f1,&f2);
    34. w->show();
    35.  
    36. f1.setGeometry(f1.locx,f1.locy,f1.w,f1.h);
    37. f2.setGeometry(f2.locx,f2.locy,f2.w,f2.h);
    38. f3.setGeometry(f3.locx,f3.locy,f3.w,f3.h);
    39. qDebug()<<"locationXof F1"<<f1.locx;
    40. qDebug()<<"locationYof F1"<<f1.locy;
    41. qDebug()<<"WIDTH of F1"<<f1.w;
    42. qDebug()<<"HIGHT of F1"<<f1.h;
    43.  
    44. qDebug()<<"locationX of F2"<<f2.locx;
    45. qDebug()<<"locationY of F2"<<f2.locy;
    46. qDebug()<<"WIDTH of F2"<<f2.w;
    47. qDebug()<<"HIGHT of F2"<<f2.h;
    48.  
    49. qDebug()<<"locationX of F3"<<f3.locx;
    50. qDebug()<<"locationY of F3"<<f3.locy;
    51. qDebug()<<"WIDTH of F3"<<f3.w;
    52. qDebug()<<"HIGHT of F3"<<f3.h;
    53.  
    54. f3.play();
    55. f1.play();
    56. f2.play();
    57.  
    58. }
    To copy to clipboard, switch view to plain text mode 
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  4. #4
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Closing a independent widget and returning to its previous widget.

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.