Results 1 to 2 of 2

Thread: Issues in nested QDialog

  1. #1
    Join Date
    Sep 2009
    Posts
    54
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Issues in nested QDialog

    Dear Friends,
    I am experiencing the following problem when i try to use nested QDialog. i had used .exec() to show those dialogs as modal. when i closed the second one, the first also comes out of the eventloop can any body help me to sort out this error.?

    Qt Code:
    1. //**************slot to call dialog1**************************//
    2.  
    3. void SettingWnd::Slot_showDialog()
    4. {
    5. setEnabled(false);
    6. setVisible(false);
    7.  
    8. dialog1 *dialogobj = new dialog1;
    9. dialogobj->exec();
    10.  
    11. setVisible(true);
    12. setEnabled(true);
    13. btnDialup_setting->setFocus();
    14. }
    15.  
    16. //**************Dialog 1**************************//
    17.  
    18.  
    19. dialog1::dialog1(QWidget *parent) :
    20. QDialog(parent),
    21. ui(new Ui::dialog1)
    22. {
    23. ui->setupUi(this);
    24. setParent(MdiArea);
    25. setWindowTitle("Dialog1");
    26. setWindowFlags(Qt::FramelessWindowHint);
    27. setFocusPolicy(Qt::NoFocus);
    28. if(ui->listWidget->count() == 0)
    29. {
    30. ui->listWidget->addItem("No connection added");
    31. }
    32. ui->listWidget->setFocus();
    33. }
    34.  
    35. dialog1::~dialog1()
    36. {
    37. delete ui;
    38. }
    39.  
    40. void dialog1::on_btnAdd_new_clicked()
    41. {
    42. setVisible(false);
    43. setEnabled(false);
    44.  
    45. dialog2 *dialogObj1 = new dialog2;
    46. dialogObj1->exec();
    47.  
    48. delete dialogObj1;
    49. setVisible(true);
    50. setEnabled(true);
    51. ui->btnAdd_new->setFocus();
    52. }
    53.  
    54. //**************Dialog 2**************************//
    55.  
    56. dialog2::dialog2(QWidget *parent) :
    57. QDialog(parent),
    58. ui(new Ui::dialog2)
    59. {
    60. ui->setupUi(this);
    61. setParent(MdiArea);
    62. setWindowTitle("Dialog2");
    63. setWindowFlags(Qt::FramelessWindowHint);
    64. setFocusPolicy(Qt::NoFocus);
    65.  
    66. ui->txtConnectionName->setFocus();
    67. }
    68.  
    69. dialog2::~dialog2()
    70. {
    71. delete ui;
    72. }
    To copy to clipboard, switch view to plain text mode 

    when i closed the dialog2, dialog1 also comes out of eventloop without closing it....

  2. #2
    Join Date
    Mar 2011
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Issues in nested QDialog

    Have you tried instantiating dialog2 with dialog1 as the parent?

    Qt Code:
    1. dialog2 *dialogObj1 = new dialog2(this);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 9
    Last Post: 25th March 2011, 22:22
  2. Nested Layout
    By starcontrol in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2008, 13:47
  3. QDialog Issues
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 17th October 2006, 09:24
  4. QDialog issues
    By vijay anandh in forum Qt Programming
    Replies: 4
    Last Post: 20th May 2006, 13:41
  5. Nested Plugins
    By Luis Rodriguez in forum Qt Programming
    Replies: 1
    Last Post: 10th March 2006, 23:00

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.